Update contextual property URI generation scheme.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Fri, 04 Nov 2011 22:11:57 -0700
changeset 13 6156a9cbd997
parent 12 0ec087464cce
child 14 2f11ba803758
Update contextual property URI generation scheme.
microdata-rdf/index.html
--- a/microdata-rdf/index.html	Mon Oct 31 15:16:12 2011 -0700
+++ b/microdata-rdf/index.html	Fri Nov 04 22:11:57 2011 -0700
@@ -345,7 +345,7 @@
       by adding the property to the type URI as a fragment.</li>
     <li>When there are multiple top-level items in a document, place items in an RDF Collection.
       Alternatively, simply list the items as multiple values, or do not generate an
-      <code>http://www.w3.org/1999/xhtml/microdata#item</code> mapping at all.</li>
+      <code>http://www.w3.org/ns/md#item</code> mapping at all.</li>
     <li>When there are multiple values for an <aref>itemprop</aref>, place items in an RDF Collection.
       Alternatively, do not use collections, use an alternative such as <code>rdf:Seq</code>, or place all values,
       whether or not multiple, into some form of collection.</li>
@@ -367,6 +367,12 @@
       An attribute appropriate for use with the <code>object</code> element for creating URI<tref>URI
       reference</tref>s.
     </dd>
+    <dt><adef>datetime</adef></dt><dd>
+      An attribute appropriate for use with the <code>date</code> element for creating typed literals.
+      <div class="issue">
+        The <code>date</code> element will likely be replaced with something more general purpose.
+      </div>
+    </dd>
     <dt><adef>href</adef></dt><dd>
       An attribute appropriate for use with <code>a</code>, <code>area</code> or <code>link</code> elements for
       creating <tref>URI reference</tref>s.
@@ -470,17 +476,55 @@
   <h2>Property URI Generation</h2>
   <p>For <tref>property names</tref> which are not <tref>absolute URI</tref>s,
     the <tdef><code>propertyURI</code></tdef> rule defines the algorithm for generating an <tref>absolute URI</tref>
-    given an <tref>evaluation context</tref> including an <tref>current type</tref> and <tref>current
-    property</tref>.</p>
+    given an <tref>evaluation context</tref> including a <tref>current type</tref>, <tref>current property</tref> and
+    <tref>current vocabulary</tref>.</p>
   <p>The procedure for generating property URIs is defined in
     <a href="#generate-predicate-URI">Generate Predicate URI</a>.</p>
   <p>Possible values for <tref><code>propertyURI</code></tref> are the following:</p>
   <dl>
-    <dt><code>context</code></dt><dd>
-      The <code>context</code> URI generation scheme guarantees that generated property URIs are
-      unique for each <tref>current type</tref> and <tref>current property</tref> combination. This is
-      required as the Microdata model requires that property names are associated with specific
+    <dt><code>contextual</code></dt><dd>
+      The <code>contextual</code> URI generation scheme guarantees that generated property URIs are
+      unique based on the value of <tref>current property</tref>. This is
+      required as the Microdata data model requires that property names are associated with specific
       items and do not have a global scope.
+      <div class="note">
+        <p>URI creation uses a base URI with query parameters to indicate the in-scope
+          type and property name list. Consider the following example:</p>
+        <pre class="example" data-transform="updateExample">
+<!--
+<span itemscope itemtype="http://microformats.org/profile/hcard">
+  <span itemprop="n" itemscope>
+    <span itemprop="given-name">
+      Princeton
+    </span>
+  </span>
+</span>
+-->
+        </pre>
+        <p>The first property name <em>n</em> generates the URI
+          <code>http://www.w3.org/ns/md?type=http://microformats.org/profile/hcard?prop=n</code>.
+          However, the included property name <em>given-name</em> is included in untyped item.
+          The inherited property URI is used to create a new property URI:
+          <code>http://www.w3.org/ns/md?type=http://microformats.org/profile/hcard?prop=n.first-name</code>.</p>
+        <p>This scheme is compatible with the needs of other RDF serialization formats such as
+          RDF/XML [[RDF-SYNTAX-GRAMMAR]],
+          which rely on <em>QNames</em> for expressing properties. For example, the generated property URIs
+          can be split as follows:
+        <pre class="example" data-transform="updateExample">
+<!--
+<rdf:Description xmlns:hcard="http://www.w3.org/ns/md?type=http://microformats.org/profile/hcard?prop="
+                 rdf:type="http://microformats.org/profile/hcard">
+  <hcard:n>
+    <rdf:Description>
+      <hcard:n.given-name>
+        Princeton
+      </hcard:n.given-name>
+    </rdf:Description>
+  </hcard:n>
+</rdf:Description>
+-->
+        </pre>
+      </div>
     </dd>
     <dt><code>type</code></dt><dd>
       The <code>type</code> URI generation scheme appends <tref>property names</tref> that are not
