N-Triples and N-Quads examples included in Sec. 5
authorGuus Schreiber <guus.schreiber@vu.nl>
Mon, 17 Feb 2014 01:08:20 +0100
changeset 1921 3bd20402f0bf
parent 1920 5974501f29a8
child 1922 80333b8c7b3a
N-Triples and N-Quads examples included in Sec. 5
rdf-primer/index.html
--- a/rdf-primer/index.html	Mon Feb 17 00:08:47 2014 +0100
+++ b/rdf-primer/index.html	Mon Feb 17 01:08:20 2014 +0100
@@ -502,7 +502,7 @@
     </figure>
 
       <p><a href="#subsection-trig">Sec. 5.2</a> provides an example
-    of concrete syntax for the graph in <a href="#fig3">Fig.&nbsp;3</a>.</p>
+    of concrete syntax for this graph.</p>
 
     </section>
 
@@ -665,19 +665,25 @@
     graphs. However, different ways of writing down the same graph lead
     to exactly the same triples, and are thus logically equivalent. </p>
 
-    <p>In the next two
+    <p>In this section we introduce the Turtle family of RDF languages
+    (Turtle/N-Triples and TriG/N-Quads) and the JSON-based RDF syntax
+    JSON-LD. Two other RDF syntaxes, RDFa (for HTML and XML embedding)
+    and RDF/XML, are briefly described next two 
     subsections we show RDF syntax examples using the Turtle and Trig
     language, because these two languages are best suited for human
     consumption. The final subsection lists the other RDF syntaxes,
-    which include RDFa (for HTML and XML embedding), JSON-LD (JSON-based syntax),
+    which include RDFa, JSON-LD (JSON-based syntax),
     N-Triples/N-Quads (line-based exchange formats) and RDF/XML. In
     <a href="#section-other-syntaxes">Appendix C</a> the
     reader can find, for each RDF syntax,
     corresponding examples of the ones in this section. </p>
 
+<section>
+<h3>The Turtle family of RDF languages</h3>
+
     <section id="subsection-turtle">
 
-      <h3>Turtle and N-Triples</h3>
+      <h4>Turtle and N-Triples</h4>
 
       <p>Turtle [[TURTLE]] provides a syntax for RDF
       graphs, which is relatively convenient for humans.
@@ -692,8 +698,6 @@
       end of the triple. This example represents concrete syntax for
       the second triple in <a href="#example-1">Example 1</a>.</p> 
 
-<p class="issue">We should explicitly introduce N-Triples here</p>
-
       <p>In addition to this basic syntax, Turtle
       introduces a number of syntax shortcuts, such as
       support for namespaces, lists and shorthands for datatyped 
@@ -778,14 +782,14 @@
       <figcaption>Graph of the Turtle example</figcaption>
     </figure>
 
-<h4>N-Triples</h4>
+<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" style="font-size: 80%">
+<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; .
@@ -798,10 +802,10 @@
 <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
+<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>
 
-<h4>Representation of blank nodes</h4>
+<h5>Representation of blank nodes</h5>
 
 <p>Below is sample Turtle syntax for blank nodes, using the
 earlier cypress tree example:</p>  
@@ -824,7 +828,7 @@
 
     <section id="subsection-trig">
 
-      <h3>TriG</h3>
+      <h4>TriG and N-Quads</h4>
 
       <p>The syntax of Turtle supports only the specification of single
       graphs without a means for "naming" them. TriG [[TRIG]] is an
@@ -892,20 +896,66 @@
       <figcaption>Triples resulting from the TriG example</figcaption>
     </figure>
 
-    </section>
+<h5>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
+the graph IRI of the triple described on that line.  Here is the
+N-Quads version of the TriG example above:</p>
+
+<pre class="example" id="n-quads-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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&gt; .
+05    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/title&gt; "Mona Lisa" &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
+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; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&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; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
+08    &lt;http://example.org/bob&gt; &lt;http://purl.org/dc/terms/publisher&gt; &lt;http://example.org&gt; .
+09    &lt;http://example.org/bob&gt; &lt;http://purl.org/dc/terms/rights&gt; &lt;http://creativecommons.org/licenses/by/3.0/&gt; .
+</pre>
+
+<p>The nine lines in the N-Quads example correspond to the nine 
+arcs in the graph diagram above. </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>
+
+<p class="issue">Include a Note that N-Quads is *not* a subset of TriG?</p>
+      
+</section>
+</section>
+
+<section>
+<h3>JSON-LD</h3>
+
+      <p class="note">Readers not familiar with JSON should skip this section.</p>
+
+      <p>JSON-LD [[JSON-LD]]  
+      provides a JSON syntax for RDF graphs and datasets.
+      JSON-LD can be used to transform JSON documents to RDF with
+      minimal changes. JSON-LD offers universal identifiers for
+      JSON objects, a mechanism in which a JSON document can refer to 
+      an object described in another JSON document elsewhere on the
+      Web, as well as datatype and language handling. JSON-LD
+      also provides a way to serialize RDF datasets 
+      through the use of the <code>@graph</code> keyword. </p>
+
+      <p>The JSON-LD example encodes the graph of <a
+      href=:#fig4">Fig.&nbsp;4</a>:</p>
+
+<p class="issue">TODO: include and annotate JSON-LD example.</p>
+      
+
+</section>
 
     <section id="subsection-other-syntaxes">
 
     <h3>Other concrete syntaxes for RDF</h3>
 
