Re: Named Graphs VS plain quads in SPARQL syntax

Alan,

Couple of things.

1. SPARQL has the concept of a default dataset. A service can bring  
its own default dataset. If no FROM NAMED is given, then the default  
dataset is used. If FROM NAMED is given, then it overrides the default  
dataset. Hence, the two queries you present below would perhaps not be  
equivalent, because the first one overrides the default dataset with  
two explicitly loaded named graphs, while the second one uses the  
default dataset.

2. The GRAPH syntax allows queries such as

  SELECT ?graph WHERE { GRAPH ?graph {} }

This lists the names of all named graphs in the dataset.

3. The triple-style syntax with GRAPH is compatible with Turtle and  
N3, while the quad-style syntax is not.

4. Personally I find the triple-style syntax with GRAPH much more  
readable than the quad-style syntax. YMMV.

Richard


On 10 Nov 2007, at 03:59, alan gebert wrote:

>
> Hi all,
>
> I assume there is a perfectly good reason for this... but I would
> really like to understand it thouroughly
>
> Why was there a need to use the NAMED and FROM NAMED graph syntax
> instead of extending sparql to use quads?
> ( by attaching an extra iri to statements patterns, for example ).
>
> The following two queries should be equivalent... right?
>
> SELECT ?mbox ?nick ?ppd
> FROM NAMED <http://example.org/foaf/aliceFoaf>
> FROM NAMED <http://example.org/foaf/bobFoaf>
> WHERE
> {
> GRAPH data:aliceFoaf
> {
>   ?alice foaf:mbox <mailto:alice@work.example> ;
>          foaf:knows ?whom .
>   ?whom  foaf:mbox ?mbox ;
>          rdfs:seeAlso ?ppd .
>   ?ppd  a foaf:PersonalProfileDocument .
> } .
> GRAPH ?ppd
> {
>     ?w foaf:mbox ?mbox ;
>        foaf:nick ?nick
> }
> }
>
>
>
>
>
> SELECT ?mbox ?nick ?ppd
> WHERE
> {
>   ?alice foaf:mbox <mailto:alice@work.example> data:aliceFoaf;
>          foaf:knows ?whom data:aliceFoaf .
>   ?whom  foaf:mbox ?mbox data:aliceFoaf ;
>          rdfs:seeAlso ?ppd data:aliceFoaf.
>   ?ppd  a foaf:PersonalProfileDocument data:aliceFoaf .
>     ?w foaf:mbox ?mbox ?ppd ;
>        foaf:nick ?nick ?ppd
> }
>
>
> Thanks,
> A
>
>
>

Received on Monday, 12 November 2007 11:27:47 UTC