ldpatch.html
author Andrei Sambra <andrei@w3.org>
Fri, 24 Jul 2015 16:30:33 -0400
branchldpatch
changeset 977 535a33b19afd
parent 976 d4e249a5bf19
permissions -rw-r--r--
Made spec pubrules compliant
<!DOCTYPE html>
<html>
  <head>
    <title>Linked Data Patch Format</title>
    <meta charset='utf-8'>
    <script src='//www.w3.org/Tools/respec/respec-w3c-common'
            async class='remove'></script>
    <script class='remove'>
      var preProc = {
        apply: function(c) {
                  // terms definitions
                  refs = document.querySelectorAll('tdef') ;
                  for (var i = 0; i < refs.length; i++) {
                      var item = refs[i];
                      if (!item) continue ;
                      var p = item.parentNode ;
                      var con = item.innerHTML ;
                      var ref = item.getAttribute('title') ;
                      if (!ref) {
                          ref = item.textContent ;
                      }
                      if (ref) {
                          ref = ref.replace(/\n/g, '_') ;
                          ref = ref.replace(/\s+/g, '_') ;
                      }
                      var sp = document.createElement( 'dfn' ) ;
                      sp.title = ref ;
                      sp.innerHTML = con ;
                      p.replaceChild(sp, item) ;
                  }
                  // term references
                  refs = document.querySelectorAll('tref') ;
                  for (var i = 0; i < refs.length; i++) {
                      var item = refs[i];
                      if (!item) continue ;
                      var p = item.parentNode ;
                      var con = item.innerHTML ;
                      var ref = item.getAttribute('title') ;
                      if (!ref) {
                          ref = item.textContent ;
                      }
                      if (ref) {
                          ref = ref.replace(/\n/g, '_') ;
                          ref = ref.replace(/\s+/g, '_') ;
                      }

                      var sp = document.createElement( 'a' ) ;
                      var id = item.textContent ;
                      sp.className = 'tref' ;
                      sp.title = ref ;
                      sp.innerHTML = con ;
                      p.replaceChild(sp, item) ;
                  }
              }
      };

      function updateExample(doc, content) {
        // perform transformations to make it render and prettier
        content = content.replace(/<!--/, '');
        content = content.replace(/-->/, '');
        content = doc._esc(content);
        content = content.replace(/\*\*\*\*([^*]*)\*\*\*\*/g, '<span class="hilite">$1</span>') ;
        return content ;
      };

      function updateDTD(doc, content) {
        // perform transformations to
        // make it render and prettier
        content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
        content = content.replace(/!ENTITY % ([^ \t\r\n]*)/g, '!ENTITY <span class="entity">% $1</span>');
        content = content.replace(/!ELEMENT ([^ \t$]*)/mg, '!ELEMENT <span class="element">$1</span>');
        return content;
      };

      function updateSchema(doc, content) {
        // perform transformations to
        // make it render and prettier
        content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
        content = content.replace(/&lt;xs:element\s+name=&quot;([^&]*)&quot;/g, '&lt;xs:element name="<span class="element" id="schema_element_$1">$1</span>"') ;
        return content;
      };

      function updateTTL(doc, content) {
        // perform transformations to
        // make it render and prettier
        content = '<pre class="sh_sourceCode">' + doc._esc(content) + '</pre>';
        content = content.replace(/@prefix/g, '<span class="sh_keyword">@prefix</span>');
        return content;
      };

      var respecConfig = {
          // specification status (e.g. WD, LCWD, WG-NOTE, etc.). If in doubt use ED.
          specStatus:           "WG-NOTE",

          // the specification's short name, as in http://www.w3.org/TR/short-name/
          shortName:            "ldpatch",

          // if your specification has a subtitle that goes below the main
          // formal title, define it here
          // subtitle   :  "an excellent document",

          // if you wish the publication date to be other than the last modification, set this
          // publishDate:  "2009-08-06",

          // if the specification's copyright date is a range of years, specify
          // the start date here:
          // copyrightStart: "2005"

          // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
          // and its maturity status
          // publishDate:  "2015-03-03",
          // crEnd: "2015-04-17", // 45 days

          // if there a publicly available Editor's Draft, this is the link
          edDraftURI:           "https://dvcs.w3.org/hg/ldpwg/raw-file/ldpatch/ldpatch.html",

          // if this is a LCWD, uncomment and set the end of its review period
          // lcEnd: "2009-08-05",

          // editors, add as many as you like
          // only "name" is required
          editors:  [
              {
                  name:       "Alexandre Bertails"
              ,   url:        "http://bertails.org/"
              ,   mailto:     "alexandre@bertails.org"
              },
              {
                  name:       "Pierre-Antoine Champin"
              ,   url:        "http://liris.cnrs.fr/~pchampin/en/"
              ,   mailto:     "pchampin@liris.cnrs.fr"
              ,   company:    "Université de Lyon"
              ,   companyURL: "http://www.universite-lyon.fr/"
              },
              {
                  name:       "Andrei Sambra"
              ,   url:        "https://deiu.rww.io/profile/card#me"
              ,   mailto:     "andrei@w3.org"
              ,   company:    "MIT/W3C"
              ,   companyURL: "http://www.w3.org/"
              },
          ],

          // name of the WG
          wg:           "Linked Data Platform Working Group",

          // URI of the public WG page
          wgURI:        "http://www.w3.org/2012/ldp",

          // name (without the @w3c.org) of the public mailing to which comments are due
          wgPublicList: "public-ldp-comments",

          // URI of the patent status for this WG, for Rec-track documents
          // !!!! IMPORTANT !!!!
          // This is important for Rec-track documents, do not copy a patent URI from a random
          // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
          // Team Contact.
          wgPatentURI:  "http://www.w3.org/Consortium/Patent-Policy-20040205/",
          // !!!! IMPORTANT !!!! MAKE THE ABOVE BLINK IN YOUR HEAD
          preProcess: [ preProc ]
      };
    </script>
    <style type="text/css">
.atrisk {
  padding:    1em;
  margin: 1em 0em 0em;
  border: 1px solid #f00;
  background: #ffc;
}
.atrisktext {
  /* content:    "Feature At Risk"; */
  display:    block;
  width:  150px;
  margin: -1.5em 0 0.5em 0;
  font-weight:    bold;
  border: 1px solid #f00;
  background: #fff;
  padding:    3px 1em;
}

div.rule {padding-top: 1em;}
div.ldp-issue {
  border-color: #E05252;
  background: #FBE9E9;
  padding: 0.5em;
  margin: 1em 0;
  position: relative;
  clear: both;
  border-left-width: .5em;
  border-left-style: solid;
}
div.ldp-issue-title {
  color: #E05252;
  padding-right: 1em;
  min-width: 7.5em;
}
    </style>
  </head>
  <body>
    <section id='abstract'>
      <p>
Linked Data Patch Format (LD Patch) defines a language for expressing a sequence of operations for patching Linked Data resources; it is suitable for use with the HTTP PATCH method.
      </p>
    </section>

    <section id='sotd'>

      <p id="alternative-designs">
 	Although the Linked Data Platform (LDP) Working Group is currently favoring LD Patch, it seeks more input in deciding which format to promote for use in <a href="http://www.w3.org/TR/ldp/#ldpr-HTTP_PATCH">LDP PATCH</a> [[!LDP]] operations on <a href="http://www.w3.org/TR/ldp/#ldprs">LDP RDF Sources</a>.  Other viable candidates include:</p>

      <ul>
      	<li><a href="http://www.w3.org/TR/sparql11-http-rdf-update/#http-patch">SPARQL 1.1 Update</a> &mdash; already standardized, but quite complex for LDP scenarios</li>
      	<li><a href="http://www.w3.org/2001/sw/wiki/SparqlPatch">SparqlPatch</a> &mdash; restricted to a simple subset of SPARQL 1.1 Update</li>
      	<li><a href="http://www.w3.org/2001/sw/wiki/TurtlePatch">TurtlePatch</a> &mdash; uses an even simpler subset, but requires unusual handling of blank nodes</li>
      	<li><a href="http://afs.github.io/rdf-patch/">RDF Patch</a> &mdash; simple, but also requires unusual handling of blank nodes</li>
      </ul>

      <p>
       At this point, the advantage leans towards LD Patch in terms of simplicity, ease of implementation, and run-time performance on anticipated data.  We welcome data relevant to this decision.
      </p>

      <p>
        This specification was previously published as a Candidate Recommendation (CR). Due to lack of sufficient implementations to meet the CR exit criteria within the time remaining under the current charter, the Working Group decided to take it off the W3C Recommendation track and publish it as a W3C Note for future reference. This document may be reused in part or in whole by another WG in the future, or not.
      </p>

    </section>

    <section class='informative' id='introduction'>
      <h1>Introduction</h1>
      <p>
          Linked Data <q cite="https://en.wikipedia.org/wiki/Linked_data">describes a method of publishing structured data so that it can be interlinked and become more useful. It builds upon standard Web technologies such as HTTP, RDF and IRIs, but rather than using them to serve web pages for human readers, it extends them to share information in a way that can be read automatically by computers. This enables data from different sources to be connected and queried.</q> (source Wikipedia).
      </p>
      <p>
