added spec for trig
authorSandro Hawke <sandro@hawke.org>
Thu, 10 May 2012 16:20:04 -0400
changeset 344 5617aed76a42
parent 343 8adb5b5444dc
child 345 ca2c2444493f
added spec for trig
rdf-spaces/index.html
--- a/rdf-spaces/index.html	Thu May 10 14:33:39 2012 -0400
+++ b/rdf-spaces/index.html	Thu May 10 16:20:04 2012 -0400
@@ -498,7 +498,7 @@
   <h2>Dataset Languages</h2>
 
   <p>This section contains specifications of languages for serializing
-  datasets.  N-Quads documents and TriG documents have identical
+  datasets.  N-Quads documents and Trig documents have identical
   semantics, since they each are just serializations of the datasets
   and therefore follow <a href="#semantics"
   class="sectionRef"></a>.</p>
@@ -510,7 +510,7 @@
     except that a fourth term, identifying an RDF space, may
     optionally be included on each line, after the "object" term.</p>
 
-    <p>Formally, the N-Quads grammar is <a href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#">the N-Triples
+    <p>Formally, the N-Quads grammar is <a href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#n-triple-grammar">the N-Triples
     Grammar</a> modified by removing productions [1] and [2], and
     adding the following productions:</p>
 
@@ -523,7 +523,7 @@
 <td><a id="prod-sandro-nquads-nquadsDoc" name="prod-sandro-nquads-nquadsDoc"></a>[<span class="prodNo">1q</span>]&nbsp;&nbsp;&nbsp;</td>
 <td><code class="production prod">nquadsDoc</code></td>
 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
-<td><code class="content">(<span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-statement">statement</a></span>)? (<span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-EOL">EOL</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-statement">statement</a></span>)* (<span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-EOL">EOL</a></span>)?</code></td>
+<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-statement">statement</a></span>? (<span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-EOL">EOL</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-statement">statement</a></span>)* <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-EOL">EOL</a></span>?</code></td>
 </tr>
 </tbody>
 
@@ -532,7 +532,7 @@
 <td><a id="prod-sandro-nquads-statement" name="prod-sandro-nquads-statement"></a>[<span class="prodNo">2q</span>]&nbsp;&nbsp;&nbsp;</td>
 <td><code class="production prod">statement</code></td>
 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
-<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-subject">subject</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-predicate">predicate</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-object">object</a></span> (<span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-space">space</a></span>)? "."</code></td>
+<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-subject">subject</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-predicate">predicate</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-object">object</a></span> <span class="prod"><a class="grammarRef" href="#prod-sandro-nquads-space">space</a></span>? "."</code></td>
 </tr>
 </tbody>
 
@@ -553,7 +553,7 @@
 <code class="production prod" id="prod-sandro-nquads-predicate">predicate</code>
 <code class="production prod" id="prod-sandro-nquads-object">object</code>, and 
 <code class="production prod" id="prod-sandro-nquads-IRIREF">IRIREF</code> are defined in the <a
-href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#">the
+href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#n-triple-grammar">the
 N-Triples Grammar</a></p>
 
 </div>
@@ -572,20 +572,137 @@
 
 
   <section>
-    <h3>TriG</h3>
+    <h3>Trig</h3>
 
-    <p>The syntax of TriG is the same as the syntax of Turtle except
-    that (name, graph) pairs can be specified by giving an option
-    GRAPH keyword, a "name" term, and a nested Turtle graph expression
+    <p>The syntax of Trig is the same as the syntax of Turtle except
+    that (name, graph) pairs can be specified by giving an optional
+    <tt>GRAPH</tt> keyword, a "name" term, and a nested Turtle graph expression
     in curly braces.</p>
 
-    <pre class="example">@prefix :eg &lt;http://example.org/>.
-eg:subject eg:predicate eg:object1.
-eg:subject eg:predicate eg:object2.
-eg:space1 { eg:subject eg:predicate eg:object1. }
-eg:space2 { eg:subject eg:predicate eg:object1. }</pre>
 
