ldpatch-20150728.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 style="" lang="en" dir="ltr" typeof="bibo:Document " prefix="bibo: http://purl.org/ontology/bibo/ w3p: http://www.w3.org/2001/02pd/rec54#"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta lang="" property="dc:language" content="en">
    <title>Linked Data Patch Format</title>
    <meta charset="utf-8">


    <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>
  <style type="text/css"></style><style>/*****************************************************************
 * ReSpec 3 CSS
 * Robin Berjon - http://berjon.com/
 *****************************************************************/

/* --- INLINES --- */
em.rfc2119 {
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  1px dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

cite .bibref {
    font-style: normal;
}

code {
    color:  #C83500;
}

/* --- TOC --- */
.toc a, .tof a {
    text-decoration:    none;
}

a .secno, a .figno {
    color:  #000;
}

ul.tof, ol.tof {
    list-style: none outside none;
}

.caption {
    margin-top: 0.5em;
    font-style:   italic;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}

@media print {
    .removeOnSave {
        display: none;
    }
}
</style><style>/* --- EXAMPLES --- */
div.example-title {
    min-width: 7.5em;
    color: #b9ab2d;
}
div.example-title span {
    text-transform: uppercase;
}
aside.example, div.example, div.illegal-example {
    padding: 0.5em;
    margin: 1em 0;
    position: relative;
    clear: both;
}
div.illegal-example { color: red }
div.illegal-example p { color: black }
aside.example, div.example {
    padding: .5em;
    border-left-width: .5em;
    border-left-style: solid;
    border-color: #e0cb52;
    background: #fcfaee;
}

aside.example div.example {
    border-left-width: .1em;
    border-color: #999;
    background: #fff;
}
aside.example div.example div.example-title {
    color: #999;
}
</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-WG-NOTE"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
  <body class="h-entry" data-feedly-mini="yes" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader">
  <p>


            <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a>


  </p>
  <h1 class="title p-name" id="title" property="dcterms:title">Linked Data Patch Format</h1>

  <h2 id="w3c-working-group-note-24-july-2015"><abbr title="World Wide Web Consortium">W3C</abbr> Working Group Note <time property="dcterms:issued" class="dt-published" datetime="2015-07-28">28 July 2015</time></h2>
  <dl>

      <dt>This version:</dt>
      <dd><a class="u-url" href="http://www.w3.org/TR/2015/NOTE-ldpatch-20150728/">http://www.w3.org/TR/2015/NOTE-ldpatch-20150728/</a></dd>
      <dt>Latest published version:</dt>
      <dd><a href="http://www.w3.org/TR/ldpatch/">http://www.w3.org/TR/ldpatch/</a></dd>

      <dt>Latest editor's draft:</dt>
      <dd><a href="https://dvcs.w3.org/hg/ldpwg/raw-file/ldpatch/ldpatch.html">https://dvcs.w3.org/hg/ldpwg/raw-file/ldpatch/ldpatch.html</a></dd>


      <dt>Test suite:</dt>
      <dd><a href="https://github.com/pchampin/ld-patch-testsuite">https://github.com/pchampin/ld-patch-testsuite</a></dd>


      <dt>Implementation report:</dt>
      <dd><a href="https://dvcs.w3.org/hg/ldpwg/raw-file/tip/tests/ldpatch/reports/ldpatch.html">https://dvcs.w3.org/hg/ldpwg/raw-file/tip/tests/ldpatch/reports/ldpatch.html</a></dd>


      <dt>Previous version:</dt>
      <dd><a rel="dcterms:replaces" href="http://www.w3.org/TR/2015/CR-ldpatch-20150303/">http://www.w3.org/TR/2015/CR-ldpatch-20150303/</a></dd>


    <dt>Editors:</dt>
    <dd class="p-author h-card vcard" property="bibo:editor" resource="_:editor0"><span property="rdf:first" typeof="foaf:Person"><meta property="foaf:name" content="Alexandre Bertails"><a class="u-url url p-name fn" property="foaf:homepage" href="http://bertails.org/">Alexandre Bertails</a>, <span class="ed_mailto"><a class="u-email email" property="foaf:mbox" href="mailto:alexandre@bertails.org">alexandre@bertails.org</a></span></span>
<span property="rdf:rest" resource="_:editor1"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor1"><span property="rdf:first" typeof="foaf:Person"><meta property="foaf:name" content="Pierre-Antoine Champin"><a class="u-url url p-name fn" property="foaf:homepage" href="http://liris.cnrs.fr/~pchampin/en/">Pierre-Antoine Champin</a>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.universite-lyon.fr/">Université de Lyon</a>, <span class="ed_mailto"><a class="u-email email" property="foaf:mbox" href="mailto:pchampin@liris.cnrs.fr">pchampin@liris.cnrs.fr</a></span></span>
<span property="rdf:rest" resource="_:editor2"></span>
</dd>
<dd class="p-author h-card vcard" resource="_:editor2"><span property="rdf:first" typeof="foaf:Person"><meta property="foaf:name" content="Andrei Sambra"><a class="u-url url p-name fn" property="foaf:homepage" href="https://deiu.me/profile#me">Andrei Sambra</a>, <a property="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.w3.org/"><abbr title="Massachusetts Institute of Technology">MIT</abbr>/<abbr title="World Wide Web Consortium">W3C</abbr></a>, <span class="ed_mailto"><a class="u-email email" property="foaf:mbox" href="mailto:andrei@w3.org">andrei@w3.org</a></span></span>
<span property="rdf:rest" resource="rdf:nil"></span>
</dd>



  </dl>

      <p class="copyright">
        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
        2015

        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
        <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>).

        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and

          <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>

        rules apply.
      </p>


  <hr>