This document defines the Linked Data Patch Format (LD Patch), a format for describing changes to apply to Linked Data. It is suitable for use with <a href="http://tools.ietf.org/html/rfc5789">HTTP PATCH</a> [[!RFC5789]], a method to perform partial modifications to Web resources. <!-- The "text/ldpatch" media type is prospectively used to identify such LD Patch documents.-->
      </p>
      <p>
          An instance of the LD Patch language (or LD Patch document) defines a list of operations to be performed against a Linked Data resource, namely the addition or removal of RDF [[!rdf11-concepts]] triples in the graph representing this resource.
      </p>

      <p id="relation-sparql-update">
        The LD Patch format described in this document should be seen as a language for updating <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph">RDF Graphs</a> in a resource-centric fashion. It is the intention to confine its expressive power to an RDF diff with <a class="internalDFN" href="#pathological-graph">partial support for blank nodes</a> and <code>rdf:List</code> manipulations. For more powerful operations on RDF Graphs and Quad Stores, the LDP WG recommends the reader to consider <a href="http://www.w3.org/TR/sparql11-update/">SPARQL Update</a> [[sparql11-update]].
      </p>

    </section>

    <section id="examples" class="informative">
      <h2>Examples</h2>

      <section id="full-example">
          <h2>Full example</h2>

          <p>
              The following RDF Graph describes the relation between a person named Tim Berners-Lee (denoted by <code>&lt;http://example.org/timbl#&gt;</code>) and two events he attended.
          </p>
          <pre class='example'>
@prefix schema: &lt;http://schema.org/&gt; .
@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
@prefix ex: &lt;http://example.org/vocab#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
&lt;#&gt; a schema:Person ;
  schema:alternateName "TimBL" ;
  profile:first_name "Tim" ;
  profile:last_name "Berners-Lee" ;
  schema:workLocation [ schema:name "W3C/MIT" ] ;
  schema:performerIn _:b1, _:b2 ;
  ex:preferredLanguages ( "en" "fr" ).

_:b1 schema:name "F2F5 - Linked Data Platform" ;
  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .

_:b2 a schema:Event ;
  schema:name "TED 2009" ;
  schema:startDate "2009-02-04" ;
  schema:url &lt;http://conferences.ted.com/TED2009/&gt; .
          </pre>
          <p>
              The following is an example HTTP Patch request, conveying an LD Patch document:
          </p>
          <pre class='example'>
PATCH /timbl HTTP/1.1
Host: example.org
Content-Length: 478
Content-Type: text/ldpatch
If-Match: "abc123"

@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
@prefix schema: &lt;http://schema.org/&gt; .
@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
@prefix ex: &lt;http://example.org/vocab#&gt; .

Delete { &lt;#&gt; profile:first_name "Tim" } .
Add {
  &lt;#&gt; profile:first_name "Timothy" ;
    profile:image &lt;https://example.org/timbl.jpg&gt; .
} .

Bind ?workLocation &lt;#&gt; / schema:workLocation .
Cut ?workLocation .

UpdateList &lt;#&gt; ex:preferredLanguages 1..2 ( "fr-CH" ) .

Bind ?event &lt;#&gt; / schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ]  .
Add { ?event rdf:type schema:Event } .

Bind ?ted &lt;http://conferences.ted.com/TED2009/&gt; / ^schema:url ! .
Delete { ?ted schema:startDate "2009-02-04" } .
Add {
  ?ted schema:location [
    schema:name "Long Beach, California" ;
    schema:geo [
      schema:latitude "33.7817" ;
      schema:longitude "-118.2054"
    ]
  ]
} .
          </pre>
          <p>
              This example introduces most features of the LD Patch format: <code>@prefix</code> and prefixed names, the <a>Add</a>, <a>Delete</a>, <a>Cut</a>, and <a>UpdateList</a> operations, the node <a>Bind</a>ing mechanism, and blank node creation. The "text/ldpatch" media type is <a href="#media-registration">prospectively</a> used to identify such LD Patch documents.
          </p>
          <p>
              The following is the resulting (patched) document.
          </p>
          <pre class='example'>
@prefix schema: &lt;http://schema.org/&gt; .
@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
@prefix ex: &lt;http://example.org/vocab#&gt; .
@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
&lt;#&gt; a schema:Person ;
  schema:alternateName "TimBL" ;
  profile:first_name "Timothy" ;
  profile:last_name "Berners-Lee" ;
  profile:image &lt;https://example.org/timbl.jpg&gt; ;
  schema:performerIn _:b1, _:b2 ;
  ex:preferredLanguages ( "en" "fr-CH" ) .

_:b1 a schema:Event ;
  schema:name "F2F5 - Linked Data Platform" ;
  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .

_:b2 a schema:Event ;
  schema:name "TED 2009" ;
  schema:url &lt;http://conferences.ted.com/TED2009/&gt; ;
  schema:location [
    schema:name "Long Beach, California";
    schema:geo [ schema:latitude "33.7817" ; schema:longitude "-118.2054" ]
  ] .
          </pre>
      </section>

      <section id="list-manipulation-examples">
          <h2><code>rdf:List</code> manipulation examples</h2>

          <p>All the LD Patch examples in this section are applied against the following RDF graph (target IRI <code>http://example.org/timbl</code>):</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "dolor" "sit" "amet" ) .
          </pre>



          <h3 id="replace-elements">How to replace elements</h3>

          <p>
              This example shows how to replace one element (here the second one) with a new one:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 1..2 ( "fr" ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "fr" "dolor" "sit" "amet" ) .
          </pre>


          <h3 id="insert-new-elements">How to insert new elements</h3>

          <p>
              This example shows how to insert new elements at a specific index (here <code>2</code>):
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 2..2 ( "en" "fr" ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "en" "fr" "dolor" "sit" "amet" ) .
          </pre>


          <h3 id="append-elements">How to append elements</h3>

          <p>
              This example shows how to append elements at the end of a collection:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; .. ( "en" "fr" ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "dolor" "sit" "amet" "en" "fr" ) .
          </pre>


          <h3 id="replace-elements">How to replace all the elements after a given index</h3>

          <p>
              This example shows how to replace all the elements after the index <code>2</code> with the provided collection:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 2.. ( "en" "fr" ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "en" "fr" ) .
          </pre>


          <h3 id="replace-elements-from-end-of-list">How to replace the n last elements</h3>

          <p>
              This example shows how to replace the last <code>3</code> elements of the provided collection:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; -3.. ( "en" "fr" ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "en" "fr" ) .
          </pre>


          <h3 id="remove-elements">How to remove elements</h3>

          <p>
              This example shows how to remove elements (here the second and the third) from a collection:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 1..3 ( ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "sit" "amet" ) .
          </pre>


          <h3 id="empty-collection">How to empty a collection</h3>

          <p>
              Finally, this example shows how to empty a collection:
          </p>

          <pre class='example'>
UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 0.. ( ) .
          </pre>

          <p>Output graph:</p>

          <pre class='example'>
&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( ) .
          </pre>

      </section>

    </section>


    <section class="normative" id="conformance">

      <p>This specification defines conformance criteria for:</p>
      <ul>
        <li>LD Patch documents</li>
        <li>LD Patch parsers</li>
        <li>LD Patch processors</li>
        <li>LD Patch servers</li>
      </ul>

      <p>A conforming <strong>LD Patch document</strong> is a Unicode string that conforms to the grammar defined in the <a href="#concrete-syntax">Concrete Syntax section</a>.</p>

      <p>A conforming <strong>LD Patch parser</strong> is a system capable of parsing LD Patch documents. The resulting abstract concept is called a <strong>Linked Data patch</strong>, or simply <strong>patch</strong> when the context is unambiguous. Parsers should treat Literals as being composed of a lexical form and an optional <a href="http://www.w3.org/TR/rdf11-concepts/#dfn-language-tag">language tag</a> [[!BCP47]] (as used by <a href="http://www.w3.org/TR/turtle/">Turtle</a> [[Turtle]]) or datatype IRI.</p>

      <p>A conforming <strong>LD Patch processor</strong> is a system capable of executing a Linked Data patch against an <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#section-rdf-graph">RDF Graph</a> and whose semantics follow the ones defined in the <a href="#semantics">LD Patch Semantics section</a>. It would either return a new graph or update the input graph in place.</p>

      <p>A conforming <strong>LD Patch server</strong> is a system capable of processing an LD Patch document through an HTTP PATCH request as defined in <a href="http://www.w3.org/TR/ldp/#ldpr-HTTP_PATCH">LDP PATCH</a> [[!LDP]]. It MUST handle errors as defined in the <a href="#error-handling">Error Handling section</a>.</p>

      <p>The IRI that identifies the LD Patch format is: <code>http://www.w3.org/ns/formats/LD_Patch</code>.</p>

    </section>




    <section class='normative' id='semantics'>
      <h1>LD Patch Semantics</h1>
      <p>
An LD Patch document is applied to a Linked Data resource identified by an IRI (the <dfn>target IRI</dfn>) and represented by an RDF graph (the <dfn>target graph</dfn>). It is made of a prologue followed by a list of statements. The prologue declares a number of <a href="#grammar-production-prefixID">prefixes</a> used to abbreviate IRIs as <a href="#grammar-production-PrefixedName">PrefixedName</a>s. Then, each statement either binds a variable to a matching node from the <a>target graph</a>, or specifies a modification on the <a>target graph</a>.
      </p>




      <section id="nodes-and-triples-semantics">
        <h2><dfn>Nodes and triples Semantics</dfn></h2>
        <p>
LD Patch borrows much of its syntax and semantics from <a href="http://www.w3.org/TR/turtle/">Turtle</a> [[Turtle]] for describing nodes and triples. Especially, whenever production rules <a class="internalDFN" href="#grammar-production-triples">triples</a> or <a class="internalDFN" href="#grammar-production-collection">collection</a> are used, Turtle semantics must be applied to parse them as a set of triples that we call an <dfn>argument graph</dfn>.
        </p>
        <p>
There are however a few points that need to be highlighted in the way LD Patch parses an <a>argument graph</a> compared to Turtle:
        </p>
        <ul>
          <li>
            The base IRI used to resolve relative IRIs is the <a>target IRI</a>.
          </li>
          <li>
            LD Patch allows <a class="internalDFN" href="#grammar-production-VAR1">var</a>iables in <a class="internalDFN" href="#grammar-production-subject">subject</a> and <a class="internalDFN" href="#grammar-production-object">object</a> positions.
          </li>
          <li>
              The value of a <a class="internalDFN" href="#grammar-production-VAR1">var</a>iables is the last node to which it was bound (in case it appears in several <a>Bind</a> statements).
          </li>
          <li>
              <dfn id="blank-node-scoping">The scope of <a class="internalDFN" href="#grammar-production-BLANK_NODE_LABEL">blank node identifiers</a> is the whole LD Patch document.</dfn> That means that <a title="argument graph">argument graphs</a> across statements can share blank nodes.
          </li>
        </ul>
        <p>
            As IRIs and RDF Literals have global scopes, such nodes in an <a>argument graph</a> represent the same resource as in the <a>target graph</a>. Blank nodes, on the other hand, pose a problem, as they have no global identifiers. Indeed, since <a class="internalDFN" href="#blank-node-scoping">the scope of blank node identifiers is limited to the LD Patch document in which they appear</a>, any blank node identifier appearing in an LD Patch document is understood to denote a <em>fresh</em> blank node, distinct from any node initially present in the <a>target graph</a>. Therefore blank node identifiers in LD Patch cannot interfere with pre-existing blank nodes in the <a>target graph</a>.
        </p>
        <p>
However, LD Patch provides mechanisms to address those pre-existing blank nodes: <a>bind</a>ing a variable to a blank node reachable through a <a>path expression</a>, <a>cut</a>ting a whole tree made of blank nodes, or using <a>UpdateList</a> to deal with those blank nodes that constitute RDF collections. There are cases where those mechanisms will not be able to unambiguously address a given blank node, but those cases are deemed <a href="#pathological-graph">pathological</a>, and are out of the scope of this specification.
        </p>
      </section>

      <section id="path-expression">
        <h2><dfn>Path Expression</dfn></h2>
        <p>
            A <a>Path expression</a> can be used to locate RDF nodes within the <a>target graph</a>. A path expression consists of a series of one or more <a>Step</a>s (introduced by a "<code>/</code>") or <a>Constraint</a>s, which are applied in order from left to right. The main goal is to allow addressing a blank node by “walking” the arcs of the graph from an previously identified node.
        </p>
        <p>
            <code>/</code> behaves like a left-associated operator where the left operand is a node set, the right operand is a <a>Step</a>, and the result is a node set. A <a>Constraint</a> behaves like a predicate function whose implicit parameter is the node set on which it is applied. In the context of a <a>Filter</a>, this implicit node set becomes the left operand for <code>/</code>.
        </p>
        <p>
            A <dfn>Step</dfn> can be of three kinds:
        </p>
        <ul>
            <li>A <dfn>StepForward</dfn> is defined by an IRI, and consists in following the corresponding outgoing arcs in the <a>target graph</a>.</li>
            <li>A <dfn>StepBackward</dfn> is defined by an IRI preceded by the caret ("<code>^</code>") sign, and consists in following the corresponding incoming arcs <em>in reverse</em> in the <a>target graph</a>.</li>
            <li>A <dfn>StepAt</dfn> is defined by an integer <i>n</i>, and consists in following <var>n</var> <code>rdf:rest</code> arcs and one <code>rdf:first</code> arc in order to reach the corresponding member of an RDF collection. It is equivalent to a sequence of <var>n</var>+1 <a>StepForward</a>s with the corresponding IRIs. A negative index <var>n</var> denotes the n-th element from the end of the list counting backwards.</li>
        </ul>
        <p>
            A <dfn>Constraint</dfn> can be of two kinds:
        </p>
        <ul>
          <li>A <dfn>Unicity constraint</dfn>, described by the <em>bang</em> ("<code>!</code>") character, checks that the current node set contains exactly one node.</li>
          <li>A <dfn>Filter</dfn>, consisting of a <a>Path expression</a> between square brackets ("<code>[</code>", "<code>]</code>"), keeps only the nodes that “satisfy” the enclosed path, i.e. those from which the enclosed path reaches at least one node.</li>
          <li>Additionally, the path in a <a>filter</a> can specify an equality constraint with the use of the equal ("<code>=</code>") sign and a <tref>Value</tref>. In that case, only the nodes for which that particular value is reached through the enclosed path are kept.</li>
        </ul>

        <p>
The following path expression (taken from the <a href="#examples">Examples section</a>) will look for all events matching the predicate <code>schema:performerIn</code>, keeping only the one matching the IRI <code>&lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt;</code>.
        <pre class='example'>
/ schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ]
        </pre>
        </p>

      </section>

      <section id="patch-operations">
        <h2>Patch Operations</h2>

        <section id="Bind-statement">
          <h2><dfn>Bind</dfn></h2>
          <p>
              The <a>Bind</a> operation is used to bind an <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term">RDF Term</a> to a variable. The process results in the variable being bound to exactly one node. After being bound, the variable can be used in the subsequent statements. Another <a>Bind</a> can override the value of a previously bound variable.
          </p>

          <p>
              The <a>Bind</a> operation is defined by three components: <a>Var</a>, <a>Value</a> and <a title="path expression">Path</a>, the last component being optional (can be considered equivalent to the empty path).
          </p>

          <p>
              <dfn>Var</dfn> contains a unique name for the new variable. Variables are prefixed by the "<code>?</code>" character, which is not part of the variable name.
          </p>
          <p>
              <dfn>Value</dfn> is the <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term">RDF Term</a> that will be used as starting point when following the path expression.
          </p>
          <p>
              <dfn>Path</dfn> is the expression that is used to identify the <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term">RDF Term</a> to which the Variable will be bound. It is comprised of <a>Step</a>(s) and/or <a>Constraint</a>(s).
          </p>

          <p>
              Following the example above, the <a>Bind</a> operation creates a new variable called <code>event</code>, starting from the <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term">RDF Term</a> <code>&lt;#&gt;</code> and following the path expression <code>/ schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ]</code> in order to identify the <a class="externalDFN" href="http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term">RDF Term</a> to which this variable will be bound to – i.e. <code>_:b2</code> in the <a>target graph</a>.
          <pre class='example'>
Bind ?event &lt;#&gt; / schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ] .
          </pre>
          </p>

        </section>

        <section id="Add-statement">
          <h2><dfn>Add</dfn></h2>
          <p>
The <a>Add</a> operation is used to append new RDF triples to the <a>target graph</a>.
          </p>
          <p>
              It has a single argument: an <a>argument graph</a> <var>g</var>. All triples in <var>g</var> must be added to the <var>target graph</var>. If an argument graph contains one or more triples that already exist in the target graph, the <a>Add</a> operation does not fail.
          <pre class='example'>
Add {
    &lt;#&gt; profile:first_name "Timothy" ;
        profile:image &lt;https://example.org/timbl.jpg&gt; .
} .

Add { ?event rdf:type schema:Event } .
          </pre>
          </p>
        </section>

        <section id="AddNew-statement">
          <h2><dfn>AddNew</dfn></h2>
          <p>
              The <a>AddNew</a> operation is used to append new RDF triples to the <a>target graph</a>. It behaves like <a>Add</a> but unlike its counterpart, <a>AddNew</a> <a href="#addnew-already-existing-triple">fails</a> when trying to add an already existing triple.
          </p>
        </section>

        <section id="Delete-statement">
          <h2><dfn>Delete</dfn></h2>
          <p>
The <a>Delete</a> operation is used to remove RDF triples from the <a>target graph</a>.
          </p>
          <p>
              It has a single argument: an <a>argument graph</a> <var>g</var>. All triples in <var>g</var> must be removed from the <var>target graph</var>. It does not fail if one of those triples did not exist in the <a>target graph</a>. Blank nodes identifiers are allowed in <a>Delete</a> statements but <a href="#blank-node-scoping">they remain scoped to the LD Patch document</a>, so they can only match a blank node previously added by the same LD Patch document.
          </p>
          <pre class='example'>
Delete { &lt;#&gt; profile:first_name "Tim" } .

Delete { ?ted schema:startDate "2009-02-04" } .
          </pre>
          </p>
        </section>

        <section id="DeleteExisting-statement">
          <h2><dfn>DeleteExisting</dfn></h2>
          <p>
The <a>DeleteExisting</a> operation is used to remove RDF triples from the <a>target graph</a>. It behaves like <a>Delete</a> but unlike its counterpart, <a>DeleteExisting</a> <a href="#deleteexisting-non-existing-triple">fails</a> when trying to delete a non-existing triple.
          </p>
        </section>

        <section id="Cut-statement">
          <h2><dfn>Cut</dfn></h2>
          <p>
            The <a>Cut</a> operation is used to remove one or more triples connected to a specific blank node <var>b</var>. More precisely, it removes all the outgoing arcs for <var>b</var> from the <a>target graph</a>, and does the same recursively for all objects of those triples being blank nodes. Finally, it removes all incoming arcs of <var>b</var>.
          <pre class='example'>
Cut ?workLocation .
          </pre>
          </p>
        </section>

        <section id="UpdateList-statement">
          <h2><dfn>UpdateList</dfn></h2>
          <p>
              The <a>UpdateList</a> operation is used to update some members of an <a href="http://www.w3.org/TR/rdf-schema/#ch_collectionvocab">RDF collection</a>. It works in a similar way to <a href="https://docs.python.org/3/reference/expressions.html#slicings">slicing in Python</a> or similar languages: it replaces a slice of a list by another list.
          </p>

          <p>
              The <a>UpdateList</a> operation is defined by four components: a <a class="internalDFN" href="#grammar-production-varOrIRI">variable or IRI</a>, a <a class="internalDFN" href="#grammar-production-predicate">predicate</a>, a <a>Slice expression</a>, and an <a>argument graph</a> containing an RDF collection.
          </p>

          <p>
              The <dfn>Slice expression</dfn> is composed of two optional 0-based indexes <var>i<sub>min</sub></var> and <var>i<sub>max</sub></var> separated by "<code>..</code>". A negative index denotes elements from the end of the list counting backwards, e.g. the last element of any non-empty list always has the index <code>-1</code>. An omitted value is interpreted as the length of the collection. The <a>Slice expression</a> will denote the slice of the list being preceded by <var>i<sub>min</sub></var> elements, and spanning over (<var>i<sub>max</sub></var> - <var>i<sub>min</sub></var>) elements.
         </p>
         <p>
             For example, here are some <a>Slice expression</a>s for the list <code>( "lorem" "ipsum" "dolor" "sit" "amet" )</code>:
          </p>
          <ul>
              <li><code>2..4</code> denotes the slice <code>( "dolor" "sit" )</code>, i.e. the elements between the indexes <code>2</code> and <code>4</code></li>
              <li><code>0..</code> denotes the slice <code>( "lorem" "ipsum" "dolor" "sit" "amet" )</code>, i.e. the whole list</li>
              <li><code>3..</code> denotes the slice <code>( "sit" "amet" )</code>, i.e. all the elements after the index <code>3</code></li>
              <li><code>-2..</code> denotes the slice <code>( "sit" "amet" )</code>, i.e. the last 2 elements</li>
              <li><code>2..2</code> denotes the empty slice located between <code>"ipsum"</code> and <code>"dolor"</code></li>
              <li><code>..</code> denotes the empty slice located at the end of the list</li>
          </ul>

          <p>
              <a href="#updatelist-algo">Appendix A</a> contains a detailed algorithm for implementing the <a>UpdateList</a> logic using reified <code>rdf:List</code>.
          </p>

      </section>



      <section id="error-handling">
        <h2><dfn>Error Handling</dfn></h2>
        <p>
LD Patch abides to the semantics of the <a href="http://tools.ietf.org/html/rfc5789">HTTP PATCH method</a> [[!RFC5789]], in that the server <q cite="http://tools.ietf.org/html/rfc5789">MUST apply the entire set of changes atomically and never provide (e.g., in response to a GET during this operation) a partially modified representation. If the entire patch document cannot be successfully applied (e.g., one of the instructions has failed), then the server MUST NOT apply any of the changes</q>. In the case LD Patch operations fail to be applied, <a href="http://tools.ietf.org/html/rfc5789#section-2.2">Error Handling, Section 2</a> of [[!RFC5789]] specifies the error codes to be used.
        </p>

	<p>
            Here are some additional error conditions more specific to LD Patch:
        </p>

        <ul>
            <li id="bind-unique-match">If a <a>Bind</a> statement fails to match exactly one node, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="unicity-constraint-violated">If a <a>Unicity constraint</a> is violated, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="cut-nothing">If a <a>Cut</a> operation fails to remove any triple, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="cut-non-bnode">If a <a>Cut</a> operation is called on a variable not bound to a blank node, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="deleteexisting-non-existing-triple">If a <a>DeleteExisting</a> attempts to remove a non-existing triple, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="addnew-already-existing-triple">If a <a>AddNew</a> attempts to add an already existing triple, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="updatelist-non-list-argument">If the subject and predicate provided to an <a>UpdateList</a> do not have a unique object, or if this object is not a well-formed collection, then a HTTP 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="wrong-order-for-indexes">If the indexes in a <a>slice expression</a> are in the wrong order (e.g. <code>2868..42</code>), then the parsing fails and a 400 (Bad Request) error status code MUST be returned.</li>
            <li id="wrong-index">If an index in a <a>slice expression</a> is greater than the length of the <code>rdf:List</code>, then a 422 (Unprocessable Entity) error status code MUST be returned.</li>
            <li id="unknown-prefix">If a prefix name (<a class="internalDFN" href="#grammar-production-PNAME_NS">PNAME_NS</a>) is used without being previously declared, then the parsing fails and a 400 (Bad Request) error status code MUST be returned.</li>
            <li id="unknown-variable">If a <a>var</a>iable is used without being previously bound, then the parsing fails and a 400 (Bad Request) error status code MUST be returned.</li>

        </ul>

        <p>
            Note: 422 (Unprocessable Entity) is defined in <a href="http://tools.ietf.org/html/rfc4918#section-11.2">422 Unprocessable Entity, Section 11.2</a> of [[!RFC4918]].

        </p>

      </section>

      <section id="pathological-graph">
        <h2><dfn>Pathological Graph</dfn></h2>
          <p>
            There exists a particular case which LD Patch is not able to address. Given an RDF graph <var>G</var>, a blank node <var>b</var> is said to be unambiguous in <var>G</var> if there exists a couple <var>(n, p)</var> where
          <ul>
            <li><var>n</var> is an IRI or a literal</li>
            <li><var>p</var> is a <a>Path Expression</a></li>
          </ul>
          such that applying <var>p</var> to {<var>n</var>} results in the singleton set {<var>b</var>}.
          </p>

          <p>
  It is easy to see that only the unambiguous blank nodes of a graph can be handled in LD Patch.
          </p>

          <p>
  Consider for example the following graph:
          </p>

        <pre class='example'>
&lt;#&gt; foaf:name "Alice" ; foaf:knows _:b1, _:b2 .
_:b1 a foaf:Person .
_:b2 a foaf:Person ; schema:workLocation _:b3 .
_:b3 schema:name "W3C/MIT" .
        </pre>

        <p>
          The blank nodes <code>_:b2</code> and <code>_:b3</code> are unambiguous as they can be reached unambiguoulsy from the literal <code>"W3C/MIT"</code>. The blank node <code>_:b1</code>, on the other hand, is ambigious as all <a>path expression</a>s that can match it would also match <code>_:b2</code>.
        </p>

        <!-- p>
          This kind of node is not particularly interesting in RDF, as its presence does not change the semantics of the graph. Indeed, if we remove <code>_:b2</code> and all its triples from the graph above, the resulting graph would be semantically equivalent to the original graph.
        </p-->

        <p>
          Another example is a graph containing only blank nodes. All its nodes are therefore ambiguous as they can not be reached from an IRI or a literal. Such a graph is not interesting in the context of Linked Data as it contains no IRI to link to or from it.
        </p>

        <p>
          Therefore, ambiguous blank nodes are considered a pathological case in the context of Linked Data, and so the fact that they cannot be coped with in LD Patch is deemed acceptable. Furthermore, their presence in a graph does not prevent the other nodes of that graph to be handled by LD Patch. Most notably, all <a class="externalDFN" href="http://www.w3.org/TR/rdf11-mt/#dfn-lean">non-lean graphs</a> [[!rdf11-mt]] are also pathological.
        </p>

        </section>

      </section>
    </section>



    <section id="turtle-sparql-comparison" class="informative">
        <h1>LD Patch compared to Turtle and SPARQL</h1>
        <p>
            The LD Patch syntax uses a Turtle [[!Turtle]] style syntax for its <a class="internalDFN" href="#grammar-production-triples">triples</a> production. This production differs from the Turtle language in that the <a class="internalDFN" href="#grammar-production-subject">subject</a> and <a class="internalDFN" href="#grammar-production-object">object</a> production rules allow the use of variables.
        </p>
        <p>
            LD Patch variables are restricted to the <a class="internalDFN" href="#grammar-production-VAR1">VAR1</a> production rule from SPARQL 1.1 [[!sparql11-query]], only allowing a leading '<code>?</code>'.
        </p>
        <p>
            Finally, the prefix directive is restricted to the <a class="internalDFN" href="#grammar-production-prefixID">prefixID</a> production rule in Turtle [[!Turtle]], only allowing <code>@prefix</code>.
        </p>

    </section>



    <section id='concrete-syntax'>
      <h1>Concrete Syntax</h1>

      <p>
          Production labels consisting of a number and a final 's', e.g. [135s], reference the production with that number in the <a href="http://www.w3.org/TR/sparql11-query/#sparqlGrammar">SPARQL 1.1 Query Language grammar</a> [[!sparql11-query]]. Production labels consisting of a number and a final 't', e.g. [6t], reference the production with that number in the <a href="http://www.w3.org/TR/turtle/#sec-grammar-grammar">Turtle grammar</a> [[!Turtle]]. A production label containing an extra trailing '*' denotes a modified rule, e.g. [10t*] and [12t*].
      </p>



      <!-- do not edit manually, this is automatically generated -->
<table class="grammar">
  <tbody class="grammar-productions">
<tr id="grammar-production-ldpatch">
    <td>[1]</td>
    <td><a href="#grammar-production-ldpatch">ldpatch</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-prologue">prologue</a> <a href="#grammar-production-statement">statement</a>*</td>
</tr>
<tr id="grammar-production-prologue">
    <td>[2]</td>
    <td><a href="#grammar-production-prologue">prologue</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-prefixID">prefixID</a>*</td>
</tr>
<tr id="grammar-production-statement">
    <td>[3]</td>
    <td><a href="#grammar-production-statement">statement</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-bind">bind</a> | <a href="#grammar-production-add">add</a> | <a href="#grammar-production-addNew">addNew</a> | <a href="#grammar-production-delete">delete</a> | <a href="#grammar-production-deleteExisting">deleteExisting</a> | <a href="#grammar-production-cut">cut</a> | <a href="#grammar-production-updateList">updateList</a></td>
</tr>
<tr id="grammar-production-bind">
    <td>[4]</td>
    <td><a href="#grammar-production-bind">bind</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">Bind</code>" | "<code class="grammar-literal">B</code>") <a href="#grammar-production-VAR1">VAR1</a> <a href="#grammar-production-value">value</a> <a href="#grammar-production-path">path</a>? "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-add">
    <td>[5]</td>
    <td><a href="#grammar-production-add">add</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">Add</code>" | "<code class="grammar-literal">A</code>") "<code class="grammar-literal">{</code>" <a href="#grammar-production-graph">graph</a> "<code class="grammar-literal">}</code>" "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-addNew">
    <td>[6]</td>
    <td><a href="#grammar-production-addNew">addNew</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">AddNew</code>" | "<code class="grammar-literal">AN</code>") "<code class="grammar-literal">{</code>" <a href="#grammar-production-graph">graph</a> "<code class="grammar-literal">}</code>" "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-delete">
    <td>[7]</td>
    <td><a href="#grammar-production-delete">delete</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">Delete</code>" | "<code class="grammar-literal">D</code>") "<code class="grammar-literal">{</code>" <a href="#grammar-production-graph">graph</a> "<code class="grammar-literal">}</code>" "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-deleteExisting">
    <td>[8]</td>
    <td><a href="#grammar-production-deleteExisting">deleteExisting</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">DeleteExisting</code>" | "<code class="grammar-literal">DE</code>") "<code class="grammar-literal">{</code>" <a href="#grammar-production-graph">graph</a> "<code class="grammar-literal">}</code>" "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-cut">
    <td>[9]</td>
    <td><a href="#grammar-production-cut">cut</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">Cut</code>" | "<code class="grammar-literal">C</code>") <a href="#grammar-production-VAR1">VAR1</a> "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-updateList">
    <td>[10]</td>
    <td><a href="#grammar-production-updateList">updateList</a></td>
    <td>::=</td>
    <td>("<code class="grammar-literal">UpdateList</code>" | "<code class="grammar-literal">UL</code>") <a href="#grammar-production-varOrIRI">varOrIRI</a> <a href="#grammar-production-predicate">predicate</a> <a href="#grammar-production-slice">slice</a> <a href="#grammar-production-collection">collection</a> "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-varOrIRI">
    <td>[11]</td>
    <td><a href="#grammar-production-varOrIRI">varOrIRI</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-VAR1">VAR1</a></td>
