Added a brief section relating JSON-LD to RDF with some Turtle examples.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Sun, 23 Oct 2011 16:59:56 -0700
changeset 238 24495e36e257
parent 237 7360a15c3230
child 239 2cdfb7cc0e1b
Added a brief section relating JSON-LD to RDF with some Turtle examples.
spec/latest/json-ld-syntax/index.html
--- a/spec/latest/json-ld-syntax/index.html	Sun Oct 23 16:26:25 2011 -0700
+++ b/spec/latest/json-ld-syntax/index.html	Sun Oct 23 16:59:56 2011 -0700
@@ -272,7 +272,7 @@
 <section id="abstract">
 <p>
 JSON [[!RFC4627]] has proven to be a highly useful object serialization and
-messaging format. In an attempt to harmonize the representation of Linked Data
+messaging format. In an attempt to harmonize the representation of <tref>Linked Data</tref>
 in JSON, this specification outlines a common JSON representation format for
 expressing directed graphs; mixing both Linked Data and non-Linked Data in
 a single document.
@@ -297,7 +297,7 @@
 
 <p>
 JSON, as specified in [[!RFC4627]], is a simple language for representing
-data on the Web. Linked Data is a technique for creating a graph of interlinked data across
+data on the Web. <tref>Linked Data</tref> is a technique for creating a graph of interlinked data across
 different
 documents or Web sites. Data entities are described using <tref>IRI</tref>s,
 which are typically dereferencable and thus may be used to find more
@@ -308,7 +308,7 @@
 
 <p>
 JSON-LD is designed as a light-weight syntax that can be used to express
-Linked Data. It is primarily intended to be a way to use Linked Data
+<tref>Linked Data</tref>. It is primarily intended to be a way to use Linked Data
 in Javascript and other Web-based programming environments. It is also
 useful when building interoperable Web services and when storing Linked
 Data in JSON-based document storage engines. It is practical and designed
@@ -552,7 +552,7 @@
 <p>JSON-LD defines a mechanism to map JSON terms, i.e., keys and values, to IRIs. This does not mean
 that JSON-LD requires every key or value to be an IRI, but rather ensures that
 keys and values can be mapped to IRIs if the developer desires to transform
-their data into Linked Data. There are a few techniques that can ensure
+their data into <tref>Linked Data</tref>. There are a few techniques that can ensure
 that developers will generate good Linked Data for the Web. JSON-LD
 formalizes those techniques.
 </p>
@@ -818,7 +818,7 @@
 <section>
 <h1>Basic Concepts</h1>
 
-<p>JSON-LD is designed to ensure that Linked Data concepts can be marked
+<p>JSON-LD is designed to ensure that <tref>Linked Data</tref> concepts can be marked
 up in a way that is simple to understand and author by Web developers. In many
 cases, regular JSON markup can become Linked Data with the simple addition
 of a <tref>context</tref>. As more JSON-LD features are used, more semantics are added
@@ -827,7 +827,7 @@
 <section>
 <h2>IRIs</h2>
 
-<p>Expressing <tref>IRI</tref>s are fundamental to Linked Data as that is how most
+<p>Expressing <tref>IRI</tref>s are fundamental to <tref>Linked Data</tref> as that is how most
 <tref>subject</tref>s and many <tref>object</tref> are named. <tref>IRI</tref>s can be
 expressed in a variety of different ways in JSON-LD.</p>
 
@@ -940,7 +940,7 @@
 
 <p>
   To be able to externally reference nodes, it is important that each node has an unambiguous identifier.
-  <tref>IRI</tref>s are a fundamental concept of Linked Data, and nodes should have a de-referencable
+  <tref>IRI</tref>s are a fundamental concept of <tref>Linked Data</tref>, and nodes should have a de-referencable
   identifier used to name and locate them. For nodes to be truely linked, de-referencing the identifier
   should result in a representation of that node. Associating an IRI with a node tells an application
   that the returned document contains a description of the node requested.
@@ -983,7 +983,7 @@
 <code>@type</code> key. Specifying the type in this way will generate a
 triple of the form (subject, type, type-iri).</p>
 
-<p>To be Linked Data, types MUST be uniquely identified by an
+<p>To be <tref>Linked Data</tref>, types MUST be uniquely identified by an
   <tref>IRI</tref>.</p>
 
 <pre class="example" data-transform="updateExample">
@@ -1434,7 +1434,7 @@
 <section>
   <h2>Vocabulary Prefixes</h2>
   <p>
-    Vocabulary terms in Linked Data documents may draw from a number of
+    Vocabulary terms in <tref>Linked Data</tref> documents may draw from a number of
     different Web vocabularies. At times, declaring every single term that
     a document uses can require the developer to declare tens, if not
     hundreds of potential vocabulary terms that may be used across an
@@ -1718,7 +1718,7 @@
 <p>The example above would set the subject to <code>_:foo</code>, which can
 then be used later on in the JSON-LD markup to refer back to the
 unlabeled node. This practice, however, is usually frowned upon when
