Skip to content

Commit 11d9098

Browse files
committed
Adds text for @source and expansion tests including with @propagate.
1 parent 31f65d5 commit 11d9098

16 files changed

+211
-19
lines changed

index.html

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,34 @@ <h3>Algorithm</h3>
11801180
<li>If <var>context</var> is not a <a class="changed">dictionary</a>, an
11811181
<a data-link-for="JsonLdErrorCode">invalid local context</a>
11821182
error has been detected and processing is aborted.</li>
1183+
<li class="changed">If <var>context</var> has an <code>@version</code> <a>member</a>:
1184+
<ol>
1185+
<li>If the associated value is not <code>1.1</code>,
1186+
an <a data-link-for="JsonLdErrorCode">invalid @version value</a>
1187+
has been detected, and processing is aborted.</li>
1188+
<li>If <a>processing mode</a>
1189+
is set to <code>json-ld-1.0</code>,
1190+
a <a data-link-for="JsonLdErrorCode">processing mode conflict</a>
1191+
error has been detected and processing is aborted.</li>
1192+
<li>Set <a>processing mode</a>,
1193+
to <code>json-ld-1.1</code>, if not already set.</li>
1194+
</ol>
1195+
</li>
1196+
<li class="changed">If <var>context</var> has a <code>@source</code> <a>member</a>:
1197+
<ol>
1198+
<li>If <a>processing mode</a> is <code>json-ld-1.0</code>,
1199+
an <a data-link-for="JsonLdErrorCode">invalid context member</a>
1200+
error has been detected and processing is aborted.</li>
1201+
<li>Otherwise, if its value is not a <a>string</a>,
1202+
an <a data-link-for="JsonLdErrorCode">invalid @source value</a>
1203+
error has been detected and processing is aborted.</li>
1204+
<li>Otherwise, set <var>result</var> to the result of recursively calling this algorithm,
1205+
passing <var>result</var> for <var>active context</var>,
1206+
the value of <code>@source</code> for <var>local context</var>,
1207+
and a copy of <var>remote contexts</var>.
1208+
</li>
1209+
</ol>
1210+
</li>
11831211
<li>If <var>context</var> has an <code>@base</code> <a>member</a> and <var>remote contexts</var> is empty, i.e., the currently
11841212
being processed context is not a remote context:
11851213
<ol>
@@ -1199,19 +1227,6 @@ <h3>Algorithm</h3>
11991227
error has been detected and processing is aborted.</li>
12001228
</ol>
12011229
</li>
1202-
<li class="changed">If <var>context</var> has an <code>@version</code> <a>member</a>:
1203-
<ol>
1204-
<li>If the associated value is not <code>1.1</code>,
1205-
an <a data-link-for="JsonLdErrorCode">invalid @version value</a>
1206-
has been detected, and processing is aborted.</li>
1207-
<li>If <a>processing mode</a>
1208-
is set to <code>json-ld-1.0</code>,
1209-
a <a data-link-for="JsonLdErrorCode">processing mode conflict</a>
1210-
error has been detected and processing is aborted.</li>
1211-
<li>Set <a>processing mode</a>,
1212-
to <code>json-ld-1.1</code>, if not already set.</li>
1213-
</ol>
1214-
</li>
12151230
<li>If <var>context</var> has an <code>@vocab</code> <a>member</a>:
12161231
<ol>
12171232
<li>Initialize <var>value</var> to the value associated with the
@@ -1249,12 +1264,18 @@ <h3>Algorithm</h3>
12491264
error has been detected and processing is aborted.</li>
12501265
</ol>
12511266
</li>
1252-
<li>If <var>context</var> has a <code>@propagate</code> <a>member</a>
1253-
and its value is not <a>boolean</a> <code>true</code> or <code>false</code>,
1254-
or <a>processing mode</a> is <code>json-ld-1.0</code>,
1255-
an <a data-link-for="JsonLdErrorCode">invalid local context</a>
1256-
error has been detected and processing is aborted.
1257-
<span class="note"><var>previous context</var> was determined before.</span></li>
1267+
<li class="changed">If <var>context</var> has a <code>@propagate</code> <a>member</a>:
1268+
<ol>
1269+
<li>If <a>processing mode</a> is <code>json-ld-1.0</code>,
1270+
an <a data-link-for="JsonLdErrorCode">invalid context member</a>
1271+
error has been detected and processing is aborted.</li>
1272+
<li>Otherwise, if its value is not <a>boolean</a> <code>true</code> or <code>false</code>,
1273+
an <a data-link-for="JsonLdErrorCode">invalid @propagate value</a>
1274+
error has been detected and processing is aborted.</li>
1275+
<li>Otherwise, <var>previous context</var> was determined before,
1276+
and no further processing is necessary.</li>
1277+
</ol>
1278+
</li>
12581279
<li>Create a <a class="changed">dictionary</a> <var>defined</var> to use to keep
12591280
track of whether or not a <a>term</a> has already been defined
12601281
or currently being defined during recursion.</li>
@@ -5930,10 +5951,13 @@ <h4>JsonLdErrorCode</h4>
59305951
"invalid @index value",
59315952
"invalid @nest value",
59325953
"invalid @prefix value",
5954+
"invalid @propagate value",
59335955
"invalid @reverse value",
5956+
"invalid @source value",
59345957
"invalid @version value",
59355958
"invalid base IRI",
59365959
"invalid container mapping",
5960+
"invalid context member",
59375961
"invalid context nullification",
59385962
"invalid default language",
59395963
"invalid IRI mapping",
@@ -5986,9 +6010,13 @@ <h4>JsonLdErrorCode</h4>
59866010
<dd class="changed">An invalid value for <code>@nest</code> has been found.</dd>
59876011
<dt class="changed"><dfn>invalid @prefix value</dfn></dt>
59886012
<dd class="changed">An invalid value for <code>@prefix</code> has been found.</dd>
6013+
<dt class="changed"><dfn>invalid @propagate value</dfn></dt>
6014+
<dd class="changed">An invalid value for <code>@propagate</code> has been found.</dd>
59896015
<dt><dfn>invalid @reverse value</dfn></dt>
59906016
<dd>An invalid value for an <code>@reverse</code> <a>member</a> has been detected,
59916017
i.e., the value was not a <a class="changed">dictionary</a>.</dd>
6018+
<dt class="changed"><dfn>invalid @source value</dfn></dt>
6019+
<dd class="changed">An invalid value for <code>@source</code> has been found.</dd>
59926020
<dt><dfn>invalid @version value</dfn></dt>
59936021
<dd>The <code>@version</code> <a>member</a> was used in a <a>context</a>
59946022
with an out of range value.</dd>
@@ -6083,6 +6111,8 @@ <h4>JsonLdErrorCode</h4>
60836111
which is incompatible with the previous specified version.</dd>
60846112
<dt><dfn>context overflow</dfn></dt>
60856113
<dd>maximum number of <code>@context</code> URLs exceeded.</dd>
6114+
<dt class="changed"><dfn>invalid context member</dfn></dt>
6115+
<dd class="changed">A member of a context is invalid due to processing mode incompatibility.</dd>
60866116
<dt class="changed"><dfn>invalid context nullification</dfn></dt>
60876117
<dd class="changed">An attempt was made to nullify a context
60886118
containing <a>protected</a> <a>term definitions</a>.</dd>
@@ -6240,6 +6270,9 @@ <h2>Changes since JSON-LD Community Group Final Report</h2>
62406270
<li>By default, all contexts are propagated when traversing <a>node objects</a>, other than
62416271
type-scoped contexts. This can be controlled using the <code>@propagate</code>
62426272
<a>member</a> in a <a>local context</a>.</li>
6273+
<li>A context may contain a <code>@source</code> member used to reference a remote context
6274+
within a context, allowing <code>JSON-LD 1.1</code> features to be added to contexts originally
6275+
authored for <code>JSON-LD 1.0</code>.</li>
62436276
</ul>
62446277
</section>
62456278

