Skip to content

Commit 85962ba

Browse files
committed
Factor in @iherman's comments, and include an example of recursive lists in expanded form.
1 parent d6e3df2 commit 85962ba

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

index.html

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,7 +2331,11 @@ <h2>Sets and Lists</h2>
23312331
-->
23322332
</pre>
23332333

2334-
<p>The implementation of <a>lists</a> in RDF depends on linking anonymous nodes together using the properties <code>rdf:first</code> and <code>rdf:rest</code>, with the end of the list defined as the resource <code>rdf:nil</code>. This can be represented as triples, as the following example shows, but the results are somewhat unwieldy.</p>
2334+
<p>The implementation of <a>lists</a> in RDF depends on linking anonymous nodes
2335+
together using the properties <code>rdf:first</code> and
2336+
<code>rdf:rest</code>, with the end of the list defined as the resource
2337+
<code>rdf:nil</code>. This can be represented as triples, as the following
2338+
example shows:</p>
23352339

23362340
<table class="example">
23372341
<thead><tr>
@@ -2378,7 +2382,7 @@ <h2>Sets and Lists</h2>
23782382
</tbody>
23792383
</table>
23802384

2381-
<p>Consequently, most RDF serializations (including JSON-LD) provide a syntactic shortcut for these lists. In Turtle, the graph would be expressed as follows:</p>
2385+
<p>JSON-LD provides a syntactic shortcut for these lists. In Turtle, the graph would be expressed as follows:</p>
23822386

23832387
<pre class="example" data-transform="updateExample"
23842388
data-content-type="text/turtle"
@@ -2390,7 +2394,11 @@ <h2>Sets and Lists</h2>
23902394
-->
23912395
</pre>
23922396

2393-
<p class="changed">In JSON-LD 1.1, lists of lists, where the value of a <a>list object</a>, may itself be a <a>list object</a> recusively, are fully supported. For example, in <em>GeoJSON</em> (see [[RFC7946]]), <em>coordinates</em> are an ordered list of <em>positions</em>, which are represented as an array of two or more numbers. For example:</p>
2397+
<p class="changed">In JSON-LD 1.1, lists of lists, where the value of
2398+
a <a>list object</a>, may itself be a <a>list object</a> recusively, are
2399+
fully supported. For example, in <em>GeoJSON</em> (see [[RFC7946]]),
2400+
<em>coordinates</em> are an ordered list of <em>positions</em>, which are
2401+
represented as an array of two or more numbers. For example:</p>
23942402

23952403
<pre class="example changed"
23962404
data-content-type="application/json"
@@ -2413,7 +2421,10 @@ <h2>Sets and Lists</h2>
24132421
}
24142422
</pre>
24152423

2416-
<p class="changed">For this example, it's important that the values expressed within 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:</p>
2424+
<p class="changed">For this example, it's important that the values
2425+
expressed within coordinates maintain their order, which requires the use of
2426+
embedded list structures. In JSON-LD 1.1, we can express this using recursive
2427+
lists, by simply adding the appropriate context definion:</p>
24172428

24182429
<pre class="example changed"
24192430
data-content-type="application/json"
@@ -2443,7 +2454,40 @@ <h2>Sets and Lists</h2>
24432454
}
24442455
</pre>
24452456

2446-
<p class="changed">Note that coordinates includes three levels of lists. When expressed in Turtle, this would be the following:</p>
2457+
<p>This is equivalent to the expanded form, which uses <a>list objects</a>:</p>
2458+
2459+
<pre class="example changed"
2460+
data-content-type="application/json"
2461+
data-transform="updateExample"
2462+
title="Coordinates expressed in JSON-LD (expanded)">
2463+
[{
2464+
"@type": ["https://purl.org/geojson/vocab#Feature"],
2465+
"https://purl.org/geojson/vocab#bbox": [{
2466+
"@list": [
2467+
{"@value": -10.0},
2468+
{"@value": -10.0},
2469+
{"@value": 10.0},
2470+
{"@value": 10.0}
2471+
]
2472+
}],
2473+
"https://purl.org/geojson/vocab#geometry": [{
2474+
"@type": ["https://purl.org/geojson/vocab#Polygon"],
2475+
"https://purl.org/geojson/vocab#coordinates": [{
2476+
"@list": [{
2477+
"@list": [
2478+
{"@list": [{"@value": -10.0}, {"@value": -10.0}]},
2479+
{"@list": [{"@value": 10.0}, {"@value": -10.0}]},
2480+
{"@list": [{"@value": 10.0}, {"@value": 10.0}]},
2481+
{"@list": [{"@value": -10.0}, {"@value": -10.0}]}
2482+
]
2483+
}]
2484+
}]
2485+
}]
2486+
}]
2487+
</pre>
2488+
2489+
<p class="changed">Note that coordinates includes three levels of lists.
2490+
When expressed in Turtle, this would be the following:</p>
24472491

24482492
<pre class="example changed"
24492493
data-content-type="text/turtle"

0 commit comments

Comments
 (0)