diff --git a/index.html b/index.html index 3490489..b8e7541 100644 --- a/index.html +++ b/index.html @@ -307,6 +307,70 @@ } + +
+

Ordering of array elements

+

By default, arrays in JSON-LD do not convey any ordering of contained elements. + However, for the processing of contexts, the ordering of elements in arrays does matter. + As such, when writing array-based contexts, this fact should be kept in mind.

+

Ordered contexts in arrays allow inheritance and overriding of context entries. + When processing the following example, the first name entry will be overridden by the second name entry.

+
+          {
+            "@context": [
+              {
+                "id": "@id",
+                "name": "http://schema.org/name"
+              },
+              {
+                "name": "http://xmlns.com/foaf/0.1/name"
+              }
+            ],
+            "@id": "http://www.wikidata.org/entity/Q76",
+            "name": "Barack Obama"
+          }
+        
+

Order is important when processing protected terms. + While the first example will cause a term redefinition error, the second example will not throw this error.

+
+          {
+            "@context": [
+              {
+                "@version": 1.1,
+                "name": {
+                  "@id": "http://schema.org/name",
+                  "@protected": true
+                }
+              },
+              {
+                "name": "http://xmlns.com/foaf/0.1/name"
+              }
+            ],
+            "@id": "http://www.wikidata.org/entity/Q76",
+            "name": "Barack Obama"
+          }
+        
+
+          {
+            "@context": [
+              {
+                "name": "http://xmlns.com/foaf/0.1/name"
+              },
+              {
+                "@version": 1.1,
+                "Person": "http://schema.org/Person",
+                "knows": "http://schema.org/knows",
+                "name": {
+                  "@id": "http://schema.org/name",
+                  "@protected": true
+                }
+              }
+            ],
+            "@id": "http://www.wikidata.org/entity/Q76",
+            "name": "Barack Obama"
+          }
+        
+