Updated toRDF for named graphs. Added two test cases.
authorGregg Kellogg <gregg@kellogg-assoc.com>
Wed, 11 Apr 2012 18:09:18 -0700
changeset 505 f2d02f4a0426
parent 504 c9a0a4b0a465
child 506 2d1f575aab17
Updated toRDF for named graphs. Added two test cases.
spec/latest/json-ld-api/index.html
test-suite/tests/rdf-0027.jsonld
test-suite/tests/rdf-0027.sparql
test-suite/tests/rdf-0028.jsonld
test-suite/tests/rdf-0028.sparql
test-suite/tests/rdf-manifest.jsonld
--- a/spec/latest/json-ld-api/index.html	Wed Apr 11 18:08:52 2012 -0700
+++ b/spec/latest/json-ld-api/index.html	Wed Apr 11 18:09:18 2012 -0700
@@ -1916,7 +1916,8 @@
             </li>
             <li>Otherwise, if <em>property</em> is <code>@graph</code>,
               process <em>value</em> algorithm recursively, using <tref>active subject</tref> as <tref>graph name</tref>
-              and null values for <tref>active subject</tref> and <tref>active property</tref>.</li>
+              and null values for <tref>active subject</tref> and <tref>active property</tref> and then
+              proceed to next property.</li>
             <li>Otherwise, if <em>property</em> is a <tref>keyword</tref>, skip this step.</li>
             <li>Otherwise, set <tref>active property</tref> to the IRI value of <em>property</em>.</li>
             <li>Process <em>value</em> recursively using this algorithm, passing copies of
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0027.jsonld	Wed Apr 11 18:09:18 2012 -0700
@@ -0,0 +1,30 @@
+{
+  "@context": {
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "ex": "http://example.org/",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "ex:locatedIn": {"@type": "@id"},
+    "ex:hasPopulaton": {"@type": "xsd:integer"},
+    "ex:hasReference": {"@type": "@id"}
+  },
+  "@graph": [
+    {
+      "@id": "http://example.org/ParisFact1",
+      "@type": "rdf:Graph",
+      "@graph": {
+        "@id": "http://example.org/location/Paris#this",
+        "ex:locatedIn": "http://example.org/location/France#this"
+      },
+      "ex:hasReference": ["http://www.britannica.com/", "http://www.wikipedia.org/", "http://www.brockhaus.de/"]
+    },
+    {
+      "@id": "http://example.org/ParisFact2",
+      "@type": "rdf:Graph",
+      "@graph": {
+        "@id": "http://example.org/location/Paris#this",
+        "ex:hasPopulation": 7000000
+      },
+      "ex:hasReference": "http://www.wikipedia.org/"
+    }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0027.sparql	Wed Apr 11 18:09:18 2012 -0700
@@ -0,0 +1,19 @@
+PREFIX ex: <http://example.org/> 
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+
+ASK
+WHERE {
+  ex:ParisFact1 a rdf:Graph;
+    ex:hasReference <http://www.britannica.com/>,
+      <http://www.wikipedia.org/>,
+      <http://www.brockhaus.de/> .
+  ex:ParisFact2 a rdf:Graph;
+    ex:hasReference <http://www.wikipedia.org/> .
+  GRAPH ex:ParisFact1 {
+    <http://example.org/location/Paris#this> ex:locatedIn <http://example.org/location/France#this> .
+  }
+  GRAPH ex:ParisFact2 {
+    <http://example.org/location/Paris#this> ex:locatedIn <http://example.org/location/France#this> .
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0028.jsonld	Wed Apr 11 18:09:18 2012 -0700
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "sec": "http://purl.org/security#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+    "dc": "http://purl.org/dc/terms/",
+    "sec:signer": {"@type": "@id"},
+    "dc:created": {"@type": "xsd:dateTime"}
+  },
+  "@id": "http://example.org/sig1",
+  "@type": ["rdf:Graph", "sec:SignedGraph"],
+  "dc:created": "2011-09-23T20:21:34Z",
+  "sec:signer": "http://payswarm.example.com/i/john/keys/5",
+  "sec:signatureValue": "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=",
+  "@graph": {
+    "@id": "http://example.org/fact1",
+    "dc:title": "Hello World!"
+  }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/rdf-0028.sparql	Wed Apr 11 18:09:18 2012 -0700
@@ -0,0 +1,14 @@
+PREFIX dc: <http://purl.org/dc/terms/>
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX sec: <http://purl.org/security#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+
+ASK WHERE {
+  <http://example.org/sig1> a rdf:Graph, sec:SignedGraph;
+    dc:created "2011-09-23T20:21:34Z"^^xsd:dateTime;
+    sec:signatureValue "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=";
+    sec:signer <http://payswarm.example.com/i/john/keys/5> .
+  GRAPH <http://example.org/sig1> {
+    <http://example.org/fact1> dc:title "Hello World!" .
+  }
+}
--- a/test-suite/tests/rdf-manifest.jsonld	Wed Apr 11 18:08:52 2012 -0700
+++ b/test-suite/tests/rdf-manifest.jsonld	Wed Apr 11 18:09:18 2012 -0700
@@ -161,6 +161,18 @@
       "name": "Test creation of multiple types",
       "purpose": "Tests that @type with an array of types creates multiple types.",
       "sparql": "rdf-0026.sparql"
+    }, {
+      "@type": ["test:TestCase", "jld:RDFTest"],
+      "input": "rdf-0027.jsonld",
+      "name": "Simple named graph (Wikidata)",
+      "purpose": "Using @graph with other keys places triples in a named graph.",
+      "sparql": "rdf-0027.sparql"
+    }, {
+      "@type": ["test:TestCase", "jld:RDFTest"],
+      "input": "rdf-0028.jsonld",
+      "name": "Simple named graph",
+      "purpose": "Signing a graph.",
+      "sparql": "rdf-0028.sparql"
     }
   ]
 }