</div>
    <section id="abstract" class="introductory" property="dc:abstract"><h2 id="h-abstract" resource="#h-abstract"><span property="xhv:role" resource="xhv:heading">Abstract</span></h2>
      <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" class="introductory"><h2 id="h-sotd" resource="#h-sotd"><span property="xhv:role" resource="xhv:heading">Status of This Document</span></h2>



        <p>
          <em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at http://www.w3.org/TR/.</em>
        </p>



      <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> [<cite><a class="bibref" href="#bib-LDP">LDP</a></cite>] 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> — already standardized, but quite complex for LDP scenarios</li>
      	<li><a href="http://www.w3.org/2001/sw/wiki/SparqlPatch">SparqlPatch</a> — restricted to a simple subset of SPARQL 1.1 Update</li>
      	<li><a href="http://www.w3.org/2001/sw/wiki/TurtlePatch">TurtlePatch</a> — 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> — 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 <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation track and publish it as a <abbr title="World Wide Web Consortium">W3C</abbr> Note for future reference. This document may be reused in part or in whole by another WG in the future, or not.
      </p>



        <p>
          This document was published by the <a href="http://www.w3.org/2012/ldp/">Linked Data Platform Working Group</a> as a Working Group Note.


            If you wish to make comments regarding this document, please send them to
            <a href="mailto:public-ldp-comments@w3.org">public-ldp-comments@w3.org</a>
            (<a href="mailto:public-ldp-comments-request@w3.org?subject=subscribe">subscribe</a>,
            <a href="http://lists.w3.org/Archives/Public/public-ldp-comments/">archives</a>).
            All comments are welcome.


        </p>



          <p>
            Publication as a Working Group Note does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr>
            Membership. This is a draft document and may be updated, replaced or obsoleted by other
            documents at any time. It is inappropriate to cite this document as other than work in
            progress.
          </p>



        <p>

            This document was produced by a group operating under the
            <a id="sotd_patent" property="w3p:patentRules" href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent
            Policy</a>.

              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/55082/status" rel="disclosure">public list of any patent
              disclosures</a>

            made in connection with the deliverables of the group; that page also includes
            instructions for disclosing a patent. An individual who has actual knowledge of a patent
            which the individual believes contains
            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
            Claim(s)</a> must disclose the information in accordance with
            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
        </p>

          <p>This document is governed by the <a id="w3c_process_revision" href="http://www.w3.org/2014/Process-20140801/">1 August 2014 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>.
          </p>

</section>


