Add missing algorithm descriptions
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Wed, 27 Mar 2013 14:21:03 +0100
changeset 1486 f9f571a6916e
parent 1485 51c0661c9241
child 1487 1ebb389b5ea3
Add missing algorithm descriptions

This addresses #218.
spec/latest/json-ld-api/index.html
--- a/spec/latest/json-ld-api/index.html	Wed Mar 27 13:27:03 2013 +0100
+++ b/spec/latest/json-ld-api/index.html	Wed Mar 27 14:21:03 2013 +0100
@@ -1341,27 +1341,45 @@
     <p>This algorithm is used to generate new
       <tref title="blank node identifier">blank node identifiers</tref> or to
       relabel an existing <tref>blank node identifier</tref> to avoid collision
-      by the introduction of new ones. Between its executions, the algorithm
-      needs to keep an <i>identifier map</i> to relabel existing
-      <tref title="blank node identifier">blank node identifiers</tref> consistently
-      and a <i>counter</i> to generate new
-      <tref title="blank node identifier">blank node identifiers</tref>. The
-      <i>counter</i> is initialized to <code>0</code> by default.</p>
-
-    <p>The algorithm takes a single input variable <i>identifier</i> which may
-      be <tref>null</tref>.</p>
-
-    <ol class="algorithm">
-      <li>If <i>identifier</i> is not <tref>null</tref> and has an entry in the
-        <i>identifier map</i>, return the mapped identifier.</li>
-      <li>Otherwise, generate a new <tref>blank node identifier</tref> by concatenating
-        the string <code>_:b</code> and <i>counter</i>.</li>
-      <li>Increment <i>counter</i> by <code>1</code>.</li>
-      <li>If <i>identifier</i> is not <tref>null</tref>, create a new entry
-        for <i>identifier</i> in <i>identifier map</i> and set its value
-        to the new <tref>blank node identifier</tref>.</li>
-      <li>Return the new <tref>blank node identifier</tref>.</li>
-    </ol>
+      by the introduction of new ones.</p>
+
+    <section class="informative">
+      <h3>General Solution</h3>
+
+      <p>The simplest case is if there exists already a <tref>blank node identifier</tref>
+        in the <i>identifier map</i> for the passed <i>identifier</i>, in which
+        case it is simply returned. Otherwise, a new <tref>blank node identifier</tref>
+        is generated by concatenating the string <code>_:b</code> and the
+        <i>counter</i>. If the passed <i>identifier</i> is not <tref>null</tref>,
+        an entry is created in the <i>identifier map</i> associating the
+        <i>identifier</i> with the <tref>blank node identifier</tref>. Finally,
+        the <i>counter</i> is increased by one and the new
+        <tref>blank node identifier</tref> is returned.</p>
+    </section>
+
+    <section>
+      <h3>Algorithm</h3>
+
+      <p>The algorithm takes a single input variable <i>identifier</i> which may
+        be <tref>null</tref>. Between its executions, the algorithm needs to
+        keep an <i>identifier map</i> to relabel existing
+        <tref title="blank node identifier">blank node identifiers</tref>
+        consistently and a <i>counter</i> to generate new
+        <tref title="blank node identifier">blank node identifiers</tref>. The
+        <i>counter</i> is initialized to <code>0</code> by default.</p>
+
+      <ol class="algorithm">
+        <li>If <i>identifier</i> is not <tref>null</tref> and has an entry in the
+          <i>identifier map</i>, return the mapped identifier.</li>
+        <li>Otherwise, generate a new <tref>blank node identifier</tref> by concatenating
+          the string <code>_:b</code> and <i>counter</i>.</li>
+        <li>Increment <i>counter</i> by <code>1</code>.</li>
+        <li>If <i>identifier</i> is not <tref>null</tref>, create a new entry
+          for <i>identifier</i> in <i>identifier map</i> and set its value
+          to the new <tref>blank node identifier</tref>.</li>
+        <li>Return the new <tref>blank node identifier</tref>.</li>
+      </ol>
+    </section>
   </section> <!-- end of Generate Blank Node Identifier -->
 </section> <!-- end of Context Processing section -->
 
