Skip to content

Commit 0a739c3

Browse files
committed
Updates and tests for @included as an array of node objects.
For #19.
1 parent 881a530 commit 0a739c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1018
-1
lines changed

index.html

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2014,7 +2014,7 @@ <h3>Algorithm</h3>
20142014
<a data-link-for="JsonLdErrorCode">invalid reverse property map</a>
20152015
error has been detected and processing is aborted.</li>
20162016
<li>If <var>result</var> has already an <var>expanded property</var> <a>entry</a>,
2017-
<span class="changed">other than `@type`</span>,
2017+
<span class="changed">other than `@included` or `@type`</span>,
20182018
a <a data-link-for="JsonLdErrorCode">colliding keywords</a>
20192019
error has been detected and processing is aborted.</li>
20202020
<li>If <var>expanded property</var> is <code>@id</code> and
@@ -2064,6 +2064,19 @@ <h3>Algorithm</h3>
20642064
and <a data-link-for="JsonLdOptions">ordered</a> flags</span>,
20652065
<span class="changed">
20662066
ensuring that <var>expanded value</var> is an <a>array</a> of one or more <a>maps</a></span>.</li>
2067+
<li class="changed">If <var>expanded property</var> is `@included`
2068+
and <a>processing mode</a> is `json-ld-1.1`,
2069+
set <var>expanded value</var> to the result of using
2070+
this algorithm recursively passing <var>active context</var>,
2071+
<var>active property</var>, <var>value</var> for <var>element</var>,
2072+
and the <a data-link-for="JsonLdOptions">frameExpansion</a>
2073+
and <a data-link-for="JsonLdOptions">ordered</a> flags,
2074+
ensuring that the result is an <a>array</a>.
2075+
If any element of <var>included result</var> is not a <a>node object</a>,
2076+
an <a data-link-for="JsonLdErrorCode">invalid @included value</a>
2077+
error has been detected and processing is aborted.
2078+
If <var>result</var> already has an entry for `@include`,
2079+
prepend the value of `@include` in <var>result</var> to <var>expanded value</var>.</li>
20672080
<li>Otherwise, if <var>expanded property</var> is <code>@value</code>,
20682081
<span class="changed"><a>processing mode</a> is <code>json-ld-1.1</code>, and
20692082
<var>input type</var> is <code>@json</code>,
@@ -4299,6 +4312,10 @@ <h3>Algorithm</h3>
42994312
algorithm passing the value of the <code>@graph</code> <a>entry</a> for <var>element</var>,
43004313
<var>node map</var>, and <var>id</var> for <var>active graph</var> before removing
43014314
the <code>@graph</code> <a>entry</a> from <var>element</var>.</li>
4315+
<li class="changed">If <var>element</var> has an `@included` <a>entry</a>,
4316+
recursively invoke this algorithm passing the value of the `@included <a>entry</a> for <var>element</var>,
4317+
<var>node map</var>, <var>active subject</var>, <var>active property</var>, and <var>active graph</var>
4318+
before removing the `@included` <a>entry</a> from <var>element</var>.</li>
43024319
<li>Finally, for each key-value pair <var>property</var>-<var>value</var> in <var>element</var> ordered by
43034320
<var>property</var> perform the following steps:
43044321
<ol>
@@ -6021,6 +6038,7 @@ <h4>JsonLdErrorCode</h4>
60216038
"invalid context entry",
60226039
"invalid context nullification",
60236040
"invalid default language",
6041+
"invalid @included value",
60246042
"invalid IRI mapping",
60256043
"invalid keyword alias",
60266044
"invalid language map value",
@@ -6179,6 +6197,8 @@ <h4>JsonLdErrorCode</h4>
61796197
containing <a>protected</a> <a>term definitions</a>.</dd>
61806198
<dt class="changed"><dfn>protected term redefinition</dfn></dt>
61816199
<dd class="changed">An attempt was made to redefine a <a>protected</a> term.</dd>
6200+
<dt class="changed"><dfn>invalid @included value</dfn></dt>
6201+
<dd class="changed">An <a>included block</a> contains an invalid value.</dd>
61826202
</dl>
61836203
</section>
61846204
</section> <!-- end of Error Handling -->
@@ -6338,6 +6358,13 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
63386358
authored for <code>JSON-LD 1.0</code>.</li>
63396359
<li>The <a data-link-for="JsonLdErrorCode">colliding keywords</a> error is not issued for `@type`;
63406360
instead, previous values of `@type` are prepended to any new values, when expanding.</li>
6361+
<li>A <a>node object</a> may include an <a>included block</a>,
6362+
which is used to contain a set of <a>node objects</a> which are treated
6363+
exactly as if they were <a>node objects</a> defined in an <a>array</a> including the containing
6364+
<a>node object</a>.
6365+
This allows the use of the object form of a JSON-LD document when there is more
6366+
than one <a>node object</a> being defined, and where those <a>node objects</a>
6367+
are not embedded as values of the containing <a>node object</a>.</li>
63416368
</ul>
63426369
</section>
63436370

tests/compact-manifest.jsonld

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,51 @@
13281328
"context": "compact/h004-context.jsonld",
13291329
"expect": "compact/h004-out.jsonld",
13301330
"option": {"specVersion": "json-ld-1.1", "extractAllScripts": true}
1331+
}, {
1332+
"@id": "#tin01",
1333+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1334+
"name": "Basic Included array",
1335+
"purpose": "Tests included maps.",
1336+
"input": "compact/in01-in.jsonld",
1337+
"context": "compact/in01-context.jsonld",
1338+
"expect": "compact/in01-out.jsonld",
1339+
"option": {"specVersion": "json-ld-1.1"}
1340+
}, {
1341+
"@id": "#tin02",
1342+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1343+
"name": "Basic Included object",
1344+
"purpose": "Tests included maps.",
1345+
"input": "compact/in02-in.jsonld",
1346+
"context": "compact/in02-context.jsonld",
1347+
"expect": "compact/in02-out.jsonld",
1348+
"option": {"specVersion": "json-ld-1.1"}
1349+
}, {
1350+
"@id": "#tin03",
1351+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1352+
"name": "Multiple properties mapping to @included are folded together",
1353+
"purpose": "Tests included maps.",
1354+
"input": "compact/in03-in.jsonld",
1355+
"context": "compact/in03-context.jsonld",
1356+
"expect": "compact/in03-out.jsonld",
1357+
"option": {"specVersion": "json-ld-1.1"}
1358+
}, {
1359+
"@id": "#tin04",
1360+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1361+
"name": "Included containing @included",
1362+
"purpose": "Tests included maps.",
1363+
"input": "compact/in04-in.jsonld",
1364+
"context": "compact/in04-context.jsonld",
1365+
"expect": "compact/in04-out.jsonld",
1366+
"option": {"specVersion": "json-ld-1.1"}
1367+
}, {
1368+
"@id": "#tin05",
1369+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1370+
"name": "Property value with @included",
1371+
"purpose": "Tests included maps.",
1372+
"input": "compact/in05-in.jsonld",
1373+
"context": "compact/in05-context.jsonld",
1374+
"expect": "compact/in05-out.jsonld",
1375+
"option": {"specVersion": "json-ld-1.1"}
13311376
}, {
13321377
"@id": "#tjs01",
13331378
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],

tests/compact/in01-context.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.org/",
5+
"included": {"@id": "@included", "@container": "@set"}
6+
}
7+
}

tests/compact/in01-in.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[{
2+
"http://example.org/prop": [{"@value": "value"}],
3+
"@included": [{
4+
"http://example.org/prop": [{"@value": "value2"}]
5+
}]
6+
}]

tests/compact/in01-out.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+
"@vocab": "http://example.org/",
5+
"included": {"@id": "@included", "@container": "@set"}
6+
},
7+
"prop": "value",
8+
"included": [{
9+
"prop": "value2"
10+
}]
11+
}

tests/compact/in02-context.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.org/"
5+
}
6+
}

tests/compact/in02-in.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[{
2+
"http://example.org/prop": [{"@value": "value"}],
3+
"@included": [{
4+
"http://example.org/prop": [{"@value": "value2"}]
5+
}]
6+
}]

tests/compact/in02-out.jsonld

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.org/"
5+
},
6+
"prop": "value",
7+
"@included": {
8+
"prop": "value2"
9+
}
10+
}

tests/compact/in03-context.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.org/",
5+
"included": "@included"
6+
}
7+
}

tests/compact/in03-in.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[{
2+
"@included": [
3+
{"http://example.org/prop": [{"@value": "value1"}]},
4+
{"http://example.org/prop": [{"@value": "value2"}]}
5+
]
6+
}]

0 commit comments

Comments
 (0)