can subqueries be executed first in SPARQL?

https://www.w3.org/TR/sparql11-query/#subqueries says

Due to the bottom-up nature of SPARQL query evaluation, the subqueries are
evaluated logically first, and the results are projected up to the outer query.

I think that this is incorrect.  For example, in

SELECT ?x WHERE {
  ?x :a :b .
  FILTER EXISTS {
    SELECT ?x WHERE { ?x :a :b } HAVING ( COUNT(*) = 1 )
    }
  }

The inner select is not even known until the bindings for ?x in the outer
query have been determined because EXISTS uses substitution into the inner
query.  (Whether that is a good idea or not is a separate issue.)

I ran into this issue when reading https://scirate.com/arxiv/1606.01441
I believe that the sentence I quote above is the one that the authors indicate
that Fuseki and Blazegraph are using to support their implementation of
subqueries inside EXISTS.



I suggest that there be an erratum removing this sentence.


Peter F. Patel-Schneider
Nuance Communications

Received on Thursday, 16 June 2016 21:37:19 UTC