Don't allow keywords to be re-defined. Left room for setting @container, for now.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Tue, 24 Apr 2012 15:31:40 -0700
changeset 569 0720bb200616
parent 568 bd8ca88805bd
child 570 78435c9f0ca9
Don't allow keywords to be re-defined. Left room for setting @container, for now.
This closes issue #102
spec/latest/json-ld-api/index.html
spec/latest/json-ld-syntax/index.html
--- a/spec/latest/json-ld-api/index.html	Tue Apr 24 13:07:58 2012 -0700
+++ b/spec/latest/json-ld-api/index.html	Tue Apr 24 15:31:40 2012 -0700
@@ -1016,12 +1016,19 @@
                 <li>If the property's value is a simple <tref>string</tref>, determine the IRI mapping value by
                   performing <a href="#iri-expansion">IRI Expansion</a> on the associated value. If the result of the IRI
                   mapping is an <tref>absolute IRI</tref>, merge the property into the <tref>local context</tref>
-                  <tref>term mapping</tref>.</li>
+                  <tref>term mapping</tref>, unless the property is a JSON-LD <tref>keyword</tref>, in which
+                  case throw an exception.</li>
                 <li>Otherwise, if the property's value is <tref>null</tref> remove mapping, coercion,
                   container and language information associated with property from the
                   <tref>local context</tref>.</li>
                 <li>Otherwise, the <em>property</em>'s <em>value</em> MUST be a <tref>JSON object</tref>.
                   <ol class="algorithm">
+                    <li>If the <em>property</em> is a JSON-LD <tref>keyword</tref> and the value has
+                      <code>@id</code>, <code>@language</code> or <code>@type</code> properties, throw an exception.
+                      <div class="issue">Undecided if <code>@type</code> or <code>@graph</code> can take a
+                        <code>@container</code> with <code>@set</code>.
+                      </div>
+                    </li>
                     <li>If the <em>property</em> has the form of <tref>term</tref>, it's <em>value</em> MUST have an
                       <code>@id</code> property with a string value which MUST have the form of a <tref>term</tref>,
                       <tref>compact IRI</tref>, or <tref>absolute IRI</tref>. Determine the IRI mapping
--- a/spec/latest/json-ld-syntax/index.html	Tue Apr 24 13:07:58 2012 -0700
+++ b/spec/latest/json-ld-syntax/index.html	Tue Apr 24 15:31:40 2012 -0700
@@ -405,7 +405,7 @@
 <section>
   <h2>Syntax Tokens and Keywords</h2>
 
-  <p>JSON-LD specifies a number of syntax tokens and keywords that are using
+  <p>JSON-LD specifies a number of syntax tokens and <tdef title="keyword">keywords</tdef> that are using
   in all algorithms described in this section:</p>
 
   <dl>
@@ -448,7 +448,7 @@
     <tref title="compact_iri">compact IRIs</tref>.</dd>
   </dl>
 
-  <p>For the avoidance of doubt, all keys, keywords, and values in JSON-LD are
+  <p>For the avoidance of doubt, all keys, <tref title="keyword">keywords</tref>, and values in JSON-LD are
   case-sensitive.</p>
 </section>
 
@@ -489,7 +489,7 @@
 
 <dl>
  <dt>Simplicity</dt>