</tr>
<tr id="grammar-production-value">
    <td>[12]</td>
    <td><a href="#grammar-production-value">value</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-literal">literal</a> | <a href="#grammar-production-VAR1">VAR1</a></td>
</tr>
<tr id="grammar-production-path">
    <td>[13]</td>
    <td><a href="#grammar-production-path">path</a></td>
    <td>::=</td>
    <td>( '<code class="grammar-literal">/</code>' <a href="#grammar-production-step">step</a> | <a href="#grammar-production-constraint">constraint</a> )*</td>
</tr>
<tr id="grammar-production-step">
    <td>[14]</td>
    <td><a href="#grammar-production-step">step</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">^</code>' <a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-INDEX">INDEX</a></td>
</tr>
<tr id="grammar-production-constraint">
    <td>[15]</td>
    <td><a href="#grammar-production-constraint">constraint</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">[</code>' <a href="#grammar-production-path">path</a> ( '<code class="grammar-literal">=</code>' <a href="#grammar-production-value">value</a> )? '<code class="grammar-literal">]</code>' | '<code class="grammar-literal">!</code>'</td>
</tr>
<tr id="grammar-production-slice">
    <td>[16]</td>
    <td><a href="#grammar-production-slice">slice</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-INDEX">INDEX</a>? '<code class="grammar-literal">..</code>' <a href="#grammar-production-INDEX">INDEX</a>?</td>