-    <p>Next to Turtle/TriG there are a number of other concrete syntaxes
-    for RDF data. These syntaxes were developed to cater to specific
-    application and/or usage needs. The examples given for each of
-    these syntaxes correspond to the same graph (i.e., the same set of
-    triples) as the Turtle example (in the case of a single graph, see <a
-    href="#fig4">Fig.&nbsp;4</a>) or the TriG example
-    (in the case of multiple graphs, see <a
-    href="#fig5">Fig.&nbsp;5</a>). </p>
+    <p>Next to the Turtle family of languages and JSON-LD there are two other concrete syntaxes
+    for RDF data: RDFa and RDF/XML. These syntaxes were developed to cater to specific
+    application and/or usage needs: </p>
 
     <dl>
       <dt>RDFa</dt>
@@ -917,38 +967,10 @@
       <a href="http://schema.org">schema.org</a> 
       and <a
       href="https://support.google.com/webmasters/answer/99170?hl=en">Rich
-      Snippets</a>). 
+      Snippets</a>). <a href="#appendix-rdfa">Appendix C.1</a>
+      provides an annotated RDFa example.
       </dd>
 
-      <dt>JSON-LD</dt>
-      <dd>JSON-LD [[JSON-LD]] (<a href="#json-ld-example-single">single-graph
-      example</a>, <a href="#json-ld-example-multiple">multiple-graphs example</a>)  
-      provides a JSON syntax for RDF graphs and datasets.
-      JSON-LD can be used to transform JSON documents to RDF with
-      minimal changes. JSON-LD offers universal identifiers for
-      JSON objects, a mechanism in which a JSON document can refer to 
-      an object described in another JSON document elsewhere on the
-      Web, as well as datatype and language handling. JSON-LD
-      also provides a way to serialize RDF datasets 
-      through the use of the <code>@graph</code> keyword. </dd>
-
-      <dt>N-Triples</dt>
-      <dd>N-Triples [[N-TRIPLES]] ( <a
-      href="#n-triples-example">single-graph example</a>)
-      provides a simple line-based, plain text way for serializing RDF
-      graphs. Each line represents 
-      an RDF triple. Its subject, predicate and object are separated
-      by white space. N-Triples is often used for RDF examples,
-      exchanging large RDF datasets, and processing large RDF graphs 
-      with line-oriented text processing tools. </dd>
-
-      <dt>N-Quads</dt>
-      <dd>N-Quads [[N-QUADS]] (<a href="#n-quads-example">multiple-graphs example</a>) is
-      a simple extension to N-Triples enabling the exchange of RDF
-      datasets. N-Quads adds a fourth 
-      element to each line, capturing the graph IRI of the triple
-      described on that line. </dd>
-
       <dt>RDF/XML</dt>
       <dd>RDF/XML [[RDF-SYNTAX-GRAMMAR]] (<a
       href="#rdf-xml-example">single-graph example</a>)
@@ -956,7 +978,10 @@
       graphs. When RDF was original developed in the late 1990s, this was its 
       only syntax, and some people still call this syntax "RDF". In 2001, a 
       precursor to Turtle called "N3" was proposed, and gradually the other 
-      syntaxes listed here have been adopted and standardizedR. </dd>
+      syntaxes listed here have been adopted and standardizedR.
+      <a href="#appendix-rdfxml">Appendix C.2</a>
+      provides an annotated RDFa example.
+      </dd>
    </dl>
 
    <p>For more information about these syntaxes consult the references.</p>
@@ -1161,7 +1186,7 @@
 corresponding examples for two other RDF syntaxes, namely RDFa and
 RDF/XML. Also, more elaborate examples of JSON-LD are included.</p>
 
-<section id="subsection-rdfa"> 
+<section id="appendix-rdfa"> 
 <h3>RDFa</h3>
 
 <p>RDFa is an RDF syntax for encoding RDF
@@ -1226,7 +1251,7 @@
 
 </section>
 
-<section id="subsection-rdf-xml">
+<section id="appendix-rdfxml">
 
 <h3>RDF/XML</h3>
 
@@ -1296,7 +1321,7 @@
 </section>
 
   
-<section id="subsection-jsonld">
+<section id="appendix-jsonld">
 
 <h3>JSON-LD</h3>
 
@@ -1463,32 +1488,7 @@
 16      ]
 17    }
 </pre>
-
-    </section>
-
-
-
-    <section id="subsection-nquads">
-
-      <h3>N-Quads</h3>
-
-<p>Multiple-graph example:</p>
-
-      <pre class="example" id="n-quads-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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&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; &lt;http://example.org/bob&gt; .
-05    &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;http://purl.org/dc/terms/title&gt; "Mona Lisa" &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
-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; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&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; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
-08    &lt;http://example.org/bob&gt; &lt;http://purl.org/dc/terms/publisher&gt; &lt;http://example.org&gt; .
-09    &lt;http://example.org/bob&gt; &lt;http://purl.org/dc/terms/rights&gt; &lt;http://creativecommons.org/licenses/by/3.0/&gt; .
-      </pre>
-
-    </section>
-
-
+</section>
 
 </section>