@@ -491,7 +535,7 @@
       <tref>absolute URI</tref>s to the <tref>URI prefix</tref>.
     </dd>
   </dl>
-  <p>The default value of <tref><code>propertyURI</code></tref> is <code>context</code>.</p>
+  <p>The default value of <tref><code>propertyURI</code></tref> is <code>contextual</code>.</p>
 </section>
 
 <section>
@@ -546,6 +590,10 @@
           <dt><tdef>current property</tdef></dt><dd>
             an <tref>absolute URI</tref> for the <em>current property</em>, used for generating URIs
             for properties of items without an explicit <aref>itemtype</aref>.
+            <div class="note">
+              <tref>current property</tref> is required for the <code>contextual</code> property URI generation
+              scheme. Without this scheme, this evaluation context component would not be required.
+            </div>
           </dd>
           <dt><tdef>current type</tdef></dt><dd>
             an <tref>absolute URI</tref> for the <em>current type</em>, used when an <tref>item</tref> does not
@@ -625,9 +673,49 @@
             The value is <tref>URI reference</tref> that results from resolving the value of the element's
             <aref>data</aref> attribute relative to the element at the time the attribute is set.
           </dd>
-          <dt>If the element is a <code>data</code> element with a <aref>value</aref> attribute
-          </dt>
+          <dt>If the element is a <code>data</code> element with a <aref>value</aref> attribute</dt>
           <dd>The value is a <tref>plain literal</tref> created from the value.</dd>
+          <dt>If the element is a <code>time</code> element with a <aref>datetime</aref> attribute</dt>
+          <dd>
+            <dl>
+              <dt>
+                If the value has the lexical form of <cite><a
+                href="http://www.w3.org/TR/xmlschema-2/#date">xsd:date</a></cite> [[!RDF-SCHEMA]].
+              </dt>
+              <dd>
+                The value is a <tref>typed literal</tref> composed of the value and
+                <code>http://www.w3.org/2001/XMLSchema#date</code>.
+              </dd>
+              <dt>
+                If the value has the lexical form of <cite><a
+                href="http://www.w3.org/TR/xmlschema-2/#time">xsd:time</a></cite> [[!RDF-SCHEMA]].
+              </dt>
+              <dd>
+                The value is a <tref>typed literal</tref> composed of the value and
+                <code>http://www.w3.org/2001/XMLSchema#time</code>.
+              </dd>
+              <dt>
+                If the value has the lexical form of <cite><a
+                href="http://www.w3.org/TR/xmlschema-2/#dateTime">xsd:dateTime</a></cite> [[!RDF-SCHEMA]].
+              </dt>
+              <dd>
+                The value is a <tref>typed literal</tref> composed of the value and
+               <code>http://www.w3.org/2001/XMLSchema#dateTime</code>.
+              </dd>
+              <!-- revisit when/if content model for @datetime is updated to allow for xsd:duration
+              <dt>
+                If the value has the lexical form of <cite><a
+                href="http://www.w3.org/TR/xmlschema-2/#duration">xsd:duration</a></cite> [[!RDF-SCHEMA]].
+              </dt>
+              <dd>
+                The value is a <tref>typed literal</tref> composed of the value and
+                <code>http://www.w3.org/2001/XMLSchema#duration</code>.
+              </dd>
+              -->
+              <dt>Otherwise</dt>
+              <dd>The value is a <tref>plain literal</tref> created from the value.</dd>
+            </dl>
+          </dd>
           <dt>Otherwise</dt>
           <dd>
             The value is a <tref>plain literal</tref>, with the language information set from the language of the
