Skip to content

Commit 24f8df1

Browse files
committed
In expansion, allow a language map to have a null value, which is allowed in the syntax. Such values are ignored.
Fixes #375.
1 parent dabf2e0 commit 24f8df1

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

spec/latest/json-ld-api/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,14 +1485,16 @@ <h3>Algorithm</h3>
14851485
<li>For each <em>item</em> in <em>language value</em>:
14861486
<ol class="algorithm">
14871487
<li><em>item</em> must be a <a>string</a>,
1488+
<span class="changed">or <code>null</code></span>,
14881489
otherwise an
14891490
<a data-link-for="JsonLdErrorCode">invalid language map value</a>
14901491
error has been detected and processing is aborted.</li>
14911492
<li>Append a <a>JSON object</a> to
14921493
<em>expanded value</em> that consists of two
14931494
key-value pairs: (<code>@value</code>-<em>item</em>)
14941495
and (<code>@language</code>-lowercased
1495-
<em>language</em>).</li>
1496+
<em>language</em>),
1497+
<span class="changed">unless <em>item</em> is <code>null</code></span>.</li>
14961498
</ol>
14971499
</li>
14981500
</ol>
@@ -4373,6 +4375,9 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
43734375
within the enclosing <a>node object</a> directly.</li>
43744376
<li><code>@container</code> values within an <a>expanded term definition</a> may now
43754377
include <code>@id</code> and <code>@type</code>, corresponding to <a>id maps</a> and <a>type maps</a>.</li>
4378+
<li>A <a>language map</a> may legitimately have a <code>null</code> value, but
4379+
the algorithm only allowed <a>string</a> values. This has been updated
4380+
to allow (and ignore) <code>null</code> values.</li>
43764381
</ul>
43774382
</section>
43784383

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@context": {
3+
"vocab": "http://example.com/vocab/",
4+
"label": {
5+
"@id": "vocab:label",
6+
"@container": "@language"
7+
}
8+
},
9+
"@id": "http://example.com/queen",
10+
"label": {
11+
"en": null,
12+
"de": [ "Die Königin", null ]
13+
}
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"@id": "http://example.com/queen",
4+
"http://example.com/vocab/label":
5+
[
6+
{
7+
"@value": "Die Königin",
8+
"@language": "de"
9+
}
10+
]
11+
}
12+
]

test-suite/tests/expand-manifest.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,13 @@
758758
"input": "expand-n007-in.jsonld",
759759
"expect": "expand-n007-out.jsonld",
760760
"option": {"processingMode": "json-ld-1.1"}
761+
}, {
762+
"@id": "#tl001",
763+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
764+
"name": "Language map with null value",
765+
"purpose": "A language map may have a null value, which is ignored",
766+
"input": "expand-l001-in.jsonld",
767+
"expect": "expand-l001-out.jsonld"
761768
}
762769
]
763770
}

0 commit comments

Comments
 (0)