[Mulgara-general] Using Lucene from SPARQL

Paul Gearon gearon at ieee.org
Thu Aug 12 17:41:35 UTC 2010


On Thu, Aug 12, 2010 at 12:49 PM, Giulio Paci <g.paci at cineca.it> wrote:
> Hi to all!
>    I've just started doing some experiments using Lucene with Mulgara, but I
> only managed to get partial success. My goal is to get both the search
> results and their score using SPARQL.
>
> The following TQL query is working as expected:
> "select $uri $score from <rmi://my#lucene>
> where
> $uri <http://mulgara.org/mulgara#search> $q in <rmi://my#lucene>
> and $q <http://my/my.owl#hasDescription> 'querystring' in <rmi://my#lucene>
> and $q <http://mulgara.org/mulgara#score> $score in <rmi://my#lucene>"
>
> Nevertheless it is not possible to remove any of the "in <rmi://my#lucene>"
> or the query won't give any result, even with the default graph set to
> "<rmi://my#lucene>".

OK, this surprises me. I would have thought they'd be exactly
equivalent. I'll have to look at the query plan to find out why
they're different.

> I'm trying the following SPARQL query without success:
> "select ?uri ?score
>  from <rmi://my#lucene>
>  where
>  {
>  graph <rmi://my#lucene>
>  {
>   ?uri <http://mulgara.org/mulgara#search> ?q
>   . ?q <http://my/my.owl#hasDescription> 'querystring'
>   . ?q <http://mulgara.org/mulgara#:score> ?score
>  }
>  }"
>
> Does anyone knows how can I solve this issue? Am I doing something wrong?

Despite the fact that this should work already, I think that the exact
equivalent to the working TQL is more likely to be:

select ?uri ?score
from <rmi://my#lucene>
where {
  graph <rmi://my#lucene> {
    ?uri <http://mulgara.org/mulgara#search> ?q } .
  graph <rmi://my#lucene> {
    ?q <http://my/my.owl#hasDescription> 'querystring' } .
  graph <rmi://my#lucene> {
    ?q <http://mulgara.org/mulgara#:score> ?score }
}

(though the FROM clause should be entirely redundant).

> The following query is working:
> "select ?uri
>  from <rmi://my#lucene>
>  where
>  {
>  graph <rmi://my#lucene>
>  {
>   ?uri <http://my/my.owl#hasDescription> 'querystring'
>  }
>  }"
>
>
> Any help is appreciated.

I'll try and figure it out soon, but it may be a couple of days. Keep
bugging me about it. :-)

Paul


More information about the Mulgara-general mailing list