diff --git a/index.html b/index.html index 9738ecde..ff39e7ed 100644 --- a/index.html +++ b/index.html @@ -26,13 +26,13 @@ prevVersion: "https://www.w3.org/TR/2014/REC-json-ld-20140116/", previousPublishDate: "2014-01-16", previousMaturity: "REC", + github: "https://github.com/w3c/json-ld-syntax/", // if there a publicly available Editor's Draft, this is the link edDraftURI: "https://w3c.github.io/json-ld/", includePermalinks: true, doJsonLd: true, - testSuiteURIkey: "https://json-ld.org/test-suite/", postProcess: [internalizeTermListReferences], // if you want to have extra CSS, append them to this list @@ -95,8 +95,6 @@ note: "v1.0" } ], - github: "https://github.com/w3c/json-ld-syntax/", - // name of the WG wg: "JSON-LD Working Group", @@ -2301,9 +2299,188 @@

Sets and Lists

--> -

List of lists in the form of list objects - are not allowed in this version of JSON-LD. This decision was made due to the - extreme amount of added complexity when processing lists of lists.

+

The implementation of lists in RDF depends on linking anonymous nodes + together using the properties rdf:first and + rdf:rest, with the end of the list defined as the resource + rdf:nil. This can be represented as triples, as the following + example shows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SubjectPropertyValue
http://example.org/people#joebobfoaf:nick_:b0
_:b0rdf:firstjoe
_:b0rdf:rest_:b1
_:b1rdf:firstbob
_:b1rdf:rest_:b2
_:b2rdf:firstjaybee
_:b2rdf:restrdf:nil
+ +

JSON-LD provides a syntactic shortcut for these lists. In Turtle, the graph would be expressed as follows:

+ +
+
+
+ +

In JSON-LD 1.1, lists of lists, where the value of + a list object, may itself be a list object, are + fully supported. For example, in GeoJSON (see [[RFC7946]]), + coordinates are an ordered list of positions, which are + represented as an array of two or more numbers:

+ +
+{
+  "type": "Feature",
+  "bbox": [-10.0, -10.0, 10.0, 10.0],
+  "geometry": {
+    "type": "Polygon",
+    "coordinates": [
+        [
+            [-10.0, -10.0],
+            [10.0, -10.0],
+            [10.0, 10.0],
+            [-10.0, -10.0]
+        ]
+    ]
+  }
+  //...
+}
+
+ +

For these examples, it's important that values + expressed within bbox and coordinates maintain their order, + which requires the use of embedded list structures. In JSON-LD 1.1, we can + express this using recursive lists, by simply adding the appropriate context + definion:

+ +
+{
+  "@context": {
+    "@vocab": "https://purl.org/geojson/vocab#",
+    "type": "@type",
+    "bbox": {"@container": "@list"},
+    "coordinates": {"@container": "@list"}
+  },
+  "type": "Feature",
+  "bbox": [-10.0, -10.0, 10.0, 10.0],
+  "geometry": {
+    "type": "Polygon",
+    "coordinates": [
+        [
+            [-10.0, -10.0],
+            [10.0, -10.0],
+            [10.0, 10.0],
+            [-10.0, -10.0]
+        ]
+    ]
+  }
+  ####//...####
+}
+
+ +

This is equivalent to the expanded form, which uses list objects:

+ +
+[{
+  "@type": ["https://purl.org/geojson/vocab#Feature"],
+  "https://purl.org/geojson/vocab#bbox": [{
+    "@list": [
+      {"@value": -10.0},
+      {"@value": -10.0},
+      {"@value": 10.0},
+      {"@value": 10.0}
+    ]
+  }],
+  "https://purl.org/geojson/vocab#geometry": [{
+    "@type": ["https://purl.org/geojson/vocab#Polygon"],
+    "https://purl.org/geojson/vocab#coordinates": [{
+      "@list": [{
+        "@list": [
+          {"@list": [{"@value": -10.0}, {"@value": -10.0}]},
+          {"@list": [{"@value": 10.0}, {"@value": -10.0}]},
+          {"@list": [{"@value": 10.0}, {"@value": 10.0}]},
+          {"@list": [{"@value": -10.0}, {"@value": -10.0}]}
+        ]
+      }]
+    }]
+  }]
+}]
+
+ +

Note that coordinates includes three levels of lists. + When expressed in Turtle, this would be the following:

+ +
+
+

While @list is used to describe ordered lists, the @set keyword is used to describe unordered sets. @@ -5118,6 +5295,7 @@

Changes since 1.0 Recommendation of 16 January 2014

a context. When this is set, vocabulary-relative IRIs, such as the keys of node objects, are expanded or compacted relative to the base IRI using string concatenation. +
  • Lists may now have members which are themselves lists.