Merge @datatype into @type. A Note is added in Typed Literals section that indicates that the concepts are actually different. This resolves issue #31.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Wed, 14 Dec 2011 22:41:34 -0800
changeset 294 efe036bef662
parent 293 6a9bb1a6bae4
child 295 241be3897afd
Merge @datatype into @type. A Note is added in Typed Literals section that indicates that the concepts are actually different. This resolves issue #31.
spec/latest/json-ld-api/index.html
spec/latest/json-ld-syntax/index.html
--- a/spec/latest/json-ld-api/index.html	Wed Dec 14 22:28:00 2011 -0800
+++ b/spec/latest/json-ld-api/index.html	Wed Dec 14 22:41:34 2011 -0800
@@ -490,7 +490,7 @@
         <dl class="exception" title="InvalidContext">
          <dt>INVALID_SYNTAX</dt>
          <dd>A general syntax error was detected in the <code>@context</code>.
-         For example, if a <code>@datatype</code> key maps to anything other than
+         For example, if a <code>@type</code> key maps to anything other than
          a string or an array of strings, this exception would be raised.</dd>
          <dt>MULTIPLE_DATATYPES</dt>
          <dd>There is more than one target datatype specified for a single
@@ -518,7 +518,7 @@
         <dl class="exception" title="InvalidContext">
           <dt>INVALID_SYNTAX</dt>
           <dd>A general syntax error was detected in the <code>@context</code>.
-            For example, if a <code>@datatype</code> key maps to anything other than
+            For example, if a <code>@type</code> key maps to anything other than
             a string or an array of strings, this exception would be raised.</dd>
           <dt>MULTIPLE_DATATYPES</dt>
           <dd>There is more than one target datatype specified for a single
@@ -584,7 +584,7 @@
         <dl class="exception" title="InvalidContext">
           <dt>INVALID_SYNTAX</dt>
           <dd>A general syntax error was detected in the <code>@context</code>.
-            For example, if a <code>@datatype</code> key maps to anything other than
+            For example, if a <code>@type</code> key maps to anything other than
             a string or an array of strings, this exception would be raised.</dd>
           <dt>MULTIPLE_DATATYPES</dt>
           <dd>There is more than one target datatype specified for a single
@@ -615,7 +615,7 @@
         <dl class="exception" title="InvalidContext">
           <dt>INVALID_SYNTAX</dt>
           <dd>A general syntax error was detected in the <code>@context</code>.
-            For example, if a <code>@datatype</code> key maps to anything other than
+            For example, if a <code>@type</code> key maps to anything other than
             a string or an array of strings, this exception would be raised.</dd>
           <dt>MULTIPLE_DATATYPES</dt>
           <dd>There is more than one target datatype specified for a single
@@ -677,11 +677,10 @@
 
   <dl>
   <dt><code>@context</code></dt><dd>Used to set the <tref>local context</tref>.</dd>
-  <dt><code>@datatype</code></dt><dd>Used to specify the datatype for a literal.</dd>
   <dt><code>@id</code></dt><dd>Sets the active subject.</dd>
   <dt><code>@language</code></dt><dd>Used to specify the language for a literal.</dd>
   <dt><code>@literal</code></dt><dd>Used to specify a literal value.</dd>
-  <dt><code>@type</code></dt><dd>Used to set the type of the active subject.</dd>
+  <dt><code>@type</code></dt><dd>Used to set the type of the active subject or the datatype of a literal.</dd>
   <dt><code>:</code></dt><dd>The separator for JSON keys and values that use the <tref>prefix</tref> mechanism.</dd>
   </dl>
 </section>
@@ -815,7 +814,7 @@
         <li>For each key in <em>value</em> having the lexical form of <code>NCName</code> or an empty string,
           with a value that is a <tref>JSON object</tref>
           <ol class="algorithm">
-            <li>If the value has a <code>@datatype</code> key, the value MUST have the form of <tref>term</tref>,
+            <li>If the value has a <code>@type</code> key, the value MUST have the form of <tref>term</tref>,
               <tref>prefix</tref>:suffix, absolute IRI or the keyword <code>@id</code>. Add a <tref>coercion
               mapping</tref> for the term to the <tref>local context</tref> performing <a href="#iri-expansion">IRI
               Expansion</a> on the associated value using the <tref>active context</tref> as necessary.</li>
@@ -831,7 +830,7 @@
       <tref>active context</tref>'s <tref>list mapping</tref>.</li>
   </ol>
   
-  <p class="note">Rules for looking up <code>@datatype</code> coercion is performed
+  <p class="note">Rules for looking up <code>@type</code> coercion is performed
     after merging local term definitions into the <tref>active context</tref>. This allows datatype
     IRIs to be specified using <tref>term</tref> or <tref>prefix</tref> defined within the same context.</p>
 </section>
@@ -901,7 +900,7 @@
           <li>If the coercion target is a typed literal, expand the value
             by adding two new key-value pairs. The first key-value pair
             will be <code>@literal</code> and the unexpanded value. The second