-    <p>This example shows the same dataset as the N-Quads example.</p>
+    <p>Formally, the Trig grammar is <a
+    href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#sec-grammar-grammar">the
+    Turtle Grammar</a> modified by removing productions [1] and [2],
+    and adding the following productions:</p>
+
+    <div style="margin: 1em; margin-top: 0; padding: 1em; border: 1px solid gray;">
+    <table border="0">
+
+<tbody class="prod">
+<tr valign="baseline">
+<td><a id="prod-trig-trigDoc" name="prod-trig-trigDoc"></a>[<span class="prodNo">1g</span>]&nbsp;&nbsp;&nbsp;</td>
+<td><code class="production prod">trigDoc</code></td>
+<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
+<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-trig-statement">statement</a></span>*</code></td>
+</tr>
+</tbody>
+
+<tbody class="prod">
+<tr valign="baseline">
+<td><a id="prod-trig-statement" name="prod-trig-statement"></a>[<span class="prodNo">2g</span>]&nbsp;&nbsp;&nbsp;</td>
+<td><code class="production prod">statement</code></td>
+<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
+<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-trig-directive">directive</a></span> "." | <span class="prod"><a class="grammarRef" href="#prod-trig-triples">triples</a></span> "." | <span class="prod"><a class="grammarRef" href="#prod-trig-naming">naming</a></span> | <span class="prod"><a class="grammarRef" href="#prod-trig-wrappedDefault">wrappedDefault</a></span></code></td>
+</tr>
+</tbody>
+
+<tbody class="prod">
+<tr valign="baseline">
+<td><a id="prod-trig-naming" name="prod-trig-naming"></a>[<span class="prodNo">3g</span>]&nbsp;&nbsp;&nbsp;</td>
+<td><code class="production prod">naming</code></td>
+<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
+<td><code class="content"><span class="prod"><a class="grammarRef" href="#prod-trig-GRAPH">GRAPH</a></span>? <span class="prod"><a class="grammarRef" href="#prod-trig-IRI_REF">IRI_REF</a></span> "{" <span class="prod"><a class="grammarRef" href="#prod-trig-triples">triples</a></span> "."? "}"</code></td>
+</tr>
+</tbody>
+
+<tbody class="prod">
+<tr valign="baseline">
+<td><a id="prod-trig-wrappedDefault" name="prod-trig-wrappedDefault"></a>[<span class="prodNo">4g</span>]&nbsp;&nbsp;&nbsp;</td>
+<td><code class="production prod">wrappedDefault</code></td>
+<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
+<td><code class="content">"{" <span class="prod"><a class="grammarRef" href="#prod-trig-triples">triples</a></span> "."? "}"</code></td>
+</tr>
+</tbody>
+
+<tbody class="term">
+<tr valign="baseline">
+<td><a id="term-trig-GRAPH" name="term-trig-GRAPH"></a>[<span class="prodNo">5g</span>]&nbsp;&nbsp;&nbsp;</td>
+<td><code class="production term">GRAPH</code></td>
+<td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
+<td><code class="content">"GRAPH"</code></td>
+</tr>
+</tbody>
+    </table>
+
+
+<p>The grammar symbols 
+
+<code class="production prod" id="prod-trig-directive">directive</code>,
+<code class="production prod" id="prod-trig-triples">triples</code> and
+<code class="production prod" id="prod-trig-IRI_REF">IRI_REF</code>
+
+are defined in <a
+href="http://dvcs.w3.org/hg/rdf/raw-file/default/rdf-turtle/index.html#sec-grammar-grammar">the
+Turtle Grammar</a>
+</p>
+
+
+    </div>
+
+
+    <p>Parsing a Trig document is like parsing a Turtle document
+    except:</p>
+    <ol>
+
+      <li>The result is a dataset, not an RDF Graph</li>
+
+      <li>The triples generated during parsing of the <code
+      class="prod production">naming</code> production go into a
+      <a>named graph</a>, with the name being the <code class="prod
+      production">IRI_REF</code>.</li>
+
+      <li>The triples generated during other parsing go into the
+      default graph.</li>
+
+    </ol>
+      
+    <p>Note that the grammar forbids directives between curly braces
+    and empty curly-brace expressions.  Also, note that blank node
+    processing is not affected by curly braces, so conceptually blank
+    node identifiers are scoped to the entire document.</p>
+
+    <p>There is no requirement that <a>named graph</a> names be unique
+    in a document, or that triples in the default graph be
+    continguous. For example, these two Trig document parse to exactly
+    the same Dataset:</p>
+
+    <pre class="example"># Trig Example 1
+    @prefix : &lt;http://example.org/>.
+    :a :b 1.
+    :s1 { :a :b 10 }
+    :s2 { :a :b 20 }
+    :s1 { :a :b 11 }
+    :s2 { :a :b 21 }
+    :a :b 2.
+</pre>
+
+    <pre class="example"># Trig Example 2
+    @prefix : &lt;http://example.org/>.
+    :a :b 1,2.
+    :s1 { :a :b 10,11. }
+    :s2 { :a :b 20,21. }
+</pre>
+
+    <p>The same dataset could be expressed in N-Quads as:</p>
+
+    <pre style="overflow-x:scroll; width:800px;" class="example"># N-Quads for TriG Example 1 and 2
+&lt;http://example/org/a> &lt;http://example/org/b> "1"^^&lt;http://www.w3.org/2001/XMLSchema#integer>.
+&lt;http://example/org/a> &lt;http://example/org/b> "2"^^&lt;http://www.w3.org/2001/XMLSchema#integer>.
+&lt;http://example/org/a> &lt;http://example/org/b> "10"^^&lt;http://www.w3.org/2001/XMLSchema#integer> &lt;http://example/org/s1>.
+&lt;http://example/org/a> &lt;http://example/org/b> "11"^^&lt;http://www.w3.org/2001/XMLSchema#integer> &lt;http://example/org/s1>.
+&lt;http://example/org/a> &lt;http://example/org/b> "20"^^&lt;http://www.w3.org/2001/XMLSchema#integer> &lt;http://example/org/s2>.
+&lt;http://example/org/a> &lt;http://example/org/b> "21"^^&lt;http://www.w3.org/2001/XMLSchema#integer> &lt;http://example/org/s2>.
+</pre>
 
     <p class="issue">Are braces around default-graph triples required,
     optional, or disallowed?    Assuming "optional" for now.