@@ -2802,46 +2820,79 @@
   <section>
     <h2>Flattening Algorithm</h2>
 
-    <p>The algorithm takes two input variables, an <i>element</i> to flatten and
-      an optional <i>context</i> used to compact the flattened document. If not
-      passed, <i>context</i> is set to <tref>null</tref>.</p>
-
-    <ol class="algorithm">
-      <li>Expand <i>element</i> according the
-        <a href="#expansion-algorithm">Expansion algorithm</a>.</li>
-      <li>Initialize <i>node map</i> to a <tref>JSON object</tref> consisting of
-        a single member whose key is <code>@default</code> and whose value is
-        an empty <tref>JSON object</tref>.</li>
-      <li>Perform the <a href="#node-map-generation">Node Map Generation algorithm</a>, passing
-        <i>element</i> and <i>node map</i>.</li>
-      <li>Initialize <i>default graph</i> to the value of the <code>@default</code>
-        member of <i>node map</i>, which is a <tref>JSON object</tref> representing
-        the <tref>default graph</tref>.</li>
-      <li>For each key-value pair <i>graph name</i>-<i>graph</i> in <i>node map</i>
-        where <i>graph name</i> is not <code>@default</code>,  perform the following steps:
-        <ol class="algorithm">
-          <li>If <i>default graph</i> does not have a <i>graph name</i> member, create
-            one and initialize its value to a <tref>JSON object</tref> consisting of an
-            <code>@id</code> member whose value is set to <i>graph name</i>.</li>
-          <li>Reference the value associated with the <i>graph name</i> member in
-            <i>default graph</i> using the variable <i>entry</i>.</li>
-          <li>Add an <code>@graph</code> member to <i>entry</i> and set it to an
-            empty <tref>array</tref>.</li>
-          <li>For each <i>id</i>-<i>node</i> pair in <i>graph</i> ordered by <i>id</i>,
-            add <i>node</i> to the <code>@graph</code> member of <i>entry</i>.</li>
-        </ol>
-      </li>
-      <li>Initialize an empty <tref>array</tref> <i>flattened</i>.</li>
-      <li>For each <i>id</i>-<i>node</i> pair in <i>default graph</i> ordered by <i>id</i>,
-        add <i>node</i> to <i>flattened</i>.</li>
-      <li>If <i>context</i> is <tref>null</tref>, return <i>flattened</i>.</li>
-      <li>Otherwise, return the result of compacting <i>flattened</i> according the
-        <a href="#compaction-algorithm">Compaction algorithm</a> passing <i>context</i>
-        ensuring that the compaction result uses the <code>@graph</code> keyword (or its alias)
-        at the top-level, even if the context is empty or if there is only one element to
-        put in the <code>@graph</code> <tref>array</tref>. This ensures that the returned
-        document has a deterministic structure.</li>
-    </ol>
+    <p>This algorithm flattens a JSON-LD document by collecting all properties
+      of a <tref>node</tref> in a single <tref>JSON object</tref> and labeling
+      all <tref title="blank node">blank nodes</tref> with
+      <tref title="blank node identifier">blank node identifiers</tref>.
+      This resulting uniform shape of the document, may drastically simplify
+      the code required to process JSON-LD data in certain applications.</p>
+
+    <section class="informative">
+      <h3>General Solution</h3>
+
+      <p>First, the document is expanded using the
+        <a href="#expansion-algorithm">Expansion algorithm</a>. This removes
+        all context definitions and expands all <tref title="term">terms</tref>
+        and <tref title="compact IRI">compact IRIs</tref> to
+        <tref title="absolute IRI">absolute IRIs</tref>,
+        <tref title="blank node identifier">blank node identifiers</tref>,
+        or <tref title="keyword">keywords</tref> and all
+        <tref title="JSON-LD value">JSON-LD values</tref> to <tref>expanded
+        form</tref>. In the next step, a <i>node map</i> is generated using
+        the <a href="#node-map-generation">Node Map Generation algorithm</a>
+        which collects all properties of a <tref>node</tref> in a single
+        <tref>JSON object</tref>. Finally, the <i>node map</i> is converted
+        to a JSON-LD document in
+        <tref href="../json-ld-syntax/#flattened-document-form">flattened document form</tref>.
+        If a <tref>context</tref> has been passed, the flattened document
+        is compacted using the <a href="#compaction-algorithm">Compaction algorithm</a>
+        before being returned.</p>
+    </section>
+
+    <section>
+      <h3>Algorithm</h3>
+
+      <p>The algorithm takes two input variables, an <i>element</i> to flatten and
+        an optional <i>context</i> used to compact the flattened document. If not
+        passed, <i>context</i> is set to <tref>null</tref>.</p>
+
+      <ol class="algorithm">
+        <li>Expand <i>element</i> according the
+          <a href="#expansion-algorithm">Expansion algorithm</a>.</li>
+        <li>Initialize <i>node map</i> to a <tref>JSON object</tref> consisting of
+          a single member whose key is <code>@default</code> and whose value is
+          an empty <tref>JSON object</tref>.</li>
+        <li>Perform the <a href="#node-map-generation">Node Map Generation algorithm</a>, passing
+          <i>element</i> and <i>node map</i>.</li>
+        <li>Initialize <i>default graph</i> to the value of the <code>@default</code>
+          member of <i>node map</i>, which is a <tref>JSON object</tref> representing
+          the <tref>default graph</tref>.</li>
+        <li>For each key-value pair <i>graph name</i>-<i>graph</i> in <i>node map</i>
+          where <i>graph name</i> is not <code>@default</code>,  perform the following steps:
+          <ol class="algorithm">
+            <li>If <i>default graph</i> does not have a <i>graph name</i> member, create
+              one and initialize its value to a <tref>JSON object</tref> consisting of an
+              <code>@id</code> member whose value is set to <i>graph name</i>.</li>
+            <li>Reference the value associated with the <i>graph name</i> member in
+              <i>default graph</i> using the variable <i>entry</i>.</li>
+            <li>Add an <code>@graph</code> member to <i>entry</i> and set it to an
+              empty <tref>array</tref>.</li>
+            <li>For each <i>id</i>-<i>node</i> pair in <i>graph</i> ordered by <i>id</i>,
+              add <i>node</i> to the <code>@graph</code> member of <i>entry</i>.</li>
+          </ol>
+        </li>
+        <li>Initialize an empty <tref>array</tref> <i>flattened</i>.</li>
+        <li>For each <i>id</i>-<i>node</i> pair in <i>default graph</i> ordered by <i>id</i>,
+          add <i>node</i> to <i>flattened</i>.</li>
+        <li>If <i>context</i> is <tref>null</tref>, return <i>flattened</i>.</li>
+        <li>Otherwise, return the result of compacting <i>flattened</i> according the
+          <a href="#compaction-algorithm">Compaction algorithm</a> passing <i>context</i>
+          ensuring that the compaction result uses the <code>@graph</code> keyword (or its alias)
+          at the top-level, even if the context is empty or if there is only one element to
+          put in the <code>@graph</code> <tref>array</tref>. This ensures that the returned
+          document has a deterministic structure.</li>
+      </ol>
+    </section>
   </section> <!-- end of Flattening Algorithm -->
 
   <section>