-            key-value pair will be <code>@datatype</code> and the associated
+            key-value pair will be <code>@type</code> and the associated
             coercion datatype expanded according to the
             <a href="#iri-expansion">IRI Expansion</a> rules.</li>
         </ol>
@@ -956,7 +955,7 @@
       "name": "http://xmlns.com/foaf/0.1/name",
       "homepage": {
         "@id": "http://xmlns.com/foaf/0.1/homepage",
-        "@datatype", "@id"
+        "@type", "@id"
       }
    },
    "name": "Manu Sporny",
@@ -1044,7 +1043,7 @@
   "name": "http://xmlns.com/foaf/0.1/name",
   "homepage": {
     "@id": "http://xmlns.com/foaf/0.1/homepage",
-    "@datatype": "@id"
+    "@type": "@id"
   }
 }
 -->
@@ -1061,7 +1060,7 @@
     "name": "http://xmlns.com/foaf/0.1/name",
     "homepage": {
       "@id": "http://xmlns.com/foaf/0.1/homepage",
-      "@datatype": "@id"
+      "@type": "@id"
     }
   },
   "name": "Manu Sporny",
@@ -1126,7 +1125,7 @@
     "Chapter":      "http://example.org/vocab#Chapter",
     "contains":     {
       "@id": "http://example.org/vocab#contains",
-      "@datatype": "@id"
+      "@type": "@id"
     },
     "creator":      "http://purl.org/dc/terms/creator",
     "description":  "http://purl.org/dc/terms/description",
@@ -1428,7 +1427,7 @@
     "name": "http://xmlns.com/foaf/0.1/name",
     "homepage": {
       "@id": "http://xmlns.com/foaf/0.1/homepage",
-      "@datatype": "@id"
+      "@type": "@id"
     },
     "xsd": "http://www.w3.org/2001/XMLSchema#"
   },
@@ -1898,7 +1897,7 @@
         <code>@literal</code> is first.
       </li>
       <li>The lexicographically lesser string associated with
-        <code>@datatype</code> is first.
+        <code>@type</code> is first.
       </li>
       <li>The lexicographically lesser string associated with
         <code>@language</code> is first.
@@ -2360,12 +2359,12 @@
             where <strong>IRI</strong> is the value associated with the
             <code>@id</code> key.</li>
           <li>If the object contains a <code>@literal</code> key and a
-            <code>@datatype</code> key, build the <tref>object string</tref>
+            <code>@type</code> key, build the <tref>object string</tref>
             using the pattern
             <code>"</code><strong>LITERAL</strong><code>"^^&lt;</code><strong>DATATYPE</strong><code>&gt;</code>
             where <strong>LITERAL</strong> is the value associated with the
             <code>@literal</code> key and <strong>DATATYPE</strong> is the
-            value associated with the <code>@datatype</code> key.</li>
+            value associated with the <code>@type</code> key.</li>
           <li>If the object contains a <code>@literal</code> key and a
             <code>@language</code> key, build the <tref>object string</tref>
             using the pattern
@@ -2468,7 +2467,7 @@
 var myObj = { "@context" : {
                 "number" : {
                   "@id": "http://example.com/vocab#number",
-                  "@datatype": "xsd:nonNegativeInteger"
+                  "@type": "xsd:nonNegativeInteger"
                 }
               },
               "number" : 42 };
@@ -2588,8 +2587,8 @@
           to a literal value as follows:
           <ol class="algorithm">
             <li>
-              as a <tref>typed literal</tref> if the <tref>JSON object</tref> contains a <code>@datatype</code> key
-              after performing <a href="#iri-expansion">IRI Expansion</a> on the specified<code>@datatype</code>.
+              as a <tref>typed literal</tref> if the <tref>JSON object</tref> contains a <code>@type</code> key
+              after performing <a href="#iri-expansion">IRI Expansion</a> on the specified<code>@type</code>.
             </li>
             <li>
               otherwise, as a <tref>plain literal</tref>. If the <tref>JSON object</tref> contains
--- a/spec/latest/json-ld-syntax/index.html	Wed Dec 14 22:28:00 2011 -0800
+++ b/spec/latest/json-ld-syntax/index.html	Wed Dec 14 22:41:34 2011 -0800
@@ -413,11 +413,10 @@
 
   <dl>
   <dt><code>@context</code></dt><dd>Used to set the <tref>local context</tref>.</dd>
-  <dt><code>@datatype</code></dt><dd>Used to specify the datatype for a literal.</dd>
   <dt><code>@id</code></dt><dd>Sets the active subject.</dd>
   <dt><code>@language</code></dt><dd>Used to specify the language for a literal.</dd>
   <dt><code>@literal</code></dt><dd>Used to specify a literal value.</dd>
-  <dt><code>@type</code></dt><dd>Used to set the type of the active subject.</dd>
+  <dt><code>@type</code></dt><dd>Used to set the type of the active subject or the datatype of a literal.</dd>
   <dt><code>:</code></dt><dd>The separator for JSON keys and values that use the <tref>prefix</tref> mechanism.</dd>
   </dl>
 </section>
