Skip to content

Commit 8161474

Browse files
committed
Improve examples based on improved extract-examples script.
1 parent 422167c commit 8161474

File tree

1 file changed

+127
-34
lines changed

1 file changed

+127
-34
lines changed

index.html

Lines changed: 127 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -488,23 +488,48 @@ <h2>Syntax Tokens and Keywords</h2>
488488
<a class="sectionRef" href="#interpreting-json-as-json-ld"></a>. For convenience, normative
489489
statements for documents are often phrased as statements on the properties of the document.</p>
490490

491-
<p>This specification makes use of the following namespaces:</p>
492-
<dl>
493-
<dt><code>dc</code>:</dt>
494-
<dd><code>http://purl.org/dc/terms/</code></dd>
495-
<dt><code>cred</code>:</dt>
496-
<dd><code>https://w3id.org/credentials#</code></dd>
497-
<dt><code>foaf</code>:</dt>
498-
<dd><code>http://xmlns.com/foaf/0.1/</code></dd>
499-
<dt><code>prov</code></dt>
500-
<dd><code>http://www.w3.org/ns/prov#</code></dd>
501-
<dt><code>rdf</code>:</dt>
502-
<dd><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#</code></dd>
503-
<dt><code>schema</code>:</dt>
504-
<dd><code>http://schema.org/</code></dd>
505-
<dt><code>xsd</code>:</dt>
506-
<dd><code>http://www.w3.org/2001/XMLSchema#</code></dd>
507-
</dl>
491+
<p>This specification makes use of the following namespace prefixes:</p>
492+
<table class="simple">
493+
<thead><tr>
494+
<th>Prefix</th>
495+
<th>IRI</th>
496+
</tr></thead>
497+
<tbody>
498+
<tr>
499+
<td>dc</td>
500+
<td>http://purl.org/dc/terms/</td>
501+
</tr>
502+
<tr>
503+
<td>cred</td>
504+
<td>https://w3id.org/credentials#</td>
505+
</tr>
506+
<tr>
507+
<td>foaf</td>
508+
<td>http://xmlns.com/foaf/0.1/</td>
509+
</tr>
510+
<tr>
511+
<td>geojson</td>
512+
<td>https://purl.org/geojson/vocab#</td>
513+
</tr>
514+
<tr>
515+
<td>prov</td>
516+
<td>http://www.w3.org/ns/prov#</td>
517+
</tr>
518+
<tr>
519+
<td>rdf</td>
520+
<td>http://www.w3.org/1999/02/22-rdf-syntax-ns#</td>
521+
</tr>
522+
<tr>
523+
<td>schema</td>
524+
<td>http://schema.org/</td>
525+
</tr>
526+
<tr>
527+
<td>xsd</td>
528+
<td>http://www.w3.org/2001/XMLSchema#</td>
529+
</tr>
530+
</tbody>
531+
</table>
532+
508533
<p>These are used within this document as part of a <a>compact IRI</a>
509534
as a shorthand for the resulting <a>absolute IRI</a>, such as <code>dc:title</code>
510535
used to represent <code>http://purl.org/dc/terms/title</code>.</p>
@@ -593,6 +618,7 @@ <h2>The Context</h2>
593618
look something like this:</p>
594619

