Skip to content

Commit 48384cb

Browse files
committed
Add spec text for detecting errors when changing protected term definitions unless from a term used as a property which has a scoped context.
Remove protected term tests with warning option.
1 parent 2d4cc1e commit 48384cb

14 files changed

+84
-295
lines changed

index.html

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,14 @@ <h3>Algorithm</h3>
10111011

10121012
<p>This algorithm specifies how a new <a>active context</a> is updated
10131013
with a <a>local context</a>. The algorithm takes two required
1014-
<span class="changed">and one optional</span>
1014+
<span class="changed">and two optional</span>
10151015
input variables.
1016-
The required inputs inputs are an <var>active context</var> and a <var>local context</var>.
1017-
The optional input is an <a>array</a> <var>remote contexts</var>,
1018-
defaulting to a new empty <a>array</a>, which is used to detect cyclical context inclusions.</p>
1016+
The required inputs are an <var>active context</var> and a <var>local context</var>.
1017+
The optional inputs are an <a>array</a> <var>remote contexts</var>,
1018+
defaulting to a new empty <a>array</a>, which is used to detect cyclical context inclusions.
1019+
<span class="changed">and <var>from term</var>, defaulting to <code>false</code>,
1020+
which is used to allow changes to protected terms.</span>.
1021+
</p>
10191022

10201023
<ol>
10211024
<li>Initialize <var>result</var> to the result of cloning
@@ -1026,12 +1029,20 @@ <h3>Algorithm</h3>
10261029
<li>
10271030
For each item <var>context</var> in <var>local context</var>:
10281031
<ol>
1029-
<li>If <var>context</var> is <code>null</code>, set <var>result</var> to a
1030-
newly-initialized <var>active context</var> and continue with the
1031-
next <var>context</var>.
1032-
<span class="note">In JSON-LD 1.0, the <a>base IRI</a> was given
1033-
a default value here; this is now described conditionally
1034-
in <a href="#the-application-programming-interface" class="sectionRef"></a>.</span></li>
1032+
<li>If <var>context</var> is <code>null</code>:
1033+
<ol>
1034+
<li class="changed">If <var>from term</var> is <code>false</code> and <var>active context</var>
1035+
contains any <a>protected</a> <a>term definitions</a>,
1036+
an <a data-link-for="JsonLdErrorCode">invalid context nullification</a>
1037+
has been detected and processing is aborted.</li>
1038+
<li>Otherwise, set <var>result</var> to a
1039+
newly-initialized <var>active context</var> and continue with the
1040+
next <var>context</var>.
1041+
<span class="note">In JSON-LD 1.0, the <a>base IRI</a> was given
1042+
a default value here; this is now described conditionally
1043+
in <a href="#the-application-programming-interface" class="sectionRef"></a>.</span></li>
1044+
</ol>
1045+
</li>
10351046
<li>If <var>context</var> is a <a>string</a>,
10361047
<ol>
10371048
<li>Set <var>context</var> to the result of resolving <var>value</var> against
@@ -1153,8 +1164,9 @@ <h3>Algorithm</h3>
11531164
passing <var>result</var> for <var>active context</var>,
11541165
<var>context</var> for <var>local context</var>, <var>key</var>,
11551166
<var>defined</var>,
1156-
<span class="changed">and the value of the <code>@protected</code>
1157-
member from <var>context</var>, if any, for <var>protected</var></span>.</li>
1167+
<span class="changed">the value of the <code>@protected</code>
1168+
member from <var>context</var>, if any, for <var>protected</var></span>,
1169+
and <var>from term</var>.</li>
11581170
</ol>
11591171
</li>
11601172
<li>Return <var>result</var>.</li>
@@ -1199,12 +1211,15 @@ <h3>Overview</h3>
11991211
<section class="algorithm">
12001212
<h3>Algorithm</h3>
12011213

