Hi,

I'm investigating a performance regression we're seeing with the current Jena 3.1.1-SNAPSHOT compared to 3.1.0.

The data in graph <http://www.yso.fi/onto/yso/> is the YSO ontology, available from http://api.finto.fi/download/yso/yso-skos.ttl

This query used to take about 0.2 seconds (with 3.1.0) and now takes about 10 seconds:

--cut--
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT *
FROM NAMED <http://www.yso.fi/onto/yso/>
WHERE {
  ?uri ?p ?o .
  OPTIONAL {
    ?x skos:member ?o .
    FILTER NOT EXISTS {
      ?x skos:member ?other .
      FILTER NOT EXISTS {
        ?other skos:broader ?uri
      }
    }
  }
  VALUES ?uri { <http://www.yso.fi/onto/yso/p864> }
}
--cut--

If I move the VALUES block to the top of the query, right after WHERE, then the query becomes fast again.

Is the placement of the VALUES block supposed to affect query evaluation order in this way? It appears to me that in the slow version, ?uri is not bound inside the inner FILTER NOT EXISTS, which causes an explosion of results internally.

-Osma

--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 26 (Kaikukatu 4)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.suomi...@helsinki.fi
http://www.nationallibrary.fi

Reply via email to