Update to latest jsonld.js, fix normalization tests.
authorDave Longley <dlongley@digitalbazaar.com>
Thu, 29 Mar 2012 14:31:57 -0400
changeset 430 f82923858d0e
parent 429 4a7d4c44a9cf
child 431 dd9c8848f82c
Update to latest jsonld.js, fix normalization tests.
playground/jsonld.js
test-suite/tests/normalize-0020-out.jsonld
test-suite/tests/normalize-0030-out.jsonld
test-suite/tests/normalize-0035-out.jsonld
test-suite/tests/normalize-0036-out.jsonld
test-suite/tests/normalize-0037-out.jsonld
test-suite/tests/normalize-0038-out.jsonld
test-suite/tests/normalize-0039-out.jsonld
test-suite/tests/normalize-0040-out.jsonld
test-suite/tests/normalize-0041-out.jsonld
test-suite/tests/normalize-0042-out.jsonld
test-suite/tests/normalize-0044-out.jsonld
test-suite/tests/normalize-0045-out.jsonld
test-suite/tests/normalize-0046-out.jsonld
test-suite/tests/normalize-0047-out.jsonld
test-suite/tests/normalize-0048-out.jsonld
test-suite/tests/normalize-0050-out.jsonld
test-suite/tests/normalize-0053-out.jsonld
--- a/playground/jsonld.js	Thu Mar 29 14:05:27 2012 -0400
+++ b/playground/jsonld.js	Thu Mar 29 14:31:57 2012 -0400
@@ -227,7 +227,7 @@
       if(err) {
         return callback(new JsonLdError(
           'Could not compact input before framing.',
-          'jsonld.CompactError', {cause: err}));
+          'jsonld.FrameError', {cause: err}));
       }
 
       // preserve compacted context
@@ -239,7 +239,7 @@
         if(err) {
           return callback(new JsonLdError(
             'Could not merge context before framing.',
-            'jsonld.CompactError', {cause: err}));
+            'jsonld.FrameError', {cause: err}));
         }
 
         try {
@@ -788,8 +788,8 @@
   // get keyword for type
   var kwtype = _getKeywords(ctx)[type];
 
-  // add new key to @context
-  if(!(key in ctx)) {
+  // add new key to @context or update existing key w/string value
+  if(!(key in ctx) || _isString(ctx[key])) {
     if(type === '@id') {
       ctx[key] = value;
     }
@@ -798,18 +798,6 @@
       ctx[key][kwtype] = value;
     }
   }
-  // update existing key w/string value
-  else if(_isString(ctx[key])) {
-    // overwrite @id
-    if(type === '@id') {
-      ctx[key] = value;
-    }
-    // expand to an object
-    else {
-      ctx[key] = {};
-      ctx[key][kwtype] = value;
-    }
-  }
   // update existing key w/object value
   else if(_isObject(ctx[key])) {
     ctx[key][kwtype] = value;
@@ -1036,6 +1024,8 @@
  * @param ctx the context to use.
  * @param property the expanded property for the value, null for none.
  * @param value the value to expand.
+ *
+ * @return the expanded value.
  */
 Processor.prototype.expand = function(ctx, property, value) {
   // nothing to expand when value is null
@@ -1060,8 +1050,9 @@
       if(value === null) {
         return null;
       }
+
       // invalid input if @list points at a non-array
-      else if(!_isArray(value)) {
+      if(!_isArray(value)) {
         throw new JsonLdError(
           'Invalid JSON-LD syntax; "@list" value must be an array or null.',
           'jsonld.SyntaxError');
@@ -1540,7 +1531,7 @@
 function _addStatement(statements, statement) {
   for(var i in statements) {
     var s = statements[i];
-    if(s.s === statement.s && s.p === statements.p &&
+    if(s.s === statement.s && s.p === statement.p &&
       jsonld.compareValues(s.o, statement.o)) {
       return;
     }
@@ -1579,7 +1570,7 @@
     }
 
     // serialize property
-    triple += '<' + statement.p + '>';
+    triple += '<' + statement.p + '> ';
 
     // serialize object
     if(_isBlankNode(statement.o)) {
@@ -1595,7 +1586,7 @@
       triple += '"' + statement.o + '"';
     }
     else if(_isSubjectReference(statement.o)) {
-      triple += '<' + statement.o + '>';
+      triple += '<' + statement.o['@id'] + '>';
     }
     // must be a value
     else {
--- a/test-suite/tests/normalize-0020-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0020-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,20 +1,20 @@
 [
   {
-    "@id": "_:c14n0",
+    "@id": "_:c14n0"
+  },
+  {
+    "@id": "_:c14n1",
     "http://example.org/vocab#next": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n0"
       }
     ]
   },
   {
-    "@id": "_:c14n1"
-  },
-  {
     "@id": "_:c14n2",
     "http://example.org/vocab#next": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -27,7 +27,7 @@
     ],
     "http://example.org/vocab#B": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n1"
       }
     ]
   }
--- a/test-suite/tests/normalize-0030-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0030-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -27,17 +27,17 @@
     "@id": "http://example.org/vocab#test",
     "http://example.org/vocab#A": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n2"
       }
     ],
     "http://example.org/vocab#B": [
       {
-        "@id": "_:c14n2"
+        "@id": "_:c14n0"
       }
     ],
     "http://example.org/vocab#C": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n1"
       }
     ]
   }
