new JSON examples in
authorGuus Schreiber <guus.schreiber@vu.nl>
Fri, 21 Feb 2014 10:54:45 +0100
changeset 1984 e9475f5a795b
parent 1983 3776d572bedf
child 1985 6491eba6852a
new JSON examples in
rdf-primer/index.html
--- a/rdf-primer/index.html	Fri Feb 21 01:09:30 2014 +0100
+++ b/rdf-primer/index.html	Fri Feb 21 10:54:45 2014 +0100
@@ -959,44 +959,72 @@
       <p>The following JSON-LD example encodes the graph of <a
       href="#fig4">Fig.&nbsp;4</a>:</p>
 
+<p>
+
       <pre class="example" title="JSON-LD">
 <span class="linenum">01</span>    {
 <span class="linenum">02</span>      "@context": "example-context.json",
-<span class="linenum">03</span>      "uri": "bob#me",
-<span class="linenum">04</span>      "type": "Person",
-<span class="linenum">05</span>      "born": "1990-07-04",
-<span class="linenum">06</span>      "friends": ["alice#me"],
-<span class="linenum">07</span>      "interest": [
-<span class="linenum">08</span>        {
-<span class="linenum">09</span>          "uri": "wd:Q12418",
-<span class="linenum">10</span>          "title": "Mona Lisa",
-<span class="linenum">11</span>          "subject_of": "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
-<span class="linenum">12</span>          "creator": {
-<span class="linenum">13</span>            "uri": "http://dbpedia.org/resource/Leonardo_da_Vinci"
-<span class="linenum">14</span>          }
-<span class="linenum">15</span>        }
-<span class="linenum">16</span>      ]
-<span class="linenum">17</span>    }
+<span class="linenum">03</span>      "@id": "http://example.org/bob#me",
+<span class="linenum">04</span>      "@type": "Person",
+<span class="linenum">05</span>      "birthdate": "1990-07-04",
+<span class="linenum">06</span>      "knows": "http://example.org/alice#me",
+<span class="linenum">07</span>      "interest": {
+<span class="linenum">08</span>          "@id": "http://www.wikidata.org/entity/Q12418",
+<span class="linenum">09</span>          "title": "Mona Lisa",
+<span class="linenum">10</span>          "subject_of": "http://data.europeana.eu/item/04802/243FA8618938F4117025F17A8B813C5F9AA4D619",
+<span class="linenum">11</span>          "creator": "http://dbpedia.org/resource/Leonardo_da_Vinci"
+<span class="linenum">12</span>          }
+<span class="linenum">13</span>       }
       </pre>
 
       <p>The <code>@context</code> key on line 2
-      points to <a href="#appendix-jsonld-3">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>
+      points to a JSON document
+      describing how the document can be mapped to an RDF graph (see below).
+      Each JSON object corresponds to an RDF resource. In this example 
+      the main resource being described is
+      <code>http://example.org/bob#me</code>, as
+      specified on line 3. The <code>@id</code> TODO.
 
-      <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
+      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.
+      on line 9. We then describe various properties of that painting
+      from line 10 to line 14. 
       </p>
 
+<pre class="example" title="JSON-LD context specification">
+<span class="linenum">01</span>    {
+<span class="linenum">02</span>      "@context": {
+<span class="linenum">03</span>         "foaf": "http://xmlns.com/foaf/0.1/", 
+<span class="linenum">04</span>         "Person": "foaf:Person",
+<span class="linenum">05</span>         "interest": "foaf:topic_interest",
+<span class="linenum">06</span>         "knows": {
+<span class="linenum">07</span>            "@id": "foaf:knows",
+<span class="linenum">08</span>            "@type": "@id"
+<span class="linenum">09</span>          },
+<span class="linenum">10</span>         "birthdate": {
+<span class="linenum">11</span>            "@id": "http://schema.org/birthDate",
+<span class="linenum">12</span>            "@type": "http://www.w3.org/2001/XMLSchema#date"
+<span class="linenum">13</span>         },
+<span class="linenum">14</span>         "dcterms": "http://purl.org/dc/terms/",
+<span class="linenum">15</span>         "title": "dcterms:title",
+<span class="linenum">16</span>         "creator": "dcterms:creator",
+<span class="linenum">17</span>            "subject_of": {
+<span class="linenum">18</span>            "@reverse": "dcterms:subject",
+<span class="linenum">19</span>            "@type": "@id"
+<span class="linenum">20</span>          }
+<span class="linenum">21</span>      }
+<span class="linenum">22</span>    }
+</pre>
+
+      For example, it will specify that the <code>birthdataorn</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>
+
 </section>
 
 <section id="section-rdfa"> 
@@ -1338,7 +1366,8 @@
    new document.</p> 
 
 </section>
-  
+
+<!--
 <section id="appendix-other-syntaxes" class="appendix">
 
 <h2>Additional JSON-LD Examoples</h2>
@@ -1348,14 +1377,12 @@
 
 
 
-  
+<!--
 <section id="appendix-jsonld">
 
 <h3>JSON-LD</h3>
 
-      <section id="appendix-jsonld-1">
-
-      <p>In this section we describe several
+       <p>In this section we describe several
       alternative serializations for JSON-LD, adding to the example
       in the <a href="#section-json-ld">JSON-LD section</a> above.</p>
 
@@ -1409,10 +1436,6 @@
      <p>Literals with datatypes can be expressed through the <code>@value</code> and <code>@type</code>
      attributes, as in lines 14 and 15.</p>
 
-     </section>
-
-     <section id="appendix-jsonld-2">
-
      <p>JSON-LD can also be used for RDF datasets, through the use of the <code>@graph</code> keyword. 
     The example below encodes the
     RDF dataset depicted in <a href="#fig5">Fig.&nbsp;5</a></p>
@@ -1476,9 +1499,6 @@
       lines 11 to 26 and lines 36 to 47. The extra provenance and rights
       information is given on lines 27 to 32.</p>
 
-      </section>
-
-      <section id="appendix-jsonld-3">
 
 <p>The <code>@context</code> of a JSON-LD document can be factored out
 and referred to by its IRI. The following is the context used in the example
@@ -1519,11 +1539,8 @@
 
 <p>For detailed information about JSON-LD please consult the JSON-LD
     specification [[JSON-LD]]. </p>
-    </section>
-
 </section>
-
-</section>
+-->
    
 
   </body>