Revision of Sec. 5: N-Triples moved to first section plys corresponding edits
authorGuus Schreiber <guus.schreiber@vu.nl>
Tue, 18 Feb 2014 01:19:33 +0100
changeset 1949 d678f2f042f5
parent 1948 0c667c9b3ffc
child 1950 def24acb8ad9
Revision of Sec. 5: N-Triples moved to first section plys corresponding edits
rdf-primer/index.html
--- a/rdf-primer/index.html	Mon Feb 17 23:26:16 2014 +0100
+++ b/rdf-primer/index.html	Tue Feb 18 01:19:33 2014 +0100
@@ -157,7 +157,7 @@
     For example, retrieving <code>http://www.example.org/bob#me</code>
     could provide data about Bob, including the fact that he
     knows Alice, as identified by her IRI (an IRI is an "International
-    Resource Identifier"; see <a href="#subsection-IRI">Sec. 3.2</a> for details).
+    Resource Identifier"; see <a href="#section-IRI">Sec. 3.2</a> for details).
     Retrieving Alice's IRI could then provide more data about her, including links
     to other datasets for her friends, interests, etc. A person or
     an automated process can then follow such links and aggregate data about these
@@ -228,13 +228,13 @@
 
     <h2>RDF Data Model</h2>
     
-    <section id="subsection-triple">
+    <section id="section-triple">
 
     <h3>Triples</h3>
     
     <p>RDF allows us to make statements about resources.
-    The format of these statements is simple. It always
-    has the following form:<p>
+    The format of these statements is simple. A statement always
+    has the following structure:<p>
    <pre>
       &lt;subject&gt; &lt;predicate&gt; &lt;object&gt;
     </pre>
@@ -264,7 +264,7 @@
       &lt;Bob&gt; &lt;is a&gt; &lt;person&gt;.
       &lt;Bob&gt; &lt;is a friend of&gt; &lt;Alice&gt;.
       &lt;Bob&gt; &lt;is born on&gt; &lt;the 4th of July 1990&gt;. 
-      &lt;Bob&gt; &lt;is interested in&gt; &lt;the Mona Lisa&gt;.
+turtle      &lt;Bob&gt; &lt;is interested in&gt; &lt;the Mona Lisa&gt;.
       &lt;the Mona Lisa&gt; &lt;was created by&gt; &lt;Leonardo da Vinci&gt;.
       &lt;the video 'La Joconde à Washington'&gt; &lt;is about&gt; &lt;the Mona Lisa&gt;
     </pre>
@@ -311,7 +311,7 @@
     
     </section>
 
-    <section id="subsection-IRI">
+    <section id="section-IRI">
 
     <h3>IRIs</h3>
 
@@ -360,7 +360,7 @@
     
     </section>
 
-    <section id="subsection-literal">
+    <section id="section-literal">
 
       <h3>Literals</h3>
 
@@ -395,7 +395,7 @@
       
     </section>
 
-    <section id="subsection-blank-node">
+    <section id="section-blank-node">
 
       <h3>Blank nodes</h3>
 
@@ -429,7 +429,7 @@
 
     </section>
 
-    <section id="subsection-multiple-graphs">
+    <section id="section-multiple-graphs">
 
       <h3>Multiple graphs</h3>
 
@@ -448,7 +448,7 @@
       at most one unnamed ("default") graph. </p><p> 
 
       <p>For example, the
-      statements in the <a href="#subsection-triple">first example</a>
+      statements in the <a href="#section-triple">first example</a>
       could be grouped in two named
       graphs. A first graph could be provided by a social networking
       site and identified by <code>http://example.org/bob</code>:</p> 
@@ -502,7 +502,7 @@
       <figcaption>Informal graph of the sample dataset</figcaption>
     </figure>
 
-      <p><a href="#subsection-trig">Sec. 5.2</a> provides an example
+      <p><a href="#section-trig">Sec. 5.2</a> provides an example
     of concrete syntax for this graph.</p>
 
     </section>
@@ -682,31 +682,76 @@
 <section>
 <h3>The Turtle family of RDF languages</h3>
 
-    <section id="subsection-turtle">
-
-      <h4>Turtle and N-Triples</h4>
-
-      <p>Turtle [[TURTLE]] provides a syntax for RDF
-      graphs, which is relatively convenient for humans.
-      In its basic form a triple in Turtle looks this:<P>
-
-      <pre class="example">
-&lt;http://example.org/bob#me&gt; &lt;http://xmlns.com/foaf/0.1/knows&gt; &lt;http://example.org/alice#me&gt; .
-      </pre>
+<section id="section-n-triples">
 
-      <p>In Turtle full IRIs are enclosed in angle brackets (<code>&lt;&gt;</code>);
-      the period signals the
-      end of the triple. This example represents concrete syntax for
-      the second triple in <a href="#example-1">Example 1</a>.</p> 
+<h4>N-Triples</h4>
 
-      <p>In addition to this basic syntax, Turtle
-      introduces a number of syntax shortcuts, such as
-      support for namespaces, lists and shorthands for datatyped 
-      literals. Turtle provides a trade-off between ease of
-      writing, ease of parsing and readability. Our 
-      <a href="#example-1">first example</a> (in slightly
-      extended form) can be
-      represented in Turtle as follows:</p>
+<p>N-Triples [[N-TRIPLES]]  provides a simple line-based, plain text way for serializing RDF
+graphs. Each line represents an RDF triple. Our 
+<a href="#example-1">first example</a> (in slightly
+extended form) can be represented in N-Triples as follows:</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>
+
+<p>Full IRIs are enclosed in angle brackets
+(<code>&lt;&gt;</code>). The period at the end of the line signals the
+end of the triple.</p>
+
+<p>In line 3 we see an example of a literal, in this case a date. The
+datatype is appended to the literal through a <code>^^</code> delimiter. The date
+representation follows the conventions of the XML Schema datatype
+<a href="http://www.w3.org/TR/xmlschema11-2/#date">date</a>.</p>
+
+<p>Because string literals are so ubiquitous N-Triples allows the user to
+omit the datatype when writing a string literal. Thus, <code>"Mona
+Lisa"</code> in line 5 is equivalent to 
+<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> 
+
+<p class="note">For technical reasons the datatype of language-tagged
+strings is not <code>xsd:string</code> but
+<code>rdf:langString</code>. The
+datatype of language-tagged strings is never specified explicitly.</p>
+
+<p>The figure below shows the triples resulting from the example:</p>
+
+    <figure id="fig4">
+      <img class="graph" src="example-graph-iris.jpg" 
+                alt="Graph of the sample triples">
+      <figcaption>Graph of the N-Triples example</figcaption>
+    </figure>
+
+<p>Note that the seven lines in the N-Triples example correspond to the seven
+arcs in the diagram above.</p>
+
+<p>N-Triples is often used for exchanging large amounts of RDF and for
+processing large RDF graphs with line-oriented text processing
+tools. </p>
+
+</section>
+
+<section id="section-turtle">
+<h4>Turtle</h4>
+
+<p>Turtle [[TURTLE]] is an <strong>extension of N-Triples</strong>.
+In addition to the basic N-Triples syntax, Turtle
+introduces a number of syntax shortcuts, such as
+support for namespaces, lists and shorthands for datatyped 
+literals. Turtle provides a trade-off between ease of
+writing, ease of parsing and readability. The graph shown in
+<a href="#fig4">Fig.&nbsp;</a> can be
+represented in Turtle as follows:</p>
 
       <pre class="example" id="turtle-example">
 01    BASE   &lt;http://example.org/&gt;
@@ -730,7 +775,8 @@
 19        dcterms:subject wd:Q12418 .
 </pre>
 
-<p>Lines 1-6 contain a number of directives which provide shorthands for
+<p>The Turtle example is logically equivalent to the <a href="n-triples-example">N-Triples</a>
+example. Lines 1-6 contain a number of directives which provide shorthands for
 writing down IRIs. Relative IRIs (such as <code>bob#me</code> on line 8) are 
 resolved agains a base IRI, specified here in line 1.
 Lines 2-6 define IRI prefixes (such as <code>foaf:</code>), which  can
@@ -755,57 +801,6 @@
 The <code>a</code> shorthand is intended to match the human
 intuition about <code>rdf:type</code>. </p>
 
-<p>In line 11 we see an example of a literal, in this case a date. The
-datatype is appended to the literal through a <code>^^</code> delimiter. The date
-representation follows the conventions of the XML Schema datatype
-<a href="http://www.w3.org/TR/xmlschema11-2/#date">date</a>.</p>
-
-<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>. 
-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> 
-
-<p class="note">For technical reasons the datatype of language-tagged
-strings is not <code>xsd:string</code> but
-<code>rdf:langString</code>. The
-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>
-
-<h5>N-Triples</h5>
-
-<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">
-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 amounts of RDF and for
-processing large RDF graphs with line-oriented text processing tools. </p>
-
 <h5>Representation of blank nodes</h5>
 
 <p>Below is sample Turtle syntax for blank nodes, using the
@@ -827,21 +822,21 @@
 
 </section>
 
-    <section id="subsection-trig">
-
-      <h4>TriG and N-Quads</h4>
+<section id="section-trig">
 
-      <p>The syntax of Turtle supports only the specification of single
-      graphs without a means for "naming" them. TriG [[TRIG]] is an
-      extension to the Turtle syntax enabling the specification of
-      multiple graphs.</p>
+<h4>TriG</h4>
+
+<p>The syntax of Turtle supports only the specification of single
+graphs without a means for "naming" them. TriG [[TRIG]] is an
+<strong>extension of Turtle</strong> enabling the specification of
+multiple graphs.</p>
 
 <p class="note">In RDF 1.1 any legal Turtle document is a legal TriG
 document. One could view it as one language. The names Turtle and TriG
 still exist for historical reasons.</p> 
 
-      <p>The <a href="#subsection-multiple-graphs">multiple-graphs version of our example</a>
-      can be specified in TriG as follows:</p>
+<p>The <a href="#section-multiple-graphs">multiple-graphs version of our example</a>
+can be specified in TriG as follows:</p>
 
       <pre class="example" id="trig-example">
 01    BASE   &lt;http://example.org/&gt; 
@@ -896,8 +891,11 @@
                 alt="Triples resulting from the TriG example">
       <figcaption>Triples resulting from the TriG example</figcaption>
     </figure>
+</section>
 
-<h5>N-Quads</h5>
+<section id="section-n-quads">
+
+<h4>N-Quads</h5>
 
 <p>N-Quads [[N-QUADS]] is a simple extension to N-Triples to enable the exchange of RDF
 datasets. N-Quads allows one to add a fourth element to a line, capturing
@@ -917,7 +915,12 @@
 </pre>
 
 <p>The nine lines in the N-Quads example correspond to the nine 
-arcs in the graph diagram above. </p>
+arcs in <a href="#fig5>Fig.&nbsp;5</a>. Lines 1-7 represent quads, where the first
+element constitutes the graph IRI. The part of the quad after the
+graph IRI specifies the
+subject, predicate and object of the statement, following the syntactic
+conventions of N-Triples. Lines 8 and 9 represent the statements in the unnamed (default)
+graph, which lack a foruth element and are thus regular triples. </p>
 
 <p><p>Like N-Triples, N-Quads is typically used for exchanging large RDF datasets and for
 processing RDF with line-oriented text processing tools. </p>
@@ -983,7 +986,7 @@
 
 </section>
 
-    <section id="subsection-other-syntaxes">
+    <section id="section-other-syntaxes">
 
     <h3>Other concrete syntaxes for RDF</h3>