Add @annotation expansion test
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Wed, 05 Dec 2012 12:36:25 +0100
changeset 991 a982f900734e
parent 990 a44c5d256b0b
child 992 9c7c6f1d3b85
Add @annotation expansion test

This addresses #196.
test-suite/tests/expand-0036-in.jsonld
test-suite/tests/expand-0036-out.jsonld
test-suite/tests/expand-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0036-in.jsonld	Wed Dec 05 12:36:25 2012 +0100
@@ -0,0 +1,94 @@
+{
+  "@context": {
+    "property": "http://example.com/property",
+    "annotContainer": { "@id": "http://example.com/container", "@container": "@annotation" }
+  },
+  "@id": "http://example.org/annotationsTest",
+  "annotContainer": {
+    "A": [
+      {
+        "@id": "http://example.org/nodeWithoutAnnotationA"
+      },
+      {
+        "@id": "http://example.org/nodeWithAnnotationA",
+        "@annotation": "this overrides the 'A' annotation from the container"
+      },
+      1,
+      true,
+      false,
+      null,
+      "simple string A",
+      {
+        "@value": "typed literal A",
+        "@type": "http://example.org/type"
+      },
+      {
+        "@value": "language-tagged string A",
+        "@language": "en"
+      }
+    ],
+    "B": "simple string B",
+    "C": [
+      {
+        "@id": "http://example.org/nodeWithoutAnnotationC"
+      },
+      {
+        "@id": "http://example.org/nodeWithAnnotationC",
+        "@annotation": "this overrides the 'C' annotation from the container"
+      },
+      3,
+      true,
+      false,
+      null,
+      "simple string C",
+      {
+        "@value": "typed literal C",
+        "@type": "http://example.org/type"
+      },
+      {
+        "@value": "language-tagged string C",
+        "@language": "en"
+      }
+    ]
+  },
+  "property": [
+    {
+      "@id": "http://example.org/nodeWithoutAnnotationProp"
+    },
+    {
+      "@id": "http://example.org/nodeWithAnnotationProp",
+      "@annotation": "prop"
+    },
+    {
+      "@value": 3,
+      "@annotation": "prop"
+    },
+    {
+      "@value": true,
+      "@annotation": "prop"
+    },
+    {
+      "@value": false,
+      "@annotation": "prop"
+    },
+    {
+      "@value": null,
+      "@annotation": "prop"
+    },
+    "simple string no annotation",
+    {
+      "@value": "typed literal Prop",
+      "@type": "http://example.org/type",
+      "@annotation": "prop"
+    },
+    {
+      "@value": "language-tagged string Prop",
+      "@language": "en",
+      "@annotation": "prop"
+    },
+    {
+      "@value": "annotation using an array with just one element (automatic recovery)",
+      "@annotation": [ "prop" ]
+    }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0036-out.jsonld	Wed Dec 05 12:36:25 2012 +0100
@@ -0,0 +1,117 @@
+[
+   {
+      "@id": "http://example.org/annotationsTest",
+      "http://example.com/container": [
+         {
+            "@id": "http://example.org/nodeWithoutAnnotationA",
+            "@annotation": "A"
+         },
+         {
+            "@id": "http://example.org/nodeWithAnnotationA",
+            "@annotation": "this overrides the 'A' annotation from the container"
+         },
+         {
+            "@value": 1,
+            "@annotation": "A"
+         },
+         {
+            "@value": true,
+            "@annotation": "A"
+         },
+         {
+            "@value": false,
+            "@annotation": "A"
+         },
+         {
+            "@value": "simple string A",
+            "@annotation": "A"
+         },
+         {
+            "@value": "typed literal A",
+            "@type": "http://example.org/type",
+            "@annotation": "A"
+         },
+         {
+            "@value": "language-tagged string A",
+            "@language": "en",
+            "@annotation": "A"
+         },
+         {
+            "@value": "simple string B",
+            "@annotation": "B"
+         },
+         {
+            "@id": "http://example.org/nodeWithoutAnnotationC",
+            "@annotation": "C"
+         },
+         {
+            "@id": "http://example.org/nodeWithAnnotationC",
+            "@annotation": "this overrides the 'C' annotation from the container"
+         },
+         {
+            "@value": 3,
+            "@annotation": "C"
+         },
+         {
+            "@value": true,
+            "@annotation": "C"
+         },
+         {
+            "@value": false,
+            "@annotation": "C"
+         },
+         {
+            "@value": "simple string C",
+            "@annotation": "C"
+         },
+         {
+            "@value": "typed literal C",
+            "@type": "http://example.org/type",
+            "@annotation": "C"
+         },
+         {
+            "@value": "language-tagged string C",
+            "@language": "en",
+            "@annotation": "C"
+         }
+      ],
+      "http://example.com/property": [
+         {
+            "@id": "http://example.org/nodeWithoutAnnotationProp"
+         },
+         {
+            "@id": "http://example.org/nodeWithAnnotationProp",
+            "@annotation": "prop"
+         },
+         {
+            "@value": 3,
+            "@annotation": "prop"
+         },
+         {
+            "@value": true,
+            "@annotation": "prop"
+         },
+         {
+            "@value": false,
+            "@annotation": "prop"
+         },
+         {
+            "@value": "simple string no annotation"
+         },
+         {
+            "@value": "typed literal Prop",
+            "@type": "http://example.org/type",
+            "@annotation": "prop"
+         },
+         {
+            "@value": "language-tagged string Prop",
+            "@language": "en",
+            "@annotation": "prop"
+         },
+         {
+             "@value": "annotation using an array with just one element (automatic recovery)",
+             "@annotation": "prop"
+         }
+      ]
+   }
+]
--- a/test-suite/tests/expand-manifest.jsonld	Tue Dec 04 22:54:18 2012 +0100
+++ b/test-suite/tests/expand-manifest.jsonld	Wed Dec 05 12:36:25 2012 +0100
@@ -181,6 +181,11 @@
       "name": "Using language maps with @vocab, a default language, and a colliding property",
       "input": "expand-0035-in.jsonld",
       "expect": "expand-0035-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Expanding @annotation",
+      "input": "expand-0036-in.jsonld",
+      "expect": "expand-0036-out.jsonld"
     }
   ]
 }