Move @list expansion up to avoid it's being made into an array.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Wed, 28 Mar 2012 19:13:49 -0700
changeset 423 3510738cffea
parent 422 8855e3ec00f9
child 424 0f4a450bbebe
Move @list expansion up to avoid it's being made into an array.
spec/latest/json-ld-api/index.html
--- a/spec/latest/json-ld-api/index.html	Wed Mar 28 17:31:17 2012 -0700
+++ b/spec/latest/json-ld-api/index.html	Wed Mar 28 19:13:49 2012 -0700
@@ -1184,40 +1184,54 @@
     and removing null entries.</li>
   <li>Otherwise, if <em>element</em> is an object
     <ol class="algorithm">
-      <li>If <em>element</em> has a <code>@context</code> property, update the <tref>active context</tref> according
-      to the steps outlined in <a href="#context-processing">Context Processing</a> and remove the <code>@context</code> property.</li>
+      <li>If <em>element</em> has a <code>@context</code> property, update the
+        <tref>active context</tref> according to the steps outlined in
+        <a href="#context-processing">Context Processing</a> and remove the <code>@context</code>
+        property.</li>
       <li>For each <em>property</em> and <em>value</em> in <em>element</em>:
         <ol class="algorithm">
           <li>Set <em>property</em> as <tref>active property</tref> and the result
-            of performing <a href="#iri-expansion">IRI Expansion</a> on <em>property</em> as <em>expanded property</em>.</li>
-          <li>If <em>value</em> is <tref>null</tref>, skip this property/value pair and remove <em>property</em> from <em>element</em></li>
+            of performing <a href="#iri-expansion">IRI Expansion</a> on <em>property</em> as
+            <em>expanded property</em>.</li>
+          <li>If <em>value</em> is <tref>null</tref>, skip this property/value pair and remove
+            <em>property</em> from <em>element</em></li>
           <li>Otherwise, if <em>value</em> is a <tref>JSON object</tref> having either a <code>@value</code>,
-            <code>@list</code>, or <code>@set</code> key with a <tref>null</tref> value, skip this property/value pair and remove
-            <em>property</em> from <em>element</em>.</li>
-          <li>Otherwise, if <em>value</em> is a <tref>JSON object</tref> having a <code>@set</code> property with a
-            non-<tref>null</tref> value, replace <em>value</em> with the value of <code>@set</code>.</li>
-          <li>If the <em>expanded property</em> is <code>@id</code> and the <em>value</em> is a <tref>string</tref>,
-            expand the value according to <a href="#iri-expansion">IRI Expansion</a>.</li>
-          <li>Otherwise, if the <em>expanded property</em> is <code>@type</code> and the <em>value</em> is a <tref>string</tref>
-            expand <em>value</em> according to <a href="#iri-expansion">IRI Expansion</a>. If <em>element</em> has no
-            <code>@value</code> property, replace <em>value</em> with an array whose only value is the expanded <em>value</em>.</li>
-          <li>Otherwise, if the <em>expanded property</em> is <code>@type</code> and the <em>value</em> is an <tref>array</tref>,
-            expand every item according to <a href="#iri-expansion">IRI Expansion</a>.</li>
-          <li>Otherwise, if the <em>expanded property</em> is <code>@list</code> and the <em>value</em> is not an array,
-            wrap <em>value</em> in an array.
-            Process each item of <em>value</em> recursively using this algorithm, passing copies of the <tref>active context</tref> and
-            <tref>active property</tref> removing all items that equal to <tref>null</tref>.</li>
-          <li>Otherwise, if the <em>expanded property</em> is <code>@value</code>, the value is not subject to further expansion.</li>
-          <li>Otherwise, if the <em>expanded property</em> is <code>@graph</code>, replace the entire object with the result of
-            performing this algorithm on the members of the value and terminate further processing of this object.</li>
+            <code>@list</code>, or <code>@set</code> key with a <tref>null</tref> value, skip this
+            property/value pair and remove <em>property</em> from <em>element</em>.</li>
+          <li>Otherwise, if <em>value</em> is a <tref>JSON object</tref> having a <code>@set</code>
+            property with a non-<tref>null</tref> value, replace <em>value</em> with the
+            value of <code>@set</code>.</li>
+          <li>Otherwise, if <em>value</em> is a <tref>JSON object</tref> having a <code>@list</code> property,
+            that value MUST be an array. Process each entry of <em>value</em>
+            recursively using this algorithm, passing copies of the <tref>active context</tref> and
+            <tref>active property</tref> removing all <tref>null</tref> entries.
+            Add an entry in the output object for <em>expanded property</em> with value and continue to the
+            next entry in <em>element</em>.</li>
+          <li>If the <em>expanded property</em> is <code>@id</code> and the <em>value</em>
+            is a <tref>string</tref>, expand the value according to
+            <a href="#iri-expansion">IRI Expansion</a>.</li>
+          <li>Otherwise, if the <em>expanded property</em> is <code>@type</code> and the <em>value</em>
+            is a <tref>string</tref> expand <em>value</em> according to
+            <a href="#iri-expansion">IRI Expansion</a>. If <em>element</em> has no
+            <code>@value</code> property, replace <em>value</em> with an array whose only value
+            is the expanded <em>value</em>.</li>
+          <li>Otherwise, if the <em>expanded property</em> is <code>@type</code> and the
+            <em>value</em> is an <tref>array</tref>, expand every entry according to
+            <a href="#iri-expansion">IRI Expansion</a>.</li>
+          <li>Otherwise, if the <em>expanded property</em> is <code>@value</code>,
+            the value is not subject to further expansion.</li>
+          <li>Otherwise, if the <em>expanded property</em> is <code>@graph</code>,
+            replace the entire object with the result of performing this algorithm on the members
+            of the value and terminate further processing of this object.</li>
           <li>Process <em>value</em> as follows:
             <ol class="algorithm">
-              <li>If the <em>value</em> is an <tref>array</tref>, and <tref>active property</tref> is subject to <code>@list</code>
-                expansion, replace the <em>value</em> with an object having a <code>@list</code> property whose value is
-                set to the current <em>value</em>.</li>
-              <li>Otherwise, if <em>value</em> is not an <tref>array</tref>, replace <em>value</em> with an array containing
-                <em>value</em>.</li>
-              <li>If <em>value</em> is an <tref>array</tref>, process each item in the <tref>array</tref>
+              <li>If the <em>value</em> is an <tref>array</tref>, and <tref>active property</tref>
+                is subject to <code>@list</code> expansion, replace <em>value</em> with a
+                new object where the key is <code>@list</code> and value set to the
+                current <em>value</em> updated by recursively using this algorithm.</li>
+              <li>Otherwise, if <em>value</em> is not an <tref>array</tref>, replace <em>value</em>
+                with an array containing <em>value</em>.</li>
+              <li>If <em>value</em> is an <tref>array</tref>, process each entry in the <tref>array</tref>
                 recursively using this algorithm, passing copies of the <tref>active context</tref> and
                 <tref>active property</tref>.</li>
             </ol>
@@ -1312,7 +1326,7 @@
 
 
 <ol class="algorithm">
-  <li>If <em>value</em> is an <tref>array</tref>, process each item in <em>value</em> recursively
+  <li>If <em>value</em> is an <tref>array</tref>, process each entry in <em>value</em> recursively
     using this algorithm, passing a copy of the <tref>active property</tref>.</li>
   <li>Otherwise, if <em>value</em> is an object, for each key and value in <em>value</em>
     <ol class="algorithm">