From 169e0a9bf20117264f6298b726e5ed9722cb7714 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 11:39:24 +0000 Subject: [PATCH 01/30] 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 f9cdd114..2c8bc383 100644 --- a/protocol.html +++ b/protocol.html @@ -719,6 +719,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.

+
+
@@ -1062,6 +1093,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]
From 9db73b876ad64b8b61817ce464f528149d2e7cba Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 13:40:38 +0000 Subject: [PATCH 02/30] Drop solid:patches as a patch requirement. --- protocol.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/protocol.html b/protocol.html index 2c8bc383..639f109e 100644 --- a/protocol.html +++ b/protocol.html @@ -728,7 +728,7 @@

Modifying Resources Using N3 Patches

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.
  • +
  • The patch document can contain patch resources identified by a URI ?patch which can be chosen freely.
  • 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.
  • @@ -738,8 +738,7 @@

    Modifying Resources Using N3 Patches

    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 document contains exactly one patch resource, identified by one or more of the triple patterns described above, which should all share the same ?patch subject.
    • 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.
    • From 8428773c4a58a246083e8619fb340a4dae9811df Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 17:17:37 +0000 Subject: [PATCH 03/30] Only allow blank nodes for insertions. --- protocol.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol.html b/protocol.html index 639f109e..72a3292a 100644 --- a/protocol.html +++ b/protocol.html @@ -740,13 +740,14 @@

      Modifying Resources Using N3 Patches

      • The patch document contains exactly one patch resource, identified by one or more of the triple patterns described above, which should all share the same ?patch subject.
      • 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 ?insertions and ?deletions formulae must not contain variables that do not occur in the ?conditions formula.
      • +
      • The ?insertions and ?deletions formulae must not contain blank nodes.
      • 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.

      +

      Servers MUST process a patch resource against the RDF dataset in the target document as follows, creating an empty RDF dataset if the target resource does not exist yet. If ?conditions is non-empty, then the dataset must 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 ?insertions must be added to the RDF dataset, where any blank nodes must result in newly created blank nodes. 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.

From ffb2a56df53f4b1bd489f68b00cd2954d4c3e346 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 17:44:46 +0000 Subject: [PATCH 04/30] Require the Accept-Patch header. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 72a3292a..ec954dc8 100644 --- a/protocol.html +++ b/protocol.html @@ -723,7 +723,7 @@

Note: Conditional Update

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]

+