595620
<pre class="example nohighlight" data-transform="updateExample"
621+
data-context-for="Sample JSON document"
596622
title="Context for the sample document in the previous section">
597623
<!--
598624
{
@@ -1076,13 +1102,13 @@ <h1>Advanced Concepts</h1>
10761102
<!--
10771103
[
10781104
{
1079-
****"@context": "http://example.org/contexts/person.jsonld",****
1105+
****"@context": "https://json-ld.org/contexts/person.jsonld",****
10801106
"name": "Manu Sporny",
10811107
"homepage": "http://manu.sporny.org/",
10821108
"depiction": "http://twitter.com/account/profile_image/manusporny"
10831109
},
10841110
{
1085-
****"@context": "http://example.org/contexts/place.jsonld",****
1111+
****"@context": "https://json-ld.org/contexts/place.jsonld",****
10861112
"name": "The Empire State Building",
10871113
"description": "The Empire State Building is a 102-story landmark in New York City.",
10881114
"geo": {
@@ -1275,6 +1301,7 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
12751301
</pre>
12761302
<p>If this document were located at <code>http://example/document</code>, it would expand as follows:</p>
12771303
<pre class="example nohighlight" data-transform="updateExample"
1304+
data-result-for="Using &quot;&quot; as the vocabulary mapping"
12781305
title="Using &quot;&quot; as the vocabulary mapping (expanded)">
12791306
<!--
12801307
[{
@@ -1629,7 +1656,8 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
16291656
definition of <em>term2</em> if <em>term2</em> also depends on
16301657
<em>term1</em>. For example, the following <a>context</a> definition
16311658
is illegal:</p>
1632-
<pre class="example nohighlight" data-transform="updateExample"
1659+
<pre class="illegal-example nohighlight" data-transform="updateExample"
1660+
data-ignore
16331661
title="Illegal circular definition of terms within a context">
16341662
<!--
16351663
{
@@ -1680,6 +1708,7 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
16801708
<p>Expanding this document, uses a combination of terms defined in the outer context, and those defined specifically for that term in an <a>embedded context</a>.</p>
16811709

16821710
<pre class="example nohighlight" data-transform="updateExample"
1711+
data-result-for="Defining an @context within a term definition"
16831712
title="Expanded document using a scoped context">
16841713
<!--
16851714
[{
@@ -1805,13 +1834,24 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
18051834
<tbody>
18061835
<tr>
18071836
<td>http://example.com/docs/1</td>
1808-
<td>http://purl.org/dc/terms/modified</td>
1837+
<td>dc:modified</td>
18091838
<td>2010-05-29T14:17:39+02:00</td>
18101839
<td>xsd:dateTime</td>
18111840
</tr>
18121841
</tbody>
18131842
</table>
18141843

1844+
<script class="example" data-content-type="text/turtle"
1845+
title="term definition with type coercion Turtle"
1846+
data-result-for="Expanded term definition with type coercion"
1847+
data-to-rdf>
1848+
<!--
1849+
@prefix dc: <http://purl.org/dc/terms/> .
1850+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
1851+
<http://example.com/docs/1> dc:modified "2010-05-29T14:17:39+02:00"^^xsd:dateTime .
1852+
-->
1853+
</script>
1854+
18151855
<p>The second example uses the expanded form of setting the type information
18161856
in the body of a JSON-LD document:</p>
18171857

@@ -1865,6 +1905,19 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
18651905
-->
18661906
</pre>
18671907

1908+
<script class="example" data-content-type="text/turtle"
1909+
title="Example demonstrating the context-sensitivity for @type Turtle"
1910+
data-result-for="Example demonstrating the context-sensitivity for @type"
1911+
data-to-rdf>
1912+
<!--
1913+
@prefix dc: <http://purl.org/dc/terms/> .
1914+
@prefix schema: <http://schema.org/> .
1915+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
1916+
<http://example.org/posts#TripToWestVirginia> a schema:BlogPosting;
1917+
dc:modified "2010-05-29T14:17:39+02:00"^^xsd:dateTime .
1918+
-->
1919+
</script>
1920+
18681921
<p>The first use of <code>@type</code> associates a <a>node type</a>
18691922
(<code>http://schema.org/BlogPosting</code>) with the <a>node</a>,
18701923
which is expressed using the <code>@id</code> <a>keyword</a>.
@@ -1961,6 +2014,21 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
19612014

19622015
<p>The example shown above would generate the following data:</p>
19632016

2017+
<script class="example" data-content-type="text/turtle"
2018+
title="Expanded term definition with types Turtle"
2019+
data-result-for="Expanded term definition with types"
2020+
data-to-rdf>
2021+
<!--
2022+
@prefix dc: <http://purl.org/dc/terms/> .
2023+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
2024+
<http://example.com/people#john> foaf:name "John Smith";
2025+
foaf:age 41;
2026+
foaf:homepage <http://personal.example.org/>,
2027+
<http://work.example.com/jsmith/>
2028+
.
2029+
-->
2030+
</script>
2031+
19642032
<table class="example">
19652033
<thead><tr>
19662034
<th>Subject</th>
@@ -2277,7 +2345,8 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
22772345
"@language": "en"
22782346
}
22792347
]****
2280-
}-->
2348+
}
2349+
-->
22812350
</pre>
22822351

22832352
<p>The example shown above would generate the following data, again with
@@ -2474,11 +2543,13 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
24742543

24752544
<pre class="example" data-transform="updateExample"
24762545
data-content-type="text/turtle"
2546+
data-result-for="Specifying that a collection is ordered in the context"
2547+
data-to-rdf
24772548
title="An ordered collection of values in Turtle">
24782549
<!--
24792550
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
24802551
2481-
<http://example.org/people#joebob> foaf:nick ("joe" "bob" "jaybe") .
2552+
<http://example.org/people#joebob> foaf:nick ("joe" "bob" "jaybee") .
24822553
-->
24832554
</pre>
24842555

@@ -2488,7 +2559,7 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
24882559
<em>coordinates</em> are an ordered list of <em>positions</em>, which are
24892560
represented as an array of two or more numbers:</p>
24902561

2491-
<pre class="example changed"
2562+
<pre class="example changed nohighlight" data-transform="updateExample"
24922563
data-content-type="application/json"
24932564
title="Coordinates expressed in GeoJSON">
24942565
{
@@ -2505,7 +2576,7 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
25052576
]
25062577
]
25072578
}
2508-
//...
2579+
####//...####
25092580
}
25102581
</pre>
25112582

@@ -2580,21 +2651,24 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
25802651

25812652
<pre class="example changed"
25822653
data-content-type="text/turtle"
2654+
data-transform="updateExample"
2655+
data-to-rdf
2656+
data-result-for="Coordinates expressed in JSON-LD"
25832657
title="Coordinates expressed in Turtle">
25842658
<!--
25852659
@prefix geojson: <https://purl.org/geojson/vocab#>.
25862660
25872661
[
25882662
a geojson:Feature ;
2589-
geojson:bbox (-10.0 -10.0 10.0 10.0) ;
2663+
geojson:bbox (-1.0e1 -1.0e1 1.0e1 1.0e1) ;
25902664
geojson:geometry [
25912665
a geojson:Polygon ;
25922666
geojson:coordinates (
25932667
(
2594-
(-10.0 -10.0)
2595-
(10.0 -10.0)
2596-
(10.0 10.0)
2597-
(-10.0 -10.0)
2668+
(-1.0e1 -1.0e1)
2669+
(1.0e1 -1.0e1)
2670+
(1.0e1 1.0e1)
2671+
(-1.0e1 -1.0e1)
25982672
)
25992673
)
26002674
]
@@ -3151,6 +3225,7 @@ <h3>Using the Document Base as the Default Vocabulary</h3>
31513225
<!--
31523226
{
31533227
"@context": {
3228+
****"@version": 1.1,****
31543229
"vocab": "http://example.com/vocab/",
31553230
"label": {
31563231
"@id": "vocab:label",
@@ -4704,6 +4779,7 @@ <h3>Graph Containers</h3>
47044779

47054780
<pre class="example nohighlight" data-transform="updateExample"
47064781
data-content-type="http"
4782+
data-ignore
47074783
title="Referencing a JSON-LD context from a JSON document via an HTTP Link Header">
47084784
<!--
47094785
GET /ordinary-json-document.json HTTP/1.1
@@ -4742,6 +4818,7 @@ <h3>Graph Containers</h3>
47424818

47434819
<pre class="example nohighlight" data-transform="updateExample"
47444820
data-content-type="text/html"
4821+
data-ignore
47454822
title="Embedding JSON-LD in HTML">
47464823
<!--
47474824
****<script type="application/ld+json">****
@@ -4809,6 +4886,7 @@ <h1>Data Model</h1>
48094886
i.e., nodes which are not connected by an <a>edge</a> to any other <a>node</a>.
48104887
<pre class="illegal-example"
48114888
data-transform="updateExample"
4889+
data-ignore
48124890
title="Illegal Unconnected Node">
48134891
<!--
48144892
{
@@ -5560,6 +5638,8 @@ <h3>Serializing/Deserializing RDF</h3>
55605638

55615639
<pre class="example" data-transform="updateExample"
55625640
data-content-type="text/turtle"
5641+
data-result-for="Flattened and expanded form for the previous example"
5642+
data-to-rdf
55635643
title="Turtle representation of expanded/flattened document">
55645644
<!--
55655645
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@@ -5663,6 +5743,8 @@ <h4>Prefix definitions</h4>
56635743

56645744
<pre class="example" data-transform="updateExample"
56655745
data-content-type="text/turtle"
5746+
data-result-for="The same set of statements serialized in JSON-LD"
5747+
data-to-rdf
56665748
title="A set of statements serialized in Turtle">
56675749
<!--
56685750
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@@ -5697,6 +5779,8 @@ <h4>Embedding</h4>
56975779

56985780
<pre class="example" data-transform="updateExample"
56995781
data-content-type="text/turtle"
5782+
data-to-rdf
5783+
data-result-for="Same embedding example in JSON-LD"
57005784
title="Embedding in Turtle">
57015785
<!--
57025786
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@@ -5757,6 +5841,8 @@ <h4>Conversion of native data types</h4>
57575841

57585842
<pre class="example" data-transform="updateExample"
57595843
data-content-type="text/turtle"
5844+
data-result-for="JSON-LD using native data types for numbers and boolean values"
5845+
data-to-rdf
57605846
title="Same example in Turtle using typed literals">
57615847
<!--
57625848
@prefix ex: <http://example.com/vocab#> .
@@ -5776,6 +5862,8 @@ <h4>Lists</h4>
57765862

57775863
<pre class="example" data-transform="updateExample"
57785864
data-content-type="text/turtle"
5865+
data-to-rdf
5866+
data-result-for="Same example with a list of values in JSON-LD"
57795867
title="A list of values in Turtle">
57805868
<!--
57815869
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@@ -5812,7 +5900,9 @@ <h3>RDFa</h3>
58125900
homepages in RDFa [[RDFA-CORE]].</p>
58135901

58145902
<pre class="example nohighlight" data-transform="updateExample"
5815-
data-content-type="text/html"
5903+
data-content-type="text/html"
5904+
data-to-rdf
5905+
data-result-for="Same description in JSON-LD (context shared among node objects)"
58165906
title="RDFa fragment that describes three people">
58175907
<!--
58185908
<div ****prefix="foaf: http://xmlns.com/foaf/0.1/"****>
@@ -5874,7 +5964,8 @@ <h3>Microformats</h3>
58745964
how Microformats [[MICROFORMATS]] are represented in JSON-LD.</p>
58755965

58765966
<pre class="example" data-transform="updateExample"
5877-
data-content-type="text/html"
5967+
data-content-type="text/html"
5968+
data-ignore
58785969
title="HTML fragment with a simple Microformats hCard">
58795970
<!--
58805971
<div class="vcard">
@@ -5915,8 +6006,10 @@ <h3>Microdata</h3>
59156006
a Microdata Work item.</p>
59166007

59176008
<pre class="example" data-transform="updateExample"
5918-
data-content-type="text/html"
5919-
title="HTML fragments that describes a book using microdata">
6009+
data-content-type="text/html"
6010+
data-result-for="Same book description in JSON-LD (avoiding contexts)"
6011+
data-to-rdf
6012+
title="HTML that describes a book using microdata">
59206013
<!--
59216014
<dl itemscope
59226015
itemtype="http://purl.org/vocab/frbr/core#Work"

0 commit comments

Comments
 (0)