diff --git a/protocol.html b/protocol.html index fdd5b3f0..3e1cc6d5 100644 --- a/protocol.html +++ b/protocol.html @@ -717,7 +717,32 @@

Note: Conditional Update

Servers MAY use the HTTP ETag header with a strong validator for RDF bearing representations in order to encourage clients to opt-in to using the If-Match header in their requests.

- + +
+

Using SPARQL to Patch Resources

+
+

+ When the target resource of a PATCH request is represented by an RDF document [RDF11-CONCEPTS], servers MUST support changing the representation using the request body containing a variation of SPARQL Update as defined in the Appendix. + Servers MAY further support SPARQL 1.1 Update [SPARQL], + except that servers MUST NOT allow a request with a PATCH method to change other resources than the target resource. [Source] + Servers that receives a request body containing a SPARQL query that falls outside of the what they are able to process MUST respond with a 422 status code [RFC4918] and a message body that explains the error. +

+ +

+ When servers that process requests containing REMOVE or REMOVE DATA operations as defined in the Appendix detects a failure resulting from the processing of these operations, then the server MUST abort any modifications and respond with a 409 status code. +

+ +

+ When the request body of a PATCH request has a SPARQL Update query that contains an INSERT keyword, servers MUST treat the request as an Append operation. + When the query contains a WHERE keyword, servers MUST treat the request as a Read operation. + When the query contains a DELETE keyword, servers MUST treat the request as a Write operation. + When the query contains a REMOVE keyword, servers MUST treat the request as a Read and Write operation. +

+ +
+
+ +

Deleting Resources

@@ -1045,6 +1070,169 @@

Security and Privacy Review

+
+

Appendix - A variant of SPARQL Update for Solid

+
+
+

Overview

+
+

This section is non-normative.

+ +

The objective of this variant is two-fold: Firstly, it is a variant of SPARQL 1.1 Update [SPARQL11-UPDATE] that is relatively easy to implement and contains features that are most commonly used. Secondly, it seeks to enable a semaphore mechanism that exploits that if a delete operation does not remove any triples, it may have been due to an edit conflict. Since this is incompatible with SPARQL 1.1 as defined, it introduces a REMOVE keyword. The variant operates over triples and triple patterns only, and uses basic graph patterns, and does not include more advanced features. To further examine the grammar definition, see the Yacker validator. +

+
+
+ +
+

Definition

+ +

+ REMOVE DATA differs from DELETE DATA as defined in SPARQL 1.1 Update [SPARQL11-UPDATE] in that the deletion of non-existing data results in a failure. +

+ +

+ REMOVE differs from DELETE as defined in SPARQL 1.1 Update [SPARQL11-UPDATE] in that when the corresponding WHERE clause does not match exactly one solution, it results in a failure. +

+ +

+ The Internet Media Type / MIME Type for this variant is "application/vnd.solid.sparql-patch". +

+ +
+ +
+

Grammar

+
+

Note: Definition of SPARQL Update Variant

+
+

This specification alters the grammar of 8 rules in the original grammar of the SPARQL 1.1 Query Language [SPARQL] grammar and introduces another 11 new rules to accommodate for INSERT DATA and REMOVE DATA, as the corresponding operations were defined in the language definition but not precisely defined in the grammar. This specification references the original grammar definition where no changes were made. +

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[30p] Update1 ::= Prologue ( InsertData | RemoveData | UpdateData | RemoveWhere | Modify )
[31d] UpdateData ::= RemoveData ';' InsertData
[38p] InsertData ::= 'INSERT DATA' '{' TripleData '}'
[39p] RemoveData ::= 'REMOVE DATA' '{' TripleData '}'
[40p] RemoveWhere ::= 'REMOVE WHERE' '{' TriplesTemplate '}'
[41p] Modify ::= ( RemoveClause InsertClause? | InsertClause ) 'WHERE' '{' TriplesTemplate '}'
[42p] RemoveClause ::= 'REMOVE' '{' TriplesTemplate '}'
[43p] InsertClause ::= 'INSERT' '{' TriplesTemplate '}'
[52d] TripleData ::= TriplesDataSameSubject ( '.' TripleData? )?
[75d] TriplesDataSameSubject ::= GraphTerm PropertyDataListNotEmpty | TriplesDataNode PropertyDataList
[76d] PropertyDataList ::= PropertyDataListNotEmpty?
[77d] PropertyDataListNotEmpty ::= Verb ObjectDataList ( ';' ( Verb ObjectDataList )? )*
[78p] Verb ::= iri | 'a'
[79d] ObjectDataList ::= ObjectData ( ',' ObjectData )*
[80d] ObjectData ::= GraphDataNode
[98d] TriplesDataNode ::= CollectionData | BlankNodeDataPropertyList
[99d] BlankNodeDataPropertyList ::= '[' PropertyDataListNotEmpty ']'
[102d] CollectionData ::= '(' GraphDataNode+ ')'
[104d] GraphDataNode ::= GraphTerm | TriplesDataNode
+
+
+
+
+

References

@@ -1070,6 +1258,8 @@

Normative References

Registration Procedures for Message Header Fields. G. Klyne; M. Nottingham; J. Mogul. IETF. September 2004. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc3864
[RFC3986]
Uniform Resource Identifier (URI): Generic Syntax. T. Berners-Lee; R. Fielding; L. Masinter. IETF. January 2005. Internet Standard. URL: https://datatracker.ietf.org/doc/html/rfc3986
+
[RFC4918]
+
HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV). L. Dusseault, Ed.. IETF. June 2007. Proposed Standard. URL: https://datatracker.ietf.org/doc/html/rfc4918
[RFC5023]
The Atom Publishing Protocol. J. Gregorio, Ed.; B. de hOra, Ed.. IETF. October 2007. Proposed Standard. URL: https://datatracker.ietf.org/doc/html/rfc5023
[RFC5789]
@@ -1100,6 +1290,10 @@

Normative References

Web Linking. M. Nottingham. IETF. October 2017. Proposed Standard. URL: https://httpwg.org/specs/rfc8288.html
[SOLID-OIDC]
SOLID-OIDC. Aaron Coburn; elf Pavlik; Dmitri Zagidulin. W3C Solid Community Group. W3C Editor's Draft. URL: https://solid.github.io/solid-oidc/
+
[SPARQL]
+
SPARQL 1.1 Overview. The W3C SPARQL Working Group. W3C. 21 March 2013. W3C Recommendation. URL: https://www.w3.org/TR/sparql11-overview/
+
[SPARQL11-UPDATE]
+
SPARQL 1.1 Update. Paula Gearon; Alexandre Passant; Axel Polleres. W3C. 21 March 2013. W3C Recommendation. URL: https://www.w3.org/TR/sparql11-update/
[Turtle]
RDF 1.1 Turtle. Eric Prud'hommeaux; Gavin Carothers. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/turtle/
[W3C-HTML]