Update short forms (from ISSUE-24)

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

Form:
    MOVE <g1> INTO <g2>
short for
   INSERT { GRAPH <g1> { ?s ?p ?o } }
   WHERE { GRAPH <g2> { ?s ?p ?o } }
   DROP <g2>

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.

   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 Wednesday, 23 December 2009 11:34:55 UTC