--- a/test-suite/tests/normalize-0035-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0035-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,8 +1,10 @@
 [
   {
     "@id": "_:c14n0",
-    "http://example.org/vocab#p2": [
-      "Foo"
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n1"
+      }
     ]
   },
   {
@@ -15,16 +17,14 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n3"
       }
     ]
   },
   {
     "@id": "_:c14n3",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
+    "http://example.org/vocab#p2": [
+      "Foo"
     ]
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0036-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0036-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,8 +1,10 @@
 [
   {
     "@id": "_:c14n0",
-    "http://example.org/vocab#p2": [
-      "Foo"
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n1"
+      }
     ]
   },
   {
@@ -15,16 +17,14 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n3"
       }
     ]
   },
   {
     "@id": "_:c14n3",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
+    "http://example.org/vocab#p2": [
+      "Foo"
     ]
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0037-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0037-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,8 +1,10 @@
 [
   {
     "@id": "_:c14n0",
-    "http://example.org/vocab#p2": [
-      "Foo"
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n1"
+      }
     ]
   },
   {
@@ -15,16 +17,14 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n3"
       }
     ]
   },
   {
     "@id": "_:c14n3",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
+    "http://example.org/vocab#p2": [
+      "Foo"
     ]
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0038-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0038-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,6 +1,17 @@
 [
   {
-    "@id": "_:c14n0",
+    "@id": "_:c14n0"
+  },
+  {
+    "@id": "_:c14n1",
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n0"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n2",
     "http://example.org/vocab#p1": [
       {
         "@id": "_:c14n1"
@@ -11,17 +22,6 @@
     ]
   },
   {
-    "@id": "_:c14n1",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n2"
-      }
-    ]
-  },
-  {
-    "@id": "_:c14n2"
-  },
-  {
     "@id": "_:c14n3"
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0039-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0039-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,6 +1,17 @@
 [
   {
-    "@id": "_:c14n0",
+    "@id": "_:c14n0"
+  },
+  {
+    "@id": "_:c14n1",
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n0"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n2",
     "http://example.org/vocab#p1": [
       {
         "@id": "_:c14n1"
@@ -11,17 +22,6 @@
     ]
   },
   {
-    "@id": "_:c14n1",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n2"
-      }
-    ]
-  },
-  {
-    "@id": "_:c14n2"
-  },
-  {
     "@id": "_:c14n3"
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0040-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0040-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,11 +1,6 @@
 [
   {
-    "@id": "_:c14n0",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
-    ]
+    "@id": "_:c14n0"
   },
   {
     "@id": "_:c14n1"
@@ -19,10 +14,7 @@
     ]
   },
   {
-    "@id": "_:c14n3"
-  },
-  {
-    "@id": "_:c14n4",
+    "@id": "_:c14n3",
     "http://example.org/vocab#p1": [
       {
         "@id": "_:c14n0"
@@ -30,10 +22,18 @@
     ]
   },
   {
+    "@id": "_:c14n4",
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n5"
+      }
+    ]
+  },
+  {
     "@id": "_:c14n5",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n2"
+        "@id": "_:c14n1"
       }
     ]
   }
