Skip to content

Commit 60a5c6a

Browse files
committed
* Change _from property_ to _override protected_,
* Change _from type_: true to _propagate_: false and fold in related changes in context processing. * Add _protected_ option to context processing and use it based on `@protected` when parsing a remotely sourced context. * Add some tests for protected sourced contexts.
1 parent 9f2a52a commit 60a5c6a

7 files changed

+58
-22
lines changed

index.html

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,15 +1093,16 @@ <h3>Algorithm</h3>
10931093

10941094
<p>This algorithm specifies how a new <a>active context</a> is updated
10951095
with a <a>local context</a>. The algorithm takes two required
1096-
<span class="changed">and three optional</span>
1097-
input variables.
1096+
<span class="changed">and four optional</span> input variables.
10981097
The required inputs are an <var>active context</var> and a <var>local context</var>.
10991098
The optional inputs are an <a>array</a> <var>remote contexts</var>,
11001099
defaulting to a new empty <a>array</a>, which is used to detect cyclical context inclusions,
1101-
<span class="changed">, <var>from property</var>, defaulting to <code>false</code>,
1100+
<span class="changed">
1101+
<var>override protected</var>, defaulting to <code>false</code>,
11021102
which is used to allow changes to protected terms,
1103-
and <var>from type</var>, defaulting to <code>false</code>,
1104-
which is used to set the default for <var>propagated</var>
1103+
<var>protected</var>, defaulting to <code>false</code>,
1104+
which provides a defeault value for <code>@protected</code>,
1105+
and <var>propagate</var>, defaulting to <code>true</code>
11051106
to mark <a>term definitions</a> associated with non-propagated <a>contexts</a>.</span>.
11061107
</p>
11071108

@@ -1111,7 +1112,6 @@ <h3>Algorithm</h3>
11111112
<li class="changed">If <var>local context</var> is an object containing the member <code>@propagate</code>,
11121113
its value MUST be <a>boolean</a> <code>true</code> or <code>false</code>,
11131114
set <var>propagate</var> to that value.</li>
1114-
<li class="changed">Otherwise, set <var>propagate</var> to <var>from type</var>.</li>
11151115
<li class="changed">If <var>propagate</var> is <code>false</code>, and <var>result</var>
11161116
does not have a <a>previous context</a>, set <a>previous context</a>
11171117
in <var>result</var> to <var>active context</var>.</li>
@@ -1123,14 +1123,14 @@ <h3>Algorithm</h3>
11231123
<ol>
11241124
<li>If <var>context</var> is <code>null</code>:
11251125
<ol>
1126-
<li class="changed">If <var>from property</var> is <code>false</code> and <var>active context</var>
1126+
<li class="changed">If <var>override protected</var> is <code>false</code> and <var>active context</var>
11271127
contains any <a>protected</a> <a>term definitions</a>,
11281128
an <a data-link-for="JsonLdErrorCode">invalid context nullification</a>
11291129
has been detected and processing is aborted.</li>
11301130
<li>Otherwise, set <var>result</var> to a
11311131
newly-initialized <var>active context</var>,
11321132
<span class="changed">setting <a>previous context</a> in <var>result</var>
1133-
to the previous value of <var>result</var> if <var>from type</var> is <code>true</code></span>.
1133+
to the previous value of <var>result</var> if <var>propagate</var> is <code>false</code></span>.
11341134
Continue with the next <var>context</var>.
11351135
<span class="note">In [[[JSON-LD]]], the <a>base IRI</a> was given
11361136
a default value here; this is now described conditionally
@@ -1195,6 +1195,9 @@ <h3>Algorithm</h3>
11951195
to <code>json-ld-1.1</code>, if not already set.</li>
11961196
</ol>
11971197
</li>
1198+
<li class="changed">If <var>context</var> has a <code>@protected</code> <a>member</a>,
1199+
set the value of <var>protected</var> from its value.</li>
1200+
</li>
11981201
<li class="changed">If <var>context</var> has a <code>@source</code> <a>member</a>:
11991202
<ol>
12001203
<li>If <a>processing mode</a> is <code>json-ld-1.0</code>,
@@ -1206,7 +1209,8 @@ <h3>Algorithm</h3>
12061209
<li>Otherwise, set <var>result</var> to the result of recursively calling this algorithm,
12071210
passing <var>result</var> for <var>active context</var>,
12081211
the value of <code>@source</code> for <var>local context</var>,
1209-
and a copy of <var>remote contexts</var>.
1212+
a copy of <var>remote contexts</var>,
1213+
and <var>protected</var>.
12101214
</li>
12111215
</ol>
12121216
</li>
@@ -1294,9 +1298,10 @@ <h3>Algorithm</h3>
12941298
passing <var>result</var> for <var>active context</var>,
12951299
<var>context</var> for <var>local context</var>, <var>key</var>,
12961300
<var>defined</var>,
1297-
<span class="changed">the value of the <code>@protected</code>
1298-
member from <var>context</var>, if any, for <var>protected</var></span>,
1299-
<var>from property</var>, and <var>from type</var>.</li>
1301+
<span class="changed">
1302+
<var>protected</var>, <var>override protected</var>, and <var>propagate</var>
1303+
</span>.
1304+
</li>
13001305
</ol>
13011306
</li>
13021307
<li>Return <var>result</var>.</li>
@@ -1347,9 +1352,9 @@ <h3>Algorithm</h3>
13471352
a <var>term</var>, and a map <var>defined</var>.
13481353
<span class="changed">The optional inputs are
13491354
<var>protected</var> which defaults to <code>false</code>,
1350-
<var>from property</var>, defaulting to <code>false</code>,
1355+
<var>override protected</var>, defaulting to <code>false</code>,
13511356
which is used to allow changes to protected terms,
1352-
and <var>from type</var>, defaulting to <code>false</code>.</span>.
1357+
and <var>propagate</var>, defaulting to <code>true</code>.</span>.
13531358
</p>
13541359
<ol>
13551360
<li>If <var>defined</var> contains the <a>member</a> <var>term</var> and the associated
@@ -1565,7 +1570,7 @@ <h3>Algorithm</h3>
15651570
<code>@context</code> <a>member</a>, which is treated as a <var>local context</var>.</li>
15661571
<li>Invoke the <a href="#context-processing-algorithm">Context Processing algorithm</a>
15671572
using the <var>active context</var>, <var>context</var> as <var>local context</var>,
1568-
and <code>true</code> for <var>from property</var>.
1573+
and <code>true</code> for <var>override protected</var>.
15691574
If any error is detected, an
15701575
<a data-link-for="JsonLdErrorCode">invalid scoped context</a> error
15711576
has been detected and processing is aborted.
@@ -1619,7 +1624,7 @@ <h3>Algorithm</h3>
16191624
<code class="changed">@prefix</code>, or <code>@type</code>, an
16201625
<a data-link-for="JsonLdErrorCode">invalid term definition</a> error has
16211626
been detected and processing is aborted.</li>
1622-
<li class="changed">If <var>from property</var> is <code>false</code>
1627+
<li class="changed">If <var>override protected</var> is <code>false</code>
16231628
and <var>previous definition</var> exists and is protected;
16241629
<ol>
16251630
<li>If <var>definition</var> is not the same as <var>previous definition</var>
@@ -1941,7 +1946,7 @@ <h3>Algorithm</h3>
19411946
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
19421947
passing <var>active context</var>, the value of the
19431948
<var>term</var>'s <a>local context</a> as <var>local context</var>,
1944-
<span class="changed">and <code>true</code> for <var>from type</var></span>.</li>
1949+
<span class="changed">and <code>true</code> for <var>propagate</var></span>.</li>
19451950
</ol>
19461951
</li>
19471952
<li>Initialize two empty <a class="changed">dictionaries</a>, <var>result</var>
@@ -2624,7 +2629,7 @@ <h3>Algorithm</h3>
26242629
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
26252630
passing <var>active context</var>, the value of the
26262631
<var>active property</var>'s <a>local context</a> as <var>local context</var>,
2627-
<span class="changed">and <code>true</code> for <var>from property</var></span>.</li>
2632+
<span class="changed">and <code>true</code> for <var>override protected</var></span>.</li>
26282633
<li>Set <var>inverse context</var> using the
26292634
<a href="#inverse-context-creation">Inverse Context Creation algorithm</a>
26302635
using <var>active context</var>.</li>
@@ -2658,7 +2663,7 @@ <h3>Algorithm</h3>
26582663
into it's compacted form using the <a href="#iri-compaction">IRI Compaction algorithm</a>,
26592664
passing <var>active context</var>, <var>inverse context</var>,
26602665
<var>expanded type</var> for <var>var</var>, <code>true</code> for <var>vocab</var>,
2661-
and <code>true</code> for <var>from type</var>.
2666+
and <code>false</code> for <var>propagate</var>.
26622667
Then, for each <var>term</var>
26632668
in <var>compacted types</var> ordered lexicographically:
26642669
<ol>

