Moving some N-Triples stuff around
authorGavin Carothers <gavin@carothers.name>
Mon, 02 Apr 2012 08:08:35 -0700
changeset 255 dc2c6425ca8a
parent 250 a39a922e1a50
child 256 316331505ff1
Moving some N-Triples stuff around
rdf-turtle/index.html
--- a/rdf-turtle/index.html	Fri Mar 30 12:52:44 2012 -0700
+++ b/rdf-turtle/index.html	Mon Apr 02 08:08:35 2012 -0700
@@ -158,7 +158,7 @@
 			</p>
 
 			<p>
-			  Turtle and N-Triples documents are textual representation of a RDF graphs.
+			  A Turtle or N-Triple document is a textual representations of a RDF graph. The following Turtle document describes the relationship between Green Goblin and Spiderman.
 			</p>
 			<pre class="example"><script type="text/turtle">@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@@ -180,29 +180,12 @@
 			  The two grammars share production and terminal names where possible.
 			  Likewise, the N-Triples grammar re-uses some productions and terminals from Turtle.
 			</p>
+			  Comments in either language may be given after a <code>#</code> that is not part of another lexical token and continue to the end of the line.
 
 			<p>
 			  The <a href="#sec-grammar">Turtle Grammar</a> and <a href="#sec-parsing">Parsing</a> sections define the construction of an RDF graph from a Turtle document.
-			  The RDF graph represented by an N-Triples document contains exactly each triple matching <a href="#prod-ntriples-triple">N-Triples <code>triple</code> production</a>.
-			</p>
-
-		  <p>
-			  An N-Triples document contains no parsing directives.
-			  Comments in either language may be given after a <code>#</code> that is not part of another lexical token and continue to the end of the line.
 			</p>
 
-			<p>
-			  N-Triples triples are a sequence of RDF terms representing the subject, predicate and object of an RDF Triple. This sequence is terminated by a '.' and a new line (optional at the end of a document).
-			</p>
-
-			<pre class="example"><script type="text/plain">
-_:subject1 <http://an.example/predicate1> "object1" .
-_:subject2 <http://an.example/predicate2> "object2" .
-</script></pre>
-
-			<p>
-			  N-Triples triples are also Turtle triples, but Turtle includes other <a href="#terms">representations of RDF Terms</a> and <a href="#groups">abbreviations of RDF Triples</a>.
-			</p>
 
 	</section>
 	<section id="terms">
@@ -259,7 +242,7 @@
 				  <p>
 				  	To write <code>http://www.perceive.net/schemas/relationship/enemyOf</code> using a prefixed name: 
 				  	<ol>
-				  		<li>Define a prefix label for the vocabulary IRI <code>http://www.perceive.net/schemas/relationship/</code> as <code>@prefix rel: &lt;http://www.perceive.net/schemas/relationship/> .</code> </li>
+				  		<li>Define a prefix label for the vocabulary IRI <code>http://www.perceive.net/schemas/relationship/</code> as <code>rel</code>
 			  			<li>Then write <code>rel:enemyOf</code> which is equalivate to writing <code>&lt;http://www.perceive.net/schemas/relationship/enemyOf></code></li>
 			  		</ol>
 
@@ -306,19 +289,27 @@
 			<section id="literals">
 				<h3>RDF Literals</h3>
 
+				<p><a href="../rdf-concepts/index.html#dfn-literal">Literals</a> are used to identify values such as strings, numbers, dates.</p>
+
+				<pre class="example"><script type="text/turtle">@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://example.org/#green-goblin> foaf:name "Green Goblin" .
+
+<http://example.org/#spiderman> foaf:name "Spiderman" .</script></pre>
+
+
 				<p>
-				  Literals in N-Triples have a lexical form followed by a bare langugae tag, a datatype IRI, or neither.
+				  Literals in Turtle N-Triples have a lexical form followed by a language tag, a datatype IRI, or neither.
 				  The representation of the lexical form consists of a delimiting <code>"</code>, a sequence of characters matching the regular expression <code>[^\"\\\n\r]</code> or <a href="#numeric">numeric escape sequence</a> or <a href="#string">string escape sequence</a>, and a final delimiting <code>"</code>.
-				  The corresponding <a href="../rdf-concepts/index.html#dfn-lexical-form">RDF lexical form</a> is the characters between the <code>""</code>s, after processing the escape sequences.
+				  The corresponding <a href="../rdf-concepts/index.html#dfn-lexical-form">RDF lexical form</a> is the characters between the <code>""</code>s, after processing any escape sequences.
 				  If present, the <a href="../rdf-concepts/index.html#dfn-language-tagged-string">language tag</a> is preceded by a <code>@</code>.