--- a/test-suite/tests/normalize-0041-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0041-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,11 +1,6 @@
 [
   {
-    "@id": "_:c14n0",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
-    ]
+    "@id": "_:c14n0"
   },
   {
     "@id": "_:c14n1"
@@ -19,10 +14,7 @@
     ]
   },
   {
-    "@id": "_:c14n3"
-  },
-  {
-    "@id": "_:c14n4",
+    "@id": "_:c14n3",
     "http://example.org/vocab#p1": [
       {
         "@id": "_:c14n0"
@@ -30,10 +22,18 @@
     ]
   },
   {
+    "@id": "_:c14n4",
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n5"
+      }
+    ]
+  },
+  {
     "@id": "_:c14n5",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n2"
+        "@id": "_:c14n1"
       }
     ]
   }
--- a/test-suite/tests/normalize-0042-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0042-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,11 +1,6 @@
 [
   {
-    "@id": "_:c14n0",
-    "http://example.org/vocab#p1": [
-      {
-        "@id": "_:c14n1"
-      }
-    ]
+    "@id": "_:c14n0"
   },
   {
     "@id": "_:c14n1"
@@ -19,10 +14,7 @@
     ]
   },
   {
-    "@id": "_:c14n3"
-  },
-  {
-    "@id": "_:c14n4",
+    "@id": "_:c14n3",
     "http://example.org/vocab#p1": [
       {
         "@id": "_:c14n0"
@@ -30,10 +22,18 @@
     ]
   },
   {
+    "@id": "_:c14n4",
+    "http://example.org/vocab#p1": [
+      {
+        "@id": "_:c14n5"
+      }
+    ]
+  },
+  {
     "@id": "_:c14n5",
     "http://example.org/vocab#p1": [
       {
-        "@id": "_:c14n2"
+        "@id": "_:c14n1"
       }
     ]
   }
--- a/test-suite/tests/normalize-0044-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0044-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -3,13 +3,13 @@
     "@id": "_:c14n0",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n1"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n3"
+      },
+      {
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -20,10 +20,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -31,10 +31,10 @@
     "@id": "_:c14n10",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
+        "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n9"
+        "@id": "_:c14n8"
       },
       {
         "@id": "_:c14n11"
@@ -45,13 +45,13 @@
     "@id": "_:c14n11",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -59,13 +59,13 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
+        "@id": "_:c14n1"
       },
       {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -73,13 +73,13 @@
     "@id": "_:c14n3",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n2"
       },
       {
         "@id": "_:c14n4"
+      },
+      {
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -87,13 +87,13 @@
     "@id": "_:c14n4",
     "http://example.org/vocab#p": [
       {
+        "@id": "_:c14n1"
+      },
+      {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n0"
-      },
-      {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -104,10 +104,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n3"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -115,13 +115,13 @@
     "@id": "_:c14n6",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
         "@id": "_:c14n11"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -132,10 +132,10 @@
         "@id": "_:c14n8"
       },
       {
-        "@id": "_:c14n10"
+        "@id": "_:c14n6"
       },
       {
-        "@id": "_:c14n6"
+        "@id": "_:c14n11"
       }
     ]
   },
@@ -143,13 +143,13 @@
     "@id": "_:c14n8",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n11"
+        "@id": "_:c14n10"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -157,13 +157,13 @@
     "@id": "_:c14n9",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n8"
       }
     ]
   }
--- a/test-suite/tests/normalize-0045-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0045-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -3,13 +3,13 @@
     "@id": "_:c14n0",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n1"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n3"
