Re: INSERT/DELETE Update syntax

On 9 Oct 2009, at 18:14, Seaborne, Andy wrote:
>> An obvious option is the same rules as per CONSTRUCT. { ?a <foo> ?b }
>> can only match triples from the default graph. I don't remember if
>> SPARQL says that it's legal for bNodes to exist in more than one
>> graph.
>
> I don't think RDF says whether bNodes can exist across graphs.  It  
> doesn't say anything across graphs.

It's a little hard to say, http://www.w3.org/TR/rdf-mt/#unlabel says  
that "This effectively treats all blank nodes as having the same  
meaning as existentially quantified variables in the RDF graph in  
which they occur, and which have the scope of the entire graph."

Carroll et al. (http://www2005.org/cdrom/docs/p613.pdf) interpret this  
section as meaning that the scope must be enforced (section 2 of the  
paper), but I'm not quite sure that was the intention of the RDF MT  
document.

>> 4store typically treats the default graph as the union of the
>> named graphs, but I've never been quite convinced that that is legal
>> per the spec.
>
> ?? I thought we'd agreed it was.  Several systems do it.  And IIRC  
> the spec was specifically worded to allow it, as well as when it's  
> not a union.

We do it because it's the most practical way to deal with large  
datasets with complex provenance, not because I think the SPARQL spec  
condones it. I do recall that it was your intention for it to be legal  
however.

> I was wondering what your proposal was for the
> "GRAPH <uri1> { <x> <y> ?a }" part.

I don't really have a strong opinion.

I absolutely agree that it's useful to be able to share bNodes between  
graphs, and also to be able to say new things about the bNode within  
the graph. I would be happy for bNodes to be moved and duplicated  
between graphs, using INSERT - assuming that people who understand  
these things better than I do say it's legal per the RDF MT.

>> The slightly trickier case is:
>>
>> INSERT {
>>    GRAPH <uri1> { <x> <y> ?a }
>>    GRAPH <uri2> { <a> <b> ?b }
>> }
>> WHERE {
>>    GRAPH <uri1> { ?a <foo> ?b }
>> }
>>
>>> I suggest that both renaming bnode labels, and choosing not to, are
>>> legal.
>>
>> Hm, I'm not sure about that. It depends whether INSERT is defined  
>> as a
>> merge, or a union.
>
> Don’t quite follow.  A graph is a set of triples.

Indeed. So, it seems that there are a few possible definitions for  
INSERT, given the current set of operations defined for RDF.

INSERT { GRAPH <g> { T } }  (or equivalently INSERT INTO <g> { T })

could be defined as:
   1)  g = rdf-merge(g, {T})
   2)  g = rdf-union(g, {T})
   ... other options

so, given 1) any bNodes in T will be rewritten, and given 2) they  
won't be. So, I think it depends partly on the definition of INSERT,  
which we haven't yet decided on.

>> Are you proposing leaving it up to the query processor?
>
> Whether it is the same bNode (label) in graph <uri1> and default  
> graph?  Yes.

OK.

> Useful if the bNode (label) is already in graph <uri1> because  
> different INSERT or DELETE operations in the same request can update  
> the same bNode resource.

Agreed.

- Steve

-- 
Steve Harris
Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK
+44(0)20 8973 2465  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
9AD

Received on Saturday, 10 October 2009 13:26:49 UTC