@@ -10856,12 +10856,31 @@ <h3>Graph Containers</h3>
10856
10856
</section>
10857
10857
</section>
10858
10858
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>
10860
10879
10861
10880
<p>Ordinary JSON documents can be interpreted as JSON-LD
10862
10881
by providing an explicit JSON-LD <a>context</a> document. One way
10863
10882
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>.
10865
10884
Doing so allows JSON to be unambiguously machine-readable without requiring developers to drastically
10866
10885
change their documents and provides an upgrade path for existing infrastructure
10867
10886
without breaking existing clients that rely on the <code>application/json</code>
@@ -10887,7 +10906,7 @@ <h3>Graph Containers</h3>
10887
10906
of the <code>@context</code> subtree in the referenced document MUST be
10888
10907
discarded. Effectively this means that the <a>active context</a> is
10889
10908
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
10891
10910
<code>http://www.w3.org/ns/json-ld#context</code> link relation.</p>
10892
10911
10893
10912
<p>Other mechanisms for providing a JSON-LD Context MAY be described for other
@@ -10932,6 +10951,63 @@ <h3>Graph Containers</h3>
10932
10951
ignored for such documents.</p>
10933
10952
</section>
10934
10953
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
+
10935
11011
<section class="changed"><h2>Embedding JSON-LD in HTML Documents</h2>
10936
11012
10937
11013
<p class="note">This section describes features available to a <a>full Processor</a>.</p>
@@ -12597,7 +12673,7 @@ <h2>Relationship to RDF</h2>
12597
12673
also be used as a <dfn data-cite="RDF11-CONCEPTS#dfn-rdf-source">graph source</dfn>.
12598
12674
In that case, a consumer MUST only use the <a>default graph</a> and ignore all <a>named graphs</a>.
12599
12675
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>
12601
12677
12602
12678
<p class="note">Publishers supporting both <a>dataset</a> and <a>graph</a> syntaxes have to ensure that
12603
12679
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>
13466
13542
This allows the use of the object form of a JSON-LD document when there is more
13467
13543
than one <a>node object</a> being defined, and where those <a>node objects</a>
13468
13544
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>
13469
13547
</ul>
13470
13548
</section>
13471
13549
0 commit comments