Skip to content

Commit b5b5b32

Browse files
committed
Update text and examples for changed semantics for sealed contexts. Sealed terms can be updated from unsealed terms, or from a sealed term defined in a different context.
1 parent ff38fc5 commit b5b5b32

14 files changed

+106
-75
lines changed

index.html

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ <h2>Context Processing Algorithm</h2>
926926
<span class="changed">an optional <a>context</a></span>,
927927
<span class="changed">an optional <dfn>nest value</dfn>,</span>
928928
<span class="changed">an optional <dfn>prefix flag</dfn>,</span>
929-
<span class="changed">an optional <dfn>sealed flag</dfn>,</span>
929+
<span class="changed">an optional <dfn>context id</dfn>, used to flag this as a sealed term,</span>
930930
and an optional <dfn>container mapping</dfn>.
931931
A <a>term definition</a> can not only be used to map a <a>term</a>
932932
to an IRI, but also to map a <a>term</a> to a <a>keyword</a>,
@@ -993,31 +993,37 @@ <h3>Overview</h3>
993993
<h3>Algorithm</h3>
994994

995995
<p>This algorithm specifies how a new <a>active context</a> is updated
996-
with a <a>local context</a>. The algorithm takes three required
997-
<span class="changed">and one optional</span>
996+
with a <a>local context</a>. The algorithm takes two required
997+
<span class="changed">and two optional</span>
998998
input variables:
999-
an <var>active context</var>, a <var>local context</var>, and an <a>array</a>
1000-
<var>remote contexts</var> which is used to detect cyclical context inclusions.
1001-
<span class="changed">The optional input is <var>from sealed term</var> defaulting to <code>false</code>.</span>
1002-
If <var>remote contexts</var> is not passed, it is initialized to an empty
1003-
<a>array</a>.</p>
999+
an <var>active context</var> and a <var>local context</var>.
1000+
<span class="changed">The optional inputs are <var>from term</var></span>,
1001+
and an <a>array</a>
1002+
<var>remote contexts</var> which is used to detect cyclical context inclusions,
1003+
which defaults to a new empty <a>array</a>.</p>
10041004

10051005
<ol>
10061006
<li>Initialize <var>result</var> to the result of cloning
10071007
<var>active context</var>.</li>
1008+
<li>Initialize <var>current seal</var> to the value of <a>context id</a>
1009+
from the term definition for <var>from term</var>,
1010+
if such a term definition exists.</li>
10081011
<li>If <var>local context</var> is not an <a>array</a>,
10091012
set it to an <a>array</a> containing only
10101013
<var>local context</var>.</li>
10111014
<li>
10121015
For each item <var>context</var> in <var>local context</var>:
10131016
<ol>
1017+
<li class="changed">Initialize <var>context id</var> to a unique identifier.
1018+
<span class="note"><var>context id</var> is used to identify sealed terms
1019+
created from the same context.</span></li>
10141020
<li>If <var>context</var> is <code>null</code>
1015-
<span class="changed">and <var>from sealed term</var> is <code>true</code>
1016-
or the <var>active context</var> contains no <a>term definition</a>
1017-
with a <a>sealed flag</a> of <code>true</code></span>,
1021+
<span class="changed">and <var>current seal</var> is <code>null</code></span>,
10181022
set <var>result</var> to a
10191023
newly-initialized <var>active context</var> and continue with the
10201024
next <var>context</var>.
1025+
<span class="changed">If <var>current seal</var> is <code>null</code>,
1026+
processors SHOULD issue a warning that an attempt to clear a sealed context was attempted.</span>
10211027
<span class="note">In JSON-LD 1.0, the <a>base IRI</a> was given
10221028
a default value here; this is now described conditionally
10231029
in <a href="#the-application-programming-interface" class="sectionRef"></a>.</span></li>
@@ -1141,8 +1147,9 @@ <h3>Algorithm</h3>
11411147
passing <var>result</var> for <var>active context</var>,
11421148
<var>context</var> for <var>local context</var>, <var>key</var>,
11431149
<var>defined</var>,
1144-
<span class="changed">and the value of the <code>@sealed</code>
1145-
member from <var>context</var>, if any, for <var>sealed</var></span>.</li>
1150+
<span class="changed">the value of the <code>@sealed</code>
1151+
member from <var>context</var>, if any, for <var>sealed</var></span>,
1152+
<var>current seal</var>, and <var>context id</var>.</li>
11461153
</ol>
11471154
</li>
11481155
<li>Return <var>result</var>.</li>
@@ -1187,11 +1194,13 @@ <h3>Overview</h3>
11871194
<section class="algorithm">
11881195
<h3>Algorithm</h3>
11891196

