Revised second half of Label Serialization Algorithm.
authorManu Sporny <msporny@digitalbazaar.com>
Sun, 14 Aug 2011 12:44:49 -0400
changeset 157 1f7865f8e089
parent 156 598c17af5f5a
child 158 df64cda434cf
Revised second half of Label Serialization Algorithm.
spec/latest/index.html
--- a/spec/latest/index.html	Sun Aug 14 09:59:44 2011 -0400
+++ b/spec/latest/index.html	Sun Aug 14 12:44:49 2011 -0400
@@ -2885,15 +2885,18 @@
 <h4>Label Serialization Algorithm</h4>
 
 <p>
-<tref>map of properties</tref>, <tdef>label serialization</tdef>
+<tref>map of properties</tref>, <tdef>label serialization</tdef>,
+<tref>label</tref>, <tref>incoming map</tref>, 
+<tdef>adjacent node labels</tdef>, <tref>key stack</tref>.
 </p>
 
 <ol class="algorithm">
   <li>Initialize the <tref>label serialization</tref> to an empty string.</li>
   <li>Append the <code>[</code> character to the 
     <tref>label serialization</tref>.</li>
-  <li>Append to the <tref>label serialization</tref> by processing each
-    key-value pair in the <tref>map of properties</tref>, excluding the
+  <li>Append all properties to the <tref>label serialization</tref> by 
+    processing each key-value pair in the <tref>map of properties</tref>, 
+    excluding the
     <code>@subject</code> property ???do the map keys need to be sorted???:
     <ol class="algorithm">
       <li>Build a string using the pattern <code>&lt;</code><strong>KEY</strong><code>&gt;</code> 
@@ -2931,6 +2934,9 @@
             <code>"</code><strong>LITERAL</strong><code>"</code> 
             where <strong>LITERAL</strong> is the value associated with the
             current key.</li>
+          <li>If this is the second iteration of the loop,
+            append a <code>|</code> separator character to the
+            <tref>label serialization</tref>.</li>
           <li>Append the <tref>object string</tref> to the 
             <tref>label serialization</tref>.</li>
         </ol>
@@ -2938,9 +2944,36 @@
   </li>
   <li>Append the <code>]</code> character to the 
     <tref>label serialization</tref>.</li>
-  <li>
-  
-  <li>Serialize all of the incoming references.</li>
+  <li>Append the <code>[</code> character to the 
+    <tref>label serialization</tref>.</li>
+  <li>Append all incoming references for the current
+    <tref>label</tref> to the <tref>label serialization</tref> by 
+    processing all of the items associated with the <tref>label</tref>
+    in the <tref>incoming map</tref>:
+    <ol class="algorithm">
+      <li>Build a <tdef>reference string</tdef> 
+        using the pattern <code>&lt;</code><strong>PROPERTY</strong><code>&gt;</code><code>&lt;</code><strong>REFERER</strong><code>&gt;</code>
+        where <strong>PROPERTY</strong> is the property associated with the
+        incoming reference and <strong>REFERER</strong> is either the subject of
+        the node referring to the <tref>label</tref> in the incoming reference
+        or <code>_:</code> if <strong>REFERER</strong> begins with
+        <code>_:</code>.
+      <li>If this is the second iteration of the loop,
+        append a <code>|</code> separator character to the
+        <tref>label serialization</tref>.</li>
+      <li>Append the <tref>reference string</tref> to the 
+        <tref>label serialization</tref>.</li>
+    </ol>
+  <li>Append the <code>]</code> character to the 
+    <tref>label serialization</tref>.</li>
+  <li>Append all <tref>adjacent node labels</tref> to the
+    <tref>label serialization</tref> by concatenating the string value
+    for all of them, one after the other, to the 
+    <tref>label serialization</tref>.</li>
+  <li>Push the <tref>adjacent node labels</tref> onto the 
+    <tref>key stack</tref> and append the result of the
+    <a href="#mapping-serialization-algorithm">Mapping Serialization Algorithm</a> 
+    to the <tref>label serialization</tref>.
 </ol>
 
 </section>