- <dd>Developers need only know JSON and two keywords (<code>@context</code>
+ <dd>Developers need only know JSON and two <tref title="keyword">keywords</tref> (<code>@context</code>
  and <code>@id</code>) to use the basic functionality in JSON-LD. No extra
  processors or software libraries are necessary to use JSON-LD in its most
  basic form. The language attempts to ensure that developers have an easy
@@ -573,9 +573,10 @@
 
 <p>In JSON-LD, a <tdef>context</tdef> is used to map <tref>term</tref>s, i.e., properties with associated
   values in an JSON document, to <tref>IRI</tref>s. A <tdef>term</tdef> is a short word that expands to an
-  <tref>IRI</tref>. <tref>Term</tref>s MAY be defined as any valid JSON <tref>string</tref>. To avoid
+  <tref>IRI</tref>. <tref>Term</tref>s MAY be defined as any valid JSON <tref>string</tref> other
+  than a JSON-LD <tref>keyword</tref>. To avoid
   forward-compatibility issues, <tref>term</tref>s starting with an <code>@</code> character SHOULD NOT be used
-  as they might be used as <a href="#syntax-tokens-and-keywords">keywords</a> in future versions of JSON-LD.</p>
+  as they might be used as <tref title="keyword">keywords</tref> in future versions of JSON-LD.</p>
 <p>The Web uses <tref title="IRI">IRIs</tref> 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
@@ -738,7 +739,7 @@
 <p>Doing this allows JSON to be unambiguously machine-readable without
 requiring developers to drastically change their workflow.</p>
 
-<p class="note">The example above does not use the <code>@id</code> keyword
+<p class="note">The example above does not use the <code>@id</code> <tref>keyword</tref>
 to set the <tref>subject</tref> of the node being described above. This type
 of node is called an <tdef>unlabeled node</tdef> and is considered to be
 a weaker form of <tref>Linked Data</tref>. It is advised that all nodes
@@ -928,7 +929,7 @@
   <tref>unlabeled node</tref>.</p>
 
 <p class="note">To ensure the best possible performance, it is a best practice
-to put the <code>@id</code> keyword before other key-value pairs in an object.
+to put the <code>@id</code> <tref>keyword</tref> before other key-value pairs in an object.
 If it isn't listed first, processors have to save each key-value pair until
 <code>@id</code> is processed before they can start generating triples.
 Not specifying the <code>@id</code> keyword first creates a memory and
@@ -940,7 +941,7 @@
 <h2>Specifying the Type</h2>
 
 <p>The type of a particular subject can be specified using the
-<code>@type</code> keyword. Specifying the type in this way will generate a
+<code>@type</code> <tref>keyword</tref>. Specifying the type in this way will generate a
 triple of the form (subject, type, type-IRI). To be considered
 <tref>Linked Data</tref>, types MUST be uniquely identified by
 an <tref>IRI</tref>.</p>
@@ -1131,7 +1132,7 @@
 
 <p>As the notion of ordered collections is rather important in data
   modeling, it is useful to have specific language support. In JSON-LD,
-  a list may be represented using the <code>@list</code> keyword as follows:</p>
+  a list may be represented using the <code>@list</code> <tref>keyword</tref> as follows:</p>
 <pre class="example" data-transform="updateExample">
 <!--
 {
@@ -1175,7 +1176,7 @@
 <p class="note">List of lists are not allowed in this version of JSON-LD.
   If a list of lists is detected, a JSON-LD processor will throw an exception.</p>
 
-<p>Similarly to <code>@list</code>, there exists the keyword <code>@set</code> to
+<p>Similarly to <code>@list</code>, there exists the <tref>keyword</tref> <code>@set</code> to
   describe unordered sets. While its use in the body of a JSON-LD document
   represents just syntactic sugar that MUST be optimized away when processing
   the document, it is very helpful for <a href="compaction">Compaction</a>
@@ -1212,7 +1213,7 @@
 </p>
 
 <ol>
-  <li>By utilizing the <code>@type</code> keyword when defining a <tref>term</tref> within a
+  <li>By utilizing the <code>@type</code> <tref>keyword</tref> when defining a <tref>term</tref> within a
     <code>@context</code> section.</li>
   <li>By utilizing the expanded form for specifying objects.</li>
   <li>By using a native JSON type.</li>
@@ -1291,7 +1292,7 @@
 </pre>
 
 <p class="note">
-  The <code>@type</code> keyword is also used to associate a type with
+  The <code>@type</code> <tref>keyword</tref> is also used to associate a type with
   a <tref>subject</tref>. Although the same keyword is used in both places,
   the concept of an <em>object type</em> and a <em>value type</em>
   are different. This is similar to object-oriented programming languages
@@ -1668,7 +1669,7 @@
 
 <p>Type coercion is specified within an <a href="#expanded-term-definition">expanded term definition</a>
   using the <code>@type</code> key. The values of this key represent type IRIs and MUST take the form of
-  <tref>term</tref>, <tref>compact IRI</tref>, <tref>absolute IRI</tref> or the keyword <code>@id</code>. Specifying
+  <tref>term</tref>, <tref>compact IRI</tref>, <tref>absolute IRI</tref> or the <tref>keyword</tref> <code>@id</code>. Specifying
   <code>@id</code> indicates that within the body of a JSON-LD document, string values of keys coerced as
   <code>@id</code> are to be interpreted as <tref>IRI</tref>s.</p>
 
@@ -1946,7 +1947,7 @@
 
 <section>
   <h2>Named Graphs</h2>
-  <p>The <code>@graph</code> keyword is used to identify a set of JSON-LD object
+  <p>The <code>@graph</code> <tref>keyword</tref> is used to identify a set of JSON-LD object
     definitions that may not be directly related through a property, or where 
     <tref>embedding</tref> is not appropriate. For example:</p>
 
@@ -1975,7 +1976,7 @@
 
   <p>In this case, embedding doesn't work as each JSON-LD object references the other.
     Using the <code>@graph</code>
-    keyword allows multiple resources to be defined within an <tref>array</tref>, and allows the use
+    <tref>keyword</tref> allows multiple resources to be defined within an <tref>array</tref>, and allows the use
     of a shared <tref>context</tref>. This is equivalent to using multiple <tref>JSON object</tref>
     definitions in array and defining the <code>@context</code> within each object:</p>
 
@@ -2000,7 +2001,7 @@
   -->
   </pre>
 
-  <p>The <code>@graph</code> keyword takes on additional meaning when it
+  <p>The <code>@graph</code> <tref>keyword</tref> takes on additional meaning when it
     is used along with other properties, or is used within an embedded JSON-LD 
     object. In this case, the set of <tref title="subject definition">subject definitions</tref>,
     or <tref title="subject reference">subject references</tref> 
@@ -2052,7 +2053,7 @@
 being able to specify the subject. Typically, this type of node is called
 an <tref>unlabeled node</tref> or a blank node. In JSON-LD, <tref>unlabeled node</tref> identifiers are
 automatically created if a subject is not specified using the
-<code>@id</code> keyword. However, authors may provide identifiers for
+<code>@id</code> <tref>keyword</tref>. However, authors may provide identifiers for
 unlabeled nodes by using the special <code>_</code> (underscore)
 <tref>prefix</tref>. This allows to reference the node locally within the
 document but not in an external document.</p>
@@ -2080,7 +2081,7 @@
 <section>
 <h2>Aliasing Keywords</h2>
 
-<p>JSON-LD allows all of the syntax keywords, except for <code>@context</code>,
+<p>JSON-LD allows all of the syntax <tref title="keyword">keywords</tref>, except for <code>@context</code>,
 to be aliased. This feature allows more legacy JSON content to be supported
 by JSON-LD. It also allows developers to design domain-specific implementations
 using only the JSON-LD <tref>context</tref>.</p>
@@ -2102,7 +2103,7 @@
 </pre>
 
 <p>In the example above, the <code>@id</code> and <code>@type</code>
-keywords have been given the aliases <strong>url</strong> and
+<tref title="keyword">keywords</tref> have been given the aliases <strong>url</strong> and
 <strong>a</strong>, respectively.
 </p>
 
@@ -2358,7 +2359,7 @@
     matches any <tref>subject definition</tref> having a <code>@type</code> property with
     any value.</dd>
   <dt>Duck Typing</dt><dd>
-    A <tref>frame</tref> without a <code>@type</code> definition but with other non-keyword
+    A <tref>frame</tref> without a <code>@type</code> definition but with other non-<tref>keyword</tref>
     property definitions matches any <tref>subject definition</tref> having at least the
     same set of properties.</dt>
   <dt>Embedding</dt><dd>
@@ -2370,7 +2371,7 @@
     to be defined within that property. <tref title="subject reference">Subject references</tref>
     that don't match the embed <tref>frame</tref> are dropped.</dd>
 </dl>
-<p>The [[!JSON-LD-API]] describes other flags and keywords
+<p>The [[!JSON-LD-API]] describes other flags and <tref title="keyword">keywords</tref>
   that are used to gain even more control over the framed output.</p>
 </section>
 </section>