Sumit,

I don't really understand the question - there are 3 calls to mb:tsMatch in the examples. The random variable names

The normal execution strategy is to evaluate from beginning to end, and so if

{
  (?res ?12c9a9gnhunaw) mb:tsMatch ("me" ns0:creator) .
  (?mi8huiqakycf ?1r4ut37ypo3yv)  mb:tsMatch ("titre"@fr) .
  ?res ?1u4ua9v2zsqkt ?mi8huiqakycf .
  (?res ?1r4ut37ypo3yv) mb:tsMatch ("titre"@fr) .

}


(?res ?12c9a9gnhunaw) mb:tsMatch ("me" ns0:creator) .

produces 2 results, then each is tried in the rest of the query.

(?mi8huiqakycf ?1r4ut?m3j8y01zhi1f37ypo3yv)  mb:tsMatch ("titre"@fr) .

has no varaibles in common with the first part, but it will get called twice.

{
  (?remo9exejffl ?mpn8d16zc5oh)  mb:tsMatch ("titre"@fr) .
  ?res ?m3j8y01zhi1f ?remo9exejffl .
  (?res ?mpn8d16zc5oh) mb:tsMatch ("titre"@fr) .
  (?res ?uoonek144gni) mb:tsMatch ("me" ns0:creator) .
}

the first two lines share ?remo9exejffl

There is no gauarentee that the same number of calls are made - sometimes more calls, with more grouned arguments, will be made.

    Andy



On 17/02/11 18:02, Sumit Raja wrote:
Hello,

It seems that differently ordered SPARQL queries is producing different
results and I need some clarification on why this may be happening. I have a
function that does a full text search (modelled exactly in the ARQ lucene
one except it uses Postgresql). For the purposes of this test I have mocked
the actual search out and am simply counting how many times the function is
executed.

In the first case I get an expected 2 calls to the function implementation
but in the second case I only get one and I was hoping someone could tell me
why (as this eventually will produce different results in an unmocked
situation). One thing to highlight is that the query does a search for
containers that may contain this string as well hence the additional query
elements. Not sure if I am not doing this container match correctly.

Case 1:

PREFIX ns0:<http://purl.org/dc/terms/>
PREFIX mb:<java:org.onionsoft.mediabag.jena.search.>
select ?res
  where
{
(?res ?12c9a9gnhunaw) mb:tsMatch ("me" ns0:creator) .

(?mi8huiqakycf ?1r4ut37ypo3yv)  mb:tsMatch ("titre"@fr) .<--------
Container Match
?res ?1u4ua9v2zsqkt ?mi8huiqakycf .<---------- Container Match
(?res ?1r4ut37ypo3yv) mb:tsMatch ("titre"@fr) .

}

BGP:

(sequence
   (propfunc<java:org.onionsoft.mediabag.jena.search.tsMatch>
     (?mi8huiqakycf ?1r4ut37ypo3yv) ("titre"@fr)
     (propfunc<java:org.onionsoft.mediabag.jena.search.tsMatch>
       (?res ?12c9a9gnhunaw) ("me"<http://purl.org/dc/terms/creator>)
       (table unit)))
   (bgp (triple ?res ?1u4ua9v2zsqkt ?mi8huiqakycf)))


Case 2:

PREFIX ns0:<http://purl.org/dc/terms/>
PREFIX mb:<java:org.onionsoft.mediabag.jena.search.>
select ?res
  where
{
(?remo9exejffl ?mpn8d16zc5oh)  mb:tsMatch ("titre"@fr) .
?res ?m3j8y01zhi1f ?remo9exejffl .
(?res ?mpn8d16zc5oh) mb:tsMatch ("titre"@fr) .

(?res ?uoonek144gni) mb:tsMatch ("me" ns0:creator) .

}

BGP:

(sequence
   (propfunc<java:org.onionsoft.mediabag.jena.search.tsMatch>
     (?remo9exejffl ?mpn8d16zc5oh) ("titre"@fr)
     (table unit))
   (bgp (triple ?res ?m3j8y01zhi1f ?remo9exejffl)))


Thanks

Sumit

Reply via email to