@@ -2849,143 +2900,169 @@
 
     <p>This algorithm creates a <tref>JSON object</tref> <i>node map</i> holding an indexed
       representation of the <tref title="JSON-LD graph">graphs</tref> and <tref title="node">nodes</tref>
-      represented in the passed, expanded document. All <tref title="node">nodes</tref> that are not
+      represented in the passed expanded document. All <tref title="node">nodes</tref> that are not
       uniquely identified by an IRI get assigned a (new) <tref>blank node identifier</tref>.
       The resulting <i>node map</i> will have a member for every graph in the document whose
       value is another object with a member for every <tref>node</tref> represented in the document.
       The default graph is stored under the <code>@default</code> member, all other graphs are
       stored under their <tref>graph name</tref>.</p>
 
-    <p>The algorithm takes as input an expanded JSON-LD document <i>element</i> and a reference to
-      a <tref>JSON object</tref> <i>node map</i>. Furthermore it has the optional parameters
-      <tref>active graph</tref> (which defaults to <code>@default</code>), an <tref>active subject</tref>,
-      <tref>active property</tref>, and a reference to a <tref>JSON object</tref> <i>list</i>. If
-      not passed, <tref>active subject</tref>, <tref>active property</tref>, and <i>list</i> are
-      set to <tref>null</tref>.</p>
-
-    <ol class="algorithm">
-      <li>If <i>element</i> is an array, process each <i>item</i> in <i>element</i>
-        as follows and then return:
-        <ol class="algorithm">
-          <li>Run this algorithm recursively by passing <i>item</i> for <i>element</i>,
-            <i>node map</i>, <tref>active graph</tref>, <tref>active subject</tref>,
-            <tref>active property</tref>, and <i>list</i>.</li>
-        </ol>
-      </li>
-      <li>Otherwise <i>element</i> is a <tref>JSON object</tref>. Reference the
-        <tref>JSON object</tref> which is the value of the <tref>active graph</tref>
-        member of <i>node map</i> using the variable <i>graph</i>. If the
-        <tref>active subject</tref> is <tref>null</tref>, set <i>node</i> to <tref>null</tref>
-        otherwise reference the <tref>active subject</tref> member of <i>graph</i> using the
-        variable <i>node</i>.</li>
-      <li>If <i>element</i> has an <code>@type</code> member, perform for each
-        <i>item</i> the following steps:
-        <ol class="algorithm">
-          <li>If <i>item</i> is a <tref>blank node identifier</tref>, replace it
-            with a newly
-            <a href="#generate-blank-node-identifier">generated blank node identifier</a>
-            passing <i>item</i> for <i>identifier</i>.</li>
-          <li>If <i>graph</i> has no member <i>item</i>, create one and initialize its
-            value to a <tref>JSON object</tref> consisting of a single member <code>@id</code>
-            whose value is <i>item</i>.</li>
-        </ol>
-      </li>
-      <li>If <i>element</i> has an <code>@value</code> member, perform the following steps:
-        <ol class="algorithm">
-          <li>If <i>list</i> is <tref>null</tref>, merge <i>element</i> into the
-            <tref>active property</tref> member of <i>node</i>; the resulting
-            <tref>array</tref> must not contain any duplicate values.</li>
-          <li>Otherwise, append <i>element</i> to the <code>@list</code> member of <i>list</i>.</li>
-        </ol>
-      </li>
-      <li>Otherwise, if <i>element</i> has an <code>@list</code> member, perform
-        the following steps:
-        <ol class="algorithm">
-          <li>Initialize a new <tref>JSON object</tref> <i>result</i> consisting of a single member
-            <code>@list</code> whose value is initialized to an empty <tref>array</tref>.</li>
-          <li>Recursively call this algorithm passing the value of <i>element's</i>
-            <code>@list</code> member for <i>element</i>, <tref>active graph</tref>,
-            <tref>active subject</tref>, <tref>active property</tref>, and
-            <i>result</i> for <i>list</i>.</li>
-          <li>Append <i>result</i> to the the value of the <tref>active property</tref> member
-            of <i>node</i>.</li>
-        </ol>
-      </li>
-      <li>Otherwise <i>element</i> is a <tref>node object</tref>, perform
-        the following steps:
-        <ol class="algorithm">
-          <li>If <i>element</i> has an <code>@id</code> member, set <i>id</i>
-            to its value and remove the member from <i>element</i>. If <i>id</i>
-            is a <tref>blank node identifier</tref>, replace it with a newly
-            <a href="#generate-blank-node-identifier">generated blank node identifier</a>
-            passing <i>id</i> for <i>identifier</i>.</li>
-          <li>Otherwise, set <i>id</i> to the result of the
-            <a href="#generate-blank-node-identifier">Generate Blank Node Identifier algorithm</a>
-            passing <tref>null</tref> for <i>identifier</i>.</li>
-          <li>If <i>graph</i> does not contain a member <i>id</i>, create one and initialize
-            its value to a <tref>JSON object</tref> consisting of a single member <code>@id</code> whose
-            value is <i>id</i>.</li>
-          <li>If <tref>active property</tref> is not <tref>null</tref>, perform the following steps:
-            <ol class="algorithm">
-              <li>Create a new <tref>JSON object</tref> <i>reference</i> consisting of a single member
-                <code>@id</code> whose value is <i>id</i>.</li>
-              <li>If <i>list</i> is <tref>null</tref>, merge <i>element</i> into the
-                <tref>active property</tref> member of <i>node</i>; the resulting
-                <tref>array</tref> must not contain any duplicate values.</li>
-              <li>Otherwise, append <i>element</i> to the <code>@list</code> member of <i>list</i>.</li>
-            </ol>
-          </li>
-          <li>Reference the value of the <i>id</i> member of <i>graph</i> using the
-            variable <i>node</i>.</li>
-          <li>If <i>element</i> has an <code>@type</code> member, merge each of its values into the
-            <code>@type</code> member of <i>node</i> and finally remove the
-            <code>@type</code> member from <i>element</i>; the resulting
-            <tref>array</tref> must not contain any duplicate values.</li>
-          <li>If <i>element</i> has an <code>@index</code> member, set the <code>@index</code>
-            member of <i>node</i> to its value. If <tref>node</tref> has already an
-            <code>@index</code> member with a different value, a
-            <code class="error"><a href="#idl-def-JsonLdErrorCode.conflicting-indexes">conflicting indexes</a></code>
-            error has been detected and processing is aborted. Otherwise, continue by
-            removing the <code>@index</code> member from <i>element</i>.</li>
-          <li>If <i>element</i> has an <code>@reverse</code> member:
-            <ol class="algorithm">
-              <li>Create a <tref>JSON object</tref> <i>referenced node</i> with a single member <code>@id</code> whose
-                value is <i>id</i>.</li>
-              <li>Set <i>reverse map</i> to the value of the <code>@reverse</code> member of
-                <i>element</i>.</li>
-              <li>For each key-value pair <i>property</i>-<i>values</i> in <i>reverse map</i>:
-                <ol class="algorithm">
-                  <li>For each <i>value</i> of <i>values</i>:
-                    <ol class="algorithm">
-                      <li>If <i>value</i> has a <i>property</i> member, append <i>referenced node</i> to
-                        its value; otherwise create a <i>property</i> member whose value is an
-                        <tref>array</tref> containing <i>referenced node</i>.</li>
-                      <li>Recursively invoke this algorithm passing </em><i>value</i> for
-                        <i>element</i>, <i>node map</i>, and <tref>active graph</tref>.</li>
-                    </ol>
-                  </li>
-                </ol>
-              </li>
-              <li>Remove the <code>@reverse</code> member from <i>element</i>.</li>
-            </ol>
-          </li>
-          <li>If <i>element</i> has an <code>@graph</code> member, recursively invoke this
-            algorithm passing the value of the <code>@graph</code> member for <i>element</i>,
-            <i>node map</i>, and <i>id</i> for <tref>active graph</tref> before removing
-            the <code>@graph</code> member from <i>element</i>.</li>
-          <li>Finally, for each key-value pair <i>property</i>-<i>value</i> in <i>element</i> ordered by
-            <i>property</i> perform the following steps:
-            <ol class="algorithm">
-              <li>If <i>node</i> does not have a <i>property</i> member, create one and initialize
-                its value to an empty <tref>array</tref>.</li>
-              <li>Recursively invoke this algorithm passing <i>value</i> for <i>element</i>,
-                <i>node map</i>, <tref>active graph</tref>, <i>id</i> for <tref>active subject</tref>,
-                <i>property</i> for <tref>active property</tref>, and <i>list</i>.</li>
-            </ol>
-          </li>
-        </ol>
-      </li>
-    </ol>
+    <section class="informative">
+      <h3>General Solution</h3>
+
+      <p>The algorithm recursively runs over an expanded JSON-LD document to
+        collect all <tref title="property">properties</tref> of a <tref>node</tref>
+        in a single <tref>JSON object</tref>. The algorithm constructs a
+        <tref>JSON object</tref> <i>node map</i> whose keys represent the
+        <tref title="graph name">graph names</tref> used in the document
+        (the <tref>default graph</tref> is stored under the key <code>@default</code>)
+        and whose associated values are <tref title="JSON object">JSON objects</tref>
+        which index the <tref title="node">nodes</tref> in the
+        <tref title="JSON-LD graph">graph</tref>. If a
+        <tref title="property">property's</tref> value is a <tref>node object</tref>,
+        it is replace by a <tref>node object</tref> consisting of only an
+        <code>@id</code> member. If a <tref>node object</tref> has no <code>@id</code>
+        member or it is identified by a <tref>blank node identifier</tref>,
+        a new <tref>blank node identifier</tref> is generated. This relabeling
+        of <tref title="blank node identifier">blank node identifiers</tref> is
+        also be done for <tref title="property">properties</tref> and values of
+        <code>@type</code>.</p>
+    </section>
+
+    <section>
+      <h3>Algorithm</h3>
+
+      <p>The algorithm takes as input an expanded JSON-LD document <i>element</i> and a reference to
+        a <tref>JSON object</tref> <i>node map</i>. Furthermore it has the optional parameters
+        <tref>active graph</tref> (which defaults to <code>@default</code>), an <tref>active subject</tref>,
+        <tref>active property</tref>, and a reference to a <tref>JSON object</tref> <i>list</i>. If
+        not passed, <tref>active subject</tref>, <tref>active property</tref>, and <i>list</i> are
+        set to <tref>null</tref>.</p>
+
+      <ol class="algorithm">
+        <li>If <i>element</i> is an array, process each <i>item</i> in <i>element</i>
+          as follows and then return:
+          <ol class="algorithm">
+            <li>Run this algorithm recursively by passing <i>item</i> for <i>element</i>,
+              <i>node map</i>, <tref>active graph</tref>, <tref>active subject</tref>,
+              <tref>active property</tref>, and <i>list</i>.</li>
+          </ol>
+        </li>
+        <li>Otherwise <i>element</i> is a <tref>JSON object</tref>. Reference the
+          <tref>JSON object</tref> which is the value of the <tref>active graph</tref>
+          member of <i>node map</i> using the variable <i>graph</i>. If the
+          <tref>active subject</tref> is <tref>null</tref>, set <i>node</i> to <tref>null</tref>
+          otherwise reference the <tref>active subject</tref> member of <i>graph</i> using the
+          variable <i>node</i>.</li>
+        <li>If <i>element</i> has an <code>@type</code> member, perform for each
+          <i>item</i> the following steps:
+          <ol class="algorithm">
+            <li>If <i>item</i> is a <tref>blank node identifier</tref>, replace it
+              with a newly
+              <a href="#generate-blank-node-identifier">generated blank node identifier</a>
+              passing <i>item</i> for <i>identifier</i>.</li>
+            <li>If <i>graph</i> has no member <i>item</i>, create one and initialize its
+              value to a <tref>JSON object</tref> consisting of a single member <code>@id</code>
+              whose value is <i>item</i>.</li>
+          </ol>
+        </li>
+        <li>If <i>element</i> has an <code>@value</code> member, perform the following steps:
+          <ol class="algorithm">
+            <li>If <i>list</i> is <tref>null</tref>, merge <i>element</i> into the
+              <tref>active property</tref> member of <i>node</i>; the resulting
+              <tref>array</tref> must not contain any duplicate values.</li>
+            <li>Otherwise, append <i>element</i> to the <code>@list</code> member of <i>list</i>.</li>
+          </ol>
+        </li>
+        <li>Otherwise, if <i>element</i> has an <code>@list</code> member, perform
+          the following steps:
+          <ol class="algorithm">
+            <li>Initialize a new <tref>JSON object</tref> <i>result</i> consisting of a single member
+              <code>@list</code> whose value is initialized to an empty <tref>array</tref>.</li>
+            <li>Recursively call this algorithm passing the value of <i>element's</i>
+              <code>@list</code> member for <i>element</i>, <tref>active graph</tref>,
+              <tref>active subject</tref>, <tref>active property</tref>, and
+              <i>result</i> for <i>list</i>.</li>
+            <li>Append <i>result</i> to the the value of the <tref>active property</tref> member
+              of <i>node</i>.</li>
+          </ol>
+        </li>
+        <li>Otherwise <i>element</i> is a <tref>node object</tref>, perform
+          the following steps:
+          <ol class="algorithm">
+            <li>If <i>element</i> has an <code>@id</code> member, set <i>id</i>
+              to its value and remove the member from <i>element</i>. If <i>id</i>
+              is a <tref>blank node identifier</tref>, replace it with a newly
+              <a href="#generate-blank-node-identifier">generated blank node identifier</a>
+              passing <i>id</i> for <i>identifier</i>.</li>
+            <li>Otherwise, set <i>id</i> to the result of the
+              <a href="#generate-blank-node-identifier">Generate Blank Node Identifier algorithm</a>
+              passing <tref>null</tref> for <i>identifier</i>.</li>
+            <li>If <i>graph</i> does not contain a member <i>id</i>, create one and initialize
+              its value to a <tref>JSON object</tref> consisting of a single member <code>@id</code> whose
+              value is <i>id</i>.</li>
+            <li>If <tref>active property</tref> is not <tref>null</tref>, perform the following steps:
+              <ol class="algorithm">
+                <li>Create a new <tref>JSON object</tref> <i>reference</i> consisting of a single member
+                  <code>@id</code> whose value is <i>id</i>.</li>
+                <li>If <i>list</i> is <tref>null</tref>, merge <i>element</i> into the
+                  <tref>active property</tref> member of <i>node</i>; the resulting
+                  <tref>array</tref> must not contain any duplicate values.</li>
+                <li>Otherwise, append <i>element</i> to the <code>@list</code> member of <i>list</i>.</li>
+              </ol>
+            </li>
+            <li>Reference the value of the <i>id</i> member of <i>graph</i> using the
+              variable <i>node</i>.</li>
+            <li>If <i>element</i> has an <code>@type</code> member, merge each of its values into the
+              <code>@type</code> member of <i>node</i> and finally remove the
+              <code>@type</code> member from <i>element</i>; the resulting
+              <tref>array</tref> must not contain any duplicate values.</li>
+            <li>If <i>element</i> has an <code>@index</code> member, set the <code>@index</code>
+              member of <i>node</i> to its value. If <tref>node</tref> has already an
+              <code>@index</code> member with a different value, a
+              <code class="error"><a href="#idl-def-JsonLdErrorCode.conflicting-indexes">conflicting indexes</a></code>
+              error has been detected and processing is aborted. Otherwise, continue by
+              removing the <code>@index</code> member from <i>element</i>.</li>
+            <li>If <i>element</i> has an <code>@reverse</code> member:
+              <ol class="algorithm">
+                <li>Create a <tref>JSON object</tref> <i>referenced node</i> with a single member <code>@id</code> whose
+                  value is <i>id</i>.</li>
+                <li>Set <i>reverse map</i> to the value of the <code>@reverse</code> member of
+                  <i>element</i>.</li>
+                <li>For each key-value pair <i>property</i>-<i>values</i> in <i>reverse map</i>:
+                  <ol class="algorithm">
+                    <li>For each <i>value</i> of <i>values</i>:
+                      <ol class="algorithm">
+                        <li>If <i>value</i> has a <i>property</i> member, append <i>referenced node</i> to
+                          its value; otherwise create a <i>property</i> member whose value is an
+                          <tref>array</tref> containing <i>referenced node</i>.</li>
+                        <li>Recursively invoke this algorithm passing </em><i>value</i> for
+                          <i>element</i>, <i>node map</i>, and <tref>active graph</tref>.</li>
+                      </ol>
+                    </li>
+                  </ol>
+                </li>
+                <li>Remove the <code>@reverse</code> member from <i>element</i>.</li>
+              </ol>
+            </li>
+            <li>If <i>element</i> has an <code>@graph</code> member, recursively invoke this
+              algorithm passing the value of the <code>@graph</code> member for <i>element</i>,
+              <i>node map</i>, and <i>id</i> for <tref>active graph</tref> before removing
+              the <code>@graph</code> member from <i>element</i>.</li>
+            <li>Finally, for each key-value pair <i>property</i>-<i>value</i> in <i>element</i> ordered by
+              <i>property</i> perform the following steps:
+              <ol class="algorithm">
+                <li>If <i>node</i> does not have a <i>property</i> member, create one and initialize
+                  its value to an empty <tref>array</tref>.</li>
+                <li>Recursively invoke this algorithm passing <i>value</i> for <i>element</i>,
+                  <i>node map</i>, <tref>active graph</tref>, <i>id</i> for <tref>active subject</tref>,
+                  <i>property</i> for <tref>active property</tref>, and <i>list</i>.</li>
+              </ol>
+            </li>
+          </ol>
+        </li>
+      </ol>
+    </section>
   </section> <!-- end of Node Map Generation -->
 </section> <!-- end of Flattening section -->
 
