~ formalized Predicate Object Lists in Turtle and Collections in Turtle
authorEric Prud'hommeaux <eric@w3.org>
Wed, 28 Mar 2012 00:04:30 -0400
changeset 246 d18c369f0e60
parent 245 868931a27ef0
child 247 e9c09e1e985e
~ formalized Predicate Object Lists in Turtle and Collections in Turtle
rdf-turtle/index.html
--- a/rdf-turtle/index.html	Mon Mar 26 12:37:26 2012 -0700
+++ b/rdf-turtle/index.html	Wed Mar 28 00:04:30 2012 -0400
@@ -486,11 +486,11 @@
 				  <h3>Nesting Unlabeled Blank Nodes in Turtle</h3>
 				  <p>
 				    In Turtle, fresh RDF blank nodes are also allocated when matching the production <a href="#prod-turtle2-blankNodePropertyList">blankNodePropertyList</a> and the terminal <a href="#term-turtle2-ANON">ANON</a>.
-				    Both of these may appear in the subject or object position of a triple.
+				    Both of these may appear in the <a href="#prod-turtle2-subject">subject</a> or <a href="#prod-turtle2-object">object</a> position of a triple (see the Turtle Grammar).
 				    That subject or object is a fresh RDF blank node.
 				    This blank node also serves as the subject of the triples produced by matching the <a href="#prod-turtle2-predicateObjectList">predicateObjectList</a> production embedded in a blankNodePropertyList.
 				    The generation of these triples is described below in <a href="#groups">Predicate Object Lists in Turtle</a>.
-				    Blank nodes are also allocated for <a href="#collections">Turtle Collections</a> (below).
+				    Blank nodes are also allocated for <a href="#collections">Collections in Turtle</a> (below).
 				  </p>
 				  <pre class="example"><script type="text/plain">
 # Someone knows someone else, who has the name "Bob".
@@ -536,37 +536,73 @@
 			<section  id="groups">
 				<h3>Predicate Object Lists in Turtle</h3>
 
-				<p>The <code>,</code> symbol may be used to repeat the subject and
-				predicate of triples that only differ in the object RDF term.</p>
+				<p>
+				  The <a href="#prod-turtle2-objectList">objectList production</a> matches a series of objects, separated by <code>,</code>, following a subject and predicate.
+				  This expresses a series of RDF Triples with that subject and predicate and a each object allocated to one triple.
+				  Thus, the <code>,</code> symbol is used to repeat the subject and predicate of triples that only differ in the object RDF term.</p>
 				<pre class="example"><script type="text/plain">
-# this is not a complete turtle document
-:subject :predicate :object1 ,
-	:object2 .
-# creates two triples, the last triple is :subject :predicate :object2 .
+<subject> <predicate> <object1> ,
+	              <object2> .
+# creates two triples; the last triple is <subject> <predicate> <object2> .
 				</script></pre>
 
-				<p>The <code>;</code> symbol may be used to repeat the subject of
-				triples that vary only in predicate and object RDF terms.</p>
+				<p>
+				  The <a href="#prod-turtle2-predicateObjectList">predicateObjectList production</a> matches a series of predicates and objects, separated by <code>;</code>, following a subject.
+				  This expresses a series of RDF Triples with that subject and a each predicate and object allocated to one triple.
+				  Thus, the <code>;</code> symbol is used to repeat the subject of triples that vary only in predicate and object RDF terms.</p>
 				<pre class="example"><script type="text/plain">
-# this is not a complete turtle document
-:subject :predicate1 :obj1 ;
-:predicate2 :obj2 .
+<subject> <predicate1> <obj1> ;
+          <predicate2> <obj2> .
 # creates two triples, the last triple is :subject :predicate2 :obj2 .
 				</script></pre>
 
+				<div class="note">
+				  <p>
+				    The use of <a href="#prod-turtle2-predicateObjectList">predicateObjectList</a> within a <a href="#prod-turtle2-blankNodePropertyList">blankNodePropertyList</a> is a common idiom for representing a series of properties of a node.
+				    The Turtle grammar allows <a href="#prod-turtle2-blankNodePropertyList">blankNodePropertyList</a>s to be nested.
+				    In this case, each inner <code>[</code> establishes a new subject blank node which reverts to the outer node with the <code>]</code>.
+				  </p>
+				  <div style="float:left;">
+				    <p class="idlAttrName" style="padding-left:2em;">Abbreviated Turtle:</p>
+				<pre class="example"><script type="text/plain">
+[ foaf:name "Alice" ] foaf:knows [
+    foaf:name "Bob" ;
+    foaf:knows [
+        foaf:name "Eve" ] ;
+    foaf:mbox <[email protected]> ] .
+				</script></pre>
+			      </div>
+				  <div style="float:left;">
+				    <p class="idlAttrName" style="padding-left:2em;">Corresponding N-Triples:</p>
+				<pre class="example"><script type="text/plain">
+_:a <http://xmlns.com/foaf/0.1/name> "Alice" .
+_:a <http://xmlns.com/foaf/0.1/knows> _:b .
+_:b <http://xmlns.com/foaf/0.1/name> "Bob" .
+_:b <http://xmlns.com/foaf/0.1/knows> _:c .
+_:c <http://xmlns.com/foaf/0.1/name> "Eve" .
+_:b <http://xmlns.com/foaf/0.1/mbox> <[email protected]> .
+				</script></pre>
+			        </div>
+				<div style="clear:both;"
+				</div>
+
+
 				</section>
 				<section id="collections">
-				<h3>Turtle Collections</h3>
+				<h3>Collections in Turtle</h3>
 
-				<p>An RDF Collection may be abbreviated using a sequence of
-				RDF Terms enclosed in <code>( )</code> brackets.  Whitespace may
-				be used to separate them, as usual.  This format provides a
-				blank node at the start of RDF Collection which may be used
-				in further abbreviations.
+				<p>
+				  RDF provides a <a href="http://www.w3.org/TR/rdf-mt/#collections">Collection</a> [[RDF-MT]] structure for lists of RDF nodes.
+				  The Turtle syntax for Collections is a possibly empty list of RDF terms enclosed by <code>()</code>.
+				  This collection represents an <code>rdf:first</code>/<code>rdf:rest</code> list structure with the sequence of objects of the <code>rdf:first</code> statements being the order of the terms enclosed by <code>()</code>.
+				</p>
+
+				<p>
+				  The <code>(…)</code> syntax MUST appear in the <a href="#prod-turtle2-subject">subject</a> or <a href="#prod-turtle2-object">object</a> position of a triple (see the Turtle Grammar).
+				  The blank node at the head of the list is the subject or object of the containing triple.
 				</p>
 
 				<pre class="example"><script type="text/turtle">
-# this is a complete turtle document
 @prefix : <http://example.org/foo> .
 # the object of this triple is the RDF collection blank node
 :subject :predicate ( :a :b :c ) .
@@ -574,6 +610,7 @@
 # an empty collection value - rdf:nil
 :subject :predicate2 () .
 				</script></pre>
+
 			</section>
 		</section>
 		<!-- section id="sec-syntax">