Add empty identifier test
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Thu, 20 Mar 2014 20:44:59 +0100
changeset 2142 70748090503c
parent 2141 4ba4dfd6dfcc
child 2143 e73995297ea4
Add empty identifier test

This has been raised by @dlongley as bug on my JSON-LD processor (https://github.com/lanthaler/JsonLD/issues/47). Other implementations in languages that don't support properties with empty identifiers suffer under the same limitation and need to work around it.
test-suite/tests/flatten-0046-in.jsonld
test-suite/tests/flatten-0046-out.jsonld
test-suite/tests/flatten-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/flatten-0046-in.jsonld	Thu Mar 20 20:44:59 2014 +0100
@@ -0,0 +1,17 @@
+{
+  "@context": {
+    "@base": null
+  },
+  "@id": "",
+  "http://example.com/foo": "bar",
+  "@graph": [
+    {
+      "@id": "",
+      "http://example.com/baz": "bam"
+    },
+    {
+      "@id": "0",
+      "http://example.com/baaaaaz": "baaaam"
+    }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/flatten-0046-out.jsonld	Thu Mar 20 20:44:59 2014 +0100
@@ -0,0 +1,16 @@
+[
+  {
+    "@id": "",
+    "http://example.com/foo": [ { "@value": "bar" } ],
+    "@graph": [
+      {
+        "@id": "",
+        "http://example.com/baz": [ { "@value": "bam" } ]
+      },
+      {
+        "@id": "0",
+        "http://example.com/baaaaaz": [ { "@value": "baaaam" } ]
+      }
+    ]
+  }
+]
--- a/test-suite/tests/flatten-manifest.jsonld	Wed Mar 19 18:53:34 2014 +0100
+++ b/test-suite/tests/flatten-manifest.jsonld	Thu Mar 20 20:44:59 2014 +0100
@@ -325,6 +325,13 @@
       "purpose": "Proper (re-)labeling of blank nodes if used with reverse properties.",
       "input": "flatten-0045-in.jsonld",
       "expect": "flatten-0045-out.jsonld"
+    }, {
+      "@id": "#t0046",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
+      "name": "Empty string as identifier",
+      "purpose": "Usage of empty strings in identifiers needs special care when constructing the node map.",
+      "input": "flatten-0046-in.jsonld",
+      "expect": "flatten-0046-out.jsonld"
     }
   ]
 }