Add compaction test using @vocab
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Fri, 10 Aug 2012 15:50:09 +0200
changeset 802 ab42822c2bb7
parent 801 5a5ab3bf8735
child 803 3a3e87d3ee0f
Add compaction test using @vocab

This test should cover most corner cases for @vocab in compaction.

See also the discussion of 92313c769d70241b4ee7a80c0d9a4f7e940db4fb.
test-suite/tests/compact-0021-context.jsonld
test-suite/tests/compact-0021-in.jsonld
test-suite/tests/compact-0021-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0021-context.jsonld	Fri Aug 10 15:50:09 2012 +0200
@@ -0,0 +1,8 @@
+{
+  "@context": {
+    "@vocab": "http://example.com/",
+    "sub": "http://example.com/subdir/",
+    "date": { "@id": "sub:vocab/date", "@type": "subdir/vocab/dateTime" },
+    "embed": "subdir/vocab/embed"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0021-in.jsonld	Fri Aug 10 15:50:09 2012 +0200
@@ -0,0 +1,23 @@
+[
+  {
+    "@id": "http://example.com/subdir/id/1",
+    "@type": [ "http://example.com/subdir/vocab/test" ],
+    "http://example.com/subdir/vocab/date": [
+      {
+        "@value": "2011-01-25T00:00:00Z",
+        "@type": "http://example.com/subdir/vocab/dateTime"
+      }
+    ],
+    "http://example.com/subdir/vocab/embed": [
+      {
+        "@id": "http://example.com/subdir/id/2",
+        "http://example.com/subdir/vocab/expandedDate": [
+          {
+            "@value": "2012-08-01T00:00:00Z",
+            "@type": "http://example.com/subdir/vocab/dateTime"
+          }
+        ]
+      }
+    ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0021-out.jsonld	Fri Aug 10 15:50:09 2012 +0200
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "@vocab": "http://example.com/",
+    "sub": "http://example.com/subdir/",
+    "date": { "@id": "sub:vocab/date", "@type": "subdir/vocab/dateTime" },
+    "embed": "subdir/vocab/embed"
+  },
+  "@id": "sub:id/1",
+  "@type": "subdir/vocab/test",
+  "date": "2011-01-25T00:00:00Z",
+  "embed": {
+    "@id": "sub:id/2",
+    "subdir/vocab/expandedDate": {
+      "@value": "2012-08-01T00:00:00Z",
+      "@type": "subdir/vocab/dateTime"
+    }
+  }
+}
--- a/test-suite/tests/compact-manifest.jsonld	Thu Aug 09 17:50:33 2012 +0200
+++ b/test-suite/tests/compact-manifest.jsonld	Fri Aug 10 15:50:09 2012 +0200
@@ -125,5 +125,11 @@
     "input": "compact-0020-in.jsonld",
     "context": "compact-0020-context.jsonld",
     "expect": "compact-0020-out.jsonld"
+  }, {
+    "@type": ["test:TestCase", "jld:CompactTest"],
+    "name": "Compact properties and types using @vocab",
+    "input": "compact-0021-in.jsonld",
+    "context": "compact-0021-context.jsonld",
+    "expect": "compact-0021-out.jsonld"
   }]
 }