@@ -603,8 +720,6 @@
     <p class="issue">Can blank node labels be used as space names?
     Assuming not, for now.</p>
 
-    <p>@@@ grammar, etc, based of Turtle spec</p>
-
   </section>
 </section>
 
@@ -639,12 +754,10 @@
 <section>   <!-- I don't like what respec does with id=conformance -->
   <h2>Conformance</h2>
 
-  <p>Something like: If a space has a URL, and you get a 200 response
-  dereferencing that URL, the the response MUST be a serialization of
-  the triples on that space, give or take synchronization (caching)
-  issues. </p>
-
-  <p>What else?</p>
+  <p>@@@ what to say here?  Maybe including something like: If a space
+  has a URL, and you get a 200 response dereferencing that URL, the
+  the response MUST be a serialization of the triples on that space,
+  give or take synchronization (caching) issues. </p>
 
 </section>
 
@@ -1133,7 +1246,7 @@
 <section class="appendix informative" id="changes">
   <h2>Changes</h2>
   <ul>
-    <li>2012-05-10: Wrote a short intro.  Started writing the Use Cases section for real.   Added grammar for N-Quads.</li>
+    <li>2012-05-10: Wrote a short intro.  Started writing the Use Cases section for real.   Added grammar for N-Quads and Trig.</li>
     <li>2012-05-09: Renamed "layers" as "spaces"; some word-smithing in Concepts and the Abstract; removed "Turtle in HTML" as a dataset syntax; added some text about trig and nquads; added a note about change-over-time; added an appendix with a reflection vocabulary</li>
     <li>2012-05-02: Removed obsolete text from the introduction, removed the section on datasets borrowed from RDF Concepts, and added many entries to Concepts (and renamed it from Terminology).</li>
     <li>2012-05-01: Starting with a little text from RDF Concepts, a few ideas, and the text from <a href="http://www.w3.org/2011/rdf-wg/wiki/Layers">Layers</a></li>
@@ -1142,6 +1255,6 @@
 
 
 
-  </body>
+</body>
 </html>