Use labelOrSubject
authorAndy Seaborne <andy.seaborne@apache.org>
Mon, 02 Sep 2013 21:20:39 +0100
changeset 1054 12af9537b633
parent 1053 094a1a29f315
child 1055 d8624ff738b8
Use labelOrSubject
trig/index.html
trig/trig-bnf.html
trig/trig.bnf
--- a/trig/index.html	Mon Sep 02 15:58:56 2013 +0100
+++ b/trig/index.html	Mon Sep 02 21:20:39 2013 +0100
@@ -203,13 +203,13 @@
 				<p>A RDF Dataset may contain only a single graph.</p>
 				<pre class="example">
 					<script type="application/trig"># This document encodes one graph.
-@prefix ex: <http://www.example.org/vocabulary#> .
-@prefix : <http://www.example.org/exampleDocument#> .
+@prefix ex: &lt;http://www.example.org/vocabulary#> .
+@prefix : &lt;http://www.example.org/exampleDocument#> .
 
 :G1 { :Monica a ex:Person ;
               ex:name "Monica Murphy" ;      
-              ex:homepage <http://www.monicamurphy.org> ;
-              ex:email <mailto:monica@monicamurphy.org> ;
+              ex:homepage &lt;http://www.monicamurphy.org> ;
+              ex:email &lt;mailto:monica@monicamurphy.org> ;
               ex:hasSkill ex:Management ,
                           ex:Programming . } 
 					</script>
@@ -218,27 +218,27 @@
 				<pre class="example">
 				<script type="application/trig"># This document contains a default graph and two named graphs.
 
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix dc: <http://purl.org/dc/terms/> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix dc: &lt;http://purl.org/dc/terms/> .
+@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
 
 # default graph
     { 
-      <http://example.org/bob> dc:publisher "Bob" . 
-      <http://example.org/alice> dc:publisher "Alice" .
+      &lt;http://example.org/bob> dc:publisher "Bob" . 
+      &lt;http://example.org/alice> dc:publisher "Alice" .
     }
 
-<http://example.org/bob> 
+&lt;http://example.org/bob> 
     { 
        _:a foaf:name "Bob" . 
-       _:a foaf:mbox <mailto:bob@oldcorp.example.org> .
+       _:a foaf:mbox &lt;mailto:bob@oldcorp.example.org> .
        _:a foaf:knows _:b .
     }
  
-<http://example.org/alice>
+&lt;http://example.org/alice>
     { 
        _:b foaf:name "Alice" . 
-       _:b foaf:mbox <mailto:alice@work.example.org> .
+       _:b foaf:mbox &lt;mailto:alice@work.example.org> .
     }				</script>
 				</pre>
 
@@ -250,27 +250,27 @@
 				<script type="application/trig"># This document contains a same data as the
 previous example.
 
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix dc: <http://purl.org/dc/terms/> .
-@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix dc: &lt;http://purl.org/dc/terms/> .
+@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
 
 # default graph - no {} used.
-<http://example.org/bob> dc:publisher "Bob" . 
-<http://example.org/alice> dc:publisher "Alice" .
+&lt;http://example.org/bob> dc:publisher "Bob" . 
+&lt;http://example.org/alice> dc:publisher "Alice" .
 
 # GRAPH keyword to highlight a named graph
 # Abbreviation of triples using ;
-GRAPH <http://example.org/bob> 
+GRAPH &lt;http://example.org/bob> 
 { 
    [] foaf:name "Bob" ; 
-      foaf:mbox <mailto:bob@oldcorp.example.org> ;
+      foaf:mbox &lt;mailto:bob@oldcorp.example.org> ;
       foaf:knows _:b .
 }
  
-GRAPH <http://example.org/alice>
+GRAPH &lt;http://example.org/alice>
 { 
     _:b foaf:name "Alice" ;
-        foaf:mbox <mailto:alice@work.example.org> 
+        foaf:mbox &lt;mailto:alice@work.example.org> 
 }</script>
                 </pre>
 
@@ -737,26 +737,12 @@
                 triples produced during parsing.  If undefined, the default
                 graph is used.</p>
 
-              <p>The following grammar production clauses set <code
-class="curGraph">curGraph</code>:</p>
-              <ul>
-                <li>
-                  The grammar production clause starting <tt>"GRAPH"</tt> in
-                  rule <tt><a href="#grammar-production-block">block</a></tt>.
-                  <code class="curGraph">curGraph</code> is set to
-                  the RDF term matched by <tt>(iri | BlankNode)</tt> in that
-                  grammar clause.
-                </li>
-
-                <li>
-                  The gramamr production clause <tt>(iri | BlankNode) wrappedGraph</tt>
-                  in rule 
-                <tt><a href="#grammar-production-triplesOrGraph">triplesOrGraph</a></tt>.
-                <code class="curGraph">curGraph</code> is set to
-                  the RDF term matched by <tt>(iri | BlankNode)</tt> in that
-                  grammar clause.
-                </li>
-              </ul>
+              <p>The rule 
+                <tt><a href="#grammar-production-labelOrSubject">labelOrSubject</a></tt>
+                sets both <code class="curGraph">curGraph</code>.
+                and <code class="curSubject">curSubject</code>
+                (only one of these will be used).
+              </p>
 
               <p>The following grammar production clauses set  
                 <code class="curGraph">curGraph</code> to be undefined, indicating the default
