Fwd: Update Syntax

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

Received on Wednesday, 28 April 2010 15:04:53 UTC