Only invoke language and annotation map expansion if the value is a JSON object
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Tue, 11 Dec 2012 13:02:54 +0100
changeset 1022 5da4243f8769
parent 1021 11d6994993b2
child 1023 0b28a26bf5c8
Only invoke language and annotation map expansion if the value is a JSON object

See Gregg's changes in 8c546b938869dadb230c3f5b6be6653e4192ae1a.

This addresses #133 and #196.
test-suite/tests/expand-0040-in.jsonld
test-suite/tests/expand-0040-out.jsonld
test-suite/tests/expand-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0040-in.jsonld	Tue Dec 11 13:02:54 2012 +0100
@@ -0,0 +1,23 @@
+{
+  "@context": {
+    "vocab": "http://example.com/vocab/",
+    "label": {
+      "@id": "vocab:label",
+      "@container": "@language"
+    },
+    "annotations": {
+      "@id": "vocab:annotation",
+      "@container": "@annotation"
+    }
+  },
+  "@id": "http://example.com/queen",
+  "label": [
+    "The Queen"
+  ],
+  "annotations":
+  [
+    "No",
+    "annotations",
+    { "@id": "asTheValueIsntAnObject" }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0040-out.jsonld	Tue Dec 11 13:02:54 2012 +0100
@@ -0,0 +1,23 @@
+[
+  {
+    "@id": "http://example.com/queen",
+    "http://example.com/vocab/label":
+    [
+      {
+        "@value": "The Queen"
+      }
+    ],
+    "http://example.com/vocab/annotation":
+    [
+      {
+        "@value": "No"
+      },
+      {
+        "@value": "annotations"
+      },
+      {
+        "@id": "http://json-ld.org/test-suite/tests/asTheValueIsntAnObject"
+      }
+    ]
+  }
+]
--- a/test-suite/tests/expand-manifest.jsonld	Mon Dec 10 18:47:41 2012 -0800
+++ b/test-suite/tests/expand-manifest.jsonld	Tue Dec 11 13:02:54 2012 +0100
@@ -201,6 +201,11 @@
       "name": "Complex property generator test case with multiple colliding IRIs (this document wouldn't roundtrip cleanly)",
       "input": "expand-0039-in.jsonld",
       "expect": "expand-0039-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Only invoke language and annotation map expansion if the value is a JSON object",
+      "input": "expand-0040-in.jsonld",
+      "expect": "expand-0040-out.jsonld"
     }
   ]
 }