You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.html
+64Lines changed: 64 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -307,6 +307,70 @@ <h3 id="type-links">External references should use typed term</h3>
307
307
}
308
308
</pre>
309
309
</section>
310
+
311
+
<section>
312
+
<h3id="context-order">Ordering of array elements</h3>
313
+
<pclass="practicedesc">By default, <aclass="externalDFN" href="https://www.w3.org/TR/json-ld/#sets-and-lists">arrays in JSON-LD do not convey any ordering of contained elements</a>.
314
+
However, for the processing of contexts, the ordering of elements in arrays <em>does</em> matter.
315
+
As such, when writing array-based contexts, this fact should be kept in mind.</p>
316
+
<p>Ordered contexts in arrays allow inheritance and overriding of context entries.
317
+
When processing the following example, the first <code>name</code> entry will be overridden by the second <code>name</code> entry.</p>
318
+
<preclass="example" title="Overriding name term">
319
+
{
320
+
"@context": [
321
+
{
322
+
"id": "@id",
323
+
"name": "http://schema.org/name"
324
+
},
325
+
{
326
+
"name": "http://xmlns.com/foaf/0.1/name"
327
+
}
328
+
],
329
+
"@id": "http://www.wikidata.org/entity/Q76",
330
+
<strong>"name": "Barack Obama"</strong>
331
+
}
332
+
</pre>
333
+
<p>Order is important when processing <aclass="externalDFN" href="https://www.w3.org/TR/json-ld/#protected-term-definitions">protected terms</a>.
334
+
While the first example will cause a term redefinition error, the second example will not throw this error.</p>
335
+
<preclass="example" title="Failing term redefinition">
336
+
{
337
+
"@context": [
338
+
{
339
+
"@version": 1.1,
340
+
"name": {
341
+
"@id": "http://schema.org/name",
342
+
"@protected": true
343
+
}
344
+
},
345
+
{
346
+
"name": "http://xmlns.com/foaf/0.1/name"
347
+
}
348
+
],
349
+
"@id": "http://www.wikidata.org/entity/Q76",
350
+
<strong>"name": "Barack Obama"</strong>
351
+
}
352
+
</pre>
353
+
<preclass="example" title="Non-failing term redefinition">
0 commit comments