Re: Update short forms (from ISSUE-24)

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>

> 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.

- 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
>

-- 
Steve Harris, CTO, 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 Wednesday, 23 December 2009 18:48:44 UTC