Skip to content

Commit da0dc41

Browse files
committed
Allow terms mapping to null to be protected.
1 parent 4dbb5dc commit da0dc41

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

index.html

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,15 +1334,9 @@ <h3>Algorithm</h3>
13341334
<a>term definition</a> for <var>term</var> in <var>active context</var>.</li>
13351335
<li>Otherwise, remove any <var>previous definition</var> from
13361336
<var>active context</var>.</li>
1337-
<li>If <var>value</var> is <code>null</code> or <var>value</var>
1338-
is a <a class="changed">dictionary</a> containing the key-value pair
1339-
<code>@id</code>-<code>null</code>, set the
1340-
<a>term definition</a> in <var>active context</var> to
1341-
<code>null</code>,
1342-
and set the value associated with <var>defined</var>'s
1343-
<a>member</a> <var>term</var> to <code>true</code>, and return.
1344-
<div class="ednote">Should probably store as a dictionary with <code>@id</code>-<code>null</code>
1345-
and retain <code>@protected</code> so we can protect against redefinitions.</div></li>
1337+
<li class="changed">If <var>value</var> is <code>null</code>,
1338+
convert it to a <a class="changed">dictionary</a> consisting of a single <a>member</a> whose
1339+
key is <code>@id</code> and whose value is <code>null</code>.</li>
13461340
<li>Otherwise, if <var>value</var> is a <a>string</a>, convert it
13471341
to a <a class="changed">dictionary</a> consisting of a single <a>member</a> whose
13481342
key is <code>@id</code> and whose value is <var>value</var>.
@@ -1414,7 +1408,10 @@ <h3>Algorithm</h3>
14141408
<li>If <var>value</var> contains the <a>member</a> <code>@id</code> and its value
14151409
does not equal <var>term</var>:
14161410
<ol>
1417-
<li>If the value associated with the <code>@id</code> <a>member</a> is not a <a>string</a>, an
1411+
<li>If <var>value</var> contains the <code>@id</code> <a>member</a>
1412+
is <code>null</code>, the term is not used for IRI expansion, but is
1413+
retained to be able to detect future redefinitions of this term.</li>
1414+
<li>Otherwise, if the value associated with the <code>@id</code> <a>member</a> is not a <a>string</a>, an
14181415
<a data-link-for="JsonLdErrorCode">invalid IRI mapping</a>
14191416
error has been detected and processing is aborted.</li>
14201417
<li>Otherwise, set the <a>IRI mapping</a> of <var>definition</var> to the
@@ -1697,9 +1694,10 @@ <h3>Algorithm</h3>
16971694
in <var>active context</var> during
16981695
<a href="#context-processing-algorithm">Context Processing</a>.</li>
16991696
<li>If <var>active context</var> contains a <a>term definition</a>
1700-
for <var>prefix</var>, return the result of concatenating
1701-
the <a>IRI mapping</a> associated with <var>prefix</var> and
1702-
<var>suffix</var>.</li>
1697+
for <var>prefix</var>
1698+
<span class="changed">having a non-<code>null</code> <a>IRI mapping</a></span>,
1699+
return the result of concatenating the <a>IRI mapping</a>
1700+
associated with <var>prefix</var> and <var>suffix</var>.</li>
17031701
<li><span class="changed">If <var>value</var> has the form of an <a>absolute IRI</a></span>,
17041702
return <var>value</var>.</li>
17051703
</ol>

tests/expand-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,14 @@
23382338
"option": {"specVersion": "json-ld-1.1"},
23392339
"input": "expand/pr27-in.jsonld",
23402340
"expect": "expand/pr27-out.jsonld"
2341+
}, {
2342+
"@id": "#tpr28",
2343+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2344+
"name": "Fails if trying to redefine a protected null term.",
2345+
"purpose": "A protected term with a null IRI mapping cannot be redefined.",
2346+
"option": {"specVersion": "json-ld-1.1"},
2347+
"input": "expand/pr28-in.jsonld",
2348+
"expect": "protected term redefinition"
23412349
}, {
23422350
"@id": "#ttn01",
23432351
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],

tests/expand/pr28-in.jsonld

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"@context": [{
3+
"@version": 1.1,
4+
"@protected": true,
5+
"term": null
6+
}, {
7+
"@version": 1.1,
8+
"term": {"@id": "http://example.com/term"}
9+
}],
10+
"term": "undefined"
11+
}

0 commit comments

Comments
 (0)