Update multiple values and allow for per-property overrides.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Wed, 16 Nov 2011 13:21:31 -0800
changeset 20 8eb4093ca497
parent 19 dcefcd38c07b
child 21 fdee8a158176
Update multiple values and allow for per-property overrides.
microdata-rdf/index.html
--- a/microdata-rdf/index.html	Tue Nov 15 19:01:34 2011 -0800
+++ b/microdata-rdf/index.html	Wed Nov 16 13:21:31 2011 -0800
@@ -377,7 +377,7 @@
       Should the <tref>registry</tref> allow property datatype specification.
     </dd>
     <dt><a href="http://www.w3.org/2011/htmldata/track/issues/4">ISSUE 4</a></dt><dd>
-      Should the <tref>registry</tref> allow a property name or URI to be used as an alias for <aref>itemid</aref>.
+      Should the <tref>registry</tref> allow a <tref>property name</tref> or URI to be used as an alias for <aref>itemid</aref>.
     </dd>
   </dl>
 
@@ -487,7 +487,6 @@
     without regards to the requirements of a particular <tref>vocabulary</tref>. However, microdata doesn't
     provide sufficient syntactic help in making these decisions. Different vocabularies have different
     needs.</p>
-  <p></p>
   <p>The <tdef>registry</tdef> associates a <tdef>URI prefix</tdef> with one or more key-value pairs denoting
   processor behavior. A hypothetical JSON representation of such a registry might be the following:</p>
 <pre class="example" data-transform="updateExample">
@@ -495,11 +494,17 @@
 {
   "http://schema.org/": {
     "propertyURI":    "vocabulary",
-    "multipleValues": "unordered"
+    "multipleValues": "unordered",
+    "properties": {
+      "tracks": "list"
+    }
   },
   "http://microformats.org/profile/hcard": {
-    "propertyURI":    "type",
-    "multipleValues": "list"
+    "propertyURI":    "vocabulary",
+    "multipleValues": "list",
+    "properties" {
+      "url": {"multipleValues": "unordered"}
+    }
   }
 }
 -->
@@ -508,7 +513,10 @@
     <code>http://microformats.org/profile/hcard</code>. Items having an <aref>itemtype</aref> with a <tref>URI
     prefix</tref> from this <tref>registry</tref> use the the rules described for that prefix within the scope of that
     <aref>itemtype</aref>. This mapping currently defines two rules: <tref><code>propertyURI</code></tref> and
-    <tref><code>multipleValues</code></tref> with values to indicate specific behavior. The interpretation of these
+    <tref><code>multipleValues</code></tref> with values to indicate specific behavior. It also allows overrides
+    on a per-property basis; the <tref><code>properties</code></tref> key associates individual <tref>property name</tref>s
+    with overrides for default behavior.
+    The interpretation of these
     rules is defined in the following sections. If an item has no <tref>current type</tref> or the
     <tref>registry</tref> contains no <tref>URI prefix</tref> matching <tref>current type</tref>, a conforming
     processor MUST use the default values defined for these rules.</p>
@@ -527,23 +535,23 @@
 
 <section class="informative">
   <h2>Property URI Generation</h2>
-  <p>For <tref>property names</tref> which are not <tref>absolute URI</tref>s,
+  <p>For <tref>property name</tref>s 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 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>
+    <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>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
+      required as the microdata data model requires that <tref>property name</tref>s are associated with specific
       items and do not have a global scope. (See <a href="#scheme-context">Step 5</a> in
-      <a href="#generate-predicate-URI">Generate Predicate URI</a>).
+      <a href="#generate-predicate-uri">Generate Predicate URI</a>).
       <div>
         <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>
+          type and <tref>property name</tref> list. Consider the following example:</p>
         <pre class="example" data-transform="updateExample">
 <!--
 <span itemscope itemtype="http://microformats.org/profile/hcard">
@@ -555,9 +563,9 @@
 </span>
 -->
         </pre>
-        <p>The first property name <em>n</em> generates the URI
+        <p>The first <tref>property name</tref> <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.
+          However, the included <tref>property name</tref> <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.given-name</code>.</p>
         <p>This scheme is compatible with the needs of other RDF serialization formats such as
@@ -590,13 +598,13 @@
       </div>
     </dd>
     <dt><code>vocabulary</code></dt><dd>
-      The <code>vocabulary</code> URI generation scheme appends <tref>property names</tref> that are not <tref>absolute
+      The <code>vocabulary</code> URI generation scheme appends <tref>property name</tref>s that are not <tref>absolute
       URI</tref>s to the <tref>URI prefix</tref>. When generating property URIs, if the <tref>URI prefix</tref> does not end
       with a '/' or '#', a '#' is appended to the URI prefix. (See <a href="#scheme-vocab">Step 4</a> in
-      <a href="#generate-predicate-URI">Generate Predicate URI</a>.)
+      <a href="#generate-predicate-uri">Generate Predicate URI</a>.)
       <div>
         <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>