</tr>
<tr id="grammar-production-INDEX">
    <td>[17]</td>
    <td><a href="#grammar-production-INDEX">INDEX</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">-</code>'? [0-9]+</td>
</tr>
<tr id="grammar-production-VAR1">
    <td>[143s]</td>
    <td><a href="#grammar-production-VAR1">VAR1</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">?</code>' <a href="#grammar-production-VARNAME">VARNAME</a></td>
</tr>
<tr id="grammar-production-VARNAME">
    <td>[166s]</td>
    <td><a href="#grammar-production-VARNAME">VARNAME</a></td>
    <td>::=</td>
    <td>( <a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> | [0-9] ) ( <a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040] )*</td>
</tr>
<tr id="grammar-production-prefixID">
    <td>[4t]</td>
    <td><a href="#grammar-production-prefixID">prefixID</a></td>
    <td>::=</td>
    <td>"<code class="grammar-literal">@prefix</code>" <a href="#grammar-production-PNAME_NS">PNAME_NS</a> <a href="#grammar-production-IRIREF">IRIREF</a> "<code class="grammar-literal">.</code>"</td>
</tr>
<tr id="grammar-production-graph">
    <td>[18]</td>
    <td><a href="#grammar-production-graph">graph</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-triples">triples</a> ( '<code class="grammar-literal">.</code>' <a href="#grammar-production-triples">triples</a> )* '<code class="grammar-literal">.</code>'?</td>
