Add reverse properties expansion tests
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Mon, 11 Mar 2013 18:43:21 +0100
changeset 1403 e8bc0b737650
parent 1402 3246f890906e
child 1404 f4a3eaf19735
Add reverse properties expansion tests

This addresses #221.
test-suite/tests/expand-0037-in.jsonld
test-suite/tests/expand-0037-out.jsonld
test-suite/tests/expand-0039-in.jsonld
test-suite/tests/expand-0039-out.jsonld
test-suite/tests/expand-0042-in.jsonld
test-suite/tests/expand-0042-out.jsonld
test-suite/tests/expand-0043-in.jsonld
test-suite/tests/expand-0043-out.jsonld
test-suite/tests/expand-0049-in.jsonld
test-suite/tests/expand-0049-out.jsonld
test-suite/tests/expand-0063-in.jsonld
test-suite/tests/expand-0063-out.jsonld
test-suite/tests/expand-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0037-in.jsonld	Mon Mar 11 18:43:21 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/expand-0037-out.jsonld	Mon Mar 11 18:43:21 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/expand-0039-in.jsonld	Mon Mar 11 18:43:21 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/expand-0039-out.jsonld	Mon Mar 11 18:43:21 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/expand-0042-in.jsonld	Mon Mar 11 18:43:21 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/expand-0042-out.jsonld	Mon Mar 11 18:43:21 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/expand-0043-in.jsonld	Mon Mar 11 18:43:21 2013 +0100
@@ -0,0 +1,20 @@
+{
+  "@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",
+  "@reverse": {
+    "isKnownBy": [
+      {
+        "@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/expand-0043-out.jsonld	Mon Mar 11 18:43:21 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/expand-0049-in.jsonld	Mon Mar 11 18:43:21 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/expand-0049-out.jsonld	Mon Mar 11 18:43:21 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/expand-0063-in.jsonld	Mon Mar 11 18:43:21 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/expand-0063-out.jsonld	Mon Mar 11 18:43:21 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" } ]
+  }
+]
--- a/test-suite/tests/expand-manifest.jsonld	Mon Mar 11 17:32:24 2013 +0100
+++ b/test-suite/tests/expand-manifest.jsonld	Mon Mar 11 18:43:21 2013 +0100
@@ -188,11 +188,21 @@
       "expect": "expand-0036-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Expanding @reverse",
+      "input": "expand-0037-in.jsonld",
+      "expect": "expand-0037-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
       "name": "Ensure all blank nodes are relabeled during expansion.",
       "input": "expand-0038-in.jsonld",
       "expect": "expand-0038-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Using terms in a reverse-maps",
+      "input": "expand-0039-in.jsonld",
+      "expect": "expand-0039-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
       "name": "Only invoke language and index map expansion if the value is a JSON object",
       "input": "expand-0040-in.jsonld",
       "expect": "expand-0040-out.jsonld"
@@ -203,6 +213,16 @@
       "expect": "expand-0041-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Expanding reverse properties",
+      "input": "expand-0042-in.jsonld",
+      "expect": "expand-0042-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Using reverse properties inside a @reverse-container",
+      "input": "expand-0043-in.jsonld",
+      "expect": "expand-0043-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
       "name": "Ensure index maps use language mapping",
       "input": "expand-0044-in.jsonld",
       "expect": "expand-0044-out.jsonld"
@@ -228,6 +248,11 @@
       "expect": "expand-0048-out.jsonld"
     }, {
       "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Using strings as value of a reverse property",
+      "input": "expand-0049-in.jsonld",
+      "expect": "expand-0049-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
       "name": "Context definitions using compact IRIs don't inherit the definitions of the prefix",
       "input": "expand-0050-in.jsonld",
       "expect": "expand-0050-out.jsonld"
@@ -293,6 +318,11 @@
       "name": "Relative IRIs with empty @base",
       "input": "expand-0062-in.jsonld",
       "expect": "expand-0062-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Expand a reverse property with an index-container",
+      "input": "expand-0063-in.jsonld",
+      "expect": "expand-0063-out.jsonld"
     }
   ]
 }