<section id="toc"><h2 class="introductory" id="h-toc" resource="#h-toc"><span property="xhv:role" resource="xhv:heading">Table of Contents</span></h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">2. </span>Examples</a><ul class="toc"><li class="tocline"><a href="#full-example" class="tocxref"><span class="secno">2.1 </span>Full example</a></li><li class="tocline"><a href="#list-manipulation-examples" class="tocxref"><span class="secno">2.2 </span><code>rdf:List</code> manipulation examples</a></li></ul></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">3. </span>Conformance</a></li><li class="tocline"><a href="#semantics" class="tocxref"><span class="secno">4. </span>LD Patch Semantics</a><ul class="toc"><li class="tocline"><a href="#nodes-and-triples-semantics" class="tocxref"><span class="secno">4.1 </span><span data-dfn-type="dfn">Nodes and triples Semantics</span></a></li><li class="tocline"><a href="#path-expression" class="tocxref"><span class="secno">4.2 </span><span data-dfn-type="dfn">Path Expression</span></a></li><li class="tocline"><a href="#patch-operations" class="tocxref"><span class="secno">4.3 </span>Patch Operations</a><ul class="toc"><li class="tocline"><a href="#Bind-statement" class="tocxref"><span class="secno">4.3.1 </span><span data-dfn-type="dfn">Bind</span></a></li><li class="tocline"><a href="#Add-statement" class="tocxref"><span class="secno">4.3.2 </span><span data-dfn-type="dfn">Add</span></a></li><li class="tocline"><a href="#AddNew-statement" class="tocxref"><span class="secno">4.3.3 </span><span data-dfn-type="dfn">AddNew</span></a></li><li class="tocline"><a href="#Delete-statement" class="tocxref"><span class="secno">4.3.4 </span><span data-dfn-type="dfn">Delete</span></a></li><li class="tocline"><a href="#DeleteExisting-statement" class="tocxref"><span class="secno">4.3.5 </span><span data-dfn-type="dfn">DeleteExisting</span></a></li><li class="tocline"><a href="#Cut-statement" class="tocxref"><span class="secno">4.3.6 </span><span data-dfn-type="dfn">Cut</span></a></li><li class="tocline"><a href="#UpdateList-statement" class="tocxref"><span class="secno">4.3.7 </span><span data-dfn-type="dfn">UpdateList</span></a></li><li class="tocline"><a href="#error-handling" class="tocxref"><span class="secno">4.3.8 </span><span data-dfn-type="dfn">Error Handling</span></a></li><li class="tocline"><a href="#pathological-graph" class="tocxref"><span class="secno">4.3.9 </span><span data-dfn-type="dfn">Pathological Graph</span></a></li></ul></li></ul></li><li class="tocline"><a href="#turtle-sparql-comparison" class="tocxref"><span class="secno">5. </span>LD Patch compared to Turtle and SPARQL</a></li><li class="tocline"><a href="#concrete-syntax" class="tocxref"><span class="secno">6. </span>Concrete Syntax</a></li><li class="tocline"><a href="#updatelist-algo" class="tocxref"><span class="secno">A. </span>UpdateList Algorithm</a></li><li class="tocline"><a href="#media-registration" class="tocxref"><span class="secno">B. </span>Internet Media Type, File Extension and Macintosh File Type</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">C. </span>Acknowledgements</a></li><li class="tocline"><a href="#changelog" class="tocxref"><span class="secno">D. </span>Change Log</a><ul class="toc"><li class="tocline"><a href="#changes-since-march-2015-candidate-recommendation" class="tocxref"><span class="secno">D.1 </span>Changes since <span class="formerLink">March 2015 Candidate Recommendation</span></a></li><li class="tocline"><a href="#changes-since-september-2014-first-public-working-draft" class="tocxref"><span class="secno">D.2 </span>Changes since <span class="formerLink">September 2014 First Public Working Draft</span></a></li></ul></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">E. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">E.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">E.2 </span>Informative references</a></li></ul></li></ul></section>


    <section class="informative" id="introduction" typeof="bibo:Chapter" resource="#introduction" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-introduction" resource="#h-introduction"><span property="xhv:role" resource="xhv:heading"><span class="secno">1. </span>Introduction</span></h2><p><em>This section is non-normative.</em></p>
      <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> [<cite><a class="bibref" href="#bib-RFC5789">RFC5789</a></cite>], a method to perform partial modifications to Web resources.
      </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 [<cite><a class="bibref" href="#bib-rdf11-concepts">rdf11-concepts</a></cite>] 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> [<cite><a class="bibref" href="#bib-sparql11-update">sparql11-update</a></cite>].
      </p>

    </section>

    <section id="examples" class="informative" typeof="bibo:Chapter" resource="#examples" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-examples" resource="#h-examples"><span property="xhv:role" resource="xhv:heading"><span class="secno">2. </span>Examples</span></h2><p><em>This section is non-normative.</em></p>

      <section id="full-example" typeof="bibo:Chapter" resource="#full-example" property="bibo:hasPart">
          <h3 id="h-full-example" resource="#h-full-example"><span property="xhv:role" resource="xhv:heading"><span class="secno">2.1 </span>Full example</span></h3>

          <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>
          <div class="example"><div class="example-title"><span>Example 1</span></div><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></div>
          <p>
              The following is an example HTTP Patch request, conveying an LD Patch document:
          </p>
          <div class="example"><div class="example-title"><span>Example 2</span></div><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></div>
          <p>
              This example introduces most features of the LD Patch format: <code>@prefix</code> and prefixed names, the <a href="#dfn-add" class="internalDFN" data-link-type="dfn">Add</a>, <a href="#dfn-delete" class="internalDFN" data-link-type="dfn">Delete</a>, <a href="#dfn-cut" class="internalDFN" data-link-type="dfn">Cut</a>, and <a href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">UpdateList</a> operations, the node <a href="#dfn-bind" class="internalDFN" data-link-type="dfn">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>
          <div class="example"><div class="example-title"><span>Example 3</span></div><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></div>
      </section>

      <section id="list-manipulation-examples" typeof="bibo:Chapter" resource="#list-manipulation-examples" property="bibo:hasPart">
          <h3 id="h-list-manipulation-examples" resource="#h-list-manipulation-examples"><span property="xhv:role" resource="xhv:heading"><span class="secno">2.2 </span><code>rdf:List</code> manipulation examples</span></h3>

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

          <div class="example"><div class="example-title"><span>Example 4</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "dolor" "sit" "amet" ) .</pre></div>



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

          <div class="example"><div class="example-title"><span>Example 5</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 1..2 ( "fr" ) .</pre></div>

          <p>Output graph:</p>

          <div class="example"><div class="example-title"><span>Example 6</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "fr" "dolor" "sit" "amet" ) .</pre></div>


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

          <div class="example"><div class="example-title"><span>Example 7</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 2..2 ( "en" "fr" ) .</pre></div>

          <p>Output graph:</p>

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


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

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

          <div class="example"><div class="example-title"><span>Example 9</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; .. ( "en" "fr" ) .</pre></div>

          <p>Output graph:</p>

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


          <h3 id="replace-elements-after-index">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>

          <div class="example"><div class="example-title"><span>Example 11</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 2.. ( "en" "fr" ) .</pre></div>

          <p>Output graph:</p>

          <div class="example"><div class="example-title"><span>Example 12</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "en" "fr" ) .</pre></div>


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

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

          <p>Output graph:</p>

          <div class="example"><div class="example-title"><span>Example 14</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "ipsum" "en" "fr" ) .</pre></div>


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

          <div class="example"><div class="example-title"><span>Example 15</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 1..3 ( ) .</pre></div>

          <p>Output graph:</p>

          <div class="example"><div class="example-title"><span>Example 16</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( "lorem" "sit" "amet" ) .</pre></div>


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

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

          <div class="example"><div class="example-title"><span>Example 17</span></div><pre class="example">UpdateList &lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; 0.. ( ) .</pre></div>

          <p>Output graph:</p>

          <div class="example"><div class="example-title"><span>Example 18</span></div><pre class="example">&lt;#&gt; &lt;http://example.org/vocab#preferredLanguages&gt; ( ) .</pre></div>

      </section>

    </section>


    <section class="normative" id="conformance" typeof="bibo:Chapter" resource="#conformance" property="bibo:hasPart"><!--OddPage--><h2 id="h-conformance" resource="#h-conformance"><span property="xhv:role" resource="xhv:heading"><span class="secno">3. </span>Conformance</span></h2>
<p>
  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
  and notes in this specification are non-normative. Everything else in this specification is
  normative.
</p>
<p id="respecRFC2119">The key words <em class="rfc2119" title="MUST">MUST</em> and <em class="rfc2119" title="MUST NOT">MUST NOT</em> are
  to be interpreted as described in [<cite><a class="bibref" href="#bib-RFC2119">RFC2119</a></cite>].
