On 01/02/16 15:13, Joël Kuiper wrote:
Well the query does what it needs to do, for a given concept find the path to a 
root, for example:


query:
SELECT DISTINCT ?parent
WHERE {
   GRAPH ?g {
     <http://purl.bioontology.org/ontology/ICD10CM/J86.0 
<http://purl.bioontology.org/ontology/ICD10CM/J86.0>> rdfs:subClassOf+ ?parent .
   }}

output:
parent
http://purl.bioontology.org/ontology/ICD10CM/J86 
<http://purl.bioontology.org/ontology/ICD10CM/J86>
http://purl.bioontology.org/ontology/ICD10CM/J85-J86 
<http://purl.bioontology.org/ontology/ICD10CM/J85-J86>
http://purl.bioontology.org/ontology/ICD10CM/J00-J99 
<http://purl.bioontology.org/ontology/ICD10CM/J00-J99>
http://www.w3.org/2002/07/owl#Thing <http://www.w3.org/2002/07/owl#Thing>

It’s just that it’s really slow, so I was wondering if there was a way of 
optimising this (either by some hints, or using reasoners that understand 
transitivity)


Can you quantify "really slow"? This version of the query has a grounded starting point.

It is not obvious to me why it would be slow though what the data overall looks like is major factor, doubly so if running from a cold start.

The GRAPH ?g does turn it into a loop over all graph names so it does the path pattern repeatedly and on a large dataset, it is likely to lead to disk activity on each loop.

Default union graph is faster (it evaluates the path only once) although that finds paths that span graphs as well so it is semantically different.


    Andy

Incidentally - I got round to putting in an optimization for "?x :predicate+ ?z" (not "*") which greatly improves that one case though none of the examples are of that form.

Reply via email to