1202-
<p>The algorithm has four required <span class="changed">and one optional</span> inputs.
1214+
<p>The algorithm has four required <span class="changed">and two optional</span> inputs.
12031215
The required inputs are
12041216
an <var>active context</var>, a <var>local context</var>,
12051217
a <var>term</var>, and a map <var>defined</var>.
1206-
<span class="changed">The optional input is
1207-
<var>protected</var> which defaults to <code>false</code>.</span></p>
1218+
<span class="changed">The optional inputs are
1219+
<var>protected</var> which defaults to <code>false</code>,
1220+
and <var>from term</var>, defaulting to <code>false</code>,
1221+
which is used to allow changes to protected terms.</span>.
1222+
</p>
12081223
<ol>
12091224
<li>If <var>defined</var> contains the <a>member</a> <var>term</var> and the associated
12101225
value is <code>true</code> (indicating that the
@@ -1228,9 +1243,11 @@ <h3>Algorithm</h3>
12281243
<var>term</var> MUST NOT be a <a>keyword</a> and a
12291244
<a data-link-for="JsonLdErrorCode">keyword redefinition</a>
12301245
error has been detected and processing is aborted.</li>
1231-
<li class="changed">If the <var>active context</var> has an existing
1232-
<a>term definition</a> for <var>term</var> which is protected, processing is aborted;
1233-
processors SHOULD issue a warning that an attempt was made to redefine a protected term.</li>
1246+
<li class="changed">If the <var>from term</var> is <code>false</code>
1247+
and <var>active context</var> has an existing
1248+
<a>term definition</a> for <var>term</var> which is protected,
1249+
a <a data-link-for="JsonLdErrorCode">protected term redefinition</a> error has been detected,
1250+
and processing is aborted.</li>
12341251
<li>Otherwise, remove any existing <a>term definition</a> for <var>term</var> in
12351252
<var>active context</var>.</li>
12361253
<li>If <var>value</var> is <code>null</code> or <var>value</var>
@@ -1412,7 +1429,8 @@ <h3>Algorithm</h3>
14121429
<li>Initialize <var>context</var> to the value associated with the
14131430
<code>@context</code> <a>member</a>, which is treated as a <var>local context</var>.</li>
14141431
<li>Invoke the <a href="#context-processing-algorithm">Context Processing algorithm</a>
1415-
using the <var>active context</var> and <var>context</var> as <var>local context</var>.
1432+
using the <var>active context</var>, <var>context</var> as <var>local context</var>,
1433+
and <code>true</code> for <var>from term</var>.
14161434
If any error is detected, an
14171435
<a data-link-for="JsonLdErrorCode">invalid scoped context</a> error
14181436
has been detected and processing is aborted.</li>
@@ -1514,7 +1532,7 @@ <h3>Overview</h3>
15141532
<a href="#create-term-definition">Create Term Definition algorithm</a>.</p>
15151533
</section>
15161534

1517-
<section>
1535+
<section class="algorithm">
15181536
<h3>Algorithm</h3>
15191537

15201538
<p>The algorithm takes two required and four optional input variables. The
@@ -1938,8 +1956,9 @@ <h3>Algorithm</h3>
19381956
<li class="changed">If <var>key</var>'s <a>term definition</a> in <var>active context</var>
19391957
has a <a>local context</a>, set <var>term context</var> to the result of the
19401958
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
1941-
passing <var>active context</var> and the value of the
1942-
<var>key</var>'s <a>local context</a> as <var>local context</var>. Otherwise,
1959+
passing <var>active context</var>, the value of the
1960+
<var>key</var>'s <a>local context</a> as <var>local context</var>,
1961+
and <code>true</code> for <var>from term</var>. Otherwise,
19431962
set <var>term context</var> to <var>active context</var>.</li>
19441963
<li>Set <var>container mapping</var> to <var>key</var>'s <a>container mapping</a> in
19451964
<var class="changed">term context</var>.</li>
@@ -5626,6 +5645,7 @@ <h4>JsonLdErrorCode</h4>
56265645
"invalid @version value",
56275646
"invalid base IRI",
56285647
"invalid container mapping",
5648+
"invalid context nullification",
56295649
"invalid default language",
56305650
"invalid IRI mapping",
56315651
"invalid keyword alias",
@@ -5653,6 +5673,7 @@ <h4>JsonLdErrorCode</h4>
56535673
"loading remote context failed",
56545674
"multiple context link headers",
56555675
"processing mode conflict",
5676+
"protected term redefinition",
56565677
"context overflow"
56575678
};
56585679
--></pre>
@@ -5769,6 +5790,11 @@ <h4>JsonLdErrorCode</h4>
57695790
which is incompatible with the previous specified version.</dd>
57705791
<dt><dfn>context overflow</dfn></dt>
57715792
<dd>maximum number of <code>@context</code> URLs exceeded.</dd>
5793+
<dt class="changed"><dfn>invalid context nullification</dfn></dt>
5794+
<dd class="changed">An attempt was made to nullify a context
5795+
containing <a>protected</a> <a>term definitions</a>.</dd>
5796+
<dt class="changed"><dfn>protected term redefinition</dfn></dt>
5797+
<dd class="changed">An attempt was made to redefine a <a>protected</a> term.</dd>
57725798
</dl>
57735799
</section>
57745800
</section> <!-- end of Error Handling -->

0 commit comments

Comments
 (0)