N-Triples example in Turtle section
authorGuus Schreiber <guus.schreiber@vu.nl>
Mon, 17 Feb 2014 00:08:47 +0100
changeset 1920 5974501f29a8
parent 1919 ec6fbb5c2e08
child 1921 3bd20402f0bf
N-Triples example in Turtle section
rdf-primer/index.html
--- a/rdf-primer/index.html	Sun Feb 16 23:30:46 2014 +0100
+++ b/rdf-primer/index.html	Mon Feb 17 00:08:47 2014 +0100
@@ -661,9 +661,6 @@
 
     <h2>Writing RDF graphs</h2>
 
-<p class="issue">We plan to include also one annotated JSON-LD example in this
-section.</p>
-
     <p>Many different concrete syntaxes exist for writing down RDF
     graphs. However, different ways of writing down the same graph lead
     to exactly the same triples, and are thus logically equivalent. </p>
@@ -680,7 +677,7 @@
 
     <section id="subsection-turtle">
 
-      <h3>Turtle</h3>
+      <h3>Turtle and N-Triples</h3>
 
       <p>Turtle [[TURTLE]] provides a syntax for RDF
       graphs, which is relatively convenient for humans.
@@ -761,17 +758,8 @@
 <p>Because string literals are so ubiquitous Turtle allows the user to
 omit the datatype when writing a string literal. Thus, <code>"Mona
 Lisa"</code> in line 15 is equivalent to 
-<code>"Mona Lisa"^^xsd:string</code>. </p>
-
-<p>The figure below shows the triples resulting from this example.</p>
-
-    <figure id="fig4">
-      <img class="graph" src="example-graph-iris.jpg" 
-                alt="Graph of the sample triples">
-      <figcaption>Graph of the Turtle example</figcaption>
-    </figure>
-
-<p>In case of language-tagged strings the tag
+<code>"Mona Lisa"^^xsd:string</code>. 
+In case of language-tagged strings the tag
 appears directly after the string, separated by a <code>@</code>
 symbol, e.g. <code>"La Joconde"@fr</code> (the French name of the Mona
 Lisa).</p> 
@@ -782,6 +770,39 @@
 datatype of language-tagged strings is never specified explicitly
 in Turtle.</p>
 
+<p>The figure below shows the triples resulting from this example:</p>
+
+    <figure id="fig4">
+      <img class="graph" src="example-graph-iris.jpg" 
+                alt="Graph of the sample triples">
+      <figcaption>Graph of the Turtle example</figcaption>
+    </figure>
+
+<h4>N-Triples</h4>
+
+<p>N-Triples [[N-TRIPLES]]  is a subset of Turtle that 
+provides a simple line-based, plain text way for serializing RDF
+graphs. Each line represents an RDF triple. The N-Triples version of
+the example above look like this:</p>
+
+<pre class="example" id="n-triples-example" style="font-size: 80%">
+01    &lt;http://example.org/bob#me&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://xmlns.com/foaf/0.1/Person&gt; .
+02    &lt;http://example.org/bob#me&gt; &lt;http://xmlns.com/foaf/0.1/knows&gt; &lt;http://example.org/alice#me&gt; .
+03    &lt;http://example.org/bob#me&gt; &lt;http://schema.org/birthDate&gt; "1990-07-04"^^&lt;http://www.w3.org/2001/XMLSchema#date&gt; .
+04    &lt;http://example.org/bob#me&gt; &lt;http://xmlns.com/foaf/0.1/topic_interest&gt; &lt;http://www.wikidata.org/entity/Q12418&gt; .
+05    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/title&gt; "Mona Lisa" .
+06    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/creator&gt; &lt;http://dbpedia.org/resource/Leonardo_da_Vinci&gt; .
+07    &lt;http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619&gt; &lt;http://purl.org/dc/terms/subject&gt; &lt;http://www.wikidata.org/entity/Q12418&gt; .
+</pre>
+
+<p>Note that the seven lines in the example correspond to the seven
+arcs in the diagram above.</p>
+
+<p>N-Triples is often used for exchanging large RDF datasets and for
+processing large RDF graphs with line-oriented text processing tools. </p>
+
+<h4>Representation of blank nodes</h4>
+
 <p>Below is sample Turtle syntax for blank nodes, using the
 earlier cypress tree example:</p>  
 
@@ -1446,23 +1467,6 @@
     </section>
 
 
-<section id="subsection-ntriples">
-
-      <h3>N-Triples</h3>
-
-      <p>Single-graph example: </p>
-
-      <pre class="example" id="n-triples-example">
-01    &lt;http://example.org/bob#me&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://xmlns.com/foaf/0.1/Person&gt; .
-02    &lt;http://example.org/bob#me&gt; &lt;http://xmlns.com/foaf/0.1/knows&gt; &lt;http://example.org/alice#me&gt; .
-03    &lt;http://example.org/bob#me&gt; &lt;http://schema.org/birthDate&gt; "1990-07-04"^^&lt;http://www.w3.org/2001/XMLSchema#date&gt; .
-04    &lt;http://example.org/bob#me&gt; &lt;http://xmlns.com/foaf/0.1/topic_interest&gt; &lt;http://www.wikidata.org/entity/Q12418&gt; .
-05    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/title&gt; "Mona Lisa" .
-06    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/creator&gt; &lt;http://dbpedia.org/resource/Leonardo_da_Vinci&gt; .
-07    &lt;http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619&gt; &lt;http://purl.org/dc/terms/subject&gt; &lt;http://www.wikidata.org/entity/Q12418&gt; .
-      </pre>
-
-     </section>
 
     <section id="subsection-nquads">