On 15/05/13 15:36, Damian Steer wrote:

On 15 May 2013, at 14:10, [email protected] wrote:

Hello,



I am using the following Sparql query against a TDB store:

SELECT *
WHERE {
   ?pat a nci:Patient .
   ?pat ec:Has_Id ?patId .
   ?findingProp rdfs:subPropertyOf ec:Has_Finding .
   ?pat ?findingProp ?finding .
   ?finding a ?findingType .
}


When I run this query WITHOUT the last triple (the bolded line), it returns the 
correct result within seconds.

Assuming " ?finding a ?findingType" was bold - the email was quote-prinable - so no markup.


But when I run this query WITH the last triple, the query runs a very long 
time. I do not know how long b/c I cancelled it after 1 hour.

I wonder wether the optimiser sees '?finding a ?findingType .' as more ground 
than the previous, and thus reorders the query?

Have a look at [1] which explains some of the diagnostic features of TDB. 
Getting hold of the query plan would be very useful.

Damian

[1] 
<https://jena.apache.org/documentation/tdb/optimizer.html#Investigating_what_is_going_on>

If you could do an "explain" as per Damian's suggestion that would be great

A couple of questions:

1/ Which version is this?
   --exaplin may be available if working from the command line

2/ Is there a stats file?

There was a recent fix in this area - if you are using stats.opt, you may find either adding rules to capture your usage or recalculating. It may not - ungrounded predicates may be confusing things.

        Andy

Reply via email to