</tr>
<tr id="grammar-production-triples">
    <td>[6t]</td>
    <td><a href="#grammar-production-triples">triples</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-subject">subject</a> <a href="#grammar-production-predicateObjectList">predicateObjectList</a> | <a href="#grammar-production-blankNodePropertyList">blankNodePropertyList</a> <a href="#grammar-production-predicateObjectList">predicateObjectList</a>?</td>
</tr>
<tr id="grammar-production-predicateObjectList">
    <td>[7t]</td>
    <td><a href="#grammar-production-predicateObjectList">predicateObjectList</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-verb">verb</a> <a href="#grammar-production-objectList">objectList</a> ('<code class="grammar-literal">;</code>' (<a href="#grammar-production-verb">verb</a> <a href="#grammar-production-objectList">objectList</a>)?)*</td>
</tr>
<tr id="grammar-production-objectList">
    <td>[8t]</td>
    <td><a href="#grammar-production-objectList">objectList</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-object">object</a> ('<code class="grammar-literal">,</code>' <a href="#grammar-production-object">object</a>)*</td>
</tr>
<tr id="grammar-production-verb">
    <td>[9t]</td>
    <td><a href="#grammar-production-verb">verb</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-predicate">predicate</a> | '<code class="grammar-literal">a</code>'</td>
</tr>
<tr id="grammar-production-subject">
    <td>[10t*]</td>
    <td><a href="#grammar-production-subject">subject</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-BlankNode">BlankNode</a> | <a href="#grammar-production-collection">collection</a> | <a href="#grammar-production-VAR1">VAR1</a></td>
</tr>
<tr id="grammar-production-predicate">
    <td>[11t]</td>
    <td><a href="#grammar-production-predicate">predicate</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-iri">iri</a></td>
</tr>
<tr id="grammar-production-object">
    <td>[12t*]</td>
    <td><a href="#grammar-production-object">object</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-iri">iri</a> | <a href="#grammar-production-BlankNode">BlankNode</a> | <a href="#grammar-production-collection">collection</a> | <a href="#grammar-production-blankNodePropertyList">blankNodePropertyList</a> | <a href="#grammar-production-literal">literal</a> | <a href="#grammar-production-VAR1">VAR1</a></td>