</p>


      <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> [<cite><a class="bibref" href="#bib-BCP47">BCP47</a></cite>] (as used by <a href="http://www.w3.org/TR/turtle/">Turtle</a> [<cite><a class="bibref" href="#bib-Turtle">Turtle</a></cite>]) 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> [<cite><a class="bibref" href="#bib-LDP">LDP</a></cite>]. It <em class="rfc2119" title="MUST">MUST</em> 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" typeof="bibo:Chapter" resource="#semantics" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-semantics" resource="#h-semantics"><span property="xhv:role" resource="xhv:heading"><span class="secno">4. </span>LD Patch Semantics</span></h2>
      <p>
An LD Patch document is applied to a Linked Data resource identified by an IRI (the <dfn data-dfn-type="dfn" id="dfn-target-iri">target IRI</dfn>) and represented by an RDF graph (the <dfn data-dfn-type="dfn" id="dfn-target-graph">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>, or specifies a modification on the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
      </p>




      <section id="nodes-and-triples-semantics" typeof="bibo:Chapter" resource="#nodes-and-triples-semantics" property="bibo:hasPart">
        <h3 id="h-nodes-and-triples-semantics" resource="#h-nodes-and-triples-semantics"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.1 </span><dfn data-dfn-type="dfn" id="dfn-nodes-and-triples-semantics">Nodes and triples Semantics</dfn></span></h3>
        <p>
LD Patch borrows much of its syntax and semantics from <a href="http://www.w3.org/TR/turtle/">Turtle</a> [<cite><a class="bibref" href="#bib-Turtle">Turtle</a></cite>] 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 data-dfn-type="dfn" id="dfn-argument-graph">argument graph</dfn>.
        </p>
        <p>
There are however a few points that need to be highlighted in the way LD Patch parses an <a href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">argument graph</a> compared to Turtle:
        </p>
        <ul>
          <li>
            The base IRI used to resolve relative IRIs is the <a href="#dfn-target-iri" class="internalDFN" data-link-type="dfn">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 href="#dfn-bind" class="internalDFN" data-link-type="dfn">Bind</a> statements).
          </li>
          <li>
              <dfn id="blank-node-scoping" data-dfn-type="dfn">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" href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">argument graph</a> represent the same resource as in the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>. Therefore blank node identifiers in LD Patch cannot interfere with pre-existing blank nodes in the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
        </p>
        <p>
However, LD Patch provides mechanisms to address those pre-existing blank nodes: <a href="#dfn-bind" class="internalDFN" data-link-type="dfn">bind</a>ing a variable to a blank node reachable through a <a href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">path expression</a>, <a href="#dfn-cut" class="internalDFN" data-link-type="dfn">cut</a>ting a whole tree made of blank nodes, or using <a href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">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" typeof="bibo:Chapter" resource="#path-expression" property="bibo:hasPart">
        <h3 id="h-path-expression" resource="#h-path-expression"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.2 </span><dfn data-dfn-type="dfn" id="dfn-path-expression">Path Expression</dfn></span></h3>
        <p>
            A <a href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">Path expression</a> can be used to locate RDF nodes within the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>. A path expression consists of a series of one or more <a href="#dfn-step" class="internalDFN" data-link-type="dfn">Step</a>s (introduced by a "<code>/</code>") or <a href="#dfn-constraint" class="internalDFN" data-link-type="dfn">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 href="#dfn-step" class="internalDFN" data-link-type="dfn">Step</a>, and the result is a node set. A <a href="#dfn-constraint" class="internalDFN" data-link-type="dfn">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 href="#dfn-filter" class="internalDFN" data-link-type="dfn">Filter</a>, this implicit node set becomes the left operand for <code>/</code>.
        </p>
        <p>
            A <dfn data-dfn-type="dfn" id="dfn-step">Step</dfn> can be of three kinds:
        </p>
        <ul>
            <li>A <dfn data-dfn-type="dfn" id="dfn-stepforward">StepForward</dfn> is defined by an IRI, and consists in following the corresponding outgoing arcs in the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.</li>
            <li>A <dfn data-dfn-type="dfn" id="dfn-stepbackward">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.</li>
            <li>A <dfn data-dfn-type="dfn" id="dfn-stepat">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 href="#dfn-stepforward" class="internalDFN" data-link-type="dfn">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 data-dfn-type="dfn" id="dfn-constraint">Constraint</dfn> can be of two kinds:
        </p>
        <ul>
          <li>A <dfn data-dfn-type="dfn" id="dfn-unicity-constraint">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 data-dfn-type="dfn" id="dfn-filter">Filter</dfn>, consisting of a <a href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">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 href="#dfn-filter" class="internalDFN" data-link-type="dfn">filter</a> can specify an equality constraint with the use of the equal ("<code>=</code>") sign and a <a class="tref internalDFN" title="Value" href="#dfn-value" data-link-type="dfn">Value</a>. 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>.
        </p><div class="example"><div class="example-title"><span>Example 19</span></div><pre class="example">/ schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ]</pre></div>
        <p></p>

      </section>

      <section id="patch-operations" typeof="bibo:Chapter" resource="#patch-operations" property="bibo:hasPart">
        <h3 id="h-patch-operations" resource="#h-patch-operations"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3 </span>Patch Operations</span></h3>

        <section id="Bind-statement" typeof="bibo:Chapter" resource="#Bind-statement" property="bibo:hasPart">
          <h4 id="h-bind-statement" resource="#h-bind-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.1 </span><dfn data-dfn-type="dfn" id="dfn-bind">Bind</dfn></span></h4>
          <p>
              The <a href="#dfn-bind" class="internalDFN" data-link-type="dfn">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 href="#dfn-bind" class="internalDFN" data-link-type="dfn">Bind</a> can override the value of a previously bound variable.
          </p>

          <p>
              The <a href="#dfn-bind" class="internalDFN" data-link-type="dfn">Bind</a> operation is defined by three components: <a href="#dfn-var" class="internalDFN" data-link-type="dfn">Var</a>, <a href="#dfn-value" class="internalDFN" data-link-type="dfn">Value</a> and <a title="path expression" href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">Path</a>, the last component being optional (can be considered equivalent to the empty path).
          </p>

          <p>
              <dfn data-dfn-type="dfn" id="dfn-var">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 data-dfn-type="dfn" id="dfn-value">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 data-dfn-type="dfn" id="dfn-path">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 href="#dfn-step" class="internalDFN" data-link-type="dfn">Step</a>(s) and/or <a href="#dfn-constraint" class="internalDFN" data-link-type="dfn">Constraint</a>(s).
          </p>

          <p>
              Following the example above, the <a href="#dfn-bind" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
          </p><div class="example"><div class="example-title"><span>Example 20</span></div><pre class="example">Bind ?event &lt;#&gt; / schema:performerIn [ / schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; ] .</pre></div>
          <p></p>

        </section>

        <section id="Add-statement" typeof="bibo:Chapter" resource="#Add-statement" property="bibo:hasPart">
          <h4 id="h-add-statement" resource="#h-add-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.2 </span><dfn data-dfn-type="dfn" id="dfn-add">Add</dfn></span></h4>
          <p>
