Skip to content

Don't expand non-string native values to node objects. #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions spec/latest/json-ld-api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,7 @@ <h3>Overview</h3>

<p>If <a>active property</a> has a <a>type mapping</a> in the
<a>active context</a> set to <code>@id</code> or <code>@vocab</code>,
<span class="changed">and the value is a <a>string</a>,</span>
a <a class="changed">dictionary</a> with a single member <code>@id</code> whose
value is the result of using the
<a href="#iri-expansion">IRI Expansion algorithm</a> on <em>value</em>
Expand All @@ -1868,26 +1869,32 @@ <h3>Algorithm</h3>
an <a>active property</a>, and a <em>value</em> to expand.</p>

<ol class="algorithm">
<li>If the <a>active property</a> has a <a>type mapping</a>
in <a>active context</a> that is <code>@id</code>, return a new
<li></span>If the <a>active property</a> has a <a>type mapping</a>
in <a>active context</a> that is <code>@id</code>,
<span class="changed">and the <em>value</em> is a <a>string</a>,</span>
return a new
<a class="changed">dictionary</a> containing a single key-value pair where the
key is <code>@id</code> and the value is the result of using the
<a href="#iri-expansion">IRI Expansion algorithm</a>, passing
<a>active context</a>, <em>value</em>, and <code>true</code> for
<em>document relative</em>.</li>
<li>If <a>active property</a> has a <a>type mapping</a> in
<a>active context</a> that is <code>@vocab</code>, return
a new <a class="changed">dictionary</a> containing a single key-value pair
where the key is <code>@id</code> and the value is the result of
using the <a href="#iri-expansion">IRI Expansion algorithm</a>, passing
<a>active context</a> that is <code>@vocab</code>,
<span class="changed">and the <em>value</em> is a <a>string</a>,</span>
return a new
<a class="changed">dictionary</a> containing a single key-value pair where the
key is <code>@id</code> and the value is the result of using the
<a href="#iri-expansion">IRI Expansion algorithm</a>, passing
<a>active context</a>, <em>value</em>, <code>true</code> for
<em>vocab</em>, and <code>true</code> for
<em>document relative</em>.</li>
<li>Otherwise, initialize <em>result</em> to a <a class="changed">dictionary</a>
with an <code>@value</code> member whose value is set to
<em>value</em>.</li>
<li>If <a>active property</a> has a <a>type mapping</a> in
<a>active context</a>, add an <code>@type</code> member to
<a>active context</a>,
<span class="changed">other than <code>@id</code> or <code>@vocab</code>,</span>
add an <code>@type</code> member to
<em>result</em> and set its value to the value associated with the
<a>type mapping</a>.</li>
<li>Otherwise, if <em>value</em> is a <a>string</a>:
Expand Down Expand Up @@ -4752,6 +4759,8 @@ <h2>Changes since 1.0 Recommendation of 16 January 2014</h2>
the <a href="#compaction-algorithm">Compaction Algorithm</a> allows
specific forms of graph objects to be compacted back to a set of <a>node
objects</a>, or maps of <a>node objects</a>.</li>
<li><a href="#value-expansion">Value Expansion</a> will not turn native values
into <a>node objects</a>.</li>
</ul>
</section>

Expand All @@ -4760,12 +4769,9 @@ <h2>Open Issues</h2>
<p>The following is a list of open issues being worked on for the next release.</p>
<p class="issue" data-number="333"></p>
<p class="issue" data-number="357"></p>
<p class="issue" data-number="470"></p>
<p class="issue" data-number="480"></p>
<p class="issue" data-number="488"></p>
<p class="issue" data-number="495"></p>
<p class="issue" data-number="510"></p>
<p class="issue" data-number="538"></p>
<p class="issue" data-number="548"></p>
</section>

Expand Down
10 changes: 10 additions & 0 deletions test-suite/tests/expand-0088-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"@context": {
"@vocab": "http://example.org/",
"@base": "http://example.com/",
"coerceId": {"@type": "@id"},
"coerceVocab": {"@type": "@vocab"}
},
"coerceId": ["string", true, false, 0, 1],
"coerceVocab": ["string", true, false, 0, 1]
}
18 changes: 18 additions & 0 deletions test-suite/tests/expand-0088-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"http://example.org/coerceId": [
{"@id": "http://example.com/string"},
{"@value": true},
{"@value": false},
{"@value": 0},
{"@value": 1}
],
"http://example.org/coerceVocab": [
{"@id": "http://example.org/string"},
{"@value": true},
{"@value": false},
{"@value": 0},
{"@value": 1}
]
}
]
7 changes: 7 additions & 0 deletions test-suite/tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,13 @@
"input": "expand-0087-in.jsonld",
"expect": "expand-0087-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0088",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Do not expand native values to IRIs",
"purpose": "Value Expansion does not expand native values, such as booleans, to a node object",
"input": "expand-0088-in.jsonld",
"expect": "expand-0088-out.jsonld"
}, {
"@id": "#tc001",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
Expand Down