tests/expand-manifest.jsonld

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,22 @@
10641064
"input": "expand/c028-in.jsonld",
10651065
"expect": "expand/c028-out.jsonld",
10661066
"option": {"specVersion": "json-ld-1.1"}
1067+
}, {
1068+
"@id": "#tc029",
1069+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
1070+
"name": "@propagate is invalid in 1.0",
1071+
"purpose": "@propagate is invalid in 1.0",
1072+
"input": "expand/c029-in.jsonld",
1073+
"expect": "invalid context member",
1074+
"option": {"specVersion": "json-ld-1.1"}
1075+
}, {
1076+
"@id": "#tc029",
1077+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
1078+
"name": "@propagate must be boolean valued",
1079+
"purpose": "@propagate must be boolean valued",
1080+
"input": "expand/c030-in.jsonld",
1081+
"expect": "invalid @propagate value",
1082+
"option": {"specVersion": "json-ld-1.1"}
10671083
}, {
10681084
"@id": "#te001",
10691085
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],
@@ -2379,6 +2395,54 @@
23792395
"option": {"specVersion": "json-ld-1.1"},
23802396
"input": "expand/pr29-in.jsonld",
23812397
"expect": "expand/pr29-out.jsonld"
2398+
}, {
2399+
"@id": "#tso01",
2400+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2401+
"name": "@source is invalid in 1.0.",
2402+
"purpose": "@source is invalid in 1.0.",
2403+
"option": {"specVersion": "json-ld-1.1"},
2404+
"input": "expand/so01-in.jsonld",
2405+
"expect": "invalid context member"
2406+
}, {
2407+
"@id": "#tso02",
2408+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2409+
"name": "@source must be a string",
2410+
"purpose": "@source must be a string.",
2411+
"option": {"specVersion": "json-ld-1.1"},
2412+
"input": "expand/so02-in.jsonld",
2413+
"expect": "invalid @source value"
2414+
}, {
2415+
"@id": "#tso03",
2416+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
2417+
"name": "@source overflow",
2418+
"purpose": "Processors must detect overflowing context loads through @source.",
2419+
"option": {"specVersion": "json-ld-1.1"},
2420+
"input": "expand/so03-in.jsonld",
2421+
"expect": "maximum number of @context URLs exceeded"
2422+
}, {
2423+
"@id": "#tso04",
2424+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
2425+
"name": "Embedded context with @source",
2426+
"purpose": "An embedded context may load another context using @source.",
2427+
"option": {"specVersion": "json-ld-1.1"},
2428+
"input": "expand/so04-in.jsonld",
2429+
"expect": "expand/so04-out.jsonld"
2430+
}, {
2431+
"@id": "#tso05",
2432+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
2433+
"name": "@propagate: true on type-scoped context with @source",
2434+
"purpose": "type-scoped context with @propagate: true survive node-objects (with @source)",
2435+
"input": "expand/so05-in.jsonld",
2436+
"expect": "expand/so05-out.jsonld",
2437+
"option": {"specVersion": "json-ld-1.1"}
2438+
}, {
2439+
"@id": "#tso06",
2440+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
2441+
"name": "@propagate: false on property-scoped context with @source",
2442+
"purpose": "property-scoped context with @propagate: false do not survive node-objects (with @source)",
2443+
"input": "expand/so06-in.jsonld",
2444+
"expect": "expand/so06-out.jsonld",
2445+
"option": {"specVersion": "json-ld-1.1"}
23822446
}, {
23832447
"@id": "#ttn01",
23842448
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],

