Updated grammar w/ negative indexes and AddNew+DeleteAny. Updated text for Slice. ldpatch
authorAlexandre Bertails <alexandre@bertails.org>
Sat, 13 Dec 2014 19:08:22 -0500
branchldpatch
changeset 923 cdee523c6f10
parent 918 3637285cdca2
child 924 25c11f178ac4
Updated grammar w/ negative indexes and AddNew+DeleteAny. Updated text for Slice.
ldpatch.html
--- a/ldpatch.html	Wed Nov 26 18:03:28 2014 +0100
+++ b/ldpatch.html	Sat Dec 13 19:08:22 2014 -0500
@@ -624,14 +624,16 @@
           </p>
 
           <p>
-              The <dfn>Slice expression</dfn> is composed of two optional non-negative integers <var>i<sub>min</sub></var> and <var>i<sub>max</sub></var> separated by "<code>..</code>". An omitted value is interpreted as the length of the collection. The <a>Slice expression</a> will denote the slice of the list being preceded by <var>i<sub>min</sub></var> elements, and spanning over (<var>i<sub>max</sub></var> - <var>i<sub>min</sub></var>) elements.
+              The <dfn>Slice expression</dfn> is composed of two optional 0-based indexes <var>i<sub>min</sub></var> and <var>i<sub>max</sub></var> separated by "<code>..</code>". A negative index denotes elements from the end of the list counting backwards, e.g. the last element of any non-empty list always has the index <code>-1</code>. An omitted value is interpreted as the length of the collection. The <a>Slice expression</a> will denote the slice of the list being preceded by <var>i<sub>min</sub></var> elements, and spanning over (<var>i<sub>max</sub></var> - <var>i<sub>min</sub></var>) elements.
          </p>
          <p>
              For example, here are some <a>Slice expression</a>s for the list <code>( "lorem" "ipsum" "dolor" "sit" "amet" )</code>:
           </p>
           <ul>
-              <li><code>2..4</code> denotes the slice <code>( "dolor" "sit" )</code></li>
-              <li><code>3..</code> denotes the slice <code>( "sit" "amet" )</code></li>
+              <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>
@@ -867,65 +869,77 @@
     <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>[6]</td>
+    <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-deleteAny">
+    <td>[8]</td>
+    <td><a href="#grammar-production-deleteAny">deleteAny</a></td>
+    <td>::=</td>
+    <td>("<code class="grammar-literal">DeleteAny</code>" | "<code class="grammar-literal">DA</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>[7]</td>
+    <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>[8]</td>
+    <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>[9]</td>
+    <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>[10]</td>
+    <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>[11]</td>
+    <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>[12]</td>
+    <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>[13]</td>
+    <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>[14]</td>
+    <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>[15]</td>
+    <td>[17]</td>
     <td><a href="#grammar-production-INDEX">INDEX</a></td>
     <td>::=</td>
-    <td>[0-9]+</td>
+    <td>'<code class="grammar-literal">-</code>'? [0-9]+</td>
 </tr>
 <tr id="grammar-production-VAR1">
     <td>[143s]</td>
@@ -946,7 +960,7 @@
     <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>[16]</td>
+    <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>
@@ -1213,7 +1227,6 @@
 </table>
 
 
-
     </section>
 
     <section class="appendix" id="media-registration">