W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2009

Re: Update short forms (from ISSUE-24)

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Thu, 24 Dec 2009 16:41:57 +0000
Message-ID: <4B3399D5.7070703@talis.com>
To: Steve Harris <steve.harris@garlik.com>
CC: SPARQL Working Group <public-rdf-dawg@w3.org>


On 23/12/2009 18:48, Steve Harris wrote:
> On 23 Dec 2009, at 11:34, Andy Seaborne wrote:
>
>> > ISSUE-24: Can data be SELECTed from one graph and INSERTed into
>> another (moved)?
>> > This is allowed
>>
>> In addition to the basic operations for SPARQL/Update, I think it is
>> useful to provide operations that are short forms for common actions.
>>
>> It helps application writer and data administrators because it is a
>> clearer statement of the intent.
>>
>> It helps implementers so they can do it specially without needing to
>> worry about pattern analysis - this is an issue for scripting and
>> lightweight implementations.
>>
>> A short form is defined to be exactly the semantics of it's long form.
>> It does not need any other specific definition.
>>
>> Form:
>> COPY <g1> INTO <g2>
>> short for:
>> INSERT { GRAPH <g1> { ?s ?p ?o } } WHERE { GRAPH <g2> { ?s ?p ?o } }
>
> Arguably, maybe people would expect
>
> DROP <g2>
> INSERT { GRAPH <g2> { ?s ?p ?o } }
> WHERE { GRAPH <g1> { ?s ?p ?o } }
>
>> Form:
>> MOVE <g1> INTO <g2>
>> short for
>> INSERT { GRAPH <g1> { ?s ?p ?o } }
>> WHERE { GRAPH <g2> { ?s ?p ?o } }
>> DROP <g2>
>
> I would have expected
>
> DROP <g2>
> INSERT { GRAPH <g2> { ?s ?p ?o } }
> WHERE { GRAPH <g1> { ?s ?p ?o } }
> DROP <g1>
>

Yes - I got my <g1> and <g2>'s mixed up in the MOVE from when I tried it 
out.

>> Form:
>>
>> This one can't be directly written in SPARQL/Update easily. This might
>> be a sign we're missing something,
>>
>> UNLOAD <g1> FROM <g2>
>>
>> which is delete all the triples in <g1> from <g2>. It's the DELETE
>> DATA equivalent using referenced data like LOAD is to INSERT DATA.
>
> There's a real can of worms in that around bNodes, which Andy
> acknowledges below.
>
> I'm concerned about attempting to define syntactic shortcuts in a
> language that's not in widespread use yet. I think there's a serious
> risk of standardising something that seems just plain odd in retrospect.

I also agree with that.  I was struck by the "we allow triples to be 
moved between graphs" and when I looked at the necessary raw SPARQL 
Update commands, I found them somewhat cumbersome (and so easy to get 
wrong or to get complex effects in supposed simple tasks).

	Andy

>
> - Steve
>
>> LOAD <g1> INTO <tmp1532>
>> WITH <g2> DELETE { ?s ?p ?o } WHERE { GRAPH <tmp1532> { ?s ?p ?o } }
>>
>> and, yes, you can't delete bnodes in <g2> this way
>>
>> LOAD <g1> INTO <g3>
>> LOAD <g2> INTO <g3>
>> UNLOAD <g1> FROM <g3>
>>
>> may not result in <g3> being the same (bnode isomorphic to) <g2>. Use
>> CLEAR if you want to remove bnodes.
>>
>> It's a common enough aggregation pattern to be worth having though.
>>
>> Andy
>>
>
Received on Thursday, 24 December 2009 16:42:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:40 GMT