W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > January 2007

FROM and FROM NAMED

From: Richard Newman <r.newman@reading.ac.uk>
Date: Thu, 25 Jan 2007 22:43:36 -0800
Message-Id: <5DF0F078-7738-4515-AD78-434595D3B5CD@reading.ac.uk>
To: public-rdf-dawg-comments@w3.org

Hello again folks, DAWG,

   I'm finding the current published SPARQL spec to be a little  
ambiguous with regards to named graphs. (As a documentation comment,  
this is primarily because the examples are insufficient; they are  
each both small and 'positive', in that there are no triples or  
graphs to distinguish between interpretations by causing spurious or  
missing results. This makes it hard to divine a correct  
interpretation by example.)

   So, an out-and-out question:

- Can GRAPH clauses be nested? If yes, how is this to be interpreted?  
The spec does not say that they cannot, and the grammar does not  
restrict it, but no examples are provided, and it is hard to imagine  
a reasonable interpretation.


   ... and two points of clarification:

- It should be made absolutely explicit that a query is really  
composed of two interleaved parts:

   - a collection of patterns that run on the default graph, which is  
selected by the merge of the FROM clauses
   - a collection of patterns, each with a GRAPH context, which are  
run against the collection of named graphs selected by FROM NAMED.

   Without a careful reading of the spec, it is hard to tell that  
GRAPH patterns don't also run on the default graph (where the graph  
variable would be unbound)*. In fact, these two collections of  
patterns intersect only in their variable bindings; otherwise, they  
are essentially completely separate.


- The spec suggests that a default graph is chosen by the  
implementation only if no dataset specification is provided;  
otherwise, the default graph is "a default graph consisting of the  
merge of the graphs referred to in the FROM clauses". The query:

   SELECT *
   FROM NAMED <http://example.com>
   {
     ?x ?y ?z .
   }

has a dataset specification, but it contains no FROM clauses. A  
strict reading of the spec, then, implies that the default graph is  
the RDF Merge of 0 graphs, which is the empty graph: the query can  
have no results. Is this as intended, or should the implementation  
provide its chosen default graph if there are no FROM clauses? If so,  
the spec needs to be altered.

   Regards,
-Richard


* Indeed, 9.1 suggests that this is a good idea: "The definition of  
RDF Dataset does not restrict the relationships of named and default  
graphs. Information can be repeated in different graphs;  
relationships between graph can exposed. Two useful arrangements are:
to have information in the default graph that includes provenance  
information about the named graphs
to include the information in the named graphs in the default graph  
as well.".
Received on Friday, 26 January 2007 06:43:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:51 GMT