</tr>
<tr id="grammar-production-literal">
    <td>[13t]</td>
    <td><a href="#grammar-production-literal">literal</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-RDFLiteral">RDFLiteral</a> | <a href="#grammar-production-NumericLiteral">NumericLiteral</a> | <a href="#grammar-production-BooleanLiteral">BooleanLiteral</a></td>
</tr>
<tr id="grammar-production-blankNodePropertyList">
    <td>[14t]</td>
    <td><a href="#grammar-production-blankNodePropertyList">blankNodePropertyList</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">[</code>' <a href="#grammar-production-predicateObjectList">predicateObjectList</a> '<code class="grammar-literal">]</code>'</td>
</tr>
<tr id="grammar-production-collection">
    <td>[15t]</td>
    <td><a href="#grammar-production-collection">collection</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">(</code>' <a href="#grammar-production-object">object</a>* '<code class="grammar-literal">)</code>'</td>
</tr>
<tr id="grammar-production-NumericLiteral">
    <td>[16t]</td>
    <td><a href="#grammar-production-NumericLiteral">NumericLiteral</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-INTEGER">INTEGER</a> | <a href="#grammar-production-DECIMAL">DECIMAL</a> | <a href="#grammar-production-DOUBLE">DOUBLE</a></td>
</tr>
<tr id="grammar-production-RDFLiteral">
    <td>[128s]</td>
    <td><a href="#grammar-production-RDFLiteral">RDFLiteral</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-String">String</a> (<a href="#grammar-production-LANGTAG">LANGTAG</a> | '<code class="grammar-literal">^^</code>' <a href="#grammar-production-iri">iri</a>)?</td>
</tr>
<tr id="grammar-production-BooleanLiteral">
    <td>[133s]</td>
    <td><a href="#grammar-production-BooleanLiteral">BooleanLiteral</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">true</code>' | '<code class="grammar-literal">false</code>'</td>
</tr>
<tr id="grammar-production-String">
    <td>[17]</td>
    <td><a href="#grammar-production-String">String</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a> | <a href="#grammar-production-STRING_LITERAL_SINGLE_QUOTE">STRING_LITERAL_SINGLE_QUOTE</a> | <a href="#grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE">STRING_LITERAL_LONG_SINGLE_QUOTE</a> | <a href="#grammar-production-STRING_LITERAL_LONG_QUOTE">STRING_LITERAL_LONG_QUOTE</a></td>
</tr>
<tr id="grammar-production-iri">
    <td>[135s]</td>
    <td><a href="#grammar-production-iri">iri</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-IRIREF">IRIREF</a> | <a href="#grammar-production-PrefixedName">PrefixedName</a></td>
</tr>
<tr id="grammar-production-PrefixedName">
    <td>[136s]</td>
    <td><a href="#grammar-production-PrefixedName">PrefixedName</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PNAME_LN">PNAME_LN</a> | <a href="#grammar-production-PNAME_NS">PNAME_NS</a></td>
</tr>
<tr id="grammar-production-BlankNode">
    <td>[137s]</td>
    <td><a href="#grammar-production-BlankNode">BlankNode</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-BLANK_NODE_LABEL">BLANK_NODE_LABEL</a> | <a href="#grammar-production-ANON">ANON</a></td>
