Use array to add compacted item when expanded property is @list.
authorDave Longley <dlongley@digitalbazaar.com>
Mon, 11 Feb 2013 11:01:49 -0500
changeset 1211 6b63e82320a0
parent 1210 e20d2b450020
child 1212 117d3d4fabd5
Use array to add compacted item when expanded property is @list.

- Add test cases for round tripping top-level @list with scalar
and with graph alias.
spec/latest/json-ld-api/alternate2.html
test-suite/tests/compact-0051-context.jsonld
test-suite/tests/compact-0051-in.jsonld
test-suite/tests/compact-0051-out.jsonld
test-suite/tests/compact-0052-context.jsonld
test-suite/tests/compact-0052-in.jsonld
test-suite/tests/compact-0052-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- a/spec/latest/json-ld-api/alternate2.html	Mon Feb 11 10:38:06 2013 -0500
+++ b/spec/latest/json-ld-api/alternate2.html	Mon Feb 11 11:01:49 2013 -0500
@@ -2832,8 +2832,9 @@
                     Initialize <em>useArray</em> to <tref>false</tref>. If
                     <em>container</em> equals <code>@set</code> or
                     <code>@list</code>, or <em>compacted item</em> is
-                    an empty <tref>array</tref>, or <em>expanded property</em>
-                    equals <code>@graph</code>, then set <em>useArray</em>
+                    an empty <tref>array</tref>, or
+                    <em>expanded property</em> equals <code>@list</code> or
+                    <code>@graph</code>, then set <em>useArray</em>
                     to <tref>true</tref>.
                   </li>
                   <li>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0051-context.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,1 @@
+{}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0051-in.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,3 @@
+{
+  "@list": [1]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0051-out.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,3 @@
+{
+  "@list": [1]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0052-context.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "graph": "@graph"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0052-in.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "graph": "@graph"
+  },
+  "graph": {
+    "@list": [1]
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0052-out.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "graph": "@graph"
+  },
+  "@list": [1]
+}
--- a/test-suite/tests/compact-manifest.jsonld	Mon Feb 11 10:38:06 2013 -0500
+++ b/test-suite/tests/compact-manifest.jsonld	Mon Feb 11 11:01:49 2013 -0500
@@ -306,6 +306,18 @@
       "input": "compact-0050-in.jsonld",
       "context": "compact-0050-context.jsonld",
       "expect": "compact-0050-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Round tripping @list with scalar",
+      "input": "compact-0051-in.jsonld",
+      "context": "compact-0051-context.jsonld",
+      "expect": "compact-0051-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Round tripping @list with scalar and @graph alias",
+      "input": "compact-0052-in.jsonld",
+      "context": "compact-0052-context.jsonld",
+      "expect": "compact-0052-out.jsonld"
     }
   ]
 }