The <a href="#dfn-add" class="internalDFN" data-link-type="dfn">Add</a> operation is used to append new RDF triples to the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
          </p>
          <p>
              It has a single argument: an <a href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-add" class="internalDFN" data-link-type="dfn">Add</a> operation does not fail.
          </p><div class="example"><div class="example-title"><span>Example 21</span></div><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></div>
          <p></p>
        </section>

        <section id="AddNew-statement" typeof="bibo:Chapter" resource="#AddNew-statement" property="bibo:hasPart">
          <h4 id="h-addnew-statement" resource="#h-addnew-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.3 </span><dfn data-dfn-type="dfn" id="dfn-addnew">AddNew</dfn></span></h4>
          <p>
              The <a href="#dfn-addnew" class="internalDFN" data-link-type="dfn">AddNew</a> operation is used to append new RDF triples to the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>. It behaves like <a href="#dfn-add" class="internalDFN" data-link-type="dfn">Add</a> but unlike its counterpart, <a href="#dfn-addnew" class="internalDFN" data-link-type="dfn">AddNew</a> <a href="#addnew-already-existing-triple">fails</a> when trying to add an already existing triple.
          </p>
        </section>

        <section id="Delete-statement" typeof="bibo:Chapter" resource="#Delete-statement" property="bibo:hasPart">
          <h4 id="h-delete-statement" resource="#h-delete-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.4 </span><dfn data-dfn-type="dfn" id="dfn-delete">Delete</dfn></span></h4>
          <p>
