Add reverse properies compaction tests
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Mon, 11 Mar 2013 19:33:31 +0100
changeset 1408 77d22cdb6495
parent 1407 483c4f47ea44
child 1409 4ba6404e371a
Add reverse properies compaction tests

This addresses #221.
test-suite/tests/compact-0031-context.jsonld
test-suite/tests/compact-0031-in.jsonld
test-suite/tests/compact-0031-out.jsonld
test-suite/tests/compact-0032-context.jsonld
test-suite/tests/compact-0032-in.jsonld
test-suite/tests/compact-0032-out.jsonld
test-suite/tests/compact-0033-context.jsonld
test-suite/tests/compact-0033-in.jsonld
test-suite/tests/compact-0033-out.jsonld
test-suite/tests/compact-0034-context.jsonld
test-suite/tests/compact-0034-in.jsonld
test-suite/tests/compact-0034-out.jsonld
test-suite/tests/compact-0035-context.jsonld
test-suite/tests/compact-0035-in.jsonld
test-suite/tests/compact-0035-out.jsonld
test-suite/tests/compact-0036-context.jsonld
test-suite/tests/compact-0036-in.jsonld
test-suite/tests/compact-0036-out.jsonld
test-suite/tests/compact-0037-context.jsonld
test-suite/tests/compact-0037-in.jsonld
test-suite/tests/compact-0037-out.jsonld
test-suite/tests/compact-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0031-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,5 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0031-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,14 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0031-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,13 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "http://xmlns.com/foaf/0.1/knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,14 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0032-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,14 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0033-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0033-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,14 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0033-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,12 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": {
+    "@id": "http://example.com/people/dave",
+    "name": "Dave Longley"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0034-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0034-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,16 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "http://xmlns.com/foaf/0.1/knows": [
+      {
+        "@id": "http://example.com/people/dave",
+        "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+      },
+      {
+        "@id": "http://example.com/people/gregg",
+        "http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
+      }
+    ],
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0034-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "http://xmlns.com/foaf/0.1/knows": [
+    {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    {
+      "@id": "http://example.com/people/gregg",
+      "name": "Gregg Kellogg"
+    }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0035-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0035-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,16 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave"
+        },
+        {
+          "@id": "http://example.com/people/gregg"
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0035-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,12 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": [
+    "http://example.com/people/dave",
+    "http://example.com/people/gregg"
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,6 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,20 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave",
+          "@index": "Dave",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+        },
+        {
+          "@id": "http://example.com/people/gregg",
+          "@index": "Gregg",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Gregg Kellogg" } ]
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0036-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "isKnownBy": { "@reverse": "http://xmlns.com/foaf/0.1/knows", "@container": "@index" }
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "isKnownBy": {
+    "Dave": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    "Gregg": {
+      "@id": "http://example.com/people/gregg",
+      "name": "Gregg Kellogg"
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0037-context.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,7 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows",
+    "@vocab": "http://example.com/vocab/"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0037-in.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,20 @@
+[
+  {
+    "@id": "http://example.com/people/markus",
+    "@reverse": {
+      "http://xmlns.com/foaf/0.1/knows": [
+        {
+          "@id": "http://example.com/people/dave",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Dave Longley" } ]
+        }
+      ],
+      "http://example.com/vocab/noTerm": [
+        {
+          "@id": "http://json-ld.org/test-suite/tests/relative-node",
+          "http://xmlns.com/foaf/0.1/name": [ { "@value": "Compact keys using @vocab" } ]
+        }
+      ]
+    },
+    "http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus Lanthaler" } ]
+  }
+]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/compact-0037-out.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "name": "http://xmlns.com/foaf/0.1/name",
+    "knows": "http://xmlns.com/foaf/0.1/knows",
+    "@vocab": "http://example.com/vocab/"
+  },
+  "@id": "http://example.com/people/markus",
+  "name": "Markus Lanthaler",
+  "@reverse": {
+    "knows": {
+      "@id": "http://example.com/people/dave",
+      "name": "Dave Longley"
+    },
+    "noTerm": {
+      "@id": "relative-node",
+      "name": "Compact keys using @vocab"
+    }
+  }
+}
--- a/test-suite/tests/compact-manifest.jsonld	Mon Mar 11 19:30:01 2013 +0100
+++ b/test-suite/tests/compact-manifest.jsonld	Mon Mar 11 19:33:31 2013 +0100
@@ -188,6 +188,48 @@
       "expect": "compact-0030-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact @reverse",
+      "input": "compact-0031-in.jsonld",
+      "context": "compact-0031-context.jsonld",
+      "expect": "compact-0031-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact keys in reverse-maps",
+      "input": "compact-0032-in.jsonld",
+      "context": "compact-0032-context.jsonld",
+      "expect": "compact-0032-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact reverse-map to reverse property",
+      "input": "compact-0033-in.jsonld",
+      "context": "compact-0033-context.jsonld",
+      "expect": "compact-0033-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Do not use reverse property if no other property matches as normal property",
+      "input": "compact-0034-in.jsonld",
+      "context": "compact-0034-context.jsonld",
+      "expect": "compact-0034-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact pure node references to strings for reverse properties",
+      "input": "compact-0035-in.jsonld",
+      "context": "compact-0035-context.jsonld",
+      "expect": "compact-0035-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact reverse properties using index containers",
+      "input": "compact-0036-in.jsonld",
+      "context": "compact-0036-context.jsonld",
+      "expect": "compact-0036-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
+      "name": "Compact keys in @reverse using @vocab",
+      "input": "compact-0037-in.jsonld",
+      "context": "compact-0037-context.jsonld",
+      "expect": "compact-0037-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:CompactTest"],
       "name": "Index map round-tripping (Drupal content deployment)",
       "input": "compact-0038-in.jsonld",
       "context": "compact-0038-context.jsonld",