Detect cycles in lists when converting from RDF
authorMarkus Lanthaler <mark_lanthaler@gmx.net>
Mon, 06 May 2013 11:30:58 +0200
changeset 1636 9f1456144d47
parent 1635 175866ffa894
child 1637 11b0debb602d
Detect cycles in lists when converting from RDF
spec/latest/json-ld-api/index.html
test-suite/tests/fromRdf-0012-in.nq
test-suite/tests/fromRdf-0012-out.jsonld
test-suite/tests/fromRdf-manifest.jsonld
--- a/spec/latest/json-ld-api/index.html	Mon May 06 11:29:27 2013 +0200
+++ b/spec/latest/json-ld-api/index.html	Mon May 06 11:30:58 2013 +0200
@@ -3480,7 +3480,9 @@
                           Set <i>subject</i> to the value of its <code>@id</code> member.</li>
                         <li>If <i>graph object</i> has a <i>subject</i> member, reference its
                           value using the variable <i>node</i>; otherwise set <i>node</i>
-                          to <tref>null</tref></li>
+                          to <tref>null</tref>.</li>
+                        <li>If <i>list nodes</i> contains <i>subject</i> a cycle has been detected,
+                          set <i>list</i> to <tref>null</tref>.</li>
                       </ol>
                     </li>
                   </ol>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/fromRdf-0012-in.nq	Mon May 06 11:30:58 2013 +0200
@@ -0,0 +1,7 @@
+<http://example.com> <http://example.com/property> _:a .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "a" .
+_:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "b" .
+_:b <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:c .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "c" .
+_:c <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/fromRdf-0012-out.jsonld	Mon May 06 11:30:58 2013 +0200
@@ -0,0 +1,21 @@
+[
+  {
+    "@id": "_:a",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "a" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "_:b",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "b" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:c" } ]
+  },
+  {
+    "@id": "_:c",
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#first": [ { "@value": "c" } ],
+    "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest":  [ { "@id": "_:b" } ]
+  },
+  {
+    "@id": "http://example.com",
+    "http://example.com/property":  [ { "@id": "_:a" } ]
+  }
+]
--- a/test-suite/tests/fromRdf-manifest.jsonld	Mon May 06 11:29:27 2013 +0200
+++ b/test-suite/tests/fromRdf-manifest.jsonld	Mon May 06 11:30:58 2013 +0200
@@ -83,6 +83,13 @@
       "purpose": "Testing list conversion.",
       "input": "fromRdf-0011-in.nq",
       "expect": "fromRdf-0011-out.jsonld"
+    }, {
+      "@id": "#t0012",
+      "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
+      "name": "Detect lists containing cycles and do not convert them to @list",
+      "purpose": "Testing list conversion.",
+      "input": "fromRdf-0012-in.nq",
+      "expect": "fromRdf-0012-out.jsonld"
     }
   ]
 }