Skip to content

Commit ad1ab6f

Browse files
committed
Add containing section on Modifying Behavior with Link Relationships and add an Alternate Document Location section.
For #204.
1 parent d3c8b8f commit ad1ab6f

File tree

1 file changed

+82
-4
lines changed

1 file changed

+82
-4
lines changed

index.html

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10856,12 +10856,31 @@ <h3>Graph Containers</h3>
1085610856
</section>
1085710857
</section>
1085810858

10859-
<section class="normative"><h2>Interpreting JSON as JSON-LD</h2>
10859+
<section class="normative"><h2>Modifying Behavior with Link Relationships</h2>
10860+
<p>Certain aspects of JSON-LD processing can be modified using
10861+
<dfn data-cite="RFC8288#section-3" data-no-xref>HTTP Link Headers</dfn> [[RFC8288]].
10862+
These can be used when retrieving resources that are not, themselves, JSON-LD,
10863+
but can be interpreted as JSON-LD by using information in a
10864+
<a href="https://en.wikipedia.org/wiki/Link_relation" data-no-xref>Link Relation</a>.</p>
10865+
10866+
<p>When processing normal JSON documents, a link relation can be specified using
10867+
the <a>HTTP Link Header</a>
10868+
returned when fetching a remote document, as described in <a href="#interpreting-json-as-json-ld" class="sectionRef"></a>.</p>
10869+
10870+
<p class="changed">In other cases, a resource may be returned using a representation that cannot easily be interpreted
10871+
as JSON-LD. Normally, <a href="https://en.wikipedia.org/wiki/Content_negotiation">HTTP content negotiation</a>
10872+
would be used to allow a client to specify a preference for JSON-LD over another representation,
10873+
but in certain situations, it is not possible for a server to respond appropriately to such requests.
10874+
For the, an <a>HTTP Link Header</a> can be used to provide an alternate location for a document
10875+
to be used in place of the originally requested resource,
10876+
as described in <a href="#alternate-document-location" class="sectionRef"></a>.</p>
10877+
10878+
<section class="normative"><h3>Interpreting JSON as JSON-LD</h2>
1086010879

1086110880
<p>Ordinary JSON documents can be interpreted as JSON-LD
1086210881
by providing an explicit JSON-LD <a>context</a> document. One way
1086310882
to provide this is by using referencing a JSON-LD
10864-
<a>context</a> document in an <a data-cite="RFC8288#section-3">HTTP Link Header</a>.
10883+
<a>context</a> document in an <a>HTTP Link Header</a>.
1086510884
Doing so allows JSON to be unambiguously machine-readable without requiring developers to drastically
1086610885
change their documents and provides an upgrade path for existing infrastructure
1086710886
without breaking existing clients that rely on the <code>application/json</code>
@@ -10887,7 +10906,7 @@ <h3>Graph Containers</h3>
1088710906
of the <code>@context</code> subtree in the referenced document MUST be
1088810907
discarded. Effectively this means that the <a>active context</a> is
1088910908
initialized with the referenced external <a>context</a>. A response MUST NOT
10890-
contain more than one <a data-cite="RFC8288#section-3">HTTP Link Header</a> [[RFC8288]] using the
10909+
contain more than one <a>HTTP Link Header</a> using the
1089110910
<code>http://www.w3.org/ns/json-ld#context</code> link relation.</p>
1089210911

1089310912
<p>Other mechanisms for providing a JSON-LD Context MAY be described for other
@@ -10932,6 +10951,63 @@ <h3>Graph Containers</h3>
1093210951
ignored for such documents.</p>
1093310952
</section>
1093410953

10954+
<section class="normative changed"><h3>Alternate Document Location</h3>
10955+
10956+
<p>Documents which can't be directly interpreted as JSON-LD can provide an alternate location containing JSON-LD.
10957+
One way to provide this is by using referencing a JSON-LD document in an <a>HTTP Link Header</a>.
10958+
This might be useful, for example, when the URL associated with a namespace naturally
10959+
contains an HTML document, but the JSON-LD context associated with that URL is located elsewhere.</p>
10960+
10961+
<p>To specify an alternate location, a non-JSON resource
10962+
(i.e., one using a media type other than `application/json` or a derivative)
10963+
can return the alternate location using a <a data-cite="RFC8288#section-3">Link Header</a> with:</p>
10964+
10965+
<ul>
10966+
<li><code>rel="alternate"</code>, and</li>
10967+
<li><code>type="application/ld+json"</code>.</li>
10968+
</ul>
10969+
10970+
<p>A response MUST NOT contain more than one <a>HTTP Link Header</a> using the
10971+
<code>alternate</code> link relation with <code>type="application/ld+json"</code> .</p>
10972+
10973+
<p>Other mechanisms for providing an alternate location MAY be described for other
10974+
URI schemes.</p>
10975+
10976+
<p>The following example demonstrates the use of an alternate location with an
10977+
ordinary HTTP document over HTTP:</p>
10978+
10979+
<pre class="example nohighlight" data-transform="updateExample"
10980+
data-content-type="http"
10981+
data-ignore
10982+
title="Specifying an alternate location via an HTTP Link Header">
10983+
<!--
10984+
GET /index.html HTTP/1.1
10985+
Host: example.com
10986+
Accept: application/ld+json,application/json,*/*;q=0.1
10987+
10988+
====================================
10989+
10990+
HTTP/1.1 200 OK
10991+
####...####
10992+
Content-Type: ****text/html****
10993+
****Link: <alternate.jsonld>; rel="alternate"; type="application/ld+json"****
10994+
10995+
<html>
10996+
<head>
10997+
<title>Primary Entrypoint</title>
10998+
</head>
10999+
<body>
11000+
<p>This is the primary entrypoint for a vocabulary</p>
11001+
</body>
11002+
</html>
11003+
-->
11004+
</pre>
11005+
11006+
<p>A processor seeing a non-JSON result will note the presense of the link header
11007+
and load that document instead.</p>
11008+
</section>
11009+
</section>
11010+
1093511011
<section class="changed"><h2>Embedding JSON-LD in HTML Documents</h2>
1093611012

1093711013
<p class="note">This section describes features available to a <a>full Processor</a>.</p>
@@ -12597,7 +12673,7 @@ <h2>Relationship to RDF</h2>
1259712673
also be used as a <dfn data-cite="RDF11-CONCEPTS#dfn-rdf-source">graph source</dfn>.
1259812674
In that case, a consumer MUST only use the <a>default graph</a> and ignore all <a>named graphs</a>.
1259912675
This allows servers to expose data in languages such as Turtle and JSON-LD
12600-
using content negotiation.</p>
12676+
using <a href="https://en.wikipedia.org/wiki/Content_negotiation">HTTP content negotiation</a>.</p>
1260112677

1260212678
<p class="note">Publishers supporting both <a>dataset</a> and <a>graph</a> syntaxes have to ensure that
1260312679
the primary data is stored in the <a>default graph</a> to enable consumers that do not support
@@ -13466,6 +13542,8 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
1346613542
This allows the use of the object form of a JSON-LD document when there is more
1346713543
than one <a>node object</a> being defined, and where those <a>node objects</a>
1346813544
are not embedded as values of the containing <a>node object</a>.</li>
13545+
<li>The `alternate` link relation can be used to supply an alternate location for
13546+
retrieving a JSON-LD document when the returned document is not JSON.</li>
1346913547
</ul>
1347013548
</section>
1347113549

0 commit comments

Comments
 (0)