On 10/12/15 11:25, Osma Suominen wrote:
On 10/12/15 13:21, Andy Seaborne wrote:
What happens if you put the text:query should be inside the GRAPH?
That sort of works for this case, i.e. the query becomes fast (~20ms)
and I get a result with ?label bound, as with Fuseki 1.3.0.
But in the original query I'm deliberately placing the text:query
outside the GRAPH because I want to target all graphs, not just a
specific one. (the jena-text index is graph-aware)
-Osma
This is not related to the performance issue although work in that area
seems to have fixed an unknown old bug.
Simpler query:
PREFIX : <http://example/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT *
WHERE
{ ?s :p ?literal
GRAPH :g
{ ?s rdfs:label ?label
FILTER ( ?label = ?literal )
}
}
Note also putting the text:query inside {} makes things worse. It
isolates that part
In this case the ?literal in the FILTER is out of scope of the basic
graph pattern it is defined in.
Algebra:
(prefix ((: <http://example/>)
(rdfs: <http://www.w3.org/2000/01/rdf-schema#>))
(join
(bgp (triple ?s :p ?literal))
(graph :g
(filter (= ?label ?literal)
(bgp (triple ?s rdfs:label ?label))))))
In this simpler case there is even an optimizer step that spots that and
replaces the inner {} by the empty table because the inner {} block
always evaluates to empty.
(prefix ((: <http://example/>)
(rdfs: <http://www.w3.org/2000/01/rdf-schema#>))
(sequence
(bgp (triple ?s :p ?literal))
(table empty)))
It is the same effect as FILTER inside {}
SELECT *
WHERE
{ ?s :p ?literal
{ FILTER ( ?literal = "WORD" ) }
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(join
(bgp (triple ?s :p ?literal))
(filter (= ?literal "WORD")
(table unit)))
Andy