@@ -767,21 +753,27 @@
                   The grammar production clause <tt>wrappedGraph</tt> in rule <tt><a href="#grammar-production-block">block</a></tt>.
                 </li>
                 <li>
-                  The grammar production 
-                  <tt>(iri | BlankNode) predicateObjectList '.'</tt>
-                  in rule  <tt><a href="#grammar-production-triplesOrGraph">triplesOrGraph</a></tt>.
-                </li>
-              
-                <li>
                   The grammar production in rule  
                   <tt><a href="#grammar-production-triples2">triples2</a></tt>.
                 </li>
+              </ul>
+
+              <p>
+                The grammar production 
+                <tt>labelOrSubject predicateObjectList '.'</tt>
+                unsets 
+                <code class="curGraph">curGraph</code>
+                before handling <tt>predicateObjectLists</tt>
+                in rule <tt><a href="#grammar-production-triplesOrGraph">triplesOrGraph</a></tt>.
+                </li>
+              
             </section>
             <section>
               <h4>Triple Output</h4>
               <p>
                 Each RDF triple produced is added to <code class="curGraph">curGraph</code>,
-                or the default graph if <code class="curGraph">curGraph</code> is not set at that
+                or the default graph if <code class="curGraph">curGraph</code>
+                is not set at that
                 point in the parsing process.
               </p>
               <p>
--- a/trig/trig-bnf.html	Mon Sep 02 15:58:56 2013 +0100
+++ b/trig/trig-bnf.html	Mon Sep 02 21:20:39 2013 +0100
@@ -6,17 +6,17 @@
     <td>::=</td>
     <td>(<a href='#grammar-production-directive'>directive</a> <code>| </code> <a href='#grammar-production-block'>block</a>)<code class='grammar-star'>*</code></td>
 </tr>
-            <tr id="grammar-production-block" data-grammar-original="[2g] block   ::=   triplesOrGraph| wrappedGraph| triples2| &quot;GRAPH&quot; ( iri | BlankNode ) wrappedGraph" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;triplesOrGraph&#x27;), (&#x27;id&#x27;, &#x27;wrappedGraph&#x27;), (&#x27;id&#x27;, &#x27;triples2&#x27;), (&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;GRAPH&#x27;), (&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;iri&#x27;), (&#x27;id&#x27;, &#x27;BlankNode&#x27;)]), (&#x27;id&#x27;, &#x27;wrappedGraph&#x27;)])])" >
+            <tr id="grammar-production-block" data-grammar-original="[2g] block   ::=   triplesOrGraph| wrappedGraph| triples2| &quot;GRAPH&quot; labelOrSubject wrappedGraph" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;triplesOrGraph&#x27;), (&#x27;id&#x27;, &#x27;wrappedGraph&#x27;), (&#x27;id&#x27;, &#x27;triples2&#x27;), (&#x27;,&#x27;, [(&quot;&#x27;&quot;, &#x27;GRAPH&#x27;), (&#x27;id&#x27;, &#x27;labelOrSubject&#x27;), (&#x27;id&#x27;, &#x27;wrappedGraph&#x27;)])])" >
     <td>[2g]</td>
     <td><code>block</code></td>
     <td>::=</td>
-    <td><a href='#grammar-production-triplesOrGraph'>triplesOrGraph</a> <code>|<br/> </code> <a href='#grammar-production-wrappedGraph'>wrappedGraph</a> <code>|<br/> </code> <a href='#grammar-production-triples2'>triples2</a> <code>|<br/> </code> "<code class='grammar-literal'>GRAPH</code>" (<a href='#grammar-production-iri'>iri</a> <code>| </code> <a href='#grammar-production-BlankNode'>BlankNode</a>) <a href='#grammar-production-wrappedGraph'>wrappedGraph</a></td>
+    <td><a href='#grammar-production-triplesOrGraph'>triplesOrGraph</a> <code>| </code> <a href='#grammar-production-wrappedGraph'>wrappedGraph</a> <code>| </code> <a href='#grammar-production-triples2'>triples2</a> <code>| </code> "<code class='grammar-literal'>GRAPH</code>" <a href='#grammar-production-labelOrSubject'>labelOrSubject</a> <a href='#grammar-production-wrappedGraph'>wrappedGraph</a></td>
 </tr>