@@ -3127,7 +3204,8 @@
       <h3>General Solution</h3>
 
       <p><tref title="value object">Value objects</tref> are transformed to
-        <tref title="RDF literal">RDF literals</tref> whereas
+        <tref title="RDF literal">RDF literals</tref> as defined in the section
+        <a href="#data-round-tripping">Data Round Tripping</a> whereas
         <tref title="node object">node objects</tref> are transformed to
         <tref title="IRI">IRIs</tref> or
         <tref title="blank node identifier">blank node identifiers</tref>.</p>
@@ -3408,6 +3486,17 @@
     <p>This algorithm transforms an RDF literal to a JSON-LD <tref>value object</tref>
       and a RDF blank node or IRI to an JSON-LD <tref>node object</tref>.</p>
 
+    <section class="informative">
+      <h3>General Solution</h3>
+
+      <p><tref title="RDF literal">RDF literals</tref> are transformed to
+        <tref title="value object">value objects</tref> as defined in the section
+        <a href="#data-round-tripping">Data Round Tripping</a> whereas
+        <tref title="IRI">IRIs</tref> and
+        <tref title="blank node identifier">blank node identifiers</tref> are
+        transformed to <tref title="node object">node objects</tref>.</p>
+    </section>
+
     <section>
       <h3>Algorithm</h3>