moved Example section and fixed a few bugs in it ldpatch
authorPierre-Antoine <pchampin@liris.cnrs.fr>
Thu, 20 Nov 2014 17:53:51 +0100
branchldpatch
changeset 892 25b18ffbdebe
parent 891 c03d434f01ba
child 893 69d062ab6fc8
moved Example section and fixed a few bugs in it
ldpatch.html
--- a/ldpatch.html	Thu Nov 20 17:47:31 2014 +0100
+++ b/ldpatch.html	Thu Nov 20 17:53:51 2014 +0100
@@ -246,6 +246,167 @@
 
     </section>
       
+    <section id="examples" class="informative">
+      <h2>Examples</h2>
+
+      <section id="full-example">
+          <h2>Full example</h2>
+
+          <p>
+              The following RDF Graph describes the relation between a person named Tim Berners-Lee (denoted by <code>&lt;http://example.org/timbl#&gt;</code>) and two events he attended.
+          </p>
+          <pre class='example'>
+@prefix schema: &lt;http://schema.org/&gt; .
+@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
+@prefix ex: &lt;http://example.org/vocab#&gt; .
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
+&lt;#&gt; a schema:Person ;
+  schema:alternateName "TimBL" ;
+  profile:first_name "Tim" ;
+  profile:last_name "Berners-Lee" ;
+  schema:workLocation [ schema:name "W3C/MIT" ] ;
+  schema:performerIn _:b1, _:b2 ;
+  ex:preferredLanguages ( "en" "fr" ).
+
+_:b1 schema:name "F2F5 - Linked Data Platform" ;
+  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .
+
+_:b2 a schema:Event ;
+  schema:name "TED 2009" ;
+  schema:startDate "2009-02-04" ;
+  schema:url &lt;http://conferences.ted.com/TED2009/&gt; .
+          </pre>
+          <p>
+              The following is an example HTTP Patch request, conveying an LD Patch document:
+          </p>
+          <pre class='example'>
+PATCH /timbl HTTP/1.1
+Host: example.org
+Content-Length: 478
+Content-Type: text/ldpatch
+If-Match: "abc123"
+
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
+@prefix schema: &lt;http://schema.org/&gt; .
+@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
+@prefix ex: &lt;http://example.org/vocab#&gt; .
+
+Delete { &lt;#&gt; profile:first_name "Tim" } .
+Add {
+  &lt;#&gt; profile:first_name "Timothy" ;
+    profile:image &lt;https://example.org/timbl.jpg&gt; .
+} .
+
+Bind ?workLocation &lt;#&gt; /schema:workLocation .
+Cut ?workLocation.
+
+UpdateList &lt;#&gt; ex:preferredLanguages 1..2 ( "fr-CH" ) .
+
+Bind ?event &lt;#&gt; /schema:attendee[/schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt;]  .
+Add { ?event rdf:type schema:Event } .
+
+Bind ?ted &lt;http://conferences.ted.com/TED2009/&gt; /^schema:url! .
+Delete { ?ted schema:startDate "2009-02-04" } .
+Add {
+  ?ted schema:location [
+    schema:name "Long Beach, California" ;
+    schema:geo [
+      schema:latitude "33.7817" ;
+      schema:longitude "-118.2054"
+    ]
+  ]
+} .
+          </pre>
+          <p>
+              This example introduces most features of the LD Patch format: <code>@prefix</code> and prefixed names, the <a>Add</a>, <a>Delete</a>, <a>Cut</a>, and <a>UpdateList</a> operations, the <a>Bind</a>-ing mechanism and blank node creation. The "text/ldpatch" media type is <a href="#media-registration">prospectively</a> used to identify such LD Patch documents.
+          </p>
+          <p>
+              The following is the resulting (patched) document.
+          </p>
+          <pre class='example'>
+@prefix schema: &lt;http://schema.org/&gt; .
+@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
+@prefix ex: &lt;http://example.org/vocab#&gt; .
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
+&lt;#&gt; a schema:Person ;
+  schema:alternateName "TimBL" ;
+  profile:first_name "Timothy" ;
+  profile:last_name "Berners-Lee" ;
+  profile:image &lt;https://example.org/timbl.jpg&gt; ;
+  schema:attendee _:b1, _:b2 ;
+  ex:preferredLanguages ( "en" "fr-CH" ).
+
+_:b1 a schema:Event ;
+  schema:name "F2F5 - Linked Data Platform" ;
+  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .
+
+_:b2 a schema:Event ;
+  schema:name "TED 2009" ;
+  schema:url &lt;http://conferences.ted.com/TED2009/&gt; ;
+  schema:location [
+    schema:name "Long Beach, California";
+    schema:geo [ schema:latitude "33.7817" ; schema:longitude "-118.2054" ]
+  ] .
+          </pre>
+      </section>
+
+      <section id="list-manipulation-examples">
+          <h2><code>rdf:List</code> manipulation examples</h2>
+
+          <p>
+              This example shows how to <strong id="replace-elements">replace one element</strong> (here the second one) with a new one:
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages 1..2 ( "fr-CH" ) .
+          </pre>
+
+          <p>
+              This example shows how to <strong id="insert-new-elements">insert new elements</strong> at a specific index (here <code>2</code>):
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages 2..2 ( "fr-CH" "en-US" ) .
+          </pre>
+
+          <p>
+              This example shows how to <strong id="append-elements">append elements</strong> at the end of a collection:
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages .. ( "fr-CH" "en-US" ) .
+          </pre>
+
+          <p>
+              This example shows how to <strong id="replace-elements">replace all the elements</strong> after the index <code>2</code> with the provided collection:
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages 2.. ( "fr-CH" "en-US" ) .
+          </pre>
+
+          <p>
+              This example shows how to <strong id="remove-elements">remove elements</strong> (here the second and the third) from a collection:
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages 1..3 ( ) .
+          </pre>
+
+          <p>
+              Finally, this example shows how to <strong id="empty-collection">empty a collection</strong>:
+          </p>
+
+          <pre class='example'>
+UpdateList &lt;#&gt; ex:preferredLanguages 0.. ( ) .
+          </pre>
+
+
+      </section>
+
+    </section>
+
+
     <section class='normative' id='semantics'>
       <h1>LD Patch Semantics</h1>
       <p>
@@ -518,168 +679,6 @@
       </section>
     </section>
 
-    <section id="examples" class="informative">
-      <h2>Examples</h2>
-
-      <section id="full-example">
-          <h3>Full example</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>
-          <pre class='example'>
-@prefix schema: &lt;http://schema.org/&gt; .
-@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
-@prefix ex: &lt;http://example.org/vocab#&gt; .
-@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
-&lt;#&gt; a schema:Person ;
-  schema:alternateName "TimBL" ;
-  profile:first_name "Tim" ;
-  profile:last_name "Berners-Lee" ;
-  schema:workLocation [ schema:name "W3C/MIT" ] ;
-  schema:performerIn _:b1, _:b2 ;
-  ex:preferredLanguages ( "en" "fr" ).
-
-_:b1 schema:name "F2F5 - Linked Data Platform" ;
-  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .
-
-_:b2 a schema:Event ;
-  schema:name "TED 2009" ;
-  schema:startDate "2009-02-04" ;
-  schema:url &lt;http://conferences.ted.com/TED2009/&gt; .
-          </pre>
-          <p>
-              The following is an example HTTP Patch request, conveying an LD Patch document:
-          </p>
-          <pre class='example'>
-PATCH /timbl HTTP/1.1
-Host: example.org
-Content-Length: 478
-Content-Type: text/ldpatch
-If-Match: "abc123"
-
-@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
-@prefix schema: &lt;http://schema.org/&gt; .
-@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
-@prefix ex: &lt;http://example.org/vocab#&gt; .
-
-Delete { &lt;#&gt; profile:first_name "Tim" } .
-Add {
-  &lt;#&gt; profile:first_name "Timothy" ;
-    profile:image &lt;https://example.org/timbl.jpg&gt; .
-} .
-
-Bind ?workLocation &lt;#&gt; /schema:workLocation .
-Cut ?workLocation.
-
-UpdateList &lt;#&gt; ex:preferredLanguages 1..2 ( "fr-CH" ) .
-
-Bind ?event &lt;#&gt; /schema:attendee[/schema:url = &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt;]  .
-Add { ?event rdf:type schema:Event } .
-
-Bind ?ted &lt;http://conferences.ted.com/TED2009/&gt; /^schema:url! .
-Delete { ?ted schema:startDate "2009-02-04" } .
-Add {
-  ?ted schema:location [
-    schema:name "Long Beach, California" ;
-    schema:geo [
-      schema:latitude "33.7817" ;
-      schema:longitude "-118.2054"
-    ]
-  ]
-} .
-          </pre>
-          <p>
-              This example introduces most features of the LD Patch format: <code>@prefix</code> and prefixed names, the <a>Add</a>, <a>Delete</a>, <a>Cut</a>, and <a>UpdateList</a> operations, the <a>Bind</a>-ing mechanism and blank node creation. The "text/ldpatch" media type is <a href="#media-registration">prospectively</a> used to identify such LD Patch documents.
-          </p>
-          <p>
-              The following is the resulting (patched) document.
-          </p>
-          <pre class='example'>
-@prefix schema: &lt;http://schema.org/&gt; .
-@prefix profile: &lt;http://ogp.me/ns/profile#&gt; .
-@prefix ex: &lt;http://example.org/vocab#&gt; .
-@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; .
-&lt;#&gt; a schema:Person ;
-  schema:alternateName "TimBL" ;
-  profile:first_name "Timothy" ;
-  profile:last_name "Berners-Lee" ;
-  profile:image &lt;https://example.org/timbl.jpg&gt; ;
-  schema:attendee _:b1, _:b2 ;
-  ex:preferredLanguages ( "en" "fr-CH" ).
-
-_:b1 a schema:Event ;
-  schema:name "F2F5 - Linked Data Platform" ;
-  schema:url &lt;https://www.w3.org/2012/ldp/wiki/F2F5&gt; .
-
-_:b2 a schema:Event ;
-  schema:name "TED 2009" ;
-  schema:url &lt;http://conferences.ted.com/TED2009/&gt; ;
-  schema:location [
-    schema:name "Long Beach, California";
-    schema:geo [ schema:latitude "33.7817" ; schema:longitude "-118.2054" ]
-  ] .
-          </pre>
-      </section>
-
-      <section id="list-manipulation-examples">
-          <h3><code>rdf:List</code> manipulation examples</h3>
-
-          <p>
-              This example shows how to <strong id="replace-elements">replace elements</strong> with new ones (here the second one):
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages 1..2 ( "fr-CH" ) .
-          </pre>
-
-          <p>
-              This example shows how to <strong id="insert-new-elements">insert new elements</strong> at a specific index (here <code>2</code>):
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages 2..3 ( "fr-CH" "en-US" ) .
-          </pre>
-
-          <p>
-              This example shows how to <strong id="append-elements">append elements</strong> to a collection:
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages .. ( "fr-CH" "en-US" ) .
-          </pre>
-
-          <p>
-              This example shows how to <strong id="replace-elements">replace all the elements</strong> after the index <code>2</code> with the provided collection:
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages 2.. ( "fr-CH" "en-US" ) .
-          </pre>
-
-          <p>
-              This example shows how to <strong id="remove-elements">remove elements</strong> from a collection:
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages 2..3 ( ) .
-          </pre>
-
-          <p>
-              Finally, this example shows how to <strong id="empty-collection">empty a collection</strong>:
-          </p>
-
-          <pre class='example'>
-UpdateList &lt;#&gt; ex:preferredLanguages 0.. ( ) .
-          </pre>
-
-
-      </section>
-
-    </section>
-
-
-
     <section id='concrete-syntax'>
       <h1>Concrete Syntax</h1>
       <p>