Skip to content

Remove "Using an HTML document as a Context section. #212

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
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
145 changes: 0 additions & 145 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11309,147 +11309,6 @@ <h3>Graph Containers</h3>
</pre>
</aside>
</section>

<section><h3>Using an HTML document as a Context</h3>
<p>A JSON-LD document, whether embedded in HTML or otherwise,
may reference a <a>context document</a> by using a string value to <code>@context</code>.
This string is interpreted as a URL to an external document from which
the context is loaded. In JSON-LD 1.1, this external document may also
be HTML containing a <a data-cite="HTML/scripting.html#the-script-element">script element</a>
with the <code>type</code> attribute set to
<code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>.</p>

<p>A processor processing a remote context which results in an HTML document
MUST locate the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
with the <code>type</code> attribute set to
<code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>,
or a specific script element targeted using a fragment identifier,
or the first script element of type <code>application/ld+json</code>
if no other is found.</p>

<p>Including a context definition within an HTML document provides a means
of documenting the context content, along with other information
such as the vocabulary definition.</p>

<p>For example, a context may be defined within an HTML file as follows
(a subset of the <em>Person</em> context published at <code><a href="https://json-ld.org/contexts/person.html">https://json-ld.org/contexts/person.html</a></code>):</p>

<pre class="example context"
title="Context defined in an HTML document"
data-content-type="text/html"
data-transform="updateExample">
<!--
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Context definition of a person</title>
<script ****type="application/ld+json;profile=http://www.w3.org/ns/json-ld#context"****>
{
"@context":
{
"foaf": "http://xmlns.com/foaf/0.1/",
"schema": "http://schema.org/",
"vcard": "http://www.w3.org/2006/vcard/ns#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"Address": "vcard:Address"####,
...####
}
}
</script>
</head>
<body>
<h1>The Person context</h1>
<p>The Person context is based on a combination of <a href="http://xmlns.com/foaf/0.1/">FOAF</a>,
<a href="http://schema.org/">schema.org </a>,
and <a href="http://www.w3.org/2006/vcard/ns#">vcard</a> vocabularies. It defines the following terms:</p>

<dl>
<dt>foaf</dt><dd><code>http://xmlns.com/foaf/0.1/</code></dd>
<dt>schema</dt><dd><code>http://schema.org/</code></dd>
<dt>vcard</dt><dd><code>http://www.w3.org/2006/vcard/ns#</code></dd>
<dt>xsd</dt><dd><code>http://www.w3.org/2001/XMLSchema#</code></dd>
<dt>Address</dt><dd><code>vcard:Address</code></dd>
####...####
</dl>
</body>
</html>
-->
</pre>

<p>Using a previous example, we can reference <code>https://json-ld.org/contexts/person.html</code>
instead of <code>https://json-ld.org/contexts/person.jsonld</code>
and a JSON-LD processor will look for the context within the referenced HTML file.</p>

<aside class="example ds-selector-tabs"
title="Referencing a Context in an HTML document">
<div class="selectors">
<button class="selected" data-selects="compacted">Compacted (Input)</button>
<button data-selects="expanded">Expanded (Result)</button>
<button data-selects="statements">Statements</button>
<button data-selects="turtle">Turtle</button>
<a class="playground" target="_blank"></a>
</div>
<pre class="compacted input selected nohighlight" data-transform="updateExample">
<!--
{
"@context": ****"https://json-ld.org/contexts/person.html"****,
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
-->
</pre>
<pre class="expanded result"
data-transform="updateExample"
data-result-for="Referencing a Context in an HTML document-compacted">
<!--
[{
"@id": "http://dbpedia.org/resource/John_Lennon",
"http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
"http://schema.org/birthDate": [
{"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
],
"http://schema.org/spouse": [
{"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
]
}]
-->
</pre>
<table class="statements"
data-result-for="Referencing a Context in an HTML document-expanded"
data-to-rdf>
<thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Value Type</th></tr></thead>
<tbody>
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>foaf:name</td><td>John Lennon</td><td>&nbsp;</td></tr>
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:birthDate</td><td>1940-10-09</td><td>xsd:date</td></tr>
<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>
</tbody>
</table>
<pre class="turtle"
data-content-type="text/turtle"
data-transform="updateExample"
data-result-for="Referencing a Context in an HTML document-expanded"
data-to-rdf>
<!--
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://dbpedia.org/resource/John_Lennon> foaf:name "John Lennon";
schema:birthDate "1940-10-09"^^xsd:date;
schema:spouse <http://dbpedia.org/resource/Cynthia_Lennon> .
-->
</pre>
</aside>

<p>In addition to using the type profile above, a context may be referenced using
a fragment identifier,
as described in <a href="#locating-a-specific-json-ld-script-element" class="sectionRef"></a>.
Otherwise, the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
of type <code>application/ld+json</code> will be used to find a context.</p>
</section>
</section>

<section class="normative">
Expand Down Expand Up @@ -13443,10 +13302,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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also remove these processor modes now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might rename it, but the full Processor mode still defines the ability to extract JSON-LD from html. The PR just removes the need to use this for contexts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k. We at least have a naming collision here then.

Processing mode (changed via @version)
vs.
Processor Levels (pure, full, and event-based)

<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>A <a>frame</a> may also be located within an HTML document, identified
using type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#frame</code>.</li>
<li>Term definitions can now be <a href="#protected-term-definitions">protected</a>,
Expand Down