-				  The datatype of literals with a language tag is <code>rdf:langString</code>, though this datatype is not written in N-Triples or Turtle.
-				  The datatype IRI in Turtle may be written in any valid IRI representation.
+				  The datatype IRI in Turtle may be written using either an <a href="#iri-summary">absolute IRI, a realitive IRI or prefixed name</a>.
 				  If there is no language tag, there may be a <a href="../rdf-concepts/index.html#dfn-datatype-URI">datatype IRI</a>, preceeded by <code>^^</code>.
 				  If there is no datatype IRI and no language tag, the datatype is <code>xsd:string</code>.
 				</p>
 
 				<section id="turtle-literals">
-				  <h3>Alternative Lexical Representations in Turtle</h3>
+				  <h3>Other Lexical Representations in Turtle</h3>
 				<p>
 				  Turtle literals include N-Triples literals, as well as three other representations of the lexical form:
 				</p>
@@ -327,12 +318,9 @@
 				  <li>Literals delimited by <code>"""</code>, which permit up to two <code>"</code>s, as well as <code>\r</code> and <code>\n</code>.</li>
 				  <li>Literals delimited by <code>'''</code>, which permit up to two <code>'</code>s, as well as <code>\r</code> and <code>\n</code>.</li>
 				</ul>
-
-				<p>
-				  Turtle datatype IRIs may be represented by <a href="#iri-summary">any valid IRI form</a>.
-				</p>
-
-				<pre class="example"><script type="text/plain">
+				<pre class="example"><script type="text/turtle">@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix show: <http://example.org/vocab/show/> .
+				
 show:218 rdfs:label "That Seventies Show"^^xsd:string .            # literal with XML Schema string datatype
 show:218 rdfs:label "That Seventies Show"^^<http://www.w3.org/2001/XMLSchema#string> . # same as above
 show:218 rdfs:label "That Seventies Show" .                                            # same again
@@ -342,6 +330,11 @@
 show:218 show:blurb '''This is a
 multi-line, single-quoted literal.''' .                            # literal with embedded new line
 </script></pre>
+
+				<p>
+				  Turtle datatype IRIs may be represented by <a href="#iri-summary">any valid IRI form</a>.
+				</p>
+
 				</section>
 				<section id="abbrev">
 				<h3 >Abbreviating Common Datatypes in Turtle</h3>
@@ -354,7 +347,6 @@
 				  <li style="padding-top: 1ex;">
 				    Arbitrary-precision decimals may be written as an optional sign, zero or more digits, a decimal point and one or more digits. Decimals match the regular expression "<code>[+-]?[0-9]*\.[0-9]+</code>".
 				  </li>
-
 				  <li style="padding-top: 1ex;">
 				    Double-precision floating point values may be written as an optionally signed mantissa with an optional decimal point, the letter "e" or "E", and an optionally signed integer exponent.
 				    The exponent matches the regular expression "<code>[+-]?[0-9]+</code>" and the mantissa one of these regular expressions: "<code>[+-]?[0-9]+\.[0-9]+</code>", "<code>[+-]?\.[0-9]+</code>" or "<code>[+-]?[0-9]</code>".
@@ -1146,6 +1138,25 @@
         <h2>N-Triples</h2>
         <p>This section defines an easy to parse line-based subset of Turtle named N-Triples.</p>
         <p>The syntax is an improved version of N-Triples as originally defined in the RDF Test Cases [[!RDF-TESTCASES]] document. Its original intent was for writing test cases, but it has proven to be popular as a dump format for RDF data.</p>
+
+        		  <p>
+			  An N-Triples document contains no parsing directives.
+			</p>
+
+			<p>
+			  N-Triples triples are a sequence of RDF terms representing the subject, predicate and object of an RDF Triple. This sequence is terminated by a '.' and a new line (optional at the end of a document).
+			</p>
+
+			<pre class="example"><script type="text/plain">
+_:subject1 <http://an.example/predicate1> "object1" .
+_:subject2 <http://an.example/predicate2> "object2" .
+</script></pre>
+
+			<p>
+			  N-Triples triples are also Turtle triples, but Turtle includes other <a href="#terms">representations of RDF Terms</a> and <a href="#groups">abbreviations of RDF Triples</a>.
+			</p>
+			<p>			  The RDF graph represented by an N-Triples document contains exactly each triple matching <a href="#prod-ntriples-triple">N-Triples <code>triple</code> production</a>.
+
         <section id="n-triples-mediatype">
 			<h2>Media Type and Content Encoding</h2>