Skip to content

Commit 4a54372

Browse files
committed
Remove requirement for extracting a context from HTML.
Reverses #66. This can be done because of w3c/json-ld-syntax#204.
1 parent a8094d9 commit 4a54372

16 files changed

+8
-246
lines changed

index.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,10 +1052,6 @@ <h3>Overview</h3>
10521052
a remote context. We dereference the remote context and replace <a>context</a>
10531053
with the value of the <code>@context</code> <a>entry</a> of the top-level object in the
10541054
retrieved JSON-LD document.
1055-
<span class="changed">If the result is an HTML document,
1056-
we attempt to extract JSON-LD from the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
1057-
of type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>
1058-
or <code>application/ld+json</code>, if no context profile exists.</span>
10591055
If there's no such <a>entry</a>, an
10601056
<a data-link-for="JsonLdErrorCode">invalid remote context</a>
10611057
has been detected. Otherwise, we process <a>context</a> by recursively using
@@ -1167,7 +1163,8 @@ <h3>Algorithm</h3>
11671163
<li class="changed">Otherwise, dereference <var>context</var> using
11681164
the <a>LoadDocumentCallback</a>, passing <var>context</var>
11691165
for <a data-link-for="LoadDocumentCallback">url</a>,
1170-
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a></li>
1166+
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a>
1167+
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.</li>
11711168
<li>If <var>context</var> cannot be dereferenced,
11721169
<span class="changed">or cannot be transformed into the <a>internal representation</a></span>,
11731170
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
@@ -1223,7 +1220,8 @@ <h3>Algorithm</h3>
12231220
<li>Dereference <var>import</var> using
12241221
the <a>LoadDocumentCallback</a>, passing <var>import</var>
12251222
for <a data-link-for="LoadDocumentCallback">url</a>,
1226-
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a></li>
1223+
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a>
1224+
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.</li>
12271225
<li>If <var>import</var> cannot be dereferenced,
12281226
<span>or cannot be transformed into the <a>internal representation</a></span>,
12291227
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
@@ -5800,7 +5798,7 @@ <h3>LoadDocumentCallback</h3>
58005798
<dd>The URL of the remote document or context to load.</dd>
58015799
<dt class="changed"><dfn data-lt="LoadDocumentCallback-options" data-lt-noDefault>options</dfn></dt>
58025800
<dd class="changed">A set of options to determine
5803-
the behavior of the callback. See <a href="loaddocumentoptions" class="sectionRef"></a>.</dd>
5801+
the behavior of the callback. See <a href="#loaddocumentoptions" class="sectionRef"></a>.</dd>
58045802
</dl>
58055803

58065804
<p class="changed">The following algorithm describes the default callback and places
@@ -5820,7 +5818,9 @@ <h3>LoadDocumentCallback</h3>
58205818

58215819
<p>Processors MAY include other media types using a <code>+json</code> suffix as defined in [[RFC6839]].</p>
58225820

5823-
<p>A <a>full Processor</a> MUST include <code>text/html</code> at any preference level.</p></li>
5821+
<p>A <a>full Processor</a> MUST include <code>text/html</code> at any preference level,
5822+
unless <a data-link-for="LoadDocumentOptions">requestProfile</a> is `http://www.w3.org/ns/json-ld#context`.</p>
5823+
</li>
58245824
<li>Set <var>documentUrl</var> to the location of the retrieved resource
58255825
considering redirections (exclusive of HTTP status <code>303</code> "See Other" redirects
58265826
as discussed in [[?cooluris]]).</li>
@@ -6344,10 +6344,6 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
63446344
<li><a>Term definitions</a> with keys which are of the form of a <a>compact IRI</a> or <a>absolute IRI</a> MUST NOT
63456345
expand to an <a>IRI</a> other than the expansion of the key itself.</li>
63466346
<li>Define different processor modes: <a>pure JSON Processor</a>, <a>event-based JSON processor</a>, and <a>full Processor</a>.</li>
6347-
<li>For a <a>full Processor</a>, if a retrieved context URL returns an HTML document, the first script element
6348-
of type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>,
6349-
or <code>application/ld+json</code> is used as the context for further processing.
6350-
This allows a mechanism for documenting the content of a context using HTML.</li>
63516347
<li>Consolidate <a>RemoteDocument</a> processing into the <a>LoadDocumentCallback</a>
63526348
including variations on HTML processing.</li>
63536349
<li>The <a href="#iri-compaction">IRI compaction algorithm</a> may generate an error if the result is an

tests/expand-manifest.jsonld

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,45 +1684,6 @@
16841684
"input": "expand/h022-in.html#second",
16851685
"expect": "expand/h022-out.jsonld",
16861686
"option": {"specVersion": "json-ld-1.1"}
1687-
}, {
1688-
"@id": "#thc01",
1689-
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1690-
"name": "Expands document using an HTML context",
1691-
"purpose": "Tests extracting a context from an HTML document.",
1692-
"input": "expand/hc01-in.jsonld",
1693-
"expect": "expand/hc01-out.jsonld",
1694-
"option": {"specVersion": "json-ld-1.1"}
1695-
}, {
1696-
"@id": "#thc02",
1697-
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1698-
"name": "Expands document using an HTML context with a fragment identifier",
1699-
"purpose": "Tests extracting a context from an HTML document with script identified by fragment identifier.",
1700-
"input": "expand/hc02-in.jsonld",
1701-
"expect": "expand/hc02-out.jsonld",
1702-
"option": {"specVersion": "json-ld-1.1"}
1703-
}, {
1704-
"@id": "#thc03",
1705-
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1706-
"name": "Expands document using an HTML context with preference to context profile",
1707-
"purpose": "Tests extracting a context from an HTML document, skipping other contexts.",
1708-
"input": "expand/hc03-in.jsonld",
1709-
"expect": "expand/hc03-out.jsonld",
1710-
"option": {"specVersion": "json-ld-1.1"}
1711-
}, {
1712-
"@id": "#thc04",
1713-
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1714-
"name": "Expands document using an HTML context with expandContext",
1715-
"purpose": "Tests extracting a context from an HTML document, using expandContext API option.",
1716-
"input": "expand/hc04-in.jsonld",
1717-
"expect": "expand/hc04-out.jsonld",
1718-
"option": {"expandContext": "hc04-context.html", "specVersion": "json-ld-1.1"}
1719-
}, {
1720-
"@id": "#thc05",
1721-
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
1722-
"name": "Errors if given an HTML file for a context where no context script element is found",
1723-
"purpose": "Verifies that an exception is raised on expansion when a remote context is an HTML file but does not contain a script element which is an object containing @context",
1724-
"input": "expand/hc05-in.jsonld",
1725-
"expect": "invalid remote context"
17261687
}, {
17271688
"@id": "#tin01",
17281689
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],

tests/expand/hc01-context.html

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/expand/hc01-in.jsonld

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/expand/hc01-out.jsonld

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/expand/hc02-context.html

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/expand/hc02-in.jsonld

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/expand/hc02-out.jsonld

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/expand/hc03-context.html

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/expand/hc03-in.jsonld

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/expand/hc03-out.jsonld

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/expand/hc04-context.html

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/expand/hc04-in.jsonld

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/expand/hc04-out.jsonld

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/expand/hc05-context.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/expand/hc05-in.jsonld

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)