The <a href="#dfn-delete" class="internalDFN" data-link-type="dfn">Delete</a> operation is used to remove RDF triples from the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
          </p>
          <p>
              It has a single argument: an <a href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>. Blank nodes identifiers are allowed in <a href="#dfn-delete" class="internalDFN" data-link-type="dfn">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>
          <div class="example"><div class="example-title"><span>Example 22</span></div><pre class="example">Delete { &lt;#&gt; profile:first_name "Tim" } .

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

        <section id="DeleteExisting-statement" typeof="bibo:Chapter" resource="#DeleteExisting-statement" property="bibo:hasPart">
          <h4 id="h-deleteexisting-statement" resource="#h-deleteexisting-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.5 </span><dfn data-dfn-type="dfn" id="dfn-deleteexisting">DeleteExisting</dfn></span></h4>
          <p>
The <a href="#dfn-deleteexisting" class="internalDFN" data-link-type="dfn">DeleteExisting</a> operation is used to remove RDF triples from the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>. It behaves like <a href="#dfn-delete" class="internalDFN" data-link-type="dfn">Delete</a> but unlike its counterpart, <a href="#dfn-deleteexisting" class="internalDFN" data-link-type="dfn">DeleteExisting</a> <a href="#deleteexisting-non-existing-triple">fails</a> when trying to delete a non-existing triple.
          </p>
        </section>

        <section id="Cut-statement" typeof="bibo:Chapter" resource="#Cut-statement" property="bibo:hasPart">
          <h4 id="h-cut-statement" resource="#h-cut-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.6 </span><dfn data-dfn-type="dfn" id="dfn-cut">Cut</dfn></span></h4>
          <p>
            The <a href="#dfn-cut" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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>.
          </p><div class="example"><div class="example-title"><span>Example 23</span></div><pre class="example">Cut ?workLocation .</pre></div>
          <p></p>
        </section>

        <section id="UpdateList-statement" typeof="bibo:Chapter" resource="#UpdateList-statement" property="bibo:hasPart">
          <h4 id="h-updatelist-statement" resource="#h-updatelist-statement"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.7 </span><dfn data-dfn-type="dfn" id="dfn-updatelist">UpdateList</dfn></span></h4>
          <p>
              The <a href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">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 href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">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 href="#dfn-slice-expression" class="internalDFN" data-link-type="dfn">Slice expression</a>, and an <a href="#dfn-argument-graph" class="internalDFN" data-link-type="dfn">argument graph</a> containing an RDF collection.
          </p>

          <p>
              The <dfn data-dfn-type="dfn" id="dfn-slice-expression">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 href="#dfn-slice-expression" class="internalDFN" data-link-type="dfn">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 href="#dfn-slice-expression" class="internalDFN" data-link-type="dfn">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 href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">UpdateList</a> logic using reified <code>rdf:List</code>.
          </p>

      </section>



      <section id="error-handling" typeof="bibo:Chapter" resource="#error-handling" property="bibo:hasPart">
        <h4 id="h-error-handling" resource="#h-error-handling"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.8 </span><dfn data-dfn-type="dfn" id="dfn-error-handling">Error Handling</dfn></span></h4>
        <p>
LD Patch abides to the semantics of the <a href="http://tools.ietf.org/html/rfc5789">HTTP PATCH method</a> [<cite><a class="bibref" href="#bib-RFC5789">RFC5789</a></cite>], in that the server <q cite="http://tools.ietf.org/html/rfc5789"><em class="rfc2119" title="MUST">MUST</em> 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 <em class="rfc2119" title="MUST NOT">MUST NOT</em> 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 [<cite><a class="bibref" href="#bib-RFC5789">RFC5789</a></cite>] 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 href="#dfn-bind" class="internalDFN" data-link-type="dfn">Bind</a> statement fails to match exactly one node, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="unicity-constraint-violated">If a <a href="#dfn-unicity-constraint" class="internalDFN" data-link-type="dfn">Unicity constraint</a> is violated, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="cut-nothing">If a <a href="#dfn-cut" class="internalDFN" data-link-type="dfn">Cut</a> operation fails to remove any triple, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="cut-non-bnode">If a <a href="#dfn-cut" class="internalDFN" data-link-type="dfn">Cut</a> operation is called on a variable not bound to a blank node, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="deleteexisting-non-existing-triple">If a <a href="#dfn-deleteexisting" class="internalDFN" data-link-type="dfn">DeleteExisting</a> attempts to remove a non-existing triple, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="addnew-already-existing-triple">If a <a href="#dfn-addnew" class="internalDFN" data-link-type="dfn">AddNew</a> attempts to add an already existing triple, then a HTTP 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="updatelist-non-list-argument">If the subject and predicate provided to an <a href="#dfn-updatelist" class="internalDFN" data-link-type="dfn">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 <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="wrong-order-for-indexes">If the indexes in a <a href="#dfn-slice-expression" class="internalDFN" data-link-type="dfn">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 <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="wrong-index">If an index in a <a href="#dfn-slice-expression" class="internalDFN" data-link-type="dfn">slice expression</a> is greater than the length of the <code>rdf:List</code>, then a 422 (Unprocessable Entity) error status code <em class="rfc2119" title="MUST">MUST</em> 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 <em class="rfc2119" title="MUST">MUST</em> be returned.</li>
            <li id="unknown-variable">If a <a href="#dfn-var" class="internalDFN" data-link-type="dfn">var</a>iable is used without being previously bound, then the parsing fails and a 400 (Bad Request) error status code <em class="rfc2119" title="MUST">MUST</em> 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 [<cite><a class="bibref" href="#bib-RFC4918">RFC4918</a></cite>].

        </p>

      </section>

      <section id="pathological-graph" typeof="bibo:Chapter" resource="#pathological-graph" property="bibo:hasPart">
        <h4 id="h-pathological-graph" resource="#h-pathological-graph"><span property="xhv:role" resource="xhv:heading"><span class="secno">4.3.9 </span><dfn data-dfn-type="dfn" id="dfn-pathological-graph">Pathological Graph</dfn></span></h4>
          <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
          </p><ul>
            <li><var>n</var> is an IRI or a literal</li>
            <li><var>p</var> is a <a href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">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>

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

        <div class="example"><div class="example-title"><span>Example 24</span></div><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></div>

        <p>
          The blank nodes <code>_:b2</code> and <code>_:b3</code> are unambiguous as they can be reached unambiguoulsy from the literal <code>"<abbr title="World Wide Web Consortium">W3C</abbr>/<abbr title="Massachusetts Institute of Technology">MIT</abbr>"</code>. The blank node <code>_:b1</code>, on the other hand, is ambigious as all <a href="#dfn-path-expression" class="internalDFN" data-link-type="dfn">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> [<cite><a class="bibref" href="#bib-rdf11-mt">rdf11-mt</a></cite>] are also pathological.
        </p>

        </section>

      </section>
    </section>



    <section id="turtle-sparql-comparison" class="informative" typeof="bibo:Chapter" resource="#turtle-sparql-comparison" property="bibo:hasPart">
        <!--OddPage--><h2 id="h-turtle-sparql-comparison" resource="#h-turtle-sparql-comparison"><span property="xhv:role" resource="xhv:heading"><span class="secno">5. </span>LD Patch compared to Turtle and SPARQL</span></h2><p><em>This section is non-normative.</em></p>
        <p>
            The LD Patch syntax uses a Turtle [<cite><a class="bibref" href="#bib-Turtle">Turtle</a></cite>] 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 [<cite><a class="bibref" href="#bib-sparql11-query">sparql11-query</a></cite>], 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 [<cite><a class="bibref" href="#bib-Turtle">Turtle</a></cite>], only allowing <code>@prefix</code>.
        </p>

    </section>



    <section id="concrete-syntax" typeof="bibo:Chapter" resource="#concrete-syntax" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-concrete-syntax" resource="#h-concrete-syntax"><span property="xhv:role" resource="xhv:heading"><span class="secno">6. </span>Concrete Syntax</span></h2>

      <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> [<cite><a class="bibref" href="#bib-sparql11-query">sparql11-query</a></cite>]. 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> [<cite><a class="bibref" href="#bib-Turtle">Turtle</a></cite>]. 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">&lt;</code>' ([^#x00-#x20&lt;&gt;"{}|^`\] | <a href="#grammar-production-UCHAR">UCHAR</a>)* '<code class="grammar-literal">&gt;</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">&amp;</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" typeof="bibo:Chapter" resource="#updatelist-algo" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-updatelist-algo" resource="#h-updatelist-algo"><span property="xhv:role" resource="xhv:heading"><span class="secno">A. </span>UpdateList Algorithm</span></h2><p><em>This section is non-normative.</em></p>

      <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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-cut" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a>.
                  </li>
              </ul>
          </li>
          <li>
              Remove from the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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 href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">target graph</a> the arc (<var>lst</var>, <code>rdf:rest</code>, <code>rdf:nil</code>).
                          </li>
                          <li>
                              Add in the <a href="#dfn-target-graph" class="internalDFN" data-link-type="dfn">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" class="fig-ref">Fig. <span class="figno">1</span> <span class="fig-title">Graph with a collection</span></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" class="fig-ref">Fig. <span class="figno">2</span> <span class="fig-title">Applying <code>UpdateList</code></span></a>.
      </p>

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

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

    </section>





    <section class="appendix" id="media-registration" typeof="bibo:Chapter" resource="#media-registration" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-media-registration" resource="#h-media-registration"><span property="xhv:role" resource="xhv:heading"><span class="secno">B. </span>Internet Media Type, File Extension and Macintosh File Type</span></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 [<cite><a class="bibref" href="#bib-UTF-8">UTF-8</a></cite>].</dd>
        <dt>Encoding considerations:</dt>
          <dd>The syntax of LD Patch is expressed over code points in Unicode [<cite><a class="bibref" href="#bib-UNICODE">UNICODE</a></cite>]. 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 [<cite><a class="bibref" href="#bib-RFC3023">RFC3023</a></cite>] 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 ([<cite><a class="bibref" href="#bib-RFC3023">RFC3023</a></cite>] 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) [<cite><a class="bibref" href="#bib-RFC3987">RFC3987</a></cite>] Section 8, as well as Uniform Resource Identifier (URI): Generic Syntax [<cite><a class="bibref" href="#bib-RFC3986">RFC3986</a></cite>] 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 [<cite><a class="bibref" href="#bib-UNICODE-SECURITY">UNICODE-SECURITY</a></cite>] and Internationalized Resource Identifiers (IRIs) [<cite><a class="bibref" href="#bib-RFC3987">RFC3987</a></cite>] 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 &amp; 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 <abbr title="World Wide Web Consortium">W3C</abbr> reserves change control over this specifications.</dd>
      </dl>
    </section>

    <section id="acknowledgements" class="appendix informative" typeof="bibo:Chapter" resource="#acknowledgements" property="bibo:hasPart">
      <!--OddPage--><h2 id="h-acknowledgements" resource="#h-acknowledgements"><span property="xhv:role" resource="xhv:heading"><span class="secno">C. </span>Acknowledgements</span></h2><p><em>This section is non-normative.</em></p>

      <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" typeof="bibo:Chapter" resource="#changelog" property="bibo:hasPart">
        <!--OddPage--><h2 id="h-changelog" resource="#h-changelog"><span property="xhv:role" resource="xhv:heading"><span class="secno">D. </span>Change Log</span></h2><p><em>This section is non-normative.</em></p>
        <section id="changes-since-march-2015-candidate-recommendation" typeof="bibo:Chapter" resource="#changes-since-march-2015-candidate-recommendation" property="bibo:hasPart">
            <h3 id="h-changes-since-march-2015-candidate-recommendation" resource="#h-changes-since-march-2015-candidate-recommendation"><span property="xhv:role" resource="xhv:heading"><span class="secno">D.1 </span>Changes since <a href="http://www.w3.org/TR/2015/CR-ldpatch-20150303/">March 2015 Candidate Recommendation</a></span></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 id="changes-since-september-2014-first-public-working-draft" typeof="bibo:Chapter" resource="#changes-since-september-2014-first-public-working-draft" property="bibo:hasPart">
            <h3 id="h-changes-since-september-2014-first-public-working-draft" resource="#h-changes-since-september-2014-first-public-working-draft"><span property="xhv:role" resource="xhv:heading"><span class="secno">D.2 </span>Changes since <a href="http://www.w3.org/TR/2014/WD-ldpatch-20140918/">September 2014 First Public Working Draft</a></span></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>



<section id="references" class="appendix" typeof="bibo:Chapter" resource="#references" property="bibo:hasPart"><!--OddPage--><h2 id="h-references" resource="#h-references"><span property="xhv:role" resource="xhv:heading"><span class="secno">E. </span>References</span></h2><section id="normative-references" typeof="bibo:Chapter" resource="#normative-references" property="bibo:hasPart"><h3 id="h-normative-references" resource="#h-normative-references"><span property="xhv:role" resource="xhv:heading"><span class="secno">E.1 </span>Normative references</span></h3><dl class="bibliography" resource=""><dt id="bib-BCP47">[BCP47]</dt><dd>A. Phillips; M. Davis. <a href="https://tools.ietf.org/html/bcp47" property="dc:requires"><cite>Tags for Identifying Languages</cite></a>. September 2009. IETF Best Current Practice. URL: <a href="https://tools.ietf.org/html/bcp47" property="dc:requires">https://tools.ietf.org/html/bcp47</a>
</dd><dt id="bib-LDP">[LDP]</dt><dd>Steve Speicher; John Arwe; Ashok Malhotra. <a href="http://www.w3.org/TR/ldp/" property="dc:requires"><cite>Linked Data Platform 1.0</cite></a>. 26 February 2015. W3C Recommendation. URL: <a href="http://www.w3.org/TR/ldp/" property="dc:requires">http://www.w3.org/TR/ldp/</a>
</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119" property="dc:requires"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119" property="dc:requires">https://tools.ietf.org/html/rfc2119</a>
</dd><dt id="bib-RFC3023">[RFC3023]</dt><dd>M. Murata; S. St. Laurent; D. Kohn. <a href="https://tools.ietf.org/html/rfc3023" property="dc:requires"><cite>XML Media Types</cite></a>. January 2001. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc3023" property="dc:requires">https://tools.ietf.org/html/rfc3023</a>
</dd><dt id="bib-RFC3986">[RFC3986]</dt><dd>T. Berners-Lee; R. Fielding; L. Masinter. <a href="https://tools.ietf.org/html/rfc3986" property="dc:requires"><cite>Uniform Resource Identifier (URI): Generic Syntax</cite></a>. January 2005. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc3986" property="dc:requires">https://tools.ietf.org/html/rfc3986</a>
</dd><dt id="bib-RFC3987">[RFC3987]</dt><dd>M. Duerst; M. Suignard. <a href="https://tools.ietf.org/html/rfc3987" property="dc:requires"><cite>Internationalized Resource Identifiers (IRIs)</cite></a>. January 2005. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc3987" property="dc:requires">https://tools.ietf.org/html/rfc3987</a>
</dd><dt id="bib-RFC4918">[RFC4918]</dt><dd>L. Dusseault, Ed.. <a href="https://tools.ietf.org/html/rfc4918" property="dc:requires"><cite>HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)</cite></a>. June 2007. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc4918" property="dc:requires">https://tools.ietf.org/html/rfc4918</a>
</dd><dt id="bib-RFC5789">[RFC5789]</dt><dd>L. Dusseault; J. Snell. <a href="https://tools.ietf.org/html/rfc5789" property="dc:requires"><cite>PATCH Method for HTTP</cite></a>. March 2010. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc5789" property="dc:requires">https://tools.ietf.org/html/rfc5789</a>
</dd><dt id="bib-Turtle">[Turtle]</dt><dd>Eric Prud'hommeaux; Gavin Carothers. <a href="http://www.w3.org/TR/turtle/" property="dc:requires"><cite>RDF 1.1 Turtle</cite></a>. 25 February 2014. W3C Recommendation. URL: <a href="http://www.w3.org/TR/turtle/" property="dc:requires">http://www.w3.org/TR/turtle/</a>
</dd><dt id="bib-UNICODE">[UNICODE]</dt><dd><a href="http://www.unicode.org/versions/latest/" property="dc:requires"><cite>The Unicode Standard</cite></a>. URL: <a href="http://www.unicode.org/versions/latest/" property="dc:requires">http://www.unicode.org/versions/latest/</a>
</dd><dt id="bib-UNICODE-SECURITY">[UNICODE-SECURITY]</dt><dd>Mark Davis; Michel Suignard. <a href="http://www.unicode.org/reports/tr36/" property="dc:requires"><cite>Unicode Security Considerations</cite></a>. URL: <a href="http://www.unicode.org/reports/tr36/" property="dc:requires">http://www.unicode.org/reports/tr36/</a>
</dd><dt id="bib-UTF-8">[UTF-8]</dt><dd>F. Yergeau. <a href="https://tools.ietf.org/html/rfc3629" property="dc:requires"><cite>UTF-8, a transformation format of ISO 10646</cite></a>. November 2003. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc3629" property="dc:requires">https://tools.ietf.org/html/rfc3629</a>
</dd><dt id="bib-rdf11-concepts">[rdf11-concepts]</dt><dd>Richard Cyganiak; David Wood; Markus Lanthaler. <a href="http://www.w3.org/TR/rdf11-concepts/" property="dc:requires"><cite>RDF 1.1 Concepts and Abstract Syntax</cite></a>. 25 February 2014. W3C Recommendation. URL: <a href="http://www.w3.org/TR/rdf11-concepts/" property="dc:requires">http://www.w3.org/TR/rdf11-concepts/</a>
</dd><dt id="bib-rdf11-mt">[rdf11-mt]</dt><dd>Patrick Hayes; Peter Patel-Schneider. <a href="http://www.w3.org/TR/rdf11-mt/" property="dc:requires"><cite>RDF 1.1 Semantics</cite></a>. 25 February 2014. W3C Recommendation. URL: <a href="http://www.w3.org/TR/rdf11-mt/" property="dc:requires">http://www.w3.org/TR/rdf11-mt/</a>
</dd><dt id="bib-sparql11-query">[sparql11-query]</dt><dd>Steven Harris; Andy Seaborne. <a href="http://www.w3.org/TR/sparql11-query/" property="dc:requires"><cite>SPARQL 1.1 Query Language</cite></a>. 21 March 2013. W3C Recommendation. URL: <a href="http://www.w3.org/TR/sparql11-query/" property="dc:requires">http://www.w3.org/TR/sparql11-query/</a>
</dd></dl></section><section id="informative-references" typeof="bibo:Chapter" resource="#informative-references" property="bibo:hasPart"><h3 id="h-informative-references" resource="#h-informative-references"><span property="xhv:role" resource="xhv:heading"><span class="secno">E.2 </span>Informative references</span></h3><dl class="bibliography" resource=""><dt id="bib-sparql11-update">[sparql11-update]</dt><dd>Paul Gearon; Alexandre Passant; Axel Polleres. <a href="http://www.w3.org/TR/sparql11-update/" property="dc:references"><cite>SPARQL 1.1 Update</cite></a>. 21 March 2013. W3C Recommendation. URL: <a href="http://www.w3.org/TR/sparql11-update/" property="dc:references">http://www.w3.org/TR/sparql11-update/</a>
</dd></dl></section></section></body></html>