Turtle example
authorYves Raimond <yves.raimond@bbc.co.uk>
Mon, 15 Apr 2013 16:07:31 +0100
changeset 804 a587dc7bb1bd
parent 803 d2b8ee0172a9
child 805 9a93c0ffa86b
Turtle example
rdf-primer/index.html
--- a/rdf-primer/index.html	Mon Apr 15 14:52:51 2013 +0100
+++ b/rdf-primer/index.html	Mon Apr 15 16:07:31 2013 +0100
@@ -295,15 +295,18 @@
     can be represented in N-Triples as follows.</p>
 
     <pre>
-&lt;http://example.org/#bob&gt; &lt;http://example.org/#knows&gt; &lt;http://example.org/#alice&gt;.
+&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/#alice&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://xmlns.com/foaf/0.1/knows&gt; &lt;http://example.org/#alice&gt;.
 &lt;http://example.org/#bob&gt; &lt;http://example.org/#birth-date&gt; "1990-07-04"^^&lt;http://www.w3.org/2001/XMLSchema#date&gt;.
-&lt;http://example.org/#da-vinci&gt; &lt;http://example.org/#created&gt; &lt;http://example.org/#the-mona-lisa&gt;.
+&lt;http://example.org/#da-vinci&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/#da-vinci&gt; &lt;http://xmlns.com/foaf/0.1/made&gt; &lt;http://example.org/#the-mona-lisa&gt;.
 &lt;http://example.org/#the-mona-lisa&gt; &lt;http://example.org/#on-display-in&gt; &lt;http://example.org/#the-louvre&gt;.
 &lt;http://example.org/#bob&gt; &lt;http://example.org/#likes&gt; &lt;http://example.org/#the-mona-lisa&gt;.
     </pre>
 
     <p>N-Triples is often used for RDF examples, exchanging large RDF datasets, and processing large RDF graphs
-    with text processing tools.</p>
+    with line-oriented text processing tools.</p>
 
     <h3>N-quads</h3>
 
@@ -316,6 +319,31 @@
 &lt;http://example.org/#bob&gt; &lt;http://example.org/#knows&gt; &lt;http://example.org/#alice&gt; &lt;http://example.org/#graph-1&gt;.
     </pre>
 
+    <h3>Turtle</h3>
+
+    <p><a href="http://www.w3.org/TR/turtle/">Turtle</a> provides a convenient syntax for RDF graphs, introducing numerous
+    syntax shortcuts when compared with N-Triples, such as the support for namespaces, lists and shorthands for data-typed
+    literals. Turtle provides a good trade-off between ease of writing, ease of parsing and readability.</p>
+
+    <pre>
+@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
+@prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
+@prefix : &lt;http://example.org/#&gt; .
+
+:bob
+  a foaf:Person ;
+  foaf:knows :alice ;
+  :birth-date "1990-07-04"^^xsd:date ;
+  :likes :the-mona-lisa .
+:alice
+  a foaf:Person .
+:da-vinci
+  a foaf:Person ;
+  foaf:made :the-mona-lisa .
+:the-mona-lisa
+  :on-display-in :the-louvre .
+    </pre>
+
 </section>
 
 <section id="section-vocabulary">