Skip to content

Commit ca4c520

Browse files
committed
Revert "Remove bits about resolving to HTML base element to be added in a separate PR for #23."
This reverts commit 9f2ef52. # Conflicts: # index.html
1 parent cf9030b commit ca4c520

17 files changed

+159
-117
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[{
2+
"@id": "http://dbpedia.org/resource/John_Lennon",
3+
"http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
4+
"http://schema.org/birthDate": [
5+
{"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
6+
],
7+
"http://schema.org/spouse": [
8+
{"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
9+
]
10+
}]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
{
3+
"@context": "https://json-ld.org/contexts/person.jsonld",
4+
"@id": "John_Lennon",
5+
"name": "John Lennon",
6+
"born": "1940-10-09",
7+
"spouse": "Cynthia_Lennon"
8+
}
9+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<table class="statements" data-result-for="Using the document base URL to establish the default base IRI-expanded" data-to-rdf>
2+
<thead><tr>
3+
<th>Subject</th>
4+
<th>Property</th>
5+
<th>Value</th>
6+
<th>Value Type</th>
7+
</tr></thead>
8+
<tbody>
9+
<tr>
10+
<td>http://dbpedia.org/resource/John_Lennon</td>
11+
<td>foaf:name</td>
12+
<td>John Lennon</td>
13+
<td> </td>
14+
</tr>
15+
<tr>
16+
<td>http://dbpedia.org/resource/John_Lennon</td>
17+
<td>schema:birthDate</td>
18+
<td>1940-10-09</td>
19+
<td>xsd:date</td>
20+
</tr>
21+
<tr>
22+
<td>http://dbpedia.org/resource/John_Lennon</td>
23+
<td>schema:spouse</td>
24+
<td>http://dbpedia.org/resource/Cynthia_Lennon</td>
25+
<td> </td>
26+
</tr>
27+
</tbody>
28+
</table>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@base <http://dbpedia.org/resource/> .
2+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
3+
@prefix schema: <http://schema.org/> .
4+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
5+
<John_Lennon> foaf:name "John Lennon";
6+
schema:birthDate "1940-10-09"^^xsd:date;
7+
schema:spouse <Cynthia_Lennon> .

index.html

Lines changed: 84 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -8485,10 +8485,92 @@ <h3>Graph Containers</h3>
84858485

84868486
<p>When processing a JSON-LD
84878487
<a data-cite="HTML52/semantics-scripting.html#the-script-element">script element</a>,
8488-
only the resolved document location of the
8489-
containing HTML document is used to establish the default <a>base IRI</a> of the enclosed
8488+
the <a data-cite="HTML52/infrastructure.html#document-base-url">Document Base URL</a>
8489+
of the containing HTML document,
8490+
as defined in [[HTML52]],
8491+
is used to establish the default <a>base IRI</a> of the enclosed
84908492
JSON-LD content.</p>
84918493

8494+
<aside class="example ds-selector-tabs"
8495+
title="Using the document base URL to establish the default base IRI">
8496+
<div class="selectors">
8497+
<button class="selected" data-selects="original">Original</button>
8498+
<button data-selects="expanded">Expanded</button>
8499+
<button data-selects="statements">Statements</button>
8500+
<button data-selects="turtle">Turtle</button>
8501+
</div>
8502+
<pre class="original selected" data-transform="updateExample"
8503+
data-content-type="text/html">
8504+
<!--
8505+
****<html>
8506+
<head>
8507+
<base href="http://dbpedia.org/resource/"/>****
8508+
<script type="application/ld+json">
8509+
< !--
8510+
{
8511+
"@context": "https://json-ld.org/contexts/person.jsonld",
8512+
"@id": ****"John_Lennon"****,
8513+
"name": "John Lennon",
8514+
"born": "1940-10-09",
8515+
"spouse": ****"Cynthia_Lennon"****
8516+
}
8517+
-- >
8518+
</script>
8519+
****</head>
8520+
</html>****
8521+
-->
8522+
</pre>
8523+
<pre class="expanded"
8524+
data-transform="updateExample"
8525+
data-result-for="Using the document base URL to establish the default base IRI-original">
8526+
<!--
8527+
[{
8528+
"@id": "http://dbpedia.org/resource/John_Lennon",
8529+
"http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
8530+
"http://schema.org/birthDate": [
8531+
{"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
8532+
],
8533+
"http://schema.org/spouse": [
8534+
{"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
8535+
]
8536+
}]
8537+
-->
8538+
</pre>
8539+
<table class="statements"
8540+
data-result-for="Using the document base URL to establish the default base IRI-expanded"
8541+
data-to-rdf>
8542+
<thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Value Type</th></tr></thead>
8543+
<tbody>
8544+
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>foaf:name</td><td>John Lennon</td><td>&nbsp;</td></tr>
8545+
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:birthDate</td><td>1940-10-09</td><td>xsd:date</td></tr>
8546+
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:spouse</td><td>http://dbpedia.org/resource/Cynthia_Lennon</td><td>&nbsp;</td></tr>
8547+
</tbody>
8548+
</table>
8549+
<pre class="turtle"
8550+
data-content-type="text/turtle"
8551+
data-transform="updateExample"
8552+
data-result-for="Using the document base URL to establish the default base IRI-expanded"
8553+
data-to-rdf>
8554+
<!--
8555+
@base <http://dbpedia.org/resource/> .
8556+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
8557+
@prefix schema: <http://schema.org/> .
8558+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
8559+
8560+
<John_Lennon> foaf:name "John Lennon";
8561+
schema:birthDate "1940-10-09"^^xsd:date;
8562+
schema:spouse <Cynthia_Lennon> .
8563+
-->
8564+
</pre>
8565+
</aside>
8566+
8567+
<p>HTML allows for <a data-cite="HTML52/infrastructure.html#dynamic-changes-to-base-urls">Dynamic changes to base URLs</a>.
8568+
This specification does not require any specific behavior,
8569+
and to ensure that all systems process the <a>base IRI</a> equivalently, authors SHOULD
8570+
either use <a>absolute IRIs</a>, or explicitly as defined in <a href="#base-iri" class="sectionRef"></a>.
8571+
Implementations (particularly those natively operating in the [[!DOM]]) MAY take into consideration
8572+
<a data-cite="HTML52/infrastructure.html#dynamic-changes-to-base-urls">Dynamic changes to base URLs</a>.</p>
8573+
84928574
<section><h3>Restrictions for contents of JSON-LD <code>script</code> elements</h3>
84938575

84948576
<p>Depending on how the HTML document is served, certain strings may need
@@ -8592,110 +8674,6 @@ <h3>Graph Containers</h3>
85928674
</aside>
85938675
</section>
85948676

8595-
<section><h3>Restrictions for contents of JSON-LD <code>script</code> elements</h3>
8596-
8597-
<p>Depending on how the HTML document is served, certain strings may need
8598-
to be escaped. In particular, the content MAY be enclosed
8599-
in the HTML <em>comment-open</em> (<code>&lt;!--</code>) and <em>comment-close</em> (<code>--&gt;</code>) text sequences.</p>
8600-
<p>As described in HTML <a data-cite="HTML52/semantics-scripting.html#restrictions-for-contents-of-script-elements">Restrictions for contents of <code>&lt;script&gt;</code> elements</a>
8601-
the <a data-cite="DOM#dom-node-textcontent">textContent</a> of a script element may include balanced comments
8602-
and other text which complicate extracting the JSON-LD content from a <a data-cite="HTML52/semantics-scripting.html#data-block">data blocks</a>.
8603-
JSON-LD places further restrictions on the contents of
8604-
<a data-cite="HTML52/semantics-scripting.html#the-script-element">script elements</a> containing JSON-LD.</p>
8605-
<p>A JSON-LD script element MAY begin with an optional <em>comment-open</em> surrounded by any amount of white space,
8606-
followed by valid JSON and ending with an optional <em>comment-close</em> surrounded by any amount of white space.
8607-
Any content within the JSON content which can be confused with a <em>comment-open</em>, <em>script-open</em>,
8608-
<em>comment-close</em>, or <em>script-close</em> MUST be escaped using a REVERSE SOLIDUS (<code>\</code>) character
8609-
as follows:</p>
8610-
<ul>
8611-
<li><code>&lt;!--</code><code>&lt;\!--</code></li>
8612-
<li><code>&lt;script</code><code>&lt;\script</code></li>
8613-
<li><code>--&gt;</code><code>--\&gt;</code></li>
8614-
<li><code>&lt;/script</code><code>&lt;\/script</code></li>
8615-
</ul>
8616-
<p>Additionally, content of a script element MAY be escaped using <a data-cite="HTML5/syntax.html#character-references">HTML Character references</a>, such as the following:</p>
8617-
<ul>
8618-
<li><code>&amp;amp;</code> → &amp; (<a href="/wiki/Ampersand" title="Ampersand">ampersand</a>, U+0026)</li>
8619-
<li><code>&amp;lt;</code> → &lt; (less-than sign, U+003C)</li>
8620-
<li><code>&amp;gt;</code> → &gt; (greater-than sign, U+003E)</li>
8621-
<li><code>&amp;quot;</code> → " (quotation mark, U+0022)</li>
8622-
<li><code>&amp;apos;</code> → ' (apostrophe, U+0027)</li>
8623-
</ul>
8624-
<p>JSON-LD Processors MUST remove surrounding <em>comment-open</em> and <em>comment-close</em>
8625-
sequences, unescape any escaped <em>comment-open</em>, <em>comment-close</em>,
8626-
<em>script-open</em>, and <em>script-close</em> sequences,
8627-
and turn <a data-cite="HTML5/syntax.html#character-references">HTML Character references</a> into the corresponding Unicode.
8628-
</p>
8629-
8630-
<aside class="example ds-selector-tabs"
8631-
title="Embedding JSON-LD in HTML with comments">
8632-
<div class="selectors">
8633-
<button class="selected" data-selects="original">Original</button>
8634-
<button data-selects="expanded">Expanded</button>
8635-
<button data-selects="statements">Statements</button>
8636-
<button data-selects="turtle">Turtle</button>
8637-
</div>
8638-
<pre class="original selected" data-transform="updateExample"
8639-
data-content-type="text/html">
8640-
<!--
8641-
<script type="application/ld+json">
8642-
< !--
8643-
{
8644-
"@context": "https://json-ld.org/contexts/person.jsonld",
8645-
"@id": "http://dbpedia.org/resource/John_Lennon",
8646-
"name": "John Lennon",
8647-
"born": "1940-10-09",
8648-
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
8649-
}
8650-
-- >
8651-
</script>
8652-
-->
8653-
</pre>
8654-
<pre class="expanded"
8655-
data-transform="updateExample"
8656-
data-result-for="Embedding JSON-LD in HTML with comments-original">
8657-
<!--
8658-
[{
8659-
"@id": "http://dbpedia.org/resource/John_Lennon",
8660-
"http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
8661-
"http://schema.org/birthDate": [
8662-
{"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
8663-
],
8664-
"http://schema.org/spouse": [
8665-
{"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
8666-
]
8667-
}]
8668-
-->
8669-
</pre>
8670-
<table class="statements"
8671-
data-result-for="Embedding JSON-LD in HTML with comments-expanded"
8672-
data-to-rdf>
8673-
<thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Value Type</th></tr></thead>
8674-
<tbody>
8675-
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>foaf:name</td><td>John Lennon</td><td>&nbsp;</td></tr>
8676-
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:birthDate</td><td>1940-10-09</td><td>xsd:date</td></tr>
8677-
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:spouse</td><td>http://dbpedia.org/resource/Cynthia_Lennon</td><td>&nbsp;</td></tr>
8678-
</tbody>
8679-
</table>
8680-
<pre class="turtle"
8681-
data-content-type="text/turtle"
8682-
data-transform="updateExample"
8683-
data-result-for="Embedding JSON-LD in HTML with comments-expanded"
8684-
data-to-rdf>
8685-
<!--
8686-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
8687-
@prefix schema: <http://schema.org/> .
8688-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
8689-
8690-
<http://dbpedia.org/resource/John_Lennon> foaf:name "John Lennon";
8691-
schema:birthDate "1940-10-09"^^xsd:date;
8692-
schema:spouse <http://dbpedia.org/resource/Cynthia_Lennon> .
8693-
-->
8694-
</pre>
8695-
</aside>
8696-
</section>
8697-
>>>>>>> 87ab2ee... Add section on restrictions for JSON-LD script elements, which is more restrictive than the base HTML definitions. This includes a sketch processing model for removing comments and unescaping the resulting content.
8698-
86998677
<section><h3>Locating a Specific JSON-LD Script Element</h3>
87008678
<p>A specific
87018679
<a data-cite="HTML52/semantics-scripting.html#the-script-element">script element</a>

yaml/Embedding-JSON-LD-in-HTML-with-comments-expanded.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 103: Embedding JSON-LD in HTML with comments-expanded
1+
Example 104: Embedding JSON-LD in HTML with comments-expanded
22
---
33
- "@id": http://dbpedia.org/resource/John_Lennon
44
http://xmlns.com/foaf/0.1/name:

yaml/Flattened-and-expanded-form-for-the-previous-example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 108: Flattened and expanded form for the previous example
1+
Example 109: Flattened and expanded form for the previous example
22
---
33
- "@id": _:b0
44
http://xmlns.com/foaf/0.1/name: Dave Longley

yaml/JSON-LD-using-native-data-types-for-numbers-and-boolean-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 114: JSON-LD using native data types for numbers and boolean values
1+
Example 115: JSON-LD using native data types for numbers and boolean values
22
---
33
"@context":
44
ex: http://example.com/vocab#

yaml/Linked-Data-Dataset-compacted.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 106: Linked Data Dataset-compacted
1+
Example 107: Linked Data Dataset-compacted
22
---
33
"@context":
44
- http://schema.org/

yaml/Linked-Data-Dataset-expanded.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 106: Linked Data Dataset-expanded
1+
Example 107: Linked Data Dataset-expanded
22
---
33
- "@id": http://example.com/people/alice
44
http://schema.org/name:

yaml/Same-book-description-in-JSON-LD-avoiding-contexts-.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 121: Same book description in JSON-LD (avoiding contexts)
1+
Example 122: Same book description in JSON-LD (avoiding contexts)
22
---
33
- "@id": http://purl.oreilly.com/works/45U8QJGZSQKDH8N
44
"@type": http://purl.org/vocab/frbr/core#Work

yaml/Same-description-in-JSON-LD-context-shared-among-node-objects-.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 119: Same description in JSON-LD (context shared among node objects)
1+
Example 120: Same description in JSON-LD (context shared among node objects)
22
---
33
"@context":
44
foaf: http://xmlns.com/foaf/0.1/

yaml/Same-embedding-example-in-JSON-LD.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 113: Same embedding example in JSON-LD
1+
Example 114: Same embedding example in JSON-LD
22
---
33
"@context":
44
foaf: http://xmlns.com/foaf/0.1/

yaml/Same-example-with-a-list-of-values-in-JSON-LD.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 117: Same example with a list of values in JSON-LD
1+
Example 118: Same example with a list of values in JSON-LD
22
---
33
"@context":
44
foaf: http://xmlns.com/foaf/0.1/

yaml/Sample-JSON-LD-document.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 107: Sample JSON-LD document
1+
Example 108: Sample JSON-LD document
22
---
33
"@context":
44
name: http://xmlns.com/foaf/0.1/name

yaml/The-same-set-of-statements-serialized-in-JSON-LD.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Example 111: The same set of statements serialized in JSON-LD
1+
Example 112: The same set of statements serialized in JSON-LD
22
---
33
"@context":
44
foaf: http://xmlns.com/foaf/0.1/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Example 103: Using the document base URL to establish the default base IRI-expanded
2+
---
3+
- "@id": http://dbpedia.org/resource/John_Lennon
4+
http://xmlns.com/foaf/0.1/name:
5+
- "@value": John Lennon
6+
http://schema.org/birthDate:
7+
- "@value": '1940-10-09'
8+
"@type": http://www.w3.org/2001/XMLSchema#date
9+
http://schema.org/spouse:
10+
- "@id": http://dbpedia.org/resource/Cynthia_Lennon

0 commit comments

Comments
 (0)