tests/expand/c029-in.jsonld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"@context": {
3+
"@propagate": true
4+
}
5+
}

tests/expand/c030-in.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+
"@propagate": "not boolean"
5+
}
6+
}

tests/expand/so01-in.jsonld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"@context": {
3+
"@source": "so01-in.jsonld"
4+
}
5+
}

tests/expand/so02-in.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+
"@source": {}
5+
}
6+
}

tests/expand/so03-in.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+
"@source": "so03-in.jsonld"
5+
}
6+
}

tests/expand/so04-context.jsonld

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

tests/expand/so04-in.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+
"@source": "so04-context.jsonld"
5+
},
6+
"property": "value"
7+
}

tests/expand/so04-out.jsonld

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

tests/expand/so05-context.jsonld

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

tests/expand/so05-in.jsonld

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example/",
5+
"Foo": {
6+
"@context": {
7+
"@source": "so05-context.jsonld",
8+
"@propagate": true
9+
}
10+
}
11+
},
12+
"@type": "Foo",
13+
"bar": {"baz": "buzz"}
14+
}

tests/expand/so05-out.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"@type": ["http://example/Foo"],
4+
"http://example/bar": [{
5+
"http://example.org/baz": [{"@id": "http://example/buzz"}]
6+
}]
7+
}
8+
]

tests/expand/so06-context.jsonld

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"@context": {
3+
"baz": {"@id": "http://example.com/baz", "@type": "@id"}
4+
}
5+
}

tests/expand/so06-in.jsonld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example/",
5+
"bar": {
6+
"@context": {
7+
"@source": "so06-context.jsonld",
8+
"@propagate": false
9+
}
10+
}
11+
},
12+
"bar": {"baz": {"baz": "buzz"}}
13+
}

tests/expand/so06-out.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[{
2+
"http://example/bar": [{
3+
"http://example.com/baz": [{
4+
"http://example/baz": [{"@value": "buzz"}]
5+
}]
6+
}]
7+
}]

0 commit comments

Comments
 (0)