+      },
+      {
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -20,10 +20,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -31,10 +31,10 @@
     "@id": "_:c14n10",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
+        "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n9"
+        "@id": "_:c14n8"
       },
       {
         "@id": "_:c14n11"
@@ -45,13 +45,13 @@
     "@id": "_:c14n11",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -59,13 +59,13 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
+        "@id": "_:c14n1"
       },
       {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -73,13 +73,13 @@
     "@id": "_:c14n3",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n2"
       },
       {
         "@id": "_:c14n4"
+      },
+      {
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -87,13 +87,13 @@
     "@id": "_:c14n4",
     "http://example.org/vocab#p": [
       {
+        "@id": "_:c14n1"
+      },
+      {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n0"
-      },
-      {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -104,10 +104,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n3"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -115,13 +115,13 @@
     "@id": "_:c14n6",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
         "@id": "_:c14n11"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -132,10 +132,10 @@
         "@id": "_:c14n8"
       },
       {
-        "@id": "_:c14n10"
+        "@id": "_:c14n6"
       },
       {
-        "@id": "_:c14n6"
+        "@id": "_:c14n11"
       }
     ]
   },
@@ -143,13 +143,13 @@
     "@id": "_:c14n8",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n11"
+        "@id": "_:c14n10"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -157,13 +157,13 @@
     "@id": "_:c14n9",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n8"
       }
     ]
   }
--- a/test-suite/tests/normalize-0046-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0046-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -3,13 +3,13 @@
     "@id": "_:c14n0",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n1"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n3"
+      },
+      {
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -20,10 +20,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n4"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -31,10 +31,10 @@
     "@id": "_:c14n10",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
+        "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n9"
+        "@id": "_:c14n8"
       },
       {
         "@id": "_:c14n11"
@@ -45,13 +45,13 @@
     "@id": "_:c14n11",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -59,13 +59,13 @@
     "@id": "_:c14n2",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
+        "@id": "_:c14n1"
       },
       {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -73,13 +73,13 @@
     "@id": "_:c14n3",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n5"
-      },
-      {
         "@id": "_:c14n2"
       },
       {
         "@id": "_:c14n4"
+      },
+      {
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -87,13 +87,13 @@
     "@id": "_:c14n4",
     "http://example.org/vocab#p": [
       {
+        "@id": "_:c14n1"
+      },
+      {
         "@id": "_:c14n3"
       },
       {
-        "@id": "_:c14n0"
-      },
-      {
-        "@id": "_:c14n1"
+        "@id": "_:c14n5"
       }
     ]
   },
@@ -104,10 +104,10 @@
         "@id": "_:c14n2"
       },
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n4"
       },
       {
-        "@id": "_:c14n3"
+        "@id": "_:c14n0"
       }
     ]
   },
@@ -115,13 +115,13 @@
     "@id": "_:c14n6",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
         "@id": "_:c14n11"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -132,10 +132,10 @@
         "@id": "_:c14n8"
       },
       {
-        "@id": "_:c14n10"
+        "@id": "_:c14n6"
       },
       {
-        "@id": "_:c14n6"
+        "@id": "_:c14n11"
       }
     ]
   },
@@ -143,13 +143,13 @@
     "@id": "_:c14n8",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n7"
-      },
-      {
         "@id": "_:c14n9"
       },
       {
-        "@id": "_:c14n11"
+        "@id": "_:c14n10"
+      },
+      {
+        "@id": "_:c14n7"
       }
     ]
   },
@@ -157,13 +157,13 @@
     "@id": "_:c14n9",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n8"
-      },
-      {
         "@id": "_:c14n10"
       },
       {
         "@id": "_:c14n6"
+      },
+      {
+        "@id": "_:c14n8"
       }
     ]
   }
