From f293c3979e7ecc92713f0a8615eb048997da8d47 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 11:39:24 +0000 Subject: [PATCH] Draft initial N3 Patch proposal. Closes https://github.com/solid/specification/issues/332 --- protocol.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/protocol.html b/protocol.html index 19b61453..f85764b2 100644 --- a/protocol.html +++ b/protocol.html @@ -717,6 +717,37 @@

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.

+ +
+

Modifying Resources Using N3 Patches

+
+

When the target resource of a PATCH request is an RDF document [RDF11-CONCEPTS], servers MUST support modifying that resource using a request body containing an N3 Patch. [Source]

+ +

An N3 Patch is a document in the Notation3 (N3) format [N3], identified by the MIME type text/n3, conforming to the following structural constraints:

+ +
    +
  • The patch document can contain patch resources identified by a triple ?patch solid:patches ?target, in which ?patch is a freely chosen identifier for a patch resource and ?target is the URI of the RDF document to be modified.
  • +
  • A patch resource contains at most one triple of the form ?patch solid:deletes ?deletions.
  • +
  • A patch resource contains at most one triple of the form ?patch solid:inserts ?insertions.
  • +
  • A patch resource contains at most one triple of the form ?patch solid:where ?conditions.
  • +
  • When present, ?deletions, ?insertions, and ?conditions must be non-nested cited formulae [N3] consisting only of triples and/or triple patterns. When not present, they are presumed to be the empty formula {}.
  • +
+ +

While other specifications might provide a structure and interpretation for a wider class of N3 Patch documents, the present specification only governs the application of N3 Patch documents that additionally adhere to the following structural constraints:

+ +
    +
  • The patch document contains exactly one patch resource.
  • +
  • The ?target is an exact match with the request URI.
  • +
  • The patch resource may optionally contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
  • +
  • The ?insertions and ?deletions formulae may only contain variables that also occur in the ?conditions formula.
  • +
  • The patch document does not contain any other triples.
  • +
+ +

Servers MUST respond with a 400 status code if a patch document does not satisfy all of the above constraints.

+ +

Servers MUST process an N3 Patch document against the RDF dataset in the target document as follows, creating an empty RDF dataset if the resource does not exist yet. If ?conditions is non-empty, then the dataset should contain exactly one match of its contents after variable substitution; if not, the server MUST respond with a 409 status code. The resulting (possibly empty) variable mapping must be propagated to the ?deletions and ?insertions formulae. Then, the resulting triples in ?deletions must be removed from the RDF dataset if there is exactly one match; if not, the server MUST respond with a 409 status code. Finally, the resulting triples in ?deletions must be added to the RDF graph. The combination of the deletions and insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.

+
+
@@ -1060,6 +1091,8 @@

Normative References

Linked Data Notifications. Sarven Capadisli; Amy Guy. W3C. 2 May 2017. W3C Recommendation. URL: https://www.w3.org/TR/ldn/
[LDP]
Linked Data Platform 1.0. Steve Speicher; John Arwe; Ashok Malhotra. W3C. 26 February 2015. W3C Recommendation. URL: https://www.w3.org/TR/ldp/
+
[N3]
+
Notation3. Dörthe Arndt; William Van Woensel;Dominik Tomaszuk; Gregg Kellogg. W3C. 5 September 2021. Draft Community Group Report. URL: https://w3c.github.io/N3/spec/
[RDF-SCHEMA]
RDF Schema 1.1. Dan Brickley; Ramanathan Guha. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/rdf-schema/
[RDF11-CONCEPTS]