tests/compact/c024-context.jsonld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@id": "ex:Inner",
1212
"@context": {
1313
"@version": 1.1,
14-
"val": "@value",
1514
"foo": {
1615
"@id": "ex:foo",
1716
"@container": "@set",

tests/compact/c024-out.jsonld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@id": "ex:Inner",
1212
"@context": {
1313
"@version": 1.1,
14-
"val": "@value",
1514
"foo": {
1615
"@id": "ex:foo",
1716
"@container": "@set",

tests/expand-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,6 +2443,14 @@
24432443
"input": "expand/so06-in.jsonld",
24442444
"expect": "expand/so06-out.jsonld",
24452445
"option": {"specVersion": "json-ld-1.1"}
2446+
}, {
2447+
"@id": "#tso07",
2448+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2449+
"name": "Protect all terms in sourced context",
2450+
"purpose": "A protected context protects all term definitions.",
2451+
"option": {"specVersion": "json-ld-1.1"},
2452+
"input": "expand/so07-in.jsonld",
2453+
"expect": "protected term redefinition"
24462454
}, {
24472455
"@id": "#ttn01",
24482456
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],

tests/expand/c024-in.jsonld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@id": "ex:Inner",
1212
"@context": {
1313
"@version": 1.1,
14-
"val": "@value",
1514
"foo": {
1615
"@id": "ex:foo",
1716
"@container": "@set",

tests/expand/so07-context.jsonld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@context": {
3+
"protected1": {
4+
"@id": "http://example.com/protected1"
5+
},
6+
"protected2": {
7+
"@id": "http://example.com/protected2"
8+
}
9+
}
10+
}

tests/expand/so07-in.jsonld

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.com/",
4+
"@version": 1.1,
5+
"@protected": true,
6+
"@source": "so07-context.jsonld"
7+
},
8+
"protected1": {
9+
"@context": {
10+
"protected1": "http://example.com/something-else",
11+
"protected2": "http://example.com/something-else"
12+
},
13+
"protected1": "error / property http://example.com/protected1",
14+
"protected2": "error / property http://example.com/protected2"
15+
}
16+
}

0 commit comments

Comments
 (0)