Reworking N-Quads example
authorYves Raimond <yves.raimond@bbc.co.uk>
Wed, 14 Aug 2013 13:39:36 +0100
changeset 998 6e35a86a1cd8
parent 997 b7c64174ae00
child 999 75658de5ed83
Reworking N-Quads example
rdf-primer/index.html
--- a/rdf-primer/index.html	Wed Aug 14 13:22:33 2013 +0100
+++ b/rdf-primer/index.html	Wed Aug 14 13:39:36 2013 +0100
@@ -498,10 +498,7 @@
 
     <h2>Writing RDF datasets</h2>
 
-    <p>Among the previous syntaxes, only JSON-LD provides support for RDF datasets (collections of graphs). 
-    There are two syntaxes dedicated to serializing and exchanging RDF datasets: 
-    <a href="https://dvcs.w3.org/hg/rdf/raw-file/default/nquads/index.html">N-Quads</a> and 
-    <a href="https://dvcs.w3.org/hg/rdf/raw-file/default/trig/index.html">TriG</a>, which we summarize below.</p>
+    <p>Syntaxes are also available to serialize and exchange RDF datasets (collections of graphs).</p> 
 
     <section id="subsection-nquads">
 
@@ -509,11 +506,19 @@
 
       <p><a href="https://dvcs.w3.org/hg/rdf/raw-file/default/nquads/index.html">N-Quads</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. For example,
-      we could write the first triple of our N-Triples example as follows.</p>
+      element to each line, capturing the graph IRI of the triple described on that line. For example
+      we could split our "Mona Lisa" example in two graphs <a href="#subsection-graphs">as we did above</a>
+      and serialize the resulting dataset in N-Quads as follows.</p>
 
       <pre>
-&lt;http://example.org/#bob&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/#graph-1&gt;.
+&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; .
+&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; .
+&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; .
+&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; .
+&lt;http://viaf.org/viaf/24604287/&gt; &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt; &lt;http://xmlns.com/foaf/0.1/Person&gt; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
+&lt;http://viaf.org/viaf/24604287/&gt; &lt;http://xmlns.com/foaf/0.1/name&gt; "Leonardo da Vinci" &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
+&lt;http://viaf.org/viaf/24604287/&gt; &lt;http://xmlns.com/foaf/0.1/made&gt; &lt;http://www.wikidata.org/entity/Q12418&gt; &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt; .
+&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; .
       </pre>
 
     </section>
@@ -523,41 +528,47 @@
       <h3>TriG</h3>
 
       <p><a href="https://dvcs.w3.org/hg/rdf/raw-file/default/trig/index.html">TriG</a>
-      is an extension to the Turtle syntax enabling the exchange of RDF datasets. For example 
-      the "Mona Lisa" example graph could be written as follows.</p>
+      is an extension to the Turtle syntax enabling the exchange of RDF datasets. For example we could write
+      our example in TriG as follows.</p>
 
       <pre>
+@base &lt;http://example.org/&gt; .
 @prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
 @prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; .
 @prefix schema: &lt;http://schema.org/&gt; .
-@prefix : &lt;http://example.org/bob#&gt; .
+@prefix dcterms: &lt;http://purl.org/dc/terms/&gt; .
+@prefix wd: &lt;http://www.wikidata.org/entity/&gt; .
 
 &lt;http://example.org/bob&gt;
   {
-    :bob
+    &lt;bob#me&gt;
       a foaf:Person ;
-      foaf:knows :alice ;
+      foaf:knows &lt;alice#me&gt; ;
       schema:birthDate "1990-07-04"^^xsd:date ;
-      :likes :the-mona-lisa .
-    :alice
-      a foaf:Person .
-    }
+      foaf:topic_interest wd:Q12418 .
+  }
 
 &lt;https://www.wikidata.org/wiki/Special:EntityData/Q12418&gt;
   {
-    :da-vinci
+    &lt;http://viaf.org/viaf/24604287/&gt;
       a foaf:Person ;
-      foaf:made :the-mona-lisa .
-    :the-mona-lisa
-      :on-display-in :the-louvre .
+      foaf:name "Leonardo da Vinci" ;
+      foaf:made wd:Q12418 .
+
+    &lt;http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619&gt;
+      dcterms:subject wd:Q12418 .
   }
-
       </pre>
 
     </section>
 
-    <p class="issue">Add an example of a dataset in JSON-LD</p>
+    <section id="subsection-jsonld-dataset">
 
+      <h3>JSON-LD</h3>
+
+      <p><a href="http://www.w3.org/TR/json-ld-syntax/">JSON-LD</a> also provides a way to serialize RDF datasets, through the use of the <code>@graph</code> keyword.</p>
+
+    </section>
 
 </section>