On 3/8/12 11:30 AM, Paolo Castagna wrote:
Sarven Capadisli wrote:
I'm doing the following query:

SELECT DISTINCT ?g
WHERE {
   GRAPH ?g {
     ?s ?p ?o .
   }
}
See also discussion here:
http://answers.semanticweb.com/questions/393/clarification-of-meaning-of-graph-clause-in-sparql-with-no-from-clause

Paolo
Yes one possibility that me and Andy raised in that discussion was the use of the following:

SELECT DISTINCT ?g WHERE { GRAPH ?g { } }

Since GRAPH ?g is defined as an iteration over all graphs in the dataset (which may of course be modified by the presence of FROM and FROM NAMED) and the empty graph pattern returns a single empty solution (i.e. always matches) then on paper at least this query should do the same job and be much more performant. Whether this query works may vary depending on how accurately an engine actually implements the SPARQL spec because the whole dataset/GRAPH interaction is one of the areas prone to ambiguities in the spec and differences of opinion between implementers

Rob

Reply via email to