-            <tr id="grammar-production-triplesOrGraph" data-grammar-original="[3g] triplesOrGraph   ::=( iri | BlankNode ) ( wrappedGraph | predicateObjectList &#x27;.&#x27; )" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;iri&#x27;), (&#x27;id&#x27;, &#x27;BlankNode&#x27;)]), (&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;wrappedGraph&#x27;), (&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;predicateObjectList&#x27;), (&quot;&#x27;&quot;, &#x27;.&#x27;)])])])" >
+            <tr id="grammar-production-triplesOrGraph" data-grammar-original="[3g] triplesOrGraph   ::=labelOrSubject ( wrappedGraph | predicateObjectList &#x27;.&#x27; )" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;labelOrSubject&#x27;), (&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;wrappedGraph&#x27;), (&#x27;,&#x27;, [(&#x27;id&#x27;, &#x27;predicateObjectList&#x27;), (&quot;&#x27;&quot;, &#x27;.&#x27;)])])])" >
     <td>[3g]</td>
     <td><code>triplesOrGraph</code></td>
     <td>::=</td>
-    <td>(<a href='#grammar-production-iri'>iri</a> <code>| </code> <a href='#grammar-production-BlankNode'>BlankNode</a>) (<a href='#grammar-production-wrappedGraph'>wrappedGraph</a> <code>| </code> <a href='#grammar-production-predicateObjectList'>predicateObjectList</a> '<code class='grammar-literal'>.</code>')</td>
+    <td><a href='#grammar-production-labelOrSubject'>labelOrSubject</a> (<a href='#grammar-production-wrappedGraph'>wrappedGraph</a> <code>| </code> <a href='#grammar-production-predicateObjectList'>predicateObjectList</a> '<code class='grammar-literal'>.</code>')</td>
 </tr>
             <tr id="grammar-production-triples2" data-grammar-original="[4g] triples2   ::=( blankNodePropertyList | collection ) predicateObjectList? &#x27;.&#x27;" data-grammar-expression="(&#x27;,&#x27;, [(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;blankNodePropertyList&#x27;), (&#x27;id&#x27;, &#x27;collection&#x27;)]), (&#x27;?&#x27;, (&#x27;id&#x27;, &#x27;predicateObjectList&#x27;)), (&quot;&#x27;&quot;, &#x27;.&#x27;)])" >
     <td>[4g]</td>
@@ -36,6 +36,12 @@
     <td>::=</td>
     <td><a href='#grammar-production-triples'>triples</a> ('<code class='grammar-literal'>.</code>' <a href='#grammar-production-triplesBlock'>triplesBlock</a>?)?</td>
 </tr>
+            <tr id="grammar-production-labelOrSubject" data-grammar-original="[7g] labelOrSubject ::=( iri | BlankNode )" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;iri&#x27;), (&#x27;id&#x27;, &#x27;BlankNode&#x27;)])" >
+    <td>[7g]</td>
+    <td><code>labelOrSubject</code></td>
+    <td>::=</td>
+    <td><a href='#grammar-production-iri'>iri</a> <code>| </code> <a href='#grammar-production-BlankNode'>BlankNode</a></td>
+</tr>
             <tr id="grammar-production-directive" data-grammar-original="[3] directive ::= prefixID| base | sparqlPrefix | sparqlBase" data-grammar-expression="(&#x27;|&#x27;, [(&#x27;id&#x27;, &#x27;prefixID&#x27;), (&#x27;id&#x27;, &#x27;base&#x27;), (&#x27;id&#x27;, &#x27;sparqlPrefix&#x27;), (&#x27;id&#x27;, &#x27;sparqlBase&#x27;)])" >
     <td>[3]</td>
     <td><code>directive</code></td>
--- a/trig/trig.bnf	Mon Sep 02 15:58:56 2013 +0100
+++ b/trig/trig.bnf	Mon Sep 02 21:20:39 2013 +0100
@@ -3,10 +3,10 @@
 [2g] block   ::=   triplesOrGraph
   | wrappedGraph
   | triples2
-  | "GRAPH" ( iri | BlankNode ) wrappedGraph
+  | "GRAPH" labelOrSubject wrappedGraph
 
 [3g] triplesOrGraph   ::=
-  ( iri | BlankNode ) ( wrappedGraph | predicateObjectList '.' )
+  labelOrSubject ( wrappedGraph | predicateObjectList '.' )
 
 [4g] triples2   ::=
   ( blankNodePropertyList | collection ) predicateObjectList? '.'
@@ -16,6 +16,9 @@
 
 [6g] triplesBlock   ::=   triples ( '.' triplesBlock? )?
 
+[7g] labelOrSubject ::=
+     ( iri | BlankNode )
+
 [3] directive ::= prefixID 
  | base | sparqlPrefix | sparqlBase
 [4] prefixID ::= '@prefix' PNAME_NS IRIREF "."