Added example explaining that contexts can be nested. Closes #32.
authorManu Sporny <msporny@digitalbazaar.com>
Tue, 29 Nov 2011 01:23:31 -0500
changeset 287 132df273b3aa
parent 286 8e5b8fc736e4
child 288 b8f58e7797a4
Added example explaining that contexts can be nested. Closes #32.
spec/latest/json-ld-syntax/index.html
--- a/spec/latest/json-ld-syntax/index.html	Tue Nov 29 01:09:25 2011 -0500
+++ b/spec/latest/json-ld-syntax/index.html	Tue Nov 29 01:23:31 2011 -0500
@@ -650,12 +650,14 @@
 
 <p>Contexts may be used at any time a <tref>JSON object</tref> is defined, and a <tref>JSON object</tref>
   may specify multiple contexts, to be processed in order, for example to include standard prefix
-  definitions along with a local language definition used to set the language of <tref>plain literal</tref>s:</p>
+  definitions along with an author-specific prefix definition.</p>
 
 <p>
   The set of contexts defined within a specific <tref>JSON Object</tref> is termed a <tdef>local context</tdef>.
   The <tdef>active context</tdef> refers to the accumulation of <tref>local context</tref>s that are in scope
-  at a specific point within the document.</p>
+  at a specific point within the document. The following example specifies
+  an external context and then layers a local context on top of the external
+  context:</p>
 
 <pre class="example" data-transform="updateExample">
 <!--
@@ -1243,7 +1245,7 @@
 </p>
 
 <section>
-<h2>External Contexts</h2>
+<h2>Contexts</h2>
 
 <p>Authors may choose to declare JSON-LD <tref>context</tref>s in external
 documents to promote re-use of contexts as well as reduce the size of JSON-LD
@@ -1302,6 +1304,34 @@
 or <tref>JSON Object</tref>s that conform to the <tref>context</tref> syntax 
 as described in this document.</p>
 
+<p>An author may nest contexts within <tref>JSON object</tref>s, with the
+more deeply nested contexts overriding the values in previously defined
+contexts:</p>
+
+<pre class="example" data-transform="updateExample">  
+<!--
+{
+  ****"@context": 
+  { 
+    "name": "http://example.com/person#name",
+    "details": "http://example.com/person#details"
+  },****
+  "****name****": "Markus",
+  ...
+  "details": 
+  {
+    ****"@context": { "name": "http://example.com/organization#name" },****
+    "****name****": "Acme, Ltd."
+  }
+}
+-->
+</pre>
+
+<p>In the example above, the <code>name</code> prefix is overridden in the
+more deeply nested <code>details</code> structure. Note that this is
+rarely a good authoring practice and is typically used when the
+JSON object has legacy applications using the structure of the object.</p>
+
 <p>External JSON-LD context documents MAY contain extra information located
 outside of the <code>@context</code> key, such as
 documentation about the <tref>prefix</tref>es declared in the document.