@@ -856,7 +855,7 @@
   "@context": {
     ...
     "homepage": {
-      "@id": "http://xmlns.com/foaf/0.1/homepage", "@datatype": "@id"
+      "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"
     }
     ...
   }****
@@ -945,7 +944,6 @@
       <http://xmlns.com/foaf/0.1/Person> .
 -->
 </pre>
-
 </section>
 
 <section>
@@ -1006,22 +1004,22 @@
 </p>
 
 <ol>
-  <li>By utilizing the <code>@datatype</code> keyword when defining a <tref>term</tref> within a
+  <li>By utilizing the <code>@type</code> keyword 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 datatype.</li>
 </ol>
 
-<p>The first example uses the <code>@datatype</code> keyword to express a typed literal:</p>
+<p>The first example uses the <code>@type</code> keyword to express a typed literal:</p>
 
 <pre class="example" data-transform="updateExample">
 <!--
 {
   ****"@context": {
-    "modified":
-    {
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "modified": {
       "@id": "http://purl.org/dc/terms/modified",
-      "@datatype": "http://www.w3.org/2001/XMLSchema#dateTime"
+      "@type": "xsd:dateTime"
     }
   }****
 ...
@@ -1037,10 +1035,9 @@
 <!--
 {
 ...
-  "modified": ****
-  {
+  "modified": ****{
     "@literal": "2010-05-29T14:17:39+02:00",
-    "@datatype": "dateTime"
+    "@type": "xsd:dateTime"
   }****
 ...
 }
@@ -1075,6 +1072,13 @@
 -->
 </pre>
 
+<p class="note">
+  The <code>@type</code> keyword is also used to associate a type with an object. Although the same keyword
+  is used in both places, the concept of object type and literal datatype are, in fact, different. This is similar
+  to object-oriented programming languages where both scalar and structured types use the same class inheritance
+  mechanism, even though scalar types and structured types are inherently different.
+</p>
+
 </section>
 
 <section>
@@ -1189,7 +1193,7 @@
   <p>
     This describes the use of this <tref>array</tref> as being ordered, and order is maintained through normalization
     and RDF conversion as described in [[JSON-LD-API]]. If every use of a given multi-valued property is a list, this
-    may be abbreviated by adding an <code>@datatype</code> <tref>coercion</tref>:
+    may be abbreviated by adding an <code>@type</code> <tref>coercion</tref>:
   </p>
   <pre class="example" data-transform="updateExample">
   <!--
@@ -1562,7 +1566,7 @@
   // The following value is automatically converted to a type of xsd:double as well
   "space:astronomicUnits": ****6.5e73****,
   // The following value should never be converted to a language-native type
-  "measure:stones": ****{ "@literal": "4.8", "@datatype": "xsd:decimal" }****,
+  "measure:stones": ****{ "@literal": "4.8", "@type": "xsd:decimal" }****,
   // This value is automatically converted to having a type of xsd:integer
   "chem:protons": ****12****,
   // This value is automatically converted to having a type of xsd:boolean
@@ -1602,13 +1606,13 @@
 properly typed RDF data.</p>
 
 <p>Type coercion is specified within an <a href="#expanded-term-definition">expanded term definition</a>
-  using the <code>@datatype</code> key. The values of this key represent datatype IRIs and MUST take the form of
+  using the <code>@type</code> key. The values of this key represent datatype IRIs and MUST take the form of
   <tref>term</tref>, <tref>prefix</tref>:suffix, absolute IRI or the keyword <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, or labeled nodes and are subject to IRI expansion.</p>
 
 <p><tref title="term">Terms</tref> or <tref title="prefix">prefixes</tref> used as the value of a
-  <code>@datatype</code> key MAY be defined within the same context.</p>
+  <code>@type</code> key MAY be defined within the same context.</p>
 
 <p>The example below demonstrates how a JSON-LD author can coerce values to
 <tref>plain literal</tref>s, <tref>typed literal</tref>s, IRIs and lists.</p>
@@ -1621,8 +1625,8 @@
      "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "xsd": "http://www.w3.org/2001/XMLSchema#",
      "name": "http://xmlns.com/foaf/0.1/name",
-     "age": ****{"@id": "http://xmlns.com/foaf/0.1/age", "@datatype": "xsd:integer"}****,
-     "homepage": ****{"@id": "http://xmlns.com/foaf/0.1/homepage", "@datatype": "@id"}****
+     "age": ****{"@id": "http://xmlns.com/foaf/0.1/age", "@type": "xsd:integer"}****,
+     "homepage": ****{"@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id"}****
   },
   "name": "John Smith",
   "age": ****"41"****,
@@ -1966,7 +1970,7 @@
   "@context":
   {
     "vcard": "http://microformats.org/profile/hcard#vcard",
-    "url": {"@id": "http://microformats.org/profile/hcard#url", "@datatype": "@id"},
+    "url": {"@id": "http://microformats.org/profile/hcard#url", "@type": "@id"},
     "fn": "http://microformats.org/profile/hcard#fn"
   },
   "@id": "_:bnode1",