Re: Querying only the default graph from the data store

Hi Barry,

This is in response to

> The working draft does not specify how the RDF dataset is constructed 
> when no FROM and FROM NAMED clauses are present in the SPARQL query.
> Implementations are therefore able to construct the dataset differently, 
> e.g.
> a. dataset default graph contains only the data store's default graph
> b. dataset default graph contains the RDF merge of all graphs in the 
> data store

It is correct that how the concrete default dataset of a SPARQL endpoint is conctructed is left open to implementations. Since different endpoints and implementations support different behaviours in this regard (e.g. in some implementations the default graph of the default dataset is the union of all named graphs whereas in others this is not the case), the working group does not feel that there is a unique standard behavior to be advocated this time around.

> As soon as a single FROM or FROM NAMED clause is used then the data 
> store's default graph is excluded from the query's dataset.
> Which means that there is no portable way to defne a SPARQL query so 
> that it executes only against the default graph in the data store - or 
> even against a combination of the default graph and one or more named 
> graphs. 

Please note that a) querying the default graph in the datastore is the standard behavior when no explicit FROM or FROM NAMED clauses are given. b) the combination of querying named graphs and the default graph of the endpoint's default dataset is supported via GRAPH graph patterns.

See also examples below.

> This is a problem that often confuses users of RDF data stores 
> and is likely to lead to implementations that provide their own specific 
> means to achieve this, e.g.
> Inspired by the update language's use of the 'DEFAULT' keyword for graph 
> manipulation, I suggest an extension to the query language that allows 
> "FROM DEFAULT" to be used, e.g.
> WHERE { ..... }
> => dataset contains a default graph made up of the data store's default 
> graph only

Please note that this the standard behaviour when no FROM clause is given, i.e. this corresponds to

WHERE { ..... }       <--- (no use of GRAPH keyword) 

> This construct can be used with any number of FROM <uri> or FROM NAMED 
> <uri> clauses, e.g.
> FROM <>
> WHERE { ..... } 
> => dataset contains a default graph made up of the data store's default 
> graph merged with the contents of the data store's g1 graph
> This would be a fairly trivial change for exisiting sparql processor 
> implementations, but would provide a big improvement in 
> functionality/flexibility by allowing a data store's default graph to be 
> used/queried/merged in the same way as any of it's named graphs.

Note that similar to the example above, you can query the default graph and named graphs within the default dataset in a data store side by side by using GRAPH graph patterns, i.e.

   .....                              <-- (no use of GRAPH) matches the default graph 
   GRAPH <> { .... }  <-- matches named graph g1 (assuming g1 is a named graph in the default dataset) 

Finally, note that it is not possible in SPARQL1.1 to construct a *new* dataset composed of *parts* of the default dataset of an endpoint plus possible external graphs; such a feature currently not foreseen in the features addressed in this round of SPARQL, but had been suggested before [1].

The features being worked on in this round of standardization have been decided in a voting process at the beginning of the WG and are documented in the following document:

Additionally, a list of work items and features postponed to a future working group are being collected by the group in a dedicated wiki page [2] which also contains the features discussed in the beginning of the WG which have not been considered for this round [3].

Among this list, the feature "Composite Datasets" [1] might partially capture what you have in mind and a future WG might possibly work out the details of such feature.

We'd kindly ask you to confirm by a reply to this list that this addresses your comment.

Axel Polleres, on behalf of the SPARQL WG


Received on Wednesday, 5 September 2012 02:12:05 UTC