Add RDF tests with recursive named graphs.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Tue, 24 Apr 2012 11:47:10 -0700
changeset 565 7a00404b2d46
parent 564 56087134ddc6
child 566 d377d0856903
Add RDF tests with recursive named graphs.
test-suite/tests/fromRdf-0007.jsonld
test-suite/tests/fromRdf-0007.trig
test-suite/tests/fromRdf-manifest.jsonld
test-suite/tests/rdf-0029.jsonld
test-suite/tests/rdf-0029.sparql
test-suite/tests/rdf-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/fromRdf-0007.jsonld	Tue Apr 24 11:47:10 2012 -0700
@@ -0,0 +1,24 @@
+[
+  {
+    "@id": "http://data.wikipedia.org/snaks/Assertions",
+    "@type": ["http://data.wikipedia.org/vocab#SnakSet"],
+    "http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://gregkellogg.net/foaf#me"}
+    ],
+    "@graph": [
+      {
+        "@id": "http://data.wikipedia.org/snaks/BerlinFact",
+        "@type": ["http://data.wikipedia.org/vocab#Snak"],
+        "http://data.wikipedia.org/vocab#assertedBy": [{"@value": "http://www.statistik-berlin-brandenburg.de/"}]
+      }
+    ]
+  },
+  {
+    "@id": "http://data.wikipedia.org/snaks/BerlinFact",
+    "@graph": [
+      {
+        "@id": "http://en.wikipedia.org/wiki/Berlin",
+        "http://data.wikipedia.org/vocab#population": [3499879]
+      }
+    ]
+  }
+]
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/fromRdf-0007.trig	Tue Apr 24 11:47:10 2012 -0700
@@ -0,0 +1,20 @@
+@prefix wd: <http://data.wikipedia.org/vocab#> .
+@prefix wp: <http://en.wikipedia.org/wiki/> .
+@prefix ws: <http://data.wikipedia.org/snaks/> .
+
+# Default graph, stating assertions on IRIs not in a named graph
+{
+  ws:Assertions a wd:SnakSet;
+     wd:assertedBy "http://gregkellogg.net/foaf#me" .
+}
+
+# Assertions graph, stating assertions on IRIs also used as graph names
+ws:Assertions {
+  ws:BerlinFact a wd:Snak;
+     wd:assertedBy "http://www.statistik-berlin-brandenburg.de/" .
+}
+
+# The inner named graph, stating an assertion
+ws:BerlinFact {
+  wp:Berlin wd:population 3499879 .
+}
--- a/test-suite/tests/fromRdf-manifest.jsonld	Mon Apr 23 15:36:06 2012 -0400
+++ b/test-suite/tests/fromRdf-manifest.jsonld	Tue Apr 24 11:47:10 2012 -0700
@@ -41,6 +41,12 @@
       "purpose": "Ensure that properties and list elements aren't confused between graphs.",
       "input": "fromRdf-0006.trig",
       "expect": "fromRdf-0006.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:FromRDFTest"],
+      "name": "TriG graph with multiple named graphs",
+      "purpose": "Testing @graph recursion.",
+      "input": "fromRdf-0007.trig",
+      "expect": "fromRdf-0007.jsonld"
     }
   ]
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0029.jsonld	Tue Apr 24 11:47:10 2012 -0700
@@ -0,0 +1,18 @@
+{
+  "@context": {
+    "wd": "http://data.wikipedia.org/vocab#",
+    "ws": "http://data.wikipedia.org/snaks/",
+    "wp": "http://en.wikipedia.org/wiki/"
+  },
+  "@id": "ws:Assertions",
+  "@type": "wd:SnakSet",
+  "@graph": {
+    "@id": "ws:BerlinFact",
+    "@type": "wd:Snak",
+    "@graph": {
+      "@id": "wp:Berlin",
+      "wd:population": 3499879
+    },
+    "wd:assertedBy": "http://www.statistik-berlin-brandenburg.de/"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0029.sparql	Tue Apr 24 11:47:10 2012 -0700
@@ -0,0 +1,14 @@
+PREFIX wd: <http://data.wikipedia.org/vocab#>
+PREFIX wp: <http://en.wikipedia.org/wiki/>
+PREFIX ws: <http://data.wikipedia.org/snaks/>
+
+ASK WHERE {
+  ws:Assertions a wd:SnakSet; .
+  GRAPH ws:Assertions {
+    ws:BerlinFact a wd:Snak;
+       wd:assertedBy "http://www.statistik-berlin-brandenburg.de/" .
+  }
+  GRAPH ws:BerlinFact {
+    wp:Berlin wd:population 3499879 .
+  }
+}
--- a/test-suite/tests/rdf-manifest.jsonld	Mon Apr 23 15:36:06 2012 -0400
+++ b/test-suite/tests/rdf-manifest.jsonld	Tue Apr 24 11:47:10 2012 -0700
@@ -173,6 +173,12 @@
       "name": "Simple named graph",
       "purpose": "Signing a graph.",
       "sparql": "rdf-0028.sparql"
+    }, {
+      "@type": ["test:TestCase", "jld:RDFTest"],
+      "name": "named graph with embedded named graph",
+      "purpose": "Tests that named graphs containing named graphs flatten to single level of graph naming.",
+      "input": "rdf-0029.jsonld",
+      "sparql": "rdf-0029.sparql"
     }
   ]
 }