+          type and <tref>property name</tref> list. Consider the following example:</p>
         <pre class="example" data-transform="updateExample">
 <!--
 <span itemscope itemtype="http://microformats.org/profile/hcard">
@@ -646,26 +654,67 @@
     <code>http://schema.org/</code>. As there is no explicit <tref><code>propertyURI</code></tref>,
     the default <code>vocabulary</code> is used, and the resulting property URI would be
     <code>http://schema.org/title</code>.</p>
-/section>
+</section>
 
 <section class="informative">
   <h2>Value Ordering</h2>
   <p>For items having multiple values for a property,
     the <tdef><code>multipleValues</code></tdef> rule defines the algorithm for serializing these values.
-    This is required as the microdata data model requires that values be strictly ordered as defined in
+    Microdata uses document order when generating property values, as defined in
     <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite>
     as <code>element.itemValue</code>. However, many RDF vocabularies expect multiple values to be generated
-    as triples sharing a common subject and predicate.</p>
-    <p>Possible values for <tref><code>multipleValues</code></tref> are the following:</p>
-    <dl>
-      <dt><code>unordered</code></dt><dd>
-        Values are serialized without ordering using a common subject and predicate.
-      </dd>
-      <dt><code>list</code></dt><dd>
-        Multi-valued <aref>itemprop</aref>s are serialized using an <tref>RDF Collection</tref>.
-      </dd>
-    </dl>
-    <p>The default value of <tref><code>multipleValues</code></tref> is <code>list</code>.</p>
+    as triples sharing a common subject and predicate. In some cases, it may be useful to retain value ordering.</p>
+  <p>The procedure for generating property values is defined in
+    <a href="#generate-property-values">Generate Property Values</a>.</p>
+  <p>Possible values for <tref><code>multipleValues</code></tref> are the following:</p>
+  <dl>
+    <dt><code>unordered</code></dt><dd>
+      Values are serialized without ordering using a common subject and predicate.
+      (See <a href="#values-unordered">Step 7</a> in
+      <a href="#generate-property-values">Generate Property Values</a>).
+    </dd>
+    <dt><code>list</code></dt><dd>
+      Multi-valued <aref>itemprop</aref>s are serialized using an <tref>RDF Collection</tref>.
+      (See <a href="#values-list">Step 8</a> in
+      <a href="#generate-property-values">Generate Property Values</a>).
+    </dd>
+  </dl>
+  <p>An example of how this might be specified in a <tref>registry</tref> is the following:</p>
+  <pre class="example" data-transform="updateExample">
+<!--
+{
+  "http://schema.org/": {
+    "propertyURI":    "vocabulary",
+    ****"multipleValues": "unordered"****
+  },
+  "http://microformats.org/profile/hcard": {
+    "propertyURI":    "type",
+    ****"multipleValues": "list"****
+  }
+}
+-->
+  </pre>
+  <p>Additionally, some vocabularies my wish to specify this on a per-property basis. For example,
+    within <code>http://schema.org/MusicPlaylist</code> the <code>tracks</code> property might depend on the order
+    of values to to reproduce associated <code>MusicRecording</code> values.</p>
+  <pre class="example" data-transform="updateExample">
+<!--
+{
+ "http://schema.org/": {
+   "propertyURI": "vocabulary",
+   "multipleValues": "unordered"****,
+   "properties": {
+     "tracks": {"multipleValues": "list"}
+   }****
+ }
+}
+-->
+  </pre>
+  <p>The <tdef><code>properties</code></tdef> key takes a JSON Object as a value, which in turn has keys for each
+    property that is to be given alternate semantics. Each <tref>property name</tref> is implicitly expanded to it's URI
+    representation as defined in <a href="#generate-predicate-uri">Generate Predicate URI</a>, so that
+    the behavior is the same whether or not the <tref>property name</tref> is listed as an <tref>absolute URI</tref>.</p>
+  <p>The default value of <tref><code>multipleValues</code></tref> is <code>unordered</code>.</p>
 </section>
 
 <section class="informative">
