Skip to content

Commit d7a354f

Browse files
committed
Add some notes to Context Processing algorithm for strings.
Move step 5.2.5 to 5.2.4.1. For #265.
1 parent 99f0961 commit d7a354f

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

index.html

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,10 +1213,20 @@ <h3>Algorithm</h3>
12131213
Continue with the next <var>context</var>.
12141214
<div class="note">In [[[JSON-LD10]]], the <a>base IRI</a> was given
12151215
a default value here; this is now described conditionally
1216-
in <a href="#the-application-programming-interface" class="sectionRef"></a>.</div></li>
1217-
</ol>
1216+
in the {{JsonLdOptions/base}} option
1217+
of the <a href="#the-application-programming-interface" class="sectionRef"></a>.
1218+
</div>
1219+
</li>
1220+
</ol>
12181221
</li>
1219-
<li>If <var>context</var> is a <a>string</a>,
1222+
<li id="alg-context-string">If <var>context</var> is a <a>string</a>,
1223+
<div class="note">
1224+
In order to prevent being overly prescriptive,
1225+
this algorithm makes no statement about how internal state is kept for dereferenced context documents
1226+
and broadly applies error handling checks.
1227+
Provided that the output of the algorithm is unchanged,
1228+
implementations may employ optimizations.
1229+
</div>
12201230
<ol>
12211231
<li>Initialize <var>context</var> to the result of resolving <var>context</var> against
12221232
the <a>base IRI</a>
@@ -1232,7 +1242,15 @@ <h3>Algorithm</h3>
12321242
references are treated in the same way that unreserved
12331243
characters are treated in URI references, per
12341244
<a data-cite="RFC3987#section-6.5">section 6.5</a>
1235-
of [[RFC3987]].</li>
1245+
of [[RFC3987]].
1246+
<div class="note">
1247+
The <a>base IRI</a> of the document containing the <var>local context</var>
1248+
is often not the same as {{JsonLdOptions/base}}
1249+
or the <a>base IRI</a> of the <var>active context</var>.
1250+
Processors are responsible for retaining the {{RemoteDocument/documentUrl}}
1251+
for documents being processed via this algorithm for use in resolving <var>context</var>.
1252+
</div>
1253+
</li>
12361254
<li>If the number of entries in the <var>remote contexts</var> array
12371255
exceeds a processor defined limit, a
12381256
<a data-link-for="JsonLdErrorCode">context overflow</a>
@@ -1241,20 +1259,25 @@ <h3>Algorithm</h3>
12411259
<li class="changed">If <var>context</var> was previously dereferenced,
12421260
then the processor MUST NOT do a further dereference, and
12431261
<a>context</a> is set to the
1244-
previously established <a>internal representation</a>.</li>
1262+
previously established <a>internal representation</a>.
1263+
<div class="note">Only the `@context` <a>entry</a> need be retained.</div>
1264+
</li>
12451265
<li class="changed">Otherwise, dereference <var>context</var> using
12461266
the <a>LoadDocumentCallback</a>, passing <var>context</var>
12471267
for <a data-link-for="LoadDocumentCallback">url</a>,
12481268
and <code>http://www.w3.org/ns/json-ld#context</code> for <a data-link-for="LoadDocumentOptions">profile</a>
1249-
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.</li>
1250-
<li>If <var>context</var> cannot be dereferenced,
1251-
<span class="changed">or cannot be transformed into the <a>internal representation</a></span>,
1252-
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
1253-
error has been detected and processing is aborted. If the dereferenced document has no
1254-
top-level <a class="changed">map</a> with an <code>@context</code> <a>entry</a>, an
1255-
<a data-link-for="JsonLdErrorCode">invalid remote context</a>
1256-
has been detected and processing is aborted; otherwise,
1257-
set <var>context</var> to the value of that <a>entry</a>.</li>
1269+
and for <a data-link-for="LoadDocumentOptions">requestProfile</a>.
1270+
<ol>
1271+
<li id="alg-context-deref-error">If <var>context</var> cannot be dereferenced,
1272+
<span class="changed">or cannot be transformed into the <a>internal representation</a></span>,
1273+
a <a data-link-for="JsonLdErrorCode">loading remote context failed</a>
1274+
error has been detected and processing is aborted. If the dereferenced document has no
1275+
top-level <a class="changed">map</a> with an <code>@context</code> <a>entry</a>, an
1276+
<a data-link-for="JsonLdErrorCode">invalid remote context</a>
1277+
has been detected and processing is aborted.</li>
1278+
<li>Otherwise, set <var>context</var> to the value of that <a>entry</a>.</li>
1279+
</ol>
1280+
</li>
12581281
<li>Set <var>result</var> to the result of recursively calling this algorithm,
12591282
passing <var>result</var> for <var>active context</var>,
12601283
<var>context</var> for <var>local context</var>, and <span class="changed">a copy of</span> <var>remote contexts</var>.</li>
@@ -6992,6 +7015,10 @@ <h2>Changes since Candidate Release of 12 December 2019</h2>
69927015
</li>
69937016
<li>Other changes:
69947017
<ul>
7018+
<li>Added explanitory notes to step <a href="#alg-context-string">5.2</a>
7019+
of <a href="#context-processing-algorithm" class="sectionRef"></a>,
7020+
and moved the former step 5.2.5 to <a href="#alg-context-deref-error">5.2.4.1</a>.
7021+
This is in response to <a href="https://github.com/w3c/json-ld-api/issues/265">Issue 265</a>.</li>
69957022
<li>Add `application/xhtml+xml` as an allowed media type in <a href="#process-html" class="sectionRef"></a>,
69967023
in the note in <a href="#loaddocumentcallback" class="sectionRef"></a>,
69977024
and as a use of the {{LoadDocumentOptions/profile}} API option.

0 commit comments

Comments
 (0)