-generating Linked Data. If a developer finds that they refer to the unlabeled
+generating <tref>Linked Data</tref>. If a developer finds that they refer to the unlabeled
 node more than once, they should consider naming the node using a resolve-able
 <tref>IRI</tref>.
 </p>
@@ -1758,14 +1758,129 @@
 
 </section>
 
+<section>
+  <h2>Using JSON-LD for RDF</h2>
+
+  <p>JSON-LD is a specification for representing <tref>Linked Data</tref> in JSON. A common
+    way of working with Linked Data is through <tdef>RDF</tdef>, the Resource Description Framework.
+    RDF can be expressed using JSON-LD by associating JSON-LD concepts such as <code>@subject</code>
+    and <code>@type</code> with the equivalent <tref>IRI</tref>s in RDF. Further information about
+    RDF may be found in [[RDF-PRIMER]].</p>
+
+  <p>Some examples of encoding <tref>RDF</tref> into JSON-LD may be found
+    in <a href="#markup-examples">Appendix A</a>. Details of transforming JSON-LD into RDF
+    are defined in [[JSON-LD-API]].</p>
+</section>
+
 <section class="appendix">
 <h2>Markup Examples</h2>
 
 <p>The JSON-LD markup examples below demonstrate how JSON-LD can be used to
-express semantic data marked up in other languages such as RDFa, Microformats,
-and Microdata. These sections are merely provided as proof that JSON-LD is
-very flexible in what it can express across different Linked Data approaches.
-</p>
+  express semantic data marked up in other languages such as RDFa, Microformats,
+  and Microdata. These sections are merely provided as proof that JSON-LD is
+  very flexible in what it can express across different <tref>Linked Data</tref> approaches.</p>
+
+<section>
+  <h3>Turtle</h3>
+  
+  <p>The following are examples of representing <tref>RDF</tref> as expressed in [[TURTLE]] into JSON-LD.</p>
+  
+<section>
+<h4>Prefix and Base definitions</h4>
+<p>The JSON-LD context has direct equivalents for Turtle <code>@base</code> and <code>@prefix</code> expressions:</p>
+
+<pre class="example" data-transform="updateExample">
+<!--
[email protected] <http://manu.sporny.org/> .
[email protected] foaf: <http://xmlns.com/foaf/0.1/> .
+
+<#me> a foaf:Person;
+  foaf:name "Manu Sporny";
+  foaf:homepage <> .
+-->
+</pre>
+
+<pre class="example" data-transform="updateExample">
+<!--
+{
+  "@context": {
+    "@base":  "http://manu.sporny.org/",
+    "foaf":   "http://xmlns.com/foaf/0.1/"
+  },
+  "@subject":       "#me",
+  "@type":          "foaf:Person",
+  "foaf:name":      "Manu Sporny",
+  "foaf:homepage":  {"@iri": ""}
+}
+-->
+</pre>
+</section>
+
+<section>
+<h4>Chaining</h4>
+<p>Both Turtle and JSON-LD allow chaining of objects, although Turtle only allows chaining of objects which
+  use nlank node identifiers.</p>
+</section>
+
+<pre class="example" data-transform="updateExample">
+<!--
[email protected] <http://manu.sporny.org/> .
[email protected] foaf: <http://xmlns.com/foaf/0.1/> .
+
+<#me> a foaf:Person;
+  foaf:name "Manu Sporny";
+  foaf:knows [ a foaf:Person; foaf:name "Gregg Kellogg" ] .
+-->
+</pre>
+
+<pre class="example" data-transform="updateExample">
+<!--
+{
+  "@context": {
+    "@base":  "http://manu.sporny.org/",
+    "foaf":   "http://xmlns.com/foaf/0.1/"
+  },
+  "@subject":       "#me",
+  "@type":          "foaf:Person",
+  "foaf:name":      "Manu Sporny",
+  "foaf:knows":  {
+    "@type":          "foaf:Person",
+    "foaf:name":      "Gregg Kellogg"
+  }
+}
+-->
+</pre>
+<section>
+<h4>Lists</h4>
+<p>Both JSON-LD and Turtle can represent sequential lists of values.</p>
+
+<pre class="example" data-transform="updateExample">
+<!--
[email protected] foaf: <http://xmlns.com/foaf/0.1/> .
+
+<http://example.org/people#joebob> a foaf:Person;
+  foaf:name "Joe Bob";
+  foaf:nick ( "joe" "bob" "jaybee") .
+-->
+</pre>
+
+<pre class="example" data-transform="updateExample">
+<!--
+{
+  "@context": {
+    "@base":  "http://manu.sporny.org/",
+    "foaf":   "http://xmlns.com/foaf/0.1/"
+  },
+  "@subject":       "http://example.org/people#joebob",
+  "@type":          "foaf:Person",
+  "foaf:name":      "Joe Bob",
+  "foaf:nick":      {"@list": ["joe", "bob", "jaybe"]}
+}
+-->
+</pre>
+</section>
+
+</section>
 
 <section>
 <h3>RDFa</h3>