@@ -705,7 +793,7 @@
           <dt>subject</dt>
           <dd><tref>Document base</tref></dd>
           <dt>predicate</dt>
-          <dd><code>http://www.w3.org/1999/xhtml/microdata#item</code></dd>
+          <dd><code>http://www.w3.org/ns/md#item</code></dd>
           <dt>object</dt>
           <dd><em>value</em></dd>
         </dl>
@@ -767,8 +855,8 @@
                 to <em>type</em> and <tref>current vocabulary</tref> set to <em>vocab</em>.
               <li>
                 Let <em>predicate</em> be the result of <a href="generate-predicate-uri">generate predicate URI</a>
-                using <em>context</em> and <em>name</em>. Update <em>context</em> by setting
-                <tref>current property</tref> to <em>predicate</em>.
+                using <em>context</em> and <em>name</em>.
+                 Update <em>context</em> by setting <tref>current property</tref> to <em>predicate</em>.
               </li>
               <li>
                 Let <em>value</em> be the <tref>property value</tref> of <em>element</em>.
@@ -789,8 +877,8 @@
         For each <em>predicate</em> in <em>property list</em>:
         <ol class="algorithm">
           <li><a href="#generate-property-values">Generate property values</a> using a copy of
-            <tref>evaluation context</tref> with <tref>current property</tref> set to <em>predicate</em> and
-            <tref>current vocabulary</tref> set to <em>vocab</em> along with <em>subject</em> and
+            <tref>evaluation context</tref> with
+            <tref>current vocabulary</tref> set to <em>vocab</em> along with <em>subject</em>, <em>predicate</em> and
             the list of values associated with <em>predicate</em> from <em>property list</em> as <em>values</em>.
           </li>
         </ol>
@@ -801,13 +889,29 @@
   
   <section>
     <h3>Generate Predicate URI</h3>
-    <p>Predicate URI generation makes use of <tref>current type</tref>, <tref>current property</tref>
+    <p>Predicate URI generation makes use of <tref>current type</tref>, <tref>current property</tref>,
       and <tref>current vocabulary</tref> from an <tref>evaluation context</tref> <em>context</em>
       along with <em>name</em>.</p>
 
     <ol class="algorithm">
       <li>If <em>name</em> is an <tref>absolute URI</tref>, return <em>name</em>
         as a <tref>URI reference</tref>.</li>
