Skip to content

Remove requirement for extracting a context from HTML. #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,6 @@ <h3>Overview</h3>
a remote context. We dereference the remote context and replace <a>context</a>
with the value of the <code>@context</code> <a>entry</a> of the top-level object in the
retrieved JSON-LD document.
<span class="changed">If the result is an HTML document,
we attempt to extract JSON-LD from the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
of type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>
or <code>application/ld+json</code>, if no context profile exists.</span>
If there's no such <a>entry</a>, an
<a data-link-for="JsonLdErrorCode">invalid remote context</a>
has been detected. Otherwise, we process <a>context</a> by recursively using
Expand Down Expand Up @@ -1167,7 +1163,8 @@ <h3>Algorithm</h3>
<li class="changed">Otherwise, dereference <var>context</var> using
the <a>LoadDocumentCallback</a>, passing <var>context</var>
for <a data-link-for="LoadDocumentCallback">url</a>,
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a></li>
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a>
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.</li>
<li>If <var>context</var> cannot be dereferenced,
<span class="changed">or cannot be transformed into the <a>internal representation</a></span>,
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
Expand Down Expand Up @@ -1223,7 +1220,8 @@ <h3>Algorithm</h3>
<li>Dereference <var>import</var> using
the <a>LoadDocumentCallback</a>, passing <var>import</var>
for <a data-link-for="LoadDocumentCallback">url</a>,
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a></li>
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a>
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.</li>
<li>If <var>import</var> cannot be dereferenced,
<span>or cannot be transformed into the <a>internal representation</a></span>,
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
Expand Down Expand Up @@ -5800,7 +5798,7 @@ <h3>LoadDocumentCallback</h3>
<dd>The URL of the remote document or context to load.</dd>
<dt class="changed"><dfn data-lt="LoadDocumentCallback-options" data-lt-noDefault>options</dfn></dt>
<dd class="changed">A set of options to determine
the behavior of the callback. See <a href="loaddocumentoptions" class="sectionRef"></a>.</dd>
the behavior of the callback. See <a href="#loaddocumentoptions" class="sectionRef"></a>.</dd>
</dl>

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

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

<p>A <a>full Processor</a> MUST include <code>text/html</code> at any preference level.</p></li>
<p>A <a>full Processor</a> MUST include <code>text/html</code> at any preference level,
unless <a data-link-for="LoadDocumentOptions">requestProfile</a> is `http://www.w3.org/ns/json-ld#context`.</p>
</li>
<li>Set <var>documentUrl</var> to the location of the retrieved resource
considering redirections (exclusive of HTTP status <code>303</code> "See Other" redirects
as discussed in [[?cooluris]]).</li>
Expand Down Expand Up @@ -6344,10 +6344,6 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
<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
expand to an <a>IRI</a> other than the expansion of the key itself.</li>
<li>Define different processor modes: <a>pure JSON Processor</a>, <a>event-based JSON processor</a>, and <a>full Processor</a>.</li>
<li>For a <a>full Processor</a>, if a retrieved context URL returns an HTML document, the first script element
of type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>,
or <code>application/ld+json</code> is used as the context for further processing.
This allows a mechanism for documenting the content of a context using HTML.</li>
<li>Consolidate <a>RemoteDocument</a> processing into the <a>LoadDocumentCallback</a>
including variations on HTML processing.</li>
<li>The <a href="#iri-compaction">IRI compaction algorithm</a> may generate an error if the result is an
Expand Down
39 changes: 0 additions & 39 deletions tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1684,45 +1684,6 @@
"input": "expand/h022-in.html#second",
"expect": "expand/h022-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#thc01",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands document using an HTML context",
"purpose": "Tests extracting a context from an HTML document.",
"input": "expand/hc01-in.jsonld",
"expect": "expand/hc01-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#thc02",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands document using an HTML context with a fragment identifier",
"purpose": "Tests extracting a context from an HTML document with script identified by fragment identifier.",
"input": "expand/hc02-in.jsonld",
"expect": "expand/hc02-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#thc03",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands document using an HTML context with preference to context profile",
"purpose": "Tests extracting a context from an HTML document, skipping other contexts.",
"input": "expand/hc03-in.jsonld",
"expect": "expand/hc03-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#thc04",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Expands document using an HTML context with expandContext",
"purpose": "Tests extracting a context from an HTML document, using expandContext API option.",
"input": "expand/hc04-in.jsonld",
"expect": "expand/hc04-out.jsonld",
"option": {"expandContext": "hc04-context.html", "specVersion": "json-ld-1.1"}
}, {
"@id": "#thc05",
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
"name": "Errors if given an HTML file for a context where no context script element is found",
"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",
"input": "expand/hc05-in.jsonld",
"expect": "invalid remote context"
}, {
"@id": "#tin01",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
Expand Down
17 changes: 0 additions & 17 deletions tests/expand/hc01-context.html

This file was deleted.

10 changes: 0 additions & 10 deletions tests/expand/hc01-in.jsonld

This file was deleted.

9 changes: 0 additions & 9 deletions tests/expand/hc01-out.jsonld

This file was deleted.

25 changes: 0 additions & 25 deletions tests/expand/hc02-context.html

This file was deleted.

10 changes: 0 additions & 10 deletions tests/expand/hc02-in.jsonld

This file was deleted.

9 changes: 0 additions & 9 deletions tests/expand/hc02-out.jsonld

This file was deleted.

25 changes: 0 additions & 25 deletions tests/expand/hc03-context.html

This file was deleted.

10 changes: 0 additions & 10 deletions tests/expand/hc03-in.jsonld

This file was deleted.

9 changes: 0 additions & 9 deletions tests/expand/hc03-out.jsonld

This file was deleted.

25 changes: 0 additions & 25 deletions tests/expand/hc04-context.html

This file was deleted.

9 changes: 0 additions & 9 deletions tests/expand/hc04-in.jsonld

This file was deleted.

9 changes: 0 additions & 9 deletions tests/expand/hc04-out.jsonld

This file was deleted.

18 changes: 0 additions & 18 deletions tests/expand/hc05-context.html

This file was deleted.

10 changes: 0 additions & 10 deletions tests/expand/hc05-in.jsonld

This file was deleted.