Re: Update Syntax

Mostly seems good, but I found a bit of optional syntax to complain about :)

I'm a bit concerned about the optional-ness of WHERE in DELETE INSERT:

> [ 'WITH <' uri '>' ]
> 'DELETE {' modify_template [ modify_template ]* '}'
> 'INSERT {' modify_template [ modify_template ]* '}'
> [ 'USING <' uri '>' ]*
> [ 'USING NAMED <' uri '>' ]*
> [ 'WHERE' ] GroupGraphPattern

This implies that
   DELETE { <a> <b> <c> } INSERT { <d> <e> <f> } { <x> <y> <z> }
would be legal syntax, and with some pretty non-obvious behaviour. It's not optional in DELETE or INSERT individually, so it seems odd that it is here.

- Steve

On 2010-04-28, at 16:04, Paul Gearon wrote:

> Initially sent to Andy, but the whole list should see this as well...
> 
> 
> This is not formal, but here is the update syntax as it stands, along
> with examples. I don't expect it to be completely correct,
> but hopefully it is close.
> 
> Regards,
> Paul Gearon
> 
> --- Insert data ---
> 
> 'INSERT DATA {' graph_triples '}'
> graph_triples :: = TriplesBlock | 'GRAPH <' graph_uri '> {' TriplesBlock '}'
> 
> Eg:
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> INSERT DATA
> { <http://example/book3> dc:title    "A new book" ;
>                         dc:creator  "A.N.Other" .
> }
> 
> 
> --- Delete data ---
> 
> 'DELETE DATA {' graph_triples '}'
> 
> Eg:
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> DELETE DATA
> { <http://example/bookx> dc:title    "David Copperfield" ;
>                         dc:creator  "Edmund Wells" .
> }
> 
> 
> // Before semicolons were chosen to separate operations,
> // the following was a valid example. I don't think that it
> // is still valid without a semicolon. and a repeated PREFIX.
> 
> PREFIX dc: <http://purl.org/dc/elements/1.1/>
> DELETE DATA
> { GRAPH <http://example/bookStore> { <http://example/book3>  dc:title
> "Fundamentals of Compiler Desing" } }
> INSERT DATA
> { GRAPH <http://example/bookStore> { <http://example/book3>  dc:title
> "Fundamentals of Compiler Design" } }
> 
> 
> --- Delete/Insert ---
> 
> [ 'WITH <' uri '>' ]
> 'DELETE {' modify_template [ modify_template ]* '}'
> 'INSERT {' modify_template [ modify_template ]* '}'
> [ 'USING <' uri '>' ]*
> [ 'USING NAMED <' uri '>' ]*
> [ 'WHERE' ] GroupGraphPattern
> 
> modify_template :: = ConstructTriples | graph_template
> graph_template ::= 'GRAPH' VarOrIRIRef '{' ConstructTriples '}'
> 
> Eg:
> PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
> WITH <http://example/addresses>
> DELETE { ?person foaf:firstName 'Bill' }
> INSERT { ?person foaf:firstName 'William' }
> WHERE
>  { ?person a foaf:Person .
>    ?person foaf:firstName 'Bill'
>  }
> 
> 
> --- Delete ---
> 
> [ 'WITH <' uri '>' ]
> 'DELETE' [ '{' modify_template [ modify_template ]* '}' ]
> 'WHERE' GroupGraphPattern
> 
> Eg:
> PREFIX dc:  <http://purl.org/dc/elements/1.1/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> DELETE
>  { ?book ?p ?v }
> WHERE
>  { ?book dc:date ?date .
>   FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime )
>   ?book ?p ?v
>  }
> 
> Eg2:
> PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
> WITH <http://example/addresses>
> DELETE WHERE { ?person foaf:firstName 'Fred';
>                       ?property      ?value }
> 
> 
> --- Insert ---
> 
> [ 'WITH <' uri '>' ]
> 'INSERT {' modify_template [ modify_template ]* '}'
> 'WHERE' GroupGraphPattern
> 
> Eg:
> PREFIX dc:  <http://purl.org/dc/elements/1.1/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> INSERT
>  { GRAPH <http://example/bookStore2> { ?book ?p ?v } }
> WHERE
>  { GRAPH  <http://example/bookStore>
>       { ?book dc:date ?date .
>         FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime )
>         ?book ?p ?v
>  } }
> 
> 
> Eg2:
> // The following was also valid before the semicolon decision
> // I'm pretty sure that we now need a semicolon and a repeated
> // set of prefixes.
> 
> PREFIX dc:  <http://purl.org/dc/elements/1.1/>
> PREFIX dcmitype: <http://purl.org/dc/dcmitype/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
> 
> INSERT
>  { GRAPH <http://example/bookStore2> { ?book ?p ?v } }
> WHERE
>  { GRAPH  <http://example/bookStore>
>     { ?book dc:date ?date .
>       FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime )
>       ?book ?p ?v
>     }
>  }
> WITH <http://example/bookStore>
> DELETE
>  { ?book ?p ?v }
> WHERE
>  { ?book dc:date ?date ;
>         dc:type dcmitype:PhysicalObject .
>   FILTER ( ?date < "2000-01-01T00:00:00-2:00"^^xsd:dateTime )
>   ?book ?p ?v
>  }
> 
> 
> --- Load ---
> 
> 'LOAD <' documentURI '>' [ 'INTO <' uri '>' ]
> 
> Eg:
> LOAD <http://example.com/data/graph.rdf> INTO <http://service.com/graph>
> 
> 
> --- Clear ---
> 
> 'CLEAR' [ 'GRAPH <' uri '>' ]
> 
> Eg:
> CLEAR GRAPH <http://service.com/graph>
> 
> 
> --- Create ---
> 
> 'CREATE' [ 'SILENT' ] 'GRAPH <' uri '>'
> 
> Eg:
> CREATE <http://service.com/graph>
> 
> 
> --- Drop ---
> 'DROP' [ 'SILENT' ] 'GRAPH <' uri '>'
> 
> Eg:
> DROP SILENT <http://service.com/graph>
> 
> 
> Regards,
> Paul Gearon
> 

-- 
Steve Harris, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  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, 28 April 2010 15:29:58 UTC