1190-
<p>The algorithm has four required <span class="changed">and one optional</span> inputs which are:
1197+
<p>The algorithm has four required <span class="changed">and three optional</span> inputs.
1198+
The required inputs are:
11911199
an <var>active context</var>, a <var>local context</var>,
11921200
a <var>term</var>, and a map <var>defined</var>.
1193-
<span class="changed">The optional input is <var>sealed</var> which defaults to <code>false</code>.</span></p>
1194-
1201+
<span class="changed">The optional inputs are
1202+
<var>sealed</var> which defaults to <code>false</code>,
1203+
<var>current seal</var>, and <var>context id</var>, which default to <code>null</code>.</span></p>
11951204
<ol>
11961205
<li>If <var>defined</var> contains the <a>member</a> <var>term</var> and the associated
11971206
value is <code>true</code> (indicating that the
@@ -1216,8 +1225,9 @@ <h3>Algorithm</h3>
12161225
<a data-link-for="JsonLdErrorCode">keyword redefinition</a>
12171226
error has been detected and processing is aborted.</li>
12181227
<li class="changed">If the <var>active context</var> has an existing
1219-
<a>term definition</a> for <var>term</var> with the <a>sealed flag</a> set to <code>true</code>
1220-
processing is aborted.</li>
1228+
<a>term definition</a> for <var>term</var> with a non-null <a>context id</a>,
1229+
and <var>current seal</var> is not <code>null</code>, processing is aborted;
1230+
processors SHOULD issue a warning that an attempt was made to redefine a sealed term.</li>
12211231
<li>Otherwise, remove any existing <a>term definition</a> for <var>term</var> in
12221232
<var>active context</var>.</li>
12231233
<li>If <var>value</var> is <code>null</code> or <var>value</var>
@@ -1235,9 +1245,11 @@ <h3>Algorithm</h3>
12351245
error has been detected and processing is aborted.
12361246
<span class="changed">Set <var>simple term</var> to <code>false</code></span>.</li>
12371247
<li>Create a new <a>term definition</a>, <var>definition</var>.</li>
1238-
<li class="changed">Set the <a>sealed flag</a> in <var>definition</var>
1239-
to the value of the <code>@sealed</code> member in <var>value</var>,
1240-
if any, or to the value of <var>sealed</var> otherwise.</li>
1248+
<li class="changed">If the <code>@sealed</code> member in <var>value</var>
1249+
is <code>true</code>, or there is no <code>@sealed</code> member in <var>value</var>
1250+
and the <var>sealed</var> parameter is <code>true</code>,
1251+
set the <a>context id</a> in <var>definition</var>
1252+
to the value of the <var>context id</var> parameter.</li>
12411253
<li>If <var>value</var> contains the <a>member</a> <code>@type</code>:
12421254
<ol>
12431255
<li>Initialize <var>type</var> to the value associated with the
@@ -1698,8 +1710,9 @@ <h3>Algorithm</h3>
16981710
<li>If <var>element</var> contains the <a>member</a> <code>@context</code>, set
16991711
<var>active context</var> to the result of the
17001712
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
1701-
passing <var>active context</var> and the value of the
1702-
<code>@context</code> <a>member</a> as <var>local context</var>.</li>
1713+
passing <var>active context</var>, the value of the
1714+
<code>@context</code> <a>member</a> as <var>local context</var>,
1715+
<span class="changed">and <var>active property</var> as <var>from term</var></span>.</li>
17031716
<li class="changed">For each <var>key</var>/<var>value</var> pair in <var>element</var>
17041717
where <var>key</var> expands to <code>@type</code> using the
17051718
<a href="#iri-expansion">IRI Expansion algorithm</a>,
@@ -1713,9 +1726,7 @@ <h3>Algorithm</h3>
17131726
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
17141727
passing <var>active context</var>, the value of the
17151728
<var>term</var>'s <a>local context</a> as <var>local context</var>,
1716-
<span class="changed">and <var>from sealed term</var> set to the value
1717-
of the <a>sealed flag</a> from
1718-
<var>term</var>'s <a>term definition</a> in <var>active context</var></span>.</li>
1729+
<span class="changed">and <var>active property</var> as <var>from term</var></span>.</li>
17191730
</ol>
17201731
</li>
17211732
<li>Initialize an empty <a class="changed">dictionary</a>, <var>result</var>.</li>
@@ -1902,11 +1913,10 @@ <h3>Algorithm</h3>
19021913
<li class="changed">If <var>key</var>'s <a>term definition</a> in <var>active context</var>
19031914
has a <a>local context</a>, set <var>term context</var> to the result of the
19041915
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
1905-
passing <var>active context</var>, the value of the
1906-
<var>key</var>'s <a>local context</a> as <var>local context</var>,
1907-
<span class="changed">and <var>from sealed term</var> set to the value
1908-
of the <a>sealed flag</a> from
1909-
<var>key</var>'s <a>term definition</a> in <var>active context</var></span>.
1916+
passing <var>active context</var> and the value of the
1917+
<var>key</var>'s <a>local context</a> as <var>local context</var>.
1918+
<span class="changed note">The <var>from term</var> is not passed,
1919+
as scoped contexts may redefine sealed terms.</span>
19101920
Otherwise, set <var>term context</var> to <var>active context</var>.</li>
19111921
<li>Set <var>container mapping</var> to <var>key</var>'s <a>container mapping</a> in
19121922
<var class="changed">term context</var>.</li>
@@ -1964,9 +1974,7 @@ <h3>Algorithm</h3>
19641974
algorithm</a>, passing <var>term context</var> as <var>active context</var>, the
19651975
value of the <var>index</var>'s <a>local context</a> as
19661976
<var>local context</var>,
1967-
<span class="changed">and <var>from sealed term</var> set to the value
1968-
of the <a>sealed flag</a> from
1969-
<var>index</var>'s <a>term definition</a> in <var>active context</var></span>.
1977+
<span class="changed">and <var>active property</var> as <var>from term</var></span>.
19701978
Otherwise, set <var>map context</var>
19711979
to <var>term context</var>.</li>
19721980
<li>Set <var>expanded index</var> to the result of using the
@@ -2341,8 +2349,9 @@ <h3>Algorithm</h3>
23412349
<ol>
23422350
<li>Set <var>active context</var> to the result of the
23432351
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
2344-
passing <var>active context</var> and the value of the
2345-
<var>active property</var>'s <a>local context</a> as <var>local context</var>.</li>
2352+
passing <var>active context</var>, the value of the
2353+
<var>active property</var>'s <a>local context</a> as <var>local context</var>,
2354+
<span class="changed">and <var>active property</var> as <var>from term</var></span>.</li>
23462355
<li>Set <var>inverse context</var> using the
23472356
<a href="#inverse-context-creation">Inverse Context Creation algorithm</a>
23482357
using <var>active context</var>.</li>
@@ -2411,8 +2420,9 @@ <h3>Algorithm</h3>
24112420
<ol>
24122421
<li>Set <var>active context</var> to the result of the
24132422
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
2414-
passing <var>active context</var> and the value of <var>term</var>'s
2415-
<a>local context</a> as <var>local context</var>.</li>
2423+
passing <var>active context</var>, the value of <var>term</var>'s
2424+
<a>local context</a> as <var>local context</var>
2425+
<span class="changed">and <var>active property</var> as <var>from term</var></span>.</li>
24162426
<li>Set <var>inverse context</var> using the
24172427
<a href="#inverse-context-creation">Inverse Context Creation algorithm</a>
24182428
using <var>active context</var>.</li>

tests/expand-manifest.jsonld

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,16 +1819,16 @@
18191819
}, {
18201820
"@id": "#tse05",
18211821
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1822-
"name": "Do not clear active context with sealed terms",
1823-
"purpose": "The Active context may not be set to null if there are sealed terms.",
1822+
"name": "Do not clear active context with sealed terms from a sealed term",
1823+
"purpose": "The Active context may not be set to null if there are sealed terms when expanding a sealed term from the same context.",
18241824
"option": {"specVersion": "json-ld-1.1"},
18251825
"input": "expand/se05-in.jsonld",
18261826
"expect": "expand/se05-out.jsonld"
18271827
}, {
18281828
"@id": "#tse06",
18291829
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1830-
"name": "Do not clear sealed context from scoped term that is not sealed.",
1831-
"purpose": "The Active context may be set to null from a scoped context of a sealed term.",
1830+
"name": "Clear active context of sealed terms from an unsealed term.",
1831+
"purpose": "The Active context may be set to null from a scoped context of an unsealed term.",
18321832
"option": {"specVersion": "json-ld-1.1"},
18331833
"input": "expand/se06-in.jsonld",
18341834
"expect": "expand/se06-out.jsonld"
@@ -1848,6 +1848,14 @@
18481848
"option": {"specVersion": "json-ld-1.1"},
18491849
"input": "expand/se08-in.jsonld",
18501850
"expect": "expand/se08-out.jsonld"
1851+
}, {
1852+
"@id": "#tse09",
1853+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
1854+
"name": "Redefine term in other sealed context.",
1855+
"purpose": "A sealed term can redefine a sealed term in another context.",
1856+
"option": {"specVersion": "json-ld-1.1"},
1857+
"input": "expand/se09-in.jsonld",
1858+
"expect": "expand/se09-out.jsonld"
18511859
}
18521860
]
18531861
}