--- a/test-suite/tests/normalize-0047-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0047-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,36 +1,21 @@
 [
   {
     "@id": "_:c14n0",
+    "http://example.org/vocab#p": [
+      {
+        "@id": "_:c14n1"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n1",
     "http://example.org/vocab#z": [
       "foo1",
       "foo2"
     ]
   },
   {
-    "@id": "_:c14n1",
-    "http://example.org/vocab#p": [
-      {
-        "@id": "_:c14n2"
-      }
-    ]
-  },
-  {
     "@id": "_:c14n2",
-    "http://example.org/vocab#z": [
-      "bar1",
-      "bar2"
-    ]
-  },
-  {
-    "@id": "_:c14n3",
-    "http://example.org/vocab#p": [
-      {
-        "@id": "_:c14n0"
-      }
-    ]
-  },
-  {
-    "@id": "_:c14n4",
     "http://example.org/vocab#p": [
       {
         "@id": "_:c14n3"
@@ -38,10 +23,25 @@
     ]
   },
   {
+    "@id": "_:c14n3",
+    "http://example.org/vocab#p": [
+      {
+        "@id": "_:c14n4"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n4",
+    "http://example.org/vocab#z": [
+      "bar1",
+      "bar2"
+    ]
+  },
+  {
     "@id": "_:c14n5",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n0"
       }
     ]
   }
--- a/test-suite/tests/normalize-0048-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0048-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,36 +1,21 @@
 [
   {
     "@id": "_:c14n0",
+    "http://example.org/vocab#p": [
+      {
+        "@id": "_:c14n1"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n1",
     "http://example.org/vocab#z": [
       "foo1",
       "foo2"
     ]
   },
   {
-    "@id": "_:c14n1",
-    "http://example.org/vocab#p": [
-      {
-        "@id": "_:c14n2"
-      }
-    ]
-  },
-  {
     "@id": "_:c14n2",
-    "http://example.org/vocab#z": [
-      "bar1",
-      "bar2"
-    ]
-  },
-  {
-    "@id": "_:c14n3",
-    "http://example.org/vocab#p": [
-      {
-        "@id": "_:c14n0"
-      }
-    ]
-  },
-  {
-    "@id": "_:c14n4",
     "http://example.org/vocab#p": [
       {
         "@id": "_:c14n3"
@@ -38,10 +23,25 @@
     ]
   },
   {
+    "@id": "_:c14n3",
+    "http://example.org/vocab#p": [
+      {
+        "@id": "_:c14n4"
+      }
+    ]
+  },
+  {
+    "@id": "_:c14n4",
+    "http://example.org/vocab#z": [
+      "bar1",
+      "bar2"
+    ]
+  },
+  {
     "@id": "_:c14n5",
     "http://example.org/vocab#p": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n0"
       }
     ]
   }
--- a/test-suite/tests/normalize-0050-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0050-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -1,9 +1,6 @@
 [
   {
-    "@id": "_:c14n0"
-  },
-  {
-    "@id": "_:c14n1",
+    "@id": "_:c14n0",
     "http://example.org/vocab#array": [
       "value"
     ],
@@ -12,8 +9,11 @@
     ],
     "http://example.org/vocab#object": [
       {
-        "@id": "_:c14n0"
+        "@id": "_:c14n1"
       }
     ]
+  },
+  {
+    "@id": "_:c14n1"
   }
 ]
\ No newline at end of file
--- a/test-suite/tests/normalize-0053-out.jsonld	Thu Mar 29 14:05:27 2012 -0400
+++ b/test-suite/tests/normalize-0053-out.jsonld	Thu Mar 29 14:31:57 2012 -0400
@@ -2,18 +2,18 @@
   {
     "@id": "_:c14n0",
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
-      "6"
+      "4"
     ],
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
       {
-        "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"
+        "@id": "_:c14n1"
       }
     ]
   },
   {
     "@id": "_:c14n1",
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
-      "4"
+      "5"
     ],
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
       {
@@ -24,18 +24,18 @@
   {
     "@id": "_:c14n2",
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
-      "5"
+      "6"
     ],
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
       {
-        "@id": "_:c14n0"
+        "@id": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"
       }
     ]
   },
   {
     "@id": "_:c14n3",
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
-      "1"
+      "2"
     ],
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
       {
@@ -46,17 +46,6 @@
   {
     "@id": "_:c14n4",
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
-      "2"
-    ],
-    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
-      {
-        "@id": "_:c14n5"
-      }
-    ]
-  },
-  {
-    "@id": "_:c14n5",
-    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
       "3"
     ],
     "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
@@ -66,15 +55,26 @@
     ]
   },
   {
+    "@id": "_:c14n5",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [
+      "1"
+    ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest": [
+      {
+        "@id": "_:c14n3"
+      }
+    ]
+  },
+  {
     "@id": "_:c14n6",
     "http://example.org/test#property1": [
       {
-        "@id": "_:c14n3"
+        "@id": "_:c14n5"
       }
     ],
     "http://example.org/test#property2": [
       {
-        "@id": "_:c14n1"
+        "@id": "_:c14n0"
       }
     ]
   },