Adding JSON-LD comments
authorYves Raimond <yves.raimond@bbc.co.uk>
Mon, 17 Feb 2014 16:01:25 +0000
changeset 1941 eba38e646ca8
parent 1938 a2a6defb18bb
child 1942 65610ae8b436
Adding JSON-LD comments
rdf-primer/example-context.jsonld
rdf-primer/index.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rdf-primer/example-context.jsonld	Mon Feb 17 16:01:25 2014 +0000
@@ -0,0 +1,29 @@
+{
+  "@context": {
+    "foaf": "http://xmlns.com/foaf/0.1/",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "schema": "http://schema.org/",
+    "dcterms": "http://purl.org/dc/terms/",
+    "wd": "http://www.wikidata.org/entity/",
+    "@base": "http://example.org/",
+    "uri": "@id",
+    "type": "@type",
+    "Person": "foaf:Person",
+    "born": {
+      "@id": "schema:birthDate",
+      "@type": "xsd:date"
+    },
+    "friends": {
+      "@id": "foaf:knows",
+      "@type": "@id"
+    },
+    "interest": "http://xmlns.com/foaf/0.1/topic_interest",
+    "subject_of": {
+      "@reverse": "dcterms:subject",
+      "@type": "@id"
+    },
+    "creator": "dcterms:creator",
+    "title": "dcterms:title",
+    "name": "foaf:name"
+  }
+}
--- a/rdf-primer/index.html	Mon Feb 17 15:27:56 2014 +0000
+++ b/rdf-primer/index.html	Mon Feb 17 16:01:25 2014 +0000
@@ -940,11 +940,46 @@
       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
+      <p>The following 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>
-      
+      <pre class="example">
+01    {
+02      "@context": "example-context.json",
+03      "uri": "bob#me",
+04      "type": "Person",
+05      "born": "1990-07-04",
+06      "friends": ["alice#me"],
+07      "interest": [
+08        {
+09          "uri": "wd:Q12418",
+10          "title": "Mona Lisa",
+11          "subject_of": "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
+12          "creator": {
+13            "uri": "http://dbpedia.org/resource/Leonardo_da_Vinci"
+14          }
+15        }
+16      ]
+17    }
+      </pre>
+
+      <p>The <code>@context</code> key on line 2
+      points to <a href="example-context.jsonld">a JSON document</a>
+      describing how the document can be mapped to an RDF graph.
+      For example it will specify that the <code>born</code> key
+      maps to the <code>schema:birthDate</code> property IRI, and that
+      its value can be mapped to an <code>xsd:date</code> datatype.</p>
+
+      <p>Each JSON object corresponds to an RDF resource. In this example 
+      the main resource being described is <code>bob#me</code>, as 
+      specified on line 3. We describe its type on line 4, its birth date
+      on line 5 and its friends on line 6. On line 7 we describe its interests,
+      including the Mona Lisa painting.</p>
+
+      <p>To describe this painting we create a
+      new JSON object in line 8 and associate it with the Mona Lisa IRI in Wikidata
+      on line 9. We then describe various properties of that painting from line 10 to line 14.
+      </p>
 
 </section>
 
@@ -1468,27 +1503,8 @@
 45    }
 </pre>
 
-The context can also be held in a separate file, as in the following example.
+The context can also be held in a separate file, as in the example presented in the <a href="#json-ld">JSON-LD section above</a>.
 
-<pre class="example">
-01    {
-02      "@context": "example-context.json",
-03      "uri": "bob#me",
-04      "type": "Person",
-05      "born": "1990-07-04",
-06      "friends": ["alice#me"],
-07      "interest": [
-08        {
-09          "uri": "wd:Q12418",
-10          "title": "Mona Lisa",
-11          "subject_of": "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
-12          "creator": {
-13            "uri": "http://dbpedia.org/resource/Leonardo_da_Vinci"
-14          }
-15        }
-16      ]
-17    }
-</pre>
 </section>
 
 </section>