@@ -682,10 +731,10 @@
  "http://schema.org/": {
    "propertyURI": "vocabulary",
    "multipleValues": "unordered"****,
-   "@context": {
-     "url": {"@datatype": "@uri"},
-     "dateCreated": {"@datatype": "http://www.w3.org/2001/XMLSchema#date"},
-     "price": {"@datatype": => [
+   "properties": {
+     "url": {"datatype": "@uri"},
+     "dateCreated": {"datatype": "http://www.w3.org/2001/XMLSchema#date"},
+     "price": {"datatype": => [
        "http://www.w3.org/2001/XMLSchema#decimal",
        "http://www.w3.org/2001/XMLSchema#string"
      ]}
@@ -694,10 +743,9 @@
 }
 -->
   </pre>
-  <p>This notation borrows some concepts from the JSON-LD [[JSON-LD]] context.
-    The @datatype identifies one or more XSD types against which to perform lexical matching, causing
+  <p>The <code>datatype</code> identifies one or more XSD types against which to perform lexical matching, causing
     the literal object to have the associated datatype.</p>
-  <p>The <code>@iri</code> datatype identifies the property has having a <tref>URI reference</tref> range,
+  <p>The <code>@uri</code> datatype identifies the property has having a <tref>URI reference</tref> range,
     rather than a literal. This allows the property to be used where there is a literal content model, such as
     <aref>content</aref>, and would cause the value to be interpreted as a <tref>URI reference</tref>.</p>
   <p>These concepts are not explored further at this time, but could be developed further in
@@ -806,7 +854,7 @@
         <tdef>plain literal</tdef>s.
         (See [[RDF-CONCEPTS]]).
       </dd>
-     <dt><tdef>property names</tdef></dt><dd>
+     <dt><tdef>property name</tdef>s</dt><dd>
         The tokens of an element's <aref>itemprop</aref> attribute.
         (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#property-names">Names: the
         itemprop attribute</a></cite> in [[!MICRODATA]]).
@@ -1046,17 +1094,17 @@
       <li>Otherwise, construct <em>vocab</em> by removing everything following the last SOLIDUS U+002F ("/")
         or NUMBER SIGN U+0023 ("#") from <em>type</em>.</li>
       <li>
-        Set <em>property list</em> to an empty mapping between properties and one or more ordered
+        Set <em>property list</em> to an empty array mapping properties to one or more
         <em>value</em>s as established below.
       </li>
       <li>
-        For each element <em>element</em> that has one or more <tref>property names</tref> and is one of the
+        For each element <em>element</em> that has one or more <tref>property name</tref>s and is one of the
         <tref title="item properties">properties of the item</tref> <em>item</em>, in the order those elements
         are given by the algorithm that returns the <tref title="item properties">properties of the item</tref>,
         run the following substep:
         <ol class="algorithm">
           <li>
-            For each <em>name</em> in the element's <tref>property names</tref>, run the following substeps:
+            For each <em>name</em> in the element's <tref>property name</tref>s, run the following substeps:
             <ol class="algorithm">
               <li>
                 Let <em>context</em> to a copy of <tref>evaluation context</tref> with <tref>current type</tref> set
@@ -1153,11 +1201,22 @@
 
     <ol class="algorithm">
       <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,
-        set <em>method</em> to <code>list</code>.</li>
-      <li>If <em>method</em> is <code>unordered</code>, foreach <em>value</em> in <em>values</em>, generate
-        the following triple:
+        and <tref>registry</tref> has an entry for <tref>current vocabulary</tref> that is a JSON Object, let <em>registry
+        object</em> be that value. Otherwise set <em>registry object</em> to null.</li>
+      <li>If <em>registry object</em> is not null and <em>registry object</em> contains key
+        <tref><code>properties</code></tref>
+        which has a JSON Object value, let <em>properties</em> be that value. Otherwise, set <em>properties</em>
+        to null.</li>
+      <li>If <em>properties</em> is not null, and <em>properties</em> contains a key, which after
+        <a href="#generate-predicate-uri">Generate Predicate URI</a> which is a JSON Object, let
+        <em>property override</em> be that value. Otherwise, set <em>property override</em> to null.</li>
+      <li>If <em>property override</em> contains the key
+        <tref><code>multipleValues</code></tref>, set that as <em>method</em>.</li>
+      <li>Otherwise, if <em>registry object</em> con  contains the key
+        <tref><code>multipleValues</code></tref>, set that as <em>method</em>.</li>
+      <li>Otherwise, set <em>method</em> to <code>unordered</code>.</li>
+      <li id="values-unordered">If <em>method</em> is <code>unordered</code>,
+        foreach <em>value</em> in <em>values</em>, generate the following triple:
         <dl class="triple">
           <dt>subject</dt>
           <dd><em>subject</em></dd>
@@ -1167,17 +1226,12 @@
           <dd><em>value</em></dd>
         </dl>
       </li>
-      <li>Otherwise, if <em>method</em> is <code>list</code>:
+      <li id="values-list">Otherwise, if <em>method</em> is <code>list</code>:
         <ol class="algorithm">
-          <li>If <em>values</em> contains multiple values, <a
-            href="generate-collection">generate an RDF Collection</a> <em>list</em> from the ordered list of values.
-            Set <em>value</em> to the value returned from <a href="generate-collection">generate an RDF
+          <li>Set <em>value</em> to the value returned from <a href="generate-collection">generate an RDF
             Collection</a>.
           </li>
           <li>
-            Otherwise, if <em>values</em> contains a single value set <em>value</em> to that value.
-          </li>
-          <li>
             Generate the following triple:
             <dl class="triple">
               <dt>subject</dt>