</tr>
<tr id="grammar-production-IRIREF">
    <td>[18]</td>
    <td><a href="#grammar-production-IRIREF">IRIREF</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal"><</code>' ([^#x00-#x20<>"{}|^`\] | <a href="#grammar-production-UCHAR">UCHAR</a>)* '<code class="grammar-literal">></code>' /* #x00=NULL #01-#x1F=control codes #x20=space */</td>
</tr>
<tr id="grammar-production-PNAME_NS">
    <td>[139s]</td>
    <td><a href="#grammar-production-PNAME_NS">PNAME_NS</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PN_PREFIX">PN_PREFIX</a>? '<code class="grammar-literal">:</code>'</td>
</tr>
<tr id="grammar-production-PNAME_LN">
    <td>[140s]</td>
    <td><a href="#grammar-production-PNAME_LN">PNAME_LN</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PNAME_NS">PNAME_NS</a> <a href="#grammar-production-PN_LOCAL">PN_LOCAL</a></td>
</tr>
<tr id="grammar-production-BLANK_NODE_LABEL">
    <td>[141s]</td>
    <td><a href="#grammar-production-BLANK_NODE_LABEL">BLANK_NODE_LABEL</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">_:</code>' (<a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> | [0-9]) ((<a href="#grammar-production-PN_CHARS">PN_CHARS</a> | '<code class="grammar-literal">.</code>')* <a href="#grammar-production-PN_CHARS">PN_CHARS</a>)?</td>
</tr>
<tr id="grammar-production-LANGTAG">
    <td>[144s]</td>
    <td><a href="#grammar-production-LANGTAG">LANGTAG</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">@</code>' [a-zA-Z]+ ('<code class="grammar-literal">-</code>' [a-zA-Z0-9]+)*</td>
</tr>
<tr id="grammar-production-INTEGER">
    <td>[19]</td>
    <td><a href="#grammar-production-INTEGER">INTEGER</a></td>
    <td>::=</td>
    <td>[+-]? [0-9]+</td>
</tr>
<tr id="grammar-production-DECIMAL">
    <td>[20]</td>
    <td><a href="#grammar-production-DECIMAL">DECIMAL</a></td>
    <td>::=</td>
    <td>[+-]? [0-9]* '<code class="grammar-literal">.</code>' [0-9]+</td>
</tr>
<tr id="grammar-production-DOUBLE">
    <td>[21]</td>
    <td><a href="#grammar-production-DOUBLE">DOUBLE</a></td>
    <td>::=</td>
    <td>[+-]? ([0-9]+ '<code class="grammar-literal">.</code>' [0-9]* <a href="#grammar-production-EXPONENT">EXPONENT</a> | '<code class="grammar-literal">.</code>' [0-9]+ <a href="#grammar-production-EXPONENT">EXPONENT</a> | [0-9]+ <a href="#grammar-production-EXPONENT">EXPONENT</a>)</td>
</tr>
<tr id="grammar-production-EXPONENT">
    <td>[154s]</td>
    <td><a href="#grammar-production-EXPONENT">EXPONENT</a></td>
    <td>::=</td>
    <td>[eE] [+-]? [0-9]+</td>
</tr>
<tr id="grammar-production-STRING_LITERAL_QUOTE">
    <td>[22]</td>
    <td><a href="#grammar-production-STRING_LITERAL_QUOTE">STRING_LITERAL_QUOTE</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">"</code>' ([^#x22#x5C#xA#xD] | <a href="#grammar-production-ECHAR">ECHAR</a> | <a href="#grammar-production-UCHAR">UCHAR</a>)* '<code class="grammar-literal">"</code>'      /* #x22=" #x5C=\ #xA=new line #xD=carriage return */</td>
</tr>
<tr id="grammar-production-STRING_LITERAL_SINGLE_QUOTE">
    <td>[23]</td>
    <td><a href="#grammar-production-STRING_LITERAL_SINGLE_QUOTE">STRING_LITERAL_SINGLE_QUOTE</a></td>
    <td>::=</td>
    <td>"<code class="grammar-literal">'</code>" ([^#x27#x5C#xA#xD] | <a href="#grammar-production-ECHAR">ECHAR</a> | <a href="#grammar-production-UCHAR">UCHAR</a>)* "<code class="grammar-literal">'</code>"      /* #x27=' #x5C=\ #xA=new line #xD=carriage return */</td>
</tr>
<tr id="grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE">
    <td>[24]</td>
    <td><a href="#grammar-production-STRING_LITERAL_LONG_SINGLE_QUOTE">STRING_LITERAL_LONG_SINGLE_QUOTE</a></td>
    <td>::=</td>
    <td>"<code class="grammar-literal">'''</code>" (("<code class="grammar-literal">'</code>" | "<code class="grammar-literal">''</code>")? ([^'\] | <a href="#grammar-production-ECHAR">ECHAR</a> | <a href="#grammar-production-UCHAR">UCHAR</a>))* "<code class="grammar-literal">'''</code>"</td>
</tr>
<tr id="grammar-production-STRING_LITERAL_LONG_QUOTE">
    <td>[25]</td>
    <td><a href="#grammar-production-STRING_LITERAL_LONG_QUOTE">STRING_LITERAL_LONG_QUOTE</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">"""</code>' (('<code class="grammar-literal">"</code>' | '<code class="grammar-literal">""</code>')? ([^"\] | <a href="#grammar-production-ECHAR">ECHAR</a> | <a href="#grammar-production-UCHAR">UCHAR</a>))* '<code class="grammar-literal">"""</code>'</td>
</tr>
<tr id="grammar-production-UCHAR">
    <td>[26]</td>
    <td><a href="#grammar-production-UCHAR">UCHAR</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">\\u</code>' <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> | '<code class="grammar-literal">\\U</code>' <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a></td>
</tr>
<tr id="grammar-production-ECHAR">
    <td>[159s]</td>
    <td><a href="#grammar-production-ECHAR">ECHAR</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">\</code>' [tbnrf"'\]</td>
</tr>
<tr id="grammar-production-WS">
    <td>[161s]</td>
    <td><a href="#grammar-production-WS">WS</a></td>
    <td>::=</td>
    <td>#x20 | #x9 | #xD | #xA</td>
</tr>
<tr id="grammar-production-ANON">
    <td>[162s]</td>
    <td><a href="#grammar-production-ANON">ANON</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">[</code>' <a href="#grammar-production-WS">WS</a>* '<code class="grammar-literal">]</code>'</td>
</tr>
<tr id="grammar-production-PN_CHARS_BASE">
    <td>[163s]</td>
    <td><a href="#grammar-production-PN_CHARS_BASE">PN_CHARS_BASE</a></td>
    <td>::=</td>
    <td>[A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6] | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]</td>
</tr>
<tr id="grammar-production-PN_CHARS_U">
    <td>[164s]</td>
    <td><a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PN_CHARS_BASE">PN_CHARS_BASE</a> | '<code class="grammar-literal">_</code>'</td>
</tr>
<tr id="grammar-production-PN_CHARS">
    <td>[166s]</td>
    <td><a href="#grammar-production-PN_CHARS">PN_CHARS</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> | '<code class="grammar-literal">-</code>' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]</td>
</tr>
<tr id="grammar-production-PN_PREFIX">
    <td>[167s]</td>
    <td><a href="#grammar-production-PN_PREFIX">PN_PREFIX</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PN_CHARS_BASE">PN_CHARS_BASE</a> ((<a href="#grammar-production-PN_CHARS">PN_CHARS</a> | '<code class="grammar-literal">.</code>')* <a href="#grammar-production-PN_CHARS">PN_CHARS</a>)?</td>
</tr>
<tr id="grammar-production-PN_LOCAL">
    <td>[168s]</td>
    <td><a href="#grammar-production-PN_LOCAL">PN_LOCAL</a></td>
    <td>::=</td>
    <td>(<a href="#grammar-production-PN_CHARS_U">PN_CHARS_U</a> | '<code class="grammar-literal">:</code>' | [0-9] | <a href="#grammar-production-PLX">PLX</a>) ((<a href="#grammar-production-PN_CHARS">PN_CHARS</a> | '<code class="grammar-literal">.</code>' | '<code class="grammar-literal">:</code>' | <a href="#grammar-production-PLX">PLX</a>)* (<a href="#grammar-production-PN_CHARS">PN_CHARS</a> | '<code class="grammar-literal">:</code>' | <a href="#grammar-production-PLX">PLX</a>))?</td>
</tr>
<tr id="grammar-production-PLX">
    <td>[169s]</td>
    <td><a href="#grammar-production-PLX">PLX</a></td>
    <td>::=</td>
    <td><a href="#grammar-production-PERCENT">PERCENT</a> | <a href="#grammar-production-PN_LOCAL_ESC">PN_LOCAL_ESC</a></td>
</tr>
<tr id="grammar-production-PERCENT">
    <td>[170s]</td>
    <td><a href="#grammar-production-PERCENT">PERCENT</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">%</code>' <a href="#grammar-production-HEX">HEX</a> <a href="#grammar-production-HEX">HEX</a></td>
</tr>
<tr id="grammar-production-HEX">
    <td>[171s]</td>
    <td><a href="#grammar-production-HEX">HEX</a></td>
    <td>::=</td>
    <td>[0-9] | [A-F] | [a-f]</td>
</tr>
<tr id="grammar-production-PN_LOCAL_ESC">
    <td>[172s]</td>
    <td><a href="#grammar-production-PN_LOCAL_ESC">PN_LOCAL_ESC</a></td>
    <td>::=</td>
    <td>'<code class="grammar-literal">\</code>' ('<code class="grammar-literal">_</code>' | '<code class="grammar-literal">~</code>' | '<code class="grammar-literal">.</code>' | '<code class="grammar-literal">-</code>' | '<code class="grammar-literal">!</code>' | '<code class="grammar-literal">$</code>' | '<code class="grammar-literal">&</code>' | "<code class="grammar-literal">'</code>" | '<code class="grammar-literal">(</code>' | '<code class="grammar-literal">)</code>' | '<code class="grammar-literal">*</code>' | '<code class="grammar-literal">+</code>' | '<code class="grammar-literal">,</code>' | '<code class="grammar-literal">;</code>' | '<code class="grammar-literal">=</code>' | '<code class="grammar-literal">/</code>' | '<code class="grammar-literal">?</code>' | '<code class="grammar-literal">#</code>' | '<code class="grammar-literal">@</code>' | '<code class="grammar-literal">%</code>')</td>
</tr>
  </tbody>
</table>


    </section>




    <section class="appendix informative" id="updatelist-algo">
      <h2>UpdateList Algorithm</h2>

      <p>
          Below is an algorithm explaining how <code>UpdateList s p i<sub>min</sub>..i<sub>max</sub> collection</code> can be processed in the presence of a reified <code>rdf:List</code>, i.e. encoded with <code>rdf:first</code> and <code>rdf:rest</code>. Implementers may take advantage of a more native encoding for <code>rdf:List</code>.
      </p>
      <ul>
          <li>
              <b class="algo">Let</b> <var>s<sub>pre</sub></var> be <var>s</var>, <var>p<sub>pre</sub></var> be <var>p</var> and <var>o<sub>pre</sub></var> the object of the triple (<var>s</var>, <var>p</var>, ?) from the <a>target graph</a>.
          </li>
          <li>
              <b class="algo">Repeat</b> <var>i<sub>min</sub></var> times:
              <ul>
                  <li>
                      <b class="algo">Set</b> <var>s<sub>pre</sub></var> to <var>o<sub>pre</sub></var>, <var>p<sub>pre</sub></var> to <code>rdf:rest</code> and <var>o<sub>pre</sub></var> to the object of the triple (<var>o<sub>pre</sub></var>, <code>rdf:rest</code>, ?) from the <a>target graph</a>.
                  </li>
              </ul>
          </li>
          <li>
              <b class="algo">Let</b> <var>s<sub>post</sub></var> be <var>s<sub>pre</sub></var>, <var>p<sub>post</sub></var> be <var>p<sub>pre</sub></var> and <var>o<sub>post</sub></var> be <var>o<sub>pre</sub></var>.
          </li>
          <li>
              <b class="algo">Repeat</b> (<var>i<sub>max</sub></var>-<var>i<sub>min</sub></var>) times:
              <ul>
                  <li>
                      Remove from the <a>target graph</a> the arcs (<var>s<sub>post</sub></var>, <var>p<sub>post</sub></var>, <var>o<sub>post</sub></var>).
                  </li>
                  <li>
                      <b class="algo">Let</b> <var>elt</var> be the object of the triple (<var>o<sub>post</sub></var>, <code>rdf:first</code>, ?). Remove from the <a>target graph</a> the arc (<var>o<sub>post</sub></var>, <code>rdf:first</code>, <var>elt</var>). <b class="algo">If</b> <var>elt</var> is a blank node, <b class="algo">Then</b> apply the <a>Cut</a> operation on <var>elt</var>.
                  </li>
                  <li>
                      <b class="algo">Set</b> <var>s<sub>post</sub></var> to <var>o<sub>post</sub></var>, <var>p<sub>post</sub></var> to <code>rdf:rest</code> and <var>o<sub>post</sub></var> to the object of the triple (<var>o<sub>post</sub></var>, <code>rdf:rest</code>, ?) from the <a>target graph</a>.
                  </li>
              </ul>
          </li>
          <li>
              Remove from the <a>target graph</a> the arcs (<var>s<sub>pre</sub></var>, <var>p<sub>pre</sub></var>, <var>o<sub>pre</sub></var>) and (<var>s<sub>post</sub></var>, <var>p<sub>post</sub></var>, <var>o<sub>post</sub></var>). (NB: in some situations, they may be the same arc, or have already been removed by a previous step)
          </li>
          <li>
              <b class="algo">If</b> <var>col</var> is the empty collection
              <ul>
                  <li>
                      <b class="algo">Then</b>
                      <ul>
                          <li>
                              Add in the <a>target graph</a> the arc (<var>s<sub>pre</sub></var>, <var>p<sub>pre</sub></var>, <var>o<sub>post</sub></var>).
                          </li>
                      </ul>
                  </li>
                  <li>
                      <b class="algo">Else</b>
                      <ul>
                          <li>
                              Add all the arcs resulting from the parsing of <var>col</var> to the target graph, let <var>fst</var> be the first node of the corresponding new collection, and <var>lst</var> the last node of that collection (excluding <code>rdf:nil</code>).
                          </li>
                          <li>
                              Remove from the <a>target graph</a> the arc (<var>lst</var>, <code>rdf:rest</code>, <code>rdf:nil</code>).
                          </li>
                          <li>
                              Add in the <a>target graph</a> the arcs (<var>s<sub>pre</sub></var>, <var>p<sub>pre</sub></var>, <var>fst</var>) and (<var>lst</var>, <code>rdf:rest</code>, <var>o<sub>post</sub></var>).
                          </li>
                      </ul>
                  </li>
              </ul>
          </li>
      </ul>

      <p>
          Here is an illustration of the previous algorithm.
      </p>
      <p>
          Consider the graph represented in <a href="#fig-graph-containing-a-collection"></a>. The result of applying the operation <code>UpdateList :s :p 2..4 ("foo" "bar" "baz") .</code> on the collection in that graph can be seen in <a href="#fig-updatelist-result"></a>.
      </p>

      <figure id="fig-graph-containing-a-collection">
          <img src="fig-alt-update-list.svg" alt="( &quote;lorem&quote; &quote;ipsum&quote; &quote;dolor&quote; &quote;sit&quote; &quote;amet&quote; ) ( &quote;foo&quote; &quote;bar&quote; &quote;baz&quote; )">
          <figcaption>Graph with a collection</figcaption>
      </figure>

      <figure id="fig-updatelist-result">
          <img src="fig-alt-update-list-2.svg" alt="( &quote;lorem&quote; &quote;ipsum&quote; &quote;dolor&quote; &quote;sit&quote; &quote;amet&quote; ) ( &quote;foo&quote; &quote;bar&quote; &quote;baz&quote; )">
          <figcaption>Applying <code>UpdateList</code></figcaption>
      </figure>

    </section>





    <section class="appendix" id="media-registration">
      <h2>Internet Media Type, File Extension and Macintosh File Type</h2>

	    <dl>
        <dt>Contact:</dt>
        <dd>Andrei Vlad Sambra</dd>
        <dt>see also:</dt>
        <dd><a href="http://www.w3.org/2002/06/registering-mediatype">How to Register a Media Type for a <abbr title="World Wide Web Consortium">W3C</abbr> Specification</a></dd>
        <dd><a href="http://www.w3.org/2001/tag/2002/0129-mime">Internet Media Type registration, consistency of use</a><br>
            TAG Finding 3 June 2002 (Revised 4 September 2002)</dd>
      </dl>
      <p>The Internet Media Type / MIME Type for LD Patch is "text/ldpatch".</p>
      <div class="ldp-issue">
        Pending discussion/registration with IETF.
      </div>

      <p>It is recommended that LD Patch files have the extension ".ldp" (all lowercase) on all platforms.</p>
      <div class="ldp-issue">
        Possible namespace conflict for .ldp!
      </div>

      <p>It is recommended that LD Patch files stored on Macintosh HFS file systems be given a file type of "TEXT".</p>


      <dl>
        <dt>Type name:</dt>
          <dd>text</dd>
        <dt>Subtype name:</dt>
          <dd>ldpatch</dd>
        <dt>Required parameters:</dt>
          <dd>None</dd>
        <dt>Optional parameters:</dt>
          <dd>charset — this parameter is required when transferring non-ASCII data. If present, the value of charset is always UTF-8 [[!UTF-8]].</dd>
        <dt>Encoding considerations:</dt>
          <dd>The syntax of LD Patch is expressed over code points in Unicode [[!UNICODE]]. The encoding is always UTF-8. Unicode code points may also be expressed using an <code>\uXXXX</code> (U+0000 to U+FFFF) or <code>\UXXXXXXXX</code> syntax (for U+10000 onwards) where <code>X</code> is a hexadecimal digit <code>[0-9A-Fa-f]</code>.</dd>
        <dt>Security considerations:</dt>
          <dd>Because of it's relation with Turtle, the same security considerations can be applied here. Applications may evaluate given data to infer more assertions or to dereference IRIs, invoking the security considerations of the scheme for that IRI. Note in particular, the privacy issues in [[!RFC3023]] section 10 for HTTP IRIs. Data obtained from an inaccurate or malicious data source may lead to inaccurate or misleading conclusions, as well as the dereferencing of unintended IRIs. Care must be taken to align the trust in consulted resources with the sensitivity of the intended use of the data; inferences of potential medical treatments would likely require different trust than inferences for trip planning.
            <!-- Turtle is used to express arbitrary application data; security considerations will vary by domain of use. Security tools and protocols applicable to text (e.g. PGP encryption, MD5 sum validation, password-protected compression) may also be used on Turtle documents. Security/privacy protocols must be imposed which reflect the sensitivity of the embedded information. -->
            Application rendering strings retrieved from untrusted LD Patch sources must ensure that malignant strings may not be used to mislead the reader. The security considerations in the media type registration for XML ([[!RFC3023]] section 10) provide additional guidance around the expression of arbitrary data and markup.
            LD Patch uses IRIs as term identifiers. Applications interpreting data expressed in LD Patch should address the security issues of Internationalized Resource Identifiers (IRIs) [[!RFC3987]] Section 8, as well as Uniform Resource Identifier (URI): Generic Syntax [[!RFC3986]] Section 7.
            Multiple IRIs may have the same appearance. Characters in different scripts may look similar (a Cyrillic "о" may appear similar to a Latin "o"). A character followed by combining characters may have the same visual representation as another character (LATIN SMALL LETTER E followed by COMBINING ACUTE ACCENT has the same visual representation as LATIN SMALL LETTER E WITH ACUTE). Any person or application that is writing or interpreting LD Patch data must take care to use the IRI that matches the intended semantics, and avoid IRIs that may look similar. Further information about matching of similar characters can be found in Unicode Security Considerations [[!UNICODE-SECURITY]] and Internationalized Resource Identifiers (IRIs) [[!RFC3987]] Section 8.</dd>
        <dt>Interoperability considerations:</dt>
          <dd>There are no known interoperability issues.</dd>
        <dt>Published specification:</dt>
          <dd>This specification.</dd>
        <dt>Applications which use this media type:</dt>
          <dd>No widely deployed applications are known to use this media type. It may be used by some web services and clients consuming their data.</dd>
      </dl>
      <strong>Additional information:</strong>
      <dl>
        <dt>Magic number(s):</dt>
          <dd>LD Patch documents may have the string '@prefix' (case sensitive) near the beginning of the document.</dd>
        <dt>File extension(s):</dt>
          <dd>".ldp"</dd>
        <dt>Macintosh file type code(s):</dt>
          <dd>"TEXT"</dd>
        <dt>Person & email address to contact for further information:</dt>
          <dd>Andrei Vlad Sambra &lt;andrei@w3.org&gt;</dd>
        <dt>Intended usage:</dt>
          <dd>COMMON</dd>
        <dt>Restrictions on usage:</dt>
          <dd>None</dd>
        <dt>Author/Change controller:</dt>
          <dd>The LD Patch specification is the product of the LDP WG. The W3C reserves change control over this specifications.</dd>
      </dl>
    </section>

    <section id="acknowledgements" class="appendix informative">
      <h2>Acknowledgements</h2>

      <p>The following people (in alphabetic order) have been instrumental in providing thoughts, feedback, reviews, content, criticism and input in the creation of this specification:</p>

      <p style="margin-left: 3em;">Andy Seaborne, Arnaud Le Hors, Ashok Malhotra, Eric Prud'hommeaux, Henry Story, John Arwe, Sandro Hawke, Steve Speicher, Tim Berners-Lee</p>

    </section>

    <section id="changelog" class="appendix informative">
        <h2>Change Log</h2>
        <section>
            <h3>Changes since <a href="http://www.w3.org/TR/2015/CR-ldpatch-20150303/">March 2015 Candidate Recommendation</a></h3>
            <ul>
                <li>Closed <a href="http://www.w3.org/2012/ldp/track/actions/156">ACTION-156</a> by changing reference to "bcp47, as used by turtle”, based on <a href="https://www.w3.org/International/track/issues/410">i18n-issue-410</a>.</li>
                <li>Fixed example</li>
                <li>Fixed typo resolution re: <a href="http://www.w3.org/2012/ldp/track/issues/102">ISSUE-102</a></li>
                <li>Added Conformance section</li>
            </ul>
        </section>
        <section>
            <h3>Changes since <a href="http://www.w3.org/TR/2014/WD-ldpatch-20140918/">September 2014 First Public Working Draft</a></h3>
            <ul>
                <li>Negative indexes in Path and Slice (<a href="http://www.w3.org/2012/ldp/track/issues/102">ISSUE-102</a> and <a href="http://www.w3.org/2012/ldp/track/issues/104">ISSUE-104</a>)</li>
                <li>New section comparing LD Patch with Turtle and SPARQL 1.1</li>
                <li>Add and Delete now takes Turtle as argument (<a href="http://www.w3.org/2012/ldp/track/issues/101">ISSUE-101</a>)</li>
                <li>New operations AddNew and DeleteExisting (<a href="http://www.w3.org/2012/ldp/track/issues/103">ISSUE-103</a>)</li>
                <li>The leading slash for Path expression is required (<a href="http://www.w3.org/2012/ldp/track/issues/100">ISSUE-100</a>)</li>
                <li>New dedicated Example section</li>
                <li>New section for Media Type registration</li>
                <li>New section about Error Handling, with specific behaviours</li>
                <li>Improvements and fixes in the grammar</li>
                <li>Removed the abstract model section, leading to a lighter operational semantics</li>
            </ul>

        </section>
    </section>

  </body>
</html>