+      <li>If <tref>current type</tref> from <em>context</em> is null, there can be no <tref>current vocabulary</tref>.        
+        Return the <tref>URI reference</tref> constructed as follows:
+        <ol class="algorithm">
+          <li>Let <em>s</em> be <tref>document base</tref>.</li>
+          <li>If <em>s</em> does not contain a U+0023 NUMBER SIGN character (#),
+            then append a U+0023 NUMBER SIGN character (#) to <em>s</em>.</li>
+          <li>Return the concatenation of <em>s</em>
+            and the fragment-escaped value of <em>name</em> as a <tref>URI reference</tref>.</li>
+        </ol>
+        <div class="note">
+          This rule is intended to allow for a the case where no type is set, and therefore there is no
+          vocabulary from which to extract rules. For example, if there is a <tref>document base</tref> of
+          <code>http://example.org/doc</code> and an <aref>itemprop</aref> of 'title', a URI will be constructed
+          to be <code>http://example.org/doc#title</code>.
+        </div>
+      </li>
       <li>Otherwise, if <tref>current vocabulary</tref> from <em>context</em> is not null
         and <tref>registry</tref> has an entry for <tref>current vocabulary</tref> having a
         <tref>propertyURI</tref> entry that is not null, set that as <em>method</em>. Otherwise,
@@ -822,25 +926,23 @@
           <li>Return the concatenation of <em>s</em>
             and the fragment-escaped value of <em>name</em> as a <tref>URI reference</tref>.</li>
         </ol>
+        <div class="note">
+          The use of the NUMER SIGN as a separator is somewhat arbitrary. A future edition of this document
+          may include additional registry parameters that could identify a different separator character (such
+          as SOLIDUS (/)).
+        </div>
       </li>
-      <li>Otherwise, if <tref>current type</tref> from <em>context</em> return the
-        <tref>URI reference</tref> constructed as follows:
-        <ol class="algorithm">
-          <li>Let <em>s</em> be <tref>document base</tref>.</li>
-          <li>If <em>s</em> does not contain a U+0023 NUMBER SIGN character (#),
-            then append a U+0023 NUMBER SIGN character (#) to <em>s</em>.</li>
-          <li>Return the concatenation of <em>s</em>
-            and the fragment-escaped value of <em>name</em> as a <tref>URI reference</tref>.</li>
-        </ol>
-      <li>Otherwise, return the <tref>URI reference</tref> constructed as follows:
+      <li>If <em>method</em> is <code>contextual</code>, return the <tref>URI reference</tref> constructed as follows:
         <ol class="algorithm">
           <li>Let <em>s</em> be <tref>current type</tref> from <em>context</em>.</li>
-          <li>If the last character of <em>s</em> is not a U+003A COLON character (:),
-            append a U+0025 PERCENT SIGN character (%), a U+0032 DIGIT TWO character (2), and a U+0030 DIGIT ZERO
-            character (0) to s.</li>
-          <li>Append the fragment-escaped value of <em>name</em> to <em>s</em>.</li>
-          <li>Return the concatenation of <code>http://www.w3.org/1999/xhtml/microdata#</code>
-            and the fragment-escaped value of <em>s</em> as a <tref>URI reference</tref>.</li>
+          <li>If <code>http://www.w3.org/ns/md?type=</code> is a prefix of <em>s</em>,
+            return the concatenation of <em>s</em>, a U+002E FULL STOP character (.) and
+            the fragment-escaped value of <em>name</em>.
+          </li>
+          <li>Otherwise, return the concatenation of <code>http://www.w3.org/ns/md?type=</code>,
+            the fragment-escaped value of <em>s</em>, the string <code>&amp;prop=</code>,
+            and the fragment-escaped value of <em>name</em>.
+          </li>
         </ol>
       </li>
     </ol>
@@ -849,11 +951,10 @@
   <section>
     <h2>Generate Property Values</h2>
     <p>Property value serialization makes use of <tref>current vocabulary</tref>
-      from an <tref>evaluation context</tref> <em>context</em> along with <em>subject</em>
+      from an <tref>evaluation context</tref> <em>context</em> along with <em>subject</em>, <em>predicate</em>
       and <em>values</em>.</p>
 
     <ol class="algorithm">
-      <li>Let <em>predicate</em> be <tref>current property</tref> from <em>context</em>.</li>
       <li>If <tref>current vocabulary</tref> from <em>context</em> is not null
         and <tref>registry</tref> has an entry for <tref>current vocabulary</tref> having a
         <tref><code>multipleValues</code></tref> entry that is not null, set that as <em>method</em>. Otherwise,
@@ -987,7 +1088,7 @@
 <!--
 @base <http://books.example.com/> .
 @prefix dc: <http://purl.org/dc/terms/> .
[email protected] md: <http://www.w3.org/1999/xhtml/microdata#> .
[email protected] md: <http://www.w3.org/ns/md#> .
 @prefix frbr: <http://purl.org/vocab/frbr/core#> .
 
 <> md:item <works/45U8QJGZSQKDH8N> .
@@ -1013,13 +1114,13 @@
 <!--
 <p>
  Both
- <span itemscope itemtype="http://microformats.org/profile/hcard#" itemref="home">
+ <span itemscope itemtype="http://microformats.org/profile/hcard" itemref="home">
    <span itemprop="fn"
        ><span itemprop="n" itemscope
        ><span itemprop="given-name">Princeton</span></span></span>
   </span>
  and
- <span itemscope itemtype="http://microformats.org/profile/hcard#" itemref="home">
+ <span itemscope itemtype="http://microformats.org/profile/hcard" itemref="home">
    <span itemprop="fn"
      ><span itemprop="n" itemscope
        ><span itemprop="given-name">Trekkie</span></span></span>
@@ -1038,8 +1139,8 @@
 
 <pre class="example" data-transform="updateExample">
 <!--
[email protected] md: <http://www.w3.org/1999/xhtml/microdata#> .
[email protected] hcard: <http://microformats.org/profile/hcard#> .
[email protected] md: <http://www.w3.org/ns/md#> .
[email protected] hcard: <http://microformats.org/profile/hcard> .
 
 <> md:item
   [ a hcard:;