Servers MUST support a PATCH request with an N3 Patch body when its target is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [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:

From 9e90ea4747543bcb1e929cd0a979488cfffe5368 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 17:59:41 +0000 Subject: [PATCH 05/30] Add example. --- protocol.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index ec954dc8..01ebb6b3 100644 --- a/protocol.html +++ b/protocol.html @@ -46,9 +46,11 @@ figure .example-h { margin-top:0; text-align: left; -text-transform: uppercase; color:#827017; } +figure .example-h > span { +text-transform: uppercase; +} header address a[href] { float: right; margin: 1rem 0 0.2rem 0.4rem; @@ -749,6 +751,18 @@

Modifying Resources Using N3 Patches

Servers MUST process a patch resource against the RDF dataset in the target document as follows, creating an empty RDF dataset if the target resource does not exist yet. If ?conditions is non-empty, then the dataset must 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 ?insertions must be added to the RDF dataset, where any blank nodes must result in newly created blank nodes. 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.

+ +
+

Example: Applying an N3 patch.

+
+@prefix solid: <http://www.w3.org/ns/solid/terms#>.
+@prefix ex: <http://www.example.org/terms#>.
+
+<> solid:where   { ?person ex:familyName "Anchor". };
+   solid:inserts { ?person ex:givenName "An". };
+   solid:deletes { ?person ex:givenName "Bob". }.
+
This N3 Patch instructs to rename An Anchor into Bob Anchor, on the condition that no other Anchor family members are present in the target RDF document.
+
From e731f769e24718dd47a6d0ee7308df0bf07b1bf9 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Wed, 10 Nov 2021 18:03:22 +0000 Subject: [PATCH 06/30] Allow the solid:Patch type. --- protocol.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 01ebb6b3..b7ffb65e 100644 --- a/protocol.html +++ b/protocol.html @@ -731,6 +731,7 @@

Modifying Resources Using N3 Patches

  • The patch document can contain patch resources identified by a URI ?patch which can be chosen freely.
  • +
  • A patch resource may contain a triple ?patch rdf:type solid:Patch.
  • 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.
  • @@ -758,7 +759,8 @@

    Modifying Resources Using N3 Patches

    @prefix solid: <http://www.w3.org/ns/solid/terms#>. @prefix ex: <http://www.example.org/terms#>. -<> solid:where { ?person ex:familyName "Anchor". }; +<> a solid:Patch; + solid:where { ?person ex:familyName "Anchor". }; solid:inserts { ?person ex:givenName "An". }; solid:deletes { ?person ex:givenName "Bob". }.
    This N3 Patch instructs to rename An Anchor into Bob Anchor, on the condition that no other Anchor family members are present in the target RDF document.
    From cfdf6ffd4151568b952281ec56565d170b0cac7c Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Thu, 11 Nov 2021 21:48:41 +0100 Subject: [PATCH 07/30] Use 'media type' instead of 'MIME type'. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index b7ffb65e..bcbffede 100644 --- a/protocol.html +++ b/protocol.html @@ -727,7 +727,7 @@

    Modifying Resources Using N3 Patches

    Servers MUST support a PATCH request with an N3 Patch body when its target is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [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:

    +

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

    • The patch document can contain patch resources identified by a URI ?patch which can be chosen freely.
    • From eecd630ca0019e72f6afc67e8a02abef00764e65 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 07:36:54 +0100 Subject: [PATCH 08/30] Allow blank nodes for patch. --- protocol.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol.html b/protocol.html index bcbffede..fd72d741 100644 --- a/protocol.html +++ b/protocol.html @@ -730,7 +730,7 @@

      Modifying Resources Using N3 Patches

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

        -
      • The patch document can contain patch resources identified by a URI ?patch which can be chosen freely.
      • +
      • The patch document can contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
      • A patch resource may contain a triple ?patch rdf:type solid:Patch.
      • 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.
      • @@ -759,7 +759,7 @@

        Modifying Resources Using N3 Patches

        @prefix solid: <http://www.w3.org/ns/solid/terms#>. @prefix ex: <http://www.example.org/terms#>. -<> a solid:Patch; +_:rename a solid:Patch; solid:where { ?person ex:familyName "Anchor". }; solid:inserts { ?person ex:givenName "An". }; solid:deletes { ?person ex:givenName "Bob". }. From 6627c658530ab650b86e549507d352705099a8d9 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 07:48:04 +0100 Subject: [PATCH 09/30] Turn patch structure into formal requirements. --- protocol.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/protocol.html b/protocol.html index fd72d741..fa90fac3 100644 --- a/protocol.html +++ b/protocol.html @@ -730,22 +730,22 @@

        Modifying Resources Using N3 Patches

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

          -
        • The patch document can contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
        • -
        • A patch resource may contain a triple ?patch rdf:type solid:Patch.
        • -
        • 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 {}.
        • +
        • The patch document MAY contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
        • +
        • A patch resource MAY contain a triple ?patch rdf:type solid:Patch.
        • +
        • A patch resource MAY contain at most one triple of the form ?patch solid:deletes ?deletions.
        • +
        • A patch resource MAY contain at most one triple of the form ?patch solid:inserts ?insertions.
        • +
        • A patch resource MAY contain 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, identified by one or more of the triple patterns described above, which should all share the same ?patch subject.
        • -
        • The patch resource may optionally contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
        • -
        • The ?insertions and ?deletions formulae must not contain variables that do not occur in the ?conditions formula.
        • -
        • The ?insertions and ?deletions formulae must not contain blank nodes.
        • -
        • The patch document does not contain any other triples.
        • +
        • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
        • +
        • The patch resource MAY optionally contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
        • +
        • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
        • +
        • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
        • +
        • The patch document MUST 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.

        From 7fded28d52a91667eb3388d6397537ef5d9ca511 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 07:50:31 +0100 Subject: [PATCH 10/30] Clarify language. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index fa90fac3..7d02f730 100644 --- a/protocol.html +++ b/protocol.html @@ -725,7 +725,7 @@

        Note: Conditional Update

        Modifying Resources Using N3 Patches

        -

        Servers MUST support a PATCH request with an N3 Patch body when its target is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

        +

        Servers MUST support a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

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

        From bae9aba7c700ec327d36b55f9e2d114868682505 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 20:27:50 +0100 Subject: [PATCH 11/30] Expand processing to list. --- protocol.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 7d02f730..ab8f47c7 100644 --- a/protocol.html +++ b/protocol.html @@ -750,7 +750,15 @@

        Modifying Resources Using N3 Patches

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

        -

        Servers MUST process a patch resource against the RDF dataset in the target document as follows, creating an empty RDF dataset if the target resource does not exist yet. If ?conditions is non-empty, then the dataset must 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 ?insertions must be added to the RDF dataset, where any blank nodes must result in newly created blank nodes. 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.

        +

        Servers MUST process a patch resource against the target document as follows:

        +
          +
        1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resources does not exist yet.
        2. +
        3. If ?conditions is non-empty, then the dataset must contain exactly one match of its contents after variable substitution; if not, the server MUST respond with a 409 status code.
        4. +
        5. The resulting (possibly empty) variable mapping is propagated to the ?deletions and ?insertions formulae.
        6. +
        7. Then, the resulting triples in ?deletions are removed from the RDF dataset if there is exactly one match; if not, the server MUST respond with a 409 status code.
        8. +
        9. Finally, the resulting triples in ?insertions are added to the RDF dataset, where any blank nodes result in newly created blank nodes.
        10. +
        11. The combination of deletions and insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
        12. +
        From b907715a469cf666c015acb4905e2a4143ef2bf9 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 20:29:16 +0100 Subject: [PATCH 12/30] Clarify May/MUST language. --- protocol.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol.html b/protocol.html index ab8f47c7..5a8e4eab 100644 --- a/protocol.html +++ b/protocol.html @@ -732,9 +732,9 @@

        Modifying Resources Using N3 Patches

        • The patch document MAY contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
        • A patch resource MAY contain a triple ?patch rdf:type solid:Patch.
        • -
        • A patch resource MAY contain at most one triple of the form ?patch solid:deletes ?deletions.
        • -
        • A patch resource MAY contain at most one triple of the form ?patch solid:inserts ?insertions.
        • -
        • A patch resource MAY contain at most one triple of the form ?patch solid:where ?conditions.
        • +
        • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
        • +
        • A patch resource MUST contain at most one triple of the form ?patch solid:inserts ?insertions.
        • +
        • A patch resource MUST contain 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 {}.
        From 043e8e4b89a4c10bfb794a5a9efb8a1e0e69459d Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 20:39:00 +0100 Subject: [PATCH 13/30] Describe permissions. --- protocol.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protocol.html b/protocol.html index 5a8e4eab..f3c31dfa 100644 --- a/protocol.html +++ b/protocol.html @@ -750,6 +750,8 @@

        Modifying Resources Using N3 Patches

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

        +

        When ?conditions is non-empty, servers MUST treat the request as a Read operation. When ?insertions is non-empty, servers MUST treat the request as an Append operation. When ?deletions is non-empty, servers MUST treat the request as a Read and Write operation.

        +

        Servers MUST process a patch resource against the target document as follows:

        1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resources does not exist yet.
        2. From 06b7d6350100b1703c8ec375f7439dfe5ac85fa8 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Fri, 12 Nov 2021 21:12:17 +0100 Subject: [PATCH 14/30] Clarify 409 conditions. --- protocol.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/protocol.html b/protocol.html index f3c31dfa..6dfc710f 100644 --- a/protocol.html +++ b/protocol.html @@ -755,11 +755,12 @@

          Modifying Resources Using N3 Patches

          Servers MUST process a patch resource against the target document as follows:

          1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resources does not exist yet.
          2. -
          3. If ?conditions is non-empty, then the dataset must contain exactly one match of its contents after variable substitution; if not, the server MUST respond with a 409 status code.
          4. -
          5. The resulting (possibly empty) variable mapping is propagated to the ?deletions and ?insertions formulae.
          6. -
          7. Then, the resulting triples in ?deletions are removed from the RDF dataset if there is exactly one match; if not, the server MUST respond with a 409 status code.
          8. -
          9. Finally, the resulting triples in ?insertions are added to the RDF dataset, where any blank nodes result in newly created blank nodes.
          10. -
          11. The combination of deletions and insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
          12. +
          13. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. +
          14. The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
          15. +
          16. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. +
          17. The triples resulting from ?deletions are to be removed from the RDF dataset.
          18. +
          19. The triples resulting from ?insertions are to be added to the RDF dataset, where any blank nodes result in newly created blank nodes.
          20. +
          21. The combination of deletions followed by insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
    From 94d4408adb25b53b1cdcab15e872756e35241e56 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 16 Nov 2021 16:16:50 +0000 Subject: [PATCH 15/30] Clarify blank node creation. Co-authored-by: Ted Thibodeau Jr --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 6dfc710f..fa10b9ad 100644 --- a/protocol.html +++ b/protocol.html @@ -759,7 +759,7 @@

    Modifying Resources Using N3 Patches

  • The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
  • If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code.
  • The triples resulting from ?deletions are to be removed from the RDF dataset.
  • -
  • The triples resulting from ?insertions are to be added to the RDF dataset, where any blank nodes result in newly created blank nodes.
  • +
  • The triples resulting from ?insertions are to be added to the RDF dataset, with each blank node from ?insertions resulting in a newly created blank node.
  • The combination of deletions followed by insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
  • From 9ac5899061f9c5d1f8629c2dbde6d9f6ee59274f Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 16 Nov 2021 16:24:55 +0000 Subject: [PATCH 16/30] Use 422 for semantically invalid patches. --- protocol.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index fa10b9ad..e9f9adb8 100644 --- a/protocol.html +++ b/protocol.html @@ -748,7 +748,7 @@

    Modifying Resources Using N3 Patches

  • The patch document MUST 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 respond with a 422 status code [RFC4918] if a patch document does not satisfy all of the above constraints.

When ?conditions is non-empty, servers MUST treat the request as a Read operation. When ?insertions is non-empty, servers MUST treat the request as an Append operation. When ?deletions is non-empty, servers MUST treat the request as a Read and Write operation.

@@ -1132,6 +1132,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]
From 7d94b2f30f5344fabc8d4511aa61328346d5ddb0 Mon Sep 17 00:00:00 2001 From: Kjetil Kjernsmo Date: Wed, 17 Nov 2021 12:34:34 +0100 Subject: [PATCH 17/30] Alternative references for triple and triple pattern --- protocol.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/protocol.html b/protocol.html index e9f9adb8..9afe7b0c 100644 --- a/protocol.html +++ b/protocol.html @@ -731,11 +731,11 @@

Modifying Resources Using N3 Patches

  • The patch document MAY contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
  • -
  • A patch resource MAY contain a triple ?patch rdf:type solid:Patch.
  • +
  • A patch resource MAY contain a triple [RDF11-CONCEPTS] ?patch rdf:type solid:Patch.
  • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
  • A patch resource MUST contain at most one triple of the form ?patch solid:inserts ?insertions.
  • A patch resource MUST contain 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 {}.
  • +
  • When present, ?deletions, ?insertions, and ?conditions MUST be non-nested cited formulae [N3] consisting only of triples and/or triple patterns [SPARQL11-QUERY]. 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:

@@ -1164,6 +1164,8 @@

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/
+
[SPARQL11-QUERY]
+
SPARQL 1.1 Query. Steve Harris; Andy Seaborne; Eric Prud'hommeaux. W3C. 21 March 2013. W3C Recommendation. URL: https://www.w3.org/TR/sparql11-query/
[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]
From 03aa9e0b38ec435210638e7c8ae960b47fa37bfc Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Mon, 29 Nov 2021 11:18:43 +0100 Subject: [PATCH 18/30] Simplify wording. Co-authored-by: Sarven Capadisli --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 9afe7b0c..8fb8da05 100644 --- a/protocol.html +++ b/protocol.html @@ -742,7 +742,7 @@

Modifying Resources Using N3 Patches

  • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
  • -
  • The patch resource MAY optionally contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
  • +
  • The patch resource MAY contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
  • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
  • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
  • The patch document MUST NOT contain any other triples.
  • From 9550f486fa1d2a583bdbbe54982322f5b0ccb4fd Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:01:46 +0000 Subject: [PATCH 19/30] Split patches and identifier statements. --- protocol.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 8fb8da05..ed09a0b0 100644 --- a/protocol.html +++ b/protocol.html @@ -730,7 +730,8 @@

    Modifying Resources Using N3 Patches

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

      -
    • The patch document MAY contain patch resources identified by a URI or blank node ?patch which can be chosen freely.
    • +
    • A patch document MUST contain one or more patch resources.
    • +
    • A patch resource MUST be identified by a URI or blank node, which we refer to as ?patch in the remainder of this section.
    • A patch resource MAY contain a triple [RDF11-CONCEPTS] ?patch rdf:type solid:Patch.
    • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
    • A patch resource MUST contain at most one triple of the form ?patch solid:inserts ?insertions.
    • From 1fed0c4c37cd83f1be9ef192c3ebf34a21902e17 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:04:19 +0000 Subject: [PATCH 20/30] Remove "structural". --- protocol.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol.html b/protocol.html index ed09a0b0..181ace04 100644 --- a/protocol.html +++ b/protocol.html @@ -727,7 +727,7 @@

      Modifying Resources Using N3 Patches

      Servers MUST support a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

      -

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

      +

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

      • A patch document MUST contain one or more patch resources.
      • @@ -739,7 +739,7 @@

        Modifying Resources Using N3 Patches

      • When present, ?deletions, ?insertions, and ?conditions MUST be non-nested cited formulae [N3] consisting only of triples and/or triple patterns [SPARQL11-QUERY]. 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:

      +

      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 constraints:

      • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
      • From 21987eb8c3ce2e085c234b5d0438438db39b0fae Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:09:42 +0000 Subject: [PATCH 21/30] Split N3 Patch acceptance and advertising. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 181ace04..54a0c26d 100644 --- a/protocol.html +++ b/protocol.html @@ -725,7 +725,7 @@

        Note: Conditional Update

        Modifying Resources Using N3 Patches

        -

        Servers MUST support a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS], and indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

        +

        Servers MUST accept a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS]. They MUST indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

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

        From 16c4b56af704e183011d64c814d88b0c0a8b600e Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:10:49 +0000 Subject: [PATCH 22/30] Add ID to extension statement. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 54a0c26d..82ead347 100644 --- a/protocol.html +++ b/protocol.html @@ -739,7 +739,7 @@

        Modifying Resources Using N3 Patches

      • When present, ?deletions, ?insertions, and ?conditions MUST be non-nested cited formulae [N3] consisting only of triples and/or triple patterns [SPARQL11-QUERY]. 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 constraints:

      +

      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 constraints:

      • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
      • From 50332c72e575dac0ea89871b2a04380581b0c6c2 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:15:42 +0000 Subject: [PATCH 23/30] Hint a cumulative nature. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 82ead347..ded21e46 100644 --- a/protocol.html +++ b/protocol.html @@ -751,7 +751,7 @@

        Modifying Resources Using N3 Patches

        Servers MUST respond with a 422 status code [RFC4918] if a patch document does not satisfy all of the above constraints.

        -

        When ?conditions is non-empty, servers MUST treat the request as a Read operation. When ?insertions is non-empty, servers MUST treat the request as an Append operation. When ?deletions is non-empty, servers MUST treat the request as a Read and Write operation.

        +

        When ?conditions is non-empty, servers MUST treat the request as a Read operation. When ?insertions is non-empty, servers MUST (also) treat the request as an Append operation. When ?deletions is non-empty, servers MUST treat the request as a Read and Write operation.

        Servers MUST process a patch resource against the target document as follows:

          From f53d94a7975ce0a162e644f21a7a1bf395d4bfe1 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:25:51 +0000 Subject: [PATCH 24/30] Add source for semaphore functionality. --- protocol.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol.html b/protocol.html index ded21e46..1306aa71 100644 --- a/protocol.html +++ b/protocol.html @@ -756,9 +756,10 @@

          Modifying Resources Using N3 Patches

          Servers MUST process a patch resource against the target document as follows:

          1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resources does not exist yet.
          2. -
          3. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. +
          4. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset.
          5. +
          6. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source]
          7. The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
          8. -
          9. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. +
          10. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. [Source]
          11. The triples resulting from ?deletions are to be removed from the RDF dataset.
          12. The triples resulting from ?insertions are to be added to the RDF dataset, with each blank node from ?insertions resulting in a newly created blank node.
          13. The combination of deletions followed by insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
          14. From 3965a0162d66503ab55638834421cd62e5ae5483 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:30:41 +0000 Subject: [PATCH 25/30] Fix typo. --- protocol.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol.html b/protocol.html index 1306aa71..2679dccc 100644 --- a/protocol.html +++ b/protocol.html @@ -755,7 +755,7 @@

            Modifying Resources Using N3 Patches

            Servers MUST process a patch resource against the target document as follows:

              -
            1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resources does not exist yet.
            2. +
            3. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resource does not exist yet.
            4. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset.
            5. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source]
            6. The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
            7. From b5d9e43fa76b78bf61faab85277dc4b6896d27d1 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 30 Nov 2021 15:33:47 +0000 Subject: [PATCH 26/30] Use more recognizable example names. --- protocol.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol.html b/protocol.html index 2679dccc..fec72d1a 100644 --- a/protocol.html +++ b/protocol.html @@ -773,10 +773,10 @@

              Modifying Resources Using N3 Patches

              @prefix ex: <http://www.example.org/terms#>. _:rename a solid:Patch; - solid:where { ?person ex:familyName "Anchor". }; - solid:inserts { ?person ex:givenName "An". }; - solid:deletes { ?person ex:givenName "Bob". }. -
              This N3 Patch instructs to rename An Anchor into Bob Anchor, on the condition that no other Anchor family members are present in the target RDF document.
              + solid:where { ?person ex:familyName "Garcia". }; + solid:inserts { ?person ex:givenName "Alex". }; + solid:deletes { ?person ex:givenName "Claudia". }. +
              This N3 Patch instructs to rename Claudia Garcia into Alex Garcia, on the condition that no other Garcia family members are present in the target RDF document.
              From 466675ce3de17e6f2c720b65a0906c166ba0dc1d Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 5 Dec 2021 23:47:01 +0100 Subject: [PATCH 27/30] Minor --- protocol.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol.html b/protocol.html index fec72d1a..2ad1236a 100644 --- a/protocol.html +++ b/protocol.html @@ -725,7 +725,7 @@

              Note: Conditional Update

              Modifying Resources Using N3 Patches

              -

              Servers MUST accept a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS]. They MUST indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

              +

              Servers MUST accept a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS]. They MUST indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

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

              @@ -757,9 +757,9 @@

              Modifying Resources Using N3 Patches

              1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resource does not exist yet.
              2. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset.
              3. -
              4. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source] +
              5. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source]
              6. The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
              7. -
              8. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. [Source] +
              9. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. [Source]
              10. The triples resulting from ?deletions are to be removed from the RDF dataset.
              11. The triples resulting from ?insertions are to be added to the RDF dataset, with each blank node from ?insertions resulting in a newly created blank node.
              12. The combination of deletions followed by insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
              13. From 97da1c9fd98c57933cffe169de68aaffa197be55 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 6 Dec 2021 00:02:15 +0100 Subject: [PATCH 28/30] Minor --- protocol.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/protocol.html b/protocol.html index 2ad1236a..ecc8ec6d 100644 --- a/protocol.html +++ b/protocol.html @@ -731,9 +731,9 @@

                Modifying Resources Using N3 Patches

                • A patch document MUST contain one or more patch resources.
                • -
                • A patch resource MUST be identified by a URI or blank node, which we refer to as ?patch in the remainder of this section.
                • -
                • A patch resource MAY contain a triple [RDF11-CONCEPTS] ?patch rdf:type solid:Patch.
                • -
                • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
                • +
                • A patch resource MUST be identified by a URI or blank node, which we refer to as ?patch in the remainder of this section.
                • +
                • A patch resource MAY contain a triple [RDF11-CONCEPTS] ?patch rdf:type solid:Patch.
                • +
                • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
                • A patch resource MUST contain at most one triple of the form ?patch solid:inserts ?insertions.
                • A patch resource MUST contain 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 [SPARQL11-QUERY]. When not present, they are presumed to be the empty formula {}.
                • @@ -746,7 +746,7 @@

                  Modifying Resources Using N3 Patches

                • The patch resource MAY contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
                • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
                • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
                • -
                • The patch document MUST NOT contain any other triples.
                • +
                • The patch document MUST NOT contain any other triples.

                Servers MUST respond with a 422 status code [RFC4918] if a patch document does not satisfy all of the above constraints.

                @@ -754,6 +754,7 @@

                Modifying Resources Using N3 Patches

                When ?conditions is non-empty, servers MUST treat the request as a Read operation. When ?insertions is non-empty, servers MUST (also) treat the request as an Append operation. When ?deletions is non-empty, servers MUST treat the request as a Read and Write operation.

                Servers MUST process a patch resource against the target document as follows:

                +
                1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resource does not exist yet.
                2. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset.
                3. @@ -768,14 +769,13 @@

                  Modifying Resources Using N3 Patches

                  Example: Applying an N3 patch.

                  -
                  -@prefix solid: <http://www.w3.org/ns/solid/terms#>.
                  -@prefix ex: <http://www.example.org/terms#>.
                  -
                  -_:rename a solid:Patch;
                  -   solid:where   { ?person ex:familyName "Garcia". };
                  -   solid:inserts { ?person ex:givenName "Alex". };
                  -   solid:deletes { ?person ex:givenName "Claudia". }.
                  +
                  @prefix solid: <http://www.w3.org/ns/solid/terms#>.
                  +@prefix ex: <http://www.example.org/terms#>.
                  +
                  +_:rename a solid:Patch;
                  +  solid:where   { ?person ex:familyName "Garcia". };
                  +  solid:inserts { ?person ex:givenName "Alex". };
                  +  solid:deletes { ?person ex:givenName "Claudia". }.
                  This N3 Patch instructs to rename Claudia Garcia into Alex Garcia, on the condition that no other Garcia family members are present in the target RDF document.
              From 970e8097795933c7dc6d0da605e46419f8674506 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Mon, 6 Dec 2021 01:07:35 +0100 Subject: [PATCH 29/30] Stabilise n3-patch spec:requirements --- protocol.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/protocol.html b/protocol.html index ecc8ec6d..e3d3fd9c 100644 --- a/protocol.html +++ b/protocol.html @@ -725,7 +725,7 @@

              Note: Conditional Update

              Modifying Resources Using N3 Patches

              -

              Servers MUST accept a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS]. They MUST indicate such support by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

              +

              Servers MUST accept a PATCH request with an N3 Patch body when the target of the request is an RDF document [RDF11-CONCEPTS]. Servers MUST indicate support of N3 Patch by listing text/n3 as a value of the Accept-Patch header [RFC5789] of relevant responses. [Source]

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

              @@ -739,14 +739,14 @@

              Modifying Resources Using N3 Patches

            8. When present, ?deletions, ?insertions, and ?conditions MUST be non-nested cited formulae [N3] consisting only of triples and/or triple patterns [SPARQL11-QUERY]. 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 constraints:

      +

      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 constraints:

      -
        +
        • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
        • The patch resource MAY contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
        • -
        • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
        • -
        • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
        • -
        • The patch document MUST NOT contain any other triples.
        • +
        • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
        • +
        • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
        • +
        • The patch document MUST NOT contain any other triples.

        Servers MUST respond with a 422 status code [RFC4918] if a patch document does not satisfy all of the above constraints.

        @@ -755,12 +755,12 @@

        Modifying Resources Using N3 Patches

        Servers MUST process a patch resource against the target document as follows:

        -
          +
          1. Start from the RDF dataset in the target document, or an empty RDF dataset if the target resource does not exist yet.
          2. If ?conditions is non-empty, find all (possibly empty) variable mappings such that all of the resulting triples occur in the dataset.
          3. -
          4. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source]
          5. +
          6. If no such mapping exists, or if multiple mappings exist, the server MUST respond with a 409 status code. [Source]
          7. The resulting variable mapping is propagated to the ?deletions and ?insertions formulae to obtain two sets of resulting triples.
          8. -
          9. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. [Source]
          10. +
          11. If the set of triples resulting from ?deletions is non-empty and the dataset does not contain all of these triples, the server MUST respond with a 409 status code. [Source]
          12. The triples resulting from ?deletions are to be removed from the RDF dataset.
          13. The triples resulting from ?insertions are to be added to the RDF dataset, with each blank node from ?insertions resulting in a newly created blank node.
          14. The combination of deletions followed by insertions then forms the new resource state of the RDF document, and the server responds with the appropriate status code.
          15. From 2a99d6a13b0e86a88a926b33b1d1e5459f9b5e97 Mon Sep 17 00:00:00 2001 From: Ruben Verborgh Date: Tue, 14 Dec 2021 13:54:19 +0000 Subject: [PATCH 30/30] Allow arbitrary patch triples by requiring a specific type. --- protocol.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/protocol.html b/protocol.html index e3d3fd9c..a405a71a 100644 --- a/protocol.html +++ b/protocol.html @@ -731,7 +731,7 @@

            Modifying Resources Using N3 Patches

            • A patch document MUST contain one or more patch resources.
            • -
            • A patch resource MUST be identified by a URI or blank node, which we refer to as ?patch in the remainder of this section.
            • +
            • A patch resource MUST be identified by a URI or blank node, which we refer to as ?patch in the remainder of this section.
            • A patch resource MAY contain a triple [RDF11-CONCEPTS] ?patch rdf:type solid:Patch.
            • A patch resource MUST contain at most one triple of the form ?patch solid:deletes ?deletions.
            • A patch resource MUST contain at most one triple of the form ?patch solid:inserts ?insertions.
            • @@ -743,10 +743,9 @@

              Modifying Resources Using N3 Patches

              • The patch document MUST contain exactly one patch resource, identified by one or more of the triple patterns described above, which all share the same ?patch subject.
              • -
              • The patch resource MAY contain one triple of the form ?patch solid:matchingStrategy solid:SingleMatch.
              • +
              • A patch resource MUST contain a triple ?patch rdf:type solid:InsertDeletePatch.
              • The ?insertions and ?deletions formulae MUST NOT contain variables that do not occur in the ?conditions formula.
              • The ?insertions and ?deletions formulae MUST NOT contain blank nodes.
              • -
              • The patch document MUST NOT contain any other triples.

              Servers MUST respond with a 422 status code [RFC4918] if a patch document does not satisfy all of the above constraints.

              @@ -772,7 +771,7 @@

              Modifying Resources Using N3 Patches

              @prefix solid: <http://www.w3.org/ns/solid/terms#>.
               @prefix ex: <http://www.example.org/terms#>.
               
              -_:rename a solid:Patch;
              +_:rename a solid:InsertDeletePatch;
                 solid:where   { ?person ex:familyName "Garcia". };
                 solid:inserts { ?person ex:givenName "Alex". };
                 solid:deletes { ?person ex:givenName "Claudia". }.
              @@ -1166,7 +1165,7 @@

              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/
              -
              [SPARQL11-QUERY]
              +
              [SPARQL11-QUERY]
              SPARQL 1.1 Query. Steve Harris; Andy Seaborne; Eric Prud'hommeaux. W3C. 21 March 2013. W3C Recommendation. URL: https://www.w3.org/TR/sparql11-query/
              [Turtle]
              RDF 1.1 Turtle. Eric Prud'hommeaux; Gavin Carothers. W3C. 25 February 2014. W3C Recommendation. URL: https://www.w3.org/TR/turtle/