tests/expand/se01-in.jsonld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"@version": 1.1,
55
"sealed": {"@sealed": true}
66
},
7-
"sealed": true,
8-
"scope": {
7+
"sealed": {
98
"@context": {"sealed": "http://example.com/something-else"},
109
"sealed": "this should have the property http://example.com/sealed"
1110
}

tests/expand/se01-out.jsonld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[
22
{
3-
"http://example.com/sealed": [{"@value": true}],
4-
"http://example.com/scope": [{
3+
"http://example.com/sealed": [{
54
"http://example.com/sealed": [{"@value": "this should have the property http://example.com/sealed"}]
65
}]
76
}

tests/expand/se03-in.jsonld

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
"sealed1": {"@id": "http://example.com/sealed1"},
77
"sealed2": {"@id": "http://example.com/sealed2"}
88
},
9-
"sealed1": true,
10-
"sealed2": true,
11-
"scope": {
12-
"@context": {"sealed1": "http://example.com/something-else"},
13-
"sealed1": "this should have the property http://example.com/sealed1"
9+
"sealed1": {
10+
"@context": {
11+
"sealed1": "http://example.com/something-else",
12+
"sealed2": "http://example.com/something-else"
13+
},
14+
"sealed1": "this should have the property http://example.com/sealed1",
15+
"sealed2": "this should have the property http://example.com/sealed2"
1416
}
1517
}

tests/expand/se03-out.jsonld

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[
22
{
3-
"http://example.com/sealed1": [{"@value": true}],
4-
"http://example.com/sealed2": [{"@value": true}],
5-
"http://example.com/scope": [{
6-
"http://example.com/sealed1": [{"@value": "this should have the property http://example.com/sealed1"}]
3+
"http://example.com/sealed1": [{
4+
"http://example.com/sealed1": [{"@value": "this should have the property http://example.com/sealed1"}],
5+
"http://example.com/sealed2": [{"@value": "this should have the property http://example.com/sealed2"}]
76
}]
87
}
98
]

tests/expand/se04-in.jsonld

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"sealed": {"@id": "http://example.com/sealed"},
77
"unsealed": {"@id": "http://example.com/unsealed", "@sealed": false}
88
},
9-
"sealed": true,
10-
"unsealed": true,
11-
"scope": {
9+
"sealed": {
1210
"@context": {
1311
"sealed": "http://example.com/something-else1",
1412
"unsealed": "http://example.com/something-else2"

tests/expand/se04-out.jsonld

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[
22
{
3-
"http://example.com/sealed": [{"@value": true}],
4-
"http://example.com/unsealed": [{"@value": true}],
5-
"http://example.com/scope": [{
3+
"http://example.com/sealed": [{
64
"http://example.com/sealed": [{"@value": "this should have the property http://example.com/sealed"}],
75
"http://example.com/something-else2": [{"@value": "this should have the property http://example.com/something-else2"}]
86
}]

tests/expand/se05-in.jsonld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"@context": {
33
"@vocab": "http://example.com/",
44
"@version": 1.1,
5-
"sealed": {"@sealed": true}
5+
"@sealed": true,
6+
"sealed": {"@language": null}
67
},
7-
"sealed": true,
8-
"scope": {
8+
"sealed": {
99
"@context": null,
1010
"sealed": "this should have the property http://example.com/sealed"
1111
}

tests/expand/se05-out.jsonld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[
22
{
3-
"http://example.com/sealed": [{"@value": true}],
4-
"http://example.com/scope": [{
3+
"http://example.com/sealed": [{
54
"http://example.com/sealed": [{"@value": "this should have the property http://example.com/sealed"}]
65
}]
76
}

tests/expand/se06-in.jsonld

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"@context": {
33
"@vocab": "http://example.com/",
44
"@version": 1.1,
5-
"sealed": {"@sealed": true},
6-
"scope": {"@sealed": false, "@context": null}
5+
"@sealed": true,
6+
"sealed": {"@type": "@id"},
7+
"unsealed": {"@sealed": false, "@context": null}
78
},
8-
"sealed": true,
9-
"scope": {
10-
"sealed": "this should have the property http://example.com/sealed"
9+
"unsealed": {
10+
"sealed": "not expanded, as sealed is not a defined term"
1111
}
1212
}

tests/expand/se06-out.jsonld

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
[
22
{
3-
"http://example.com/sealed": [{"@value": true}],
4-
"http://example.com/scope": [{
5-
"http://example.com/sealed": [{"@value": "this should have the property http://example.com/sealed"}]
6-
}]
3+
"http://example.com/unsealed": [{}]
74
}
85
]

tests/expand/se09-in.jsonld

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@context": [{
3+
"@version": 1.1,
4+
"@sealed": true,
5+
"sealed1": "http://example.org/sealed1"
6+
}, {
7+
"@version": 1.1,
8+
"@sealed": true,
9+
"sealed2": "http://example.org/sealed2"
10+
}],
11+
"sealed2": {
12+
"@context": {"sealed1": "http://example.com/something-else"},
13+
"sealed1": "this should have the property http://example.com/something-else"
14+
}
15+
}

tests/expand/se09-out.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[{
2+
"http://example.org/sealed2": [{
3+
"http://example.org/sealed1": [{
4+
"@value": "this should have the property http://example.com/something-else"
5+
}]
6+
}]
7+
}]

0 commit comments

Comments
 (0)