Skip to content

Commit d3c8b8f

Browse files
committed
Revert Remove "Using an HTML document as a Context section.
1 parent 592ab98 commit d3c8b8f

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed

index.html

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11309,6 +11309,147 @@ <h3>Graph Containers</h3>
1130911309
</pre>
1131011310
</aside>
1131111311
</section>
11312+
11313+
<section><h3>Using an HTML document as a Context</h3>
11314+
<p>A JSON-LD document, whether embedded in HTML or otherwise,
11315+
may reference a <a>context document</a> by using a string value to <code>@context</code>.
11316+
This string is interpreted as a URL to an external document from which
11317+
the context is loaded. In JSON-LD 1.1, this external document may also
11318+
be HTML containing a <a data-cite="HTML/scripting.html#the-script-element">script element</a>
11319+
with the <code>type</code> attribute set to
11320+
<code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>.</p>
11321+
11322+
<p>A processor processing a remote context which results in an HTML document
11323+
MUST locate the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
11324+
with the <code>type</code> attribute set to
11325+
<code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>,
11326+
or a specific script element targeted using a fragment identifier,
11327+
or the first script element of type <code>application/ld+json</code>
11328+
if no other is found.</p>
11329+
11330+
<p>Including a context definition within an HTML document provides a means
11331+
of documenting the context content, along with other information
11332+
such as the vocabulary definition.</p>
11333+
11334+
<p>For example, a context may be defined within an HTML file as follows
11335+
(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>
11336+
11337+
<pre class="example context"
11338+
title="Context defined in an HTML document"
11339+
data-content-type="text/html"
11340+
data-transform="updateExample">
11341+
<!--
11342+
<!DOCTYPE html>
11343+
<html lang="en">
11344+
<head>
11345+
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
11346+
<title>Context definition of a person</title>
11347+
<script ****type="application/ld+json;profile=http://www.w3.org/ns/json-ld#context"****>
11348+
{
11349+
"@context":
11350+
{
11351+
"foaf": "http://xmlns.com/foaf/0.1/",
11352+
"schema": "http://schema.org/",
11353+
"vcard": "http://www.w3.org/2006/vcard/ns#",
11354+
"xsd": "http://www.w3.org/2001/XMLSchema#",
11355+
"Address": "vcard:Address"####,
11356+
...####
11357+
}
11358+
}
11359+
</script>
11360+
</head>
11361+
<body>
11362+
<h1>The Person context</h1>
11363+
<p>The Person context is based on a combination of <a href="http://xmlns.com/foaf/0.1/">FOAF</a>,
11364+
<a href="http://schema.org/">schema.org </a>,
11365+
and <a href="http://www.w3.org/2006/vcard/ns#">vcard</a> vocabularies. It defines the following terms:</p>
11366+
11367+
<dl>
11368+
<dt>foaf</dt><dd><code>http://xmlns.com/foaf/0.1/</code></dd>
11369+
<dt>schema</dt><dd><code>http://schema.org/</code></dd>
11370+
<dt>vcard</dt><dd><code>http://www.w3.org/2006/vcard/ns#</code></dd>
11371+
<dt>xsd</dt><dd><code>http://www.w3.org/2001/XMLSchema#</code></dd>
11372+
<dt>Address</dt><dd><code>vcard:Address</code></dd>
11373+
####...####
11374+
</dl>
11375+
</body>
11376+
</html>
11377+
-->
11378+
</pre>
11379+
11380+
<p>Using a previous example, we can reference <code>https://json-ld.org/contexts/person.html</code>
11381+
instead of <code>https://json-ld.org/contexts/person.jsonld</code>
11382+
and a JSON-LD processor will look for the context within the referenced HTML file.</p>
11383+
11384+
<aside class="example ds-selector-tabs"
11385+
title="Referencing a Context in an HTML document">
11386+
<div class="selectors">
11387+
<button class="selected" data-selects="compacted">Compacted (Input)</button>
11388+
<button data-selects="expanded">Expanded (Result)</button>
11389+
<button data-selects="statements">Statements</button>
11390+
<button data-selects="turtle">Turtle</button>
11391+
<a class="playground" target="_blank"></a>
11392+
</div>
11393+
<pre class="compacted input selected nohighlight" data-transform="updateExample">
11394+
<!--
11395+
{
11396+
"@context": ****"https://json-ld.org/contexts/person.html"****,
11397+
"@id": "http://dbpedia.org/resource/John_Lennon",
11398+
"name": "John Lennon",
11399+
"born": "1940-10-09",
11400+
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
11401+
}
11402+
-->
11403+
</pre>
11404+
<pre class="expanded result"
11405+
data-transform="updateExample"
11406+
data-result-for="Referencing a Context in an HTML document-compacted">
11407+
<!--
11408+
[{
11409+
"@id": "http://dbpedia.org/resource/John_Lennon",
11410+
"http://xmlns.com/foaf/0.1/name": [{"@value": "John Lennon"}],
11411+
"http://schema.org/birthDate": [
11412+
{"@value": "1940-10-09", "@type": "http://www.w3.org/2001/XMLSchema#date"}
11413+
],
11414+
"http://schema.org/spouse": [
11415+
{"@id": "http://dbpedia.org/resource/Cynthia_Lennon"}
11416+
]
11417+
}]
11418+
-->
11419+
</pre>
11420+
<table class="statements"
11421+
data-result-for="Referencing a Context in an HTML document-expanded"
11422+
data-to-rdf>
11423+
<thead><tr><th>Subject</th><th>Property</th><th>Value</th><th>Value Type</th></tr></thead>
11424+
<tbody>
11425+
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>foaf:name</td><td>John Lennon</td><td>&nbsp;</td></tr>
11426+
<tr><td>http://dbpedia.org/resource/John_Lennon</td><td>schema:birthDate</td><td>1940-10-09</td><td>xsd:date</td></tr>
11427+
<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>
11428+
</tbody>
11429+
</table>
11430+
<pre class="turtle"
11431+
data-content-type="text/turtle"
11432+
data-transform="updateExample"
11433+
data-result-for="Referencing a Context in an HTML document-expanded"
11434+
data-to-rdf>
11435+
<!--
11436+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
11437+
@prefix schema: <http://schema.org/> .
11438+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
11439+
11440+
<http://dbpedia.org/resource/John_Lennon> foaf:name "John Lennon";
11441+
schema:birthDate "1940-10-09"^^xsd:date;
11442+
schema:spouse <http://dbpedia.org/resource/Cynthia_Lennon> .
11443+
-->
11444+
</pre>
11445+
</aside>
11446+
11447+
<p>In addition to using the type profile above, a context may be referenced using
11448+
a fragment identifier,
11449+
as described in <a href="#locating-a-specific-json-ld-script-element" class="sectionRef"></a>.
11450+
Otherwise, the first <a data-cite="HTML/scripting.html#the-script-element">script element</a>
11451+
of type <code>application/ld+json</code> will be used to find a context.</p>
11452+
</section>
1131211453
</section>
1131311454

1131411455
<section class="normative">
@@ -13302,6 +13443,10 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
1330213443
<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
1330313444
expand to an <a>IRI</a> other than the expansion of the key itself.</li>
1330413445
<li>Define different processor modes: <a>pure JSON Processor</a>, <a>event-based JSON processor</a>, and <a>full Processor</a>.</li>
13446+
<li>For a <a>full Processor</a>, if a retrieved context URL returns an HTML document, the first script element
13447+
of type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#context</code>,
13448+
or <code>application/ld+json</code> is used as the context for further processing.
13449+
This allows a mechanism for documenting the content of a context using HTML.</li>
1330513450
<li>A <a>frame</a> may also be located within an HTML document, identified
1330613451
using type <code>application/ld+json;profile=http://www.w3.org/ns/json-ld#frame</code>.</li>
1330713452
<li>Term definitions can now be <a href="#protected-term-definitions">protected</a>,

0 commit comments

Comments
 (0)