More formally define term, including how and when it is expanded. Also make clear that a prefix is a term, and how it is identified and expanded. Clarify that relative IRIs SHOULD begin with special (non-NCNAME) characters.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Sun, 06 Nov 2011 19:48:07 -0800
changeset 258 fec17e851267
parent 257 740c15e6c7ce
child 259 4c9996850f3c
More formally define term, including how and when it is expanded. Also make clear that a prefix is a term, and how it is identified and expanded. Clarify that relative IRIs SHOULD begin with special (non-NCNAME) characters.
spec/latest/json-ld-syntax/index.html
--- a/spec/latest/json-ld-syntax/index.html	Sun Nov 06 18:54:07 2011 -0800
+++ b/spec/latest/json-ld-syntax/index.html	Sun Nov 06 19:48:07 2011 -0800
@@ -576,19 +576,16 @@
 <h3>The Context</h3>
 
 <p>In JSON-LD, a <tdef>context</tdef> is used to map <tref>term</tref>s, i.e., keys and values
-  in an JSON document, to
-  <tref>IRI</tref>s. A <tdef>term</tdef> is a short word that MAY be expanded
-to an <tref>IRI</tref>. The Web uses IRIs for unambiguous identification. The
-idea is that these <tref>term</tref>s mean something that may be of use to
-other developers and that it is useful to give them an unambiguous identifier.
-That is, it is useful for <tref>term</tref>s to expand to IRIs so that
-developers don't accidentally step on each other's Web Vocabulary terms.
-For example, the term <code>name</code> may map directly to the IRI
-<code>http://xmlns.com/foaf/0.1/name</code>. This allows JSON-LD documents to
-be constructed using the common JSON practice of simple name/value pairs while
-ensuring that the data is useful outside of the page, API or database in which it
-resides.
-</p>
+  in an JSON document, to <tref>IRI</tref>s. A <tdef>term</tdef> is a short word that MAY be expanded to an
+  <tref>IRI</tref>. A <tref>term</tref> MUST have the lexical form of <cite><a
+  href="http://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName">NCName</a></cite> (see [[XML-NAMES]]).</p>
+<p>The Web uses IRIs for unambiguous identification. The
+  idea is that these <tref>term</tref>s mean something that may be of use to other developers and that it is useful to
+  give them an unambiguous identifier. That is, it is useful for <tref>term</tref>s to expand to IRIs so that
+  developers don't accidentally step on each other's Web Vocabulary terms. For example, the term <code>name</code> may
+  map directly to the IRI <code>http://xmlns.com/foaf/0.1/name</code>. This allows JSON-LD documents to be constructed
+  using the common JSON practice of simple name/value pairs while ensuring that the data is useful outside of the
+  page, API or database in which it resides.</p>
 
 <p>These Linked Data <tref>term</tref>s are typically collected in a context document that would look something like this:</p>
 
@@ -788,7 +785,7 @@
 <section>
 <h3>From JSON to JSON-LD</h3>
 
-<p>If a set of terms such as, <strong>name</strong>, <strong>homepage</strong>,
+<p>If a set of <tref>term</tref>s such as, <strong>name</strong>, <strong>homepage</strong>,
 and <strong>avatar</strong>,
 are defined in a <tref>context</tref>, and that context is used to resolve the
 names in JSON objects, machines are able to automatically expand the terms to
@@ -832,21 +829,31 @@
 expressed in a variety of different ways in JSON-LD.</p>
 
 <ol>
-  <li>In general, <tref>term</tref>s in the key position in
-    a <tref>JSON object</tref> that have a mapping to an <tref>IRI</tref> or another key in the <tref>context</tref> are
-    expanded to an IRI by JSON-LD processors. There are special rules for
-    processing keys in <code>@context</code> and when dealing with keys that
-    start with the <code>@subject</code> character.</li>
-  <li>An <tref>IRI</tref> is generated for the value specified using <code>@subject</code>,
-    if it is a <tref>string</tref>.</li>
-  <li>An <tref>IRI</tref> is generated for the value specified using <code>@type</code>.</li>
-  <li>An <tref>IRI</tref> is generated for the value specified using the <code>@iri</code>
-    keyword.</li>
+  <li>Except within a <tref>context</tref> definition, <tref>term</tref>s in the key position in
+    a <tref>JSON object</tref> that have a mapping to an <tref>IRI</tref> or another key in the <tref>active
+    context</tref> are expanded to an IRI by JSON-LD processors.</li>
+  <li>An <tref>IRI</tref> is generated for the <tref>string</tref> value specified using <code>@subject</code>,
+    <code>@type</code> or <code>@iri</code>.</li>
+  <li>An <tref>IRI</tref> is generated for any key or <tref>string</tref> value with the <code>@coerce</code>,
+    section of a <tref>context</tref> definition.
   <li>An <tref>IRI</tref> is generated for the value of any other key if there are <code>@coerce</code> rules in
     effect for that key that identify it as a <code>@iri</code>.</li>
 </ol>
 
-<p>IRIs may be represented as an absolute IRI, a <tref>term</tref>, a <tref>prefix</tref>:suffix construct, or as a value relative to <code>@base</code> or <code>@vocab</code>.</p>
+<p>IRIs may be represented as an absolute IRI, a <tref>term</tref>, a <tref>prefix</tref>:suffix construct, or as a value relative to <code>@base</code> or <code>@vocab</code>. Relative IRIs are resolved against <code>@vocab</code> if they are in a key position, or the value of <code>@type</code> key, otherwise they are resolved against <code>@base</code>.</p>
+
+<p class="note">
+  As there it is possible to confuse <tref>term</tref>s or <tref>prefix</tref>es with relative IRIs, as
+  a best practice, relative IRIs SHOULD begin with './', '#' or '/', as these are not valid for use within
+  <tref>term</tref> definitions.
+</p>
+
+<p class="issue">
+  There is active discussion on merging the @coerce mappings into <tref>term</tref> definitions, in which case
+  <tref>term</tref> or <tref>prefix</tref> expansion cannot take place unless they are in the active context when processing
+  a context definition (i.e., they were previously defined in a context definition prior to parsing
+  a new context definition).
+</p>
 
 <p>IRIs can be expressed directly in the key position like so:</p>
 
@@ -1055,7 +1062,7 @@
 that is generated. Languages MUST be expressed in [[!BCP47]] format.</p>
 
 <p>It is also possible to set a language to use within a <code>@context</code>, to allow specify a language
-to apply to all <tref>plain literal</tref>s within the scope of the <tref>context</tref></p>
+to apply to all <tref>plain literal</tref>s within the scope of the <tref>active context</tref></p>
 
 <pre class="example" data-transform="updateExample">
 <!--