Skip to content

Commit b0ba962

Browse files
committed
Small refinement to detection of compact IRI terms that mis-map to provide for terms ending with a colon.
Modify, obsolete and add tests accordingly.
1 parent 44b08b2 commit b0ba962

17 files changed

+87
-24
lines changed

index.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,12 +1307,6 @@ <h3>Algorithm</h3>
13071307
i.e., it contains no colon (<code>:</code>), an
13081308
<a data-link-for="JsonLdErrorCode">invalid IRI mapping</a>
13091309
error has been detected and processing is aborted.</li>
1310-
<li class="changed">If the <var>term</var> contains a colon (<code>:</code>)
1311-
and the result of expanding <var>term</var>
1312-
using the <a href="#iri-expansion">IRI Expansion algorithm</a>
1313-
is not the same as the <a>IRI mapping</a> of <var>definition</var>,
1314-
an <a data-link-for="JsonLdErrorCode">invalid IRI mapping</a>
1315-
error has been detected and processing is aborted.</li>
13161310
<li>If <var>value</var> contains an <code>@container</code> <a>member</a>,
13171311
set the <a>container mapping</a> of <var>definition</var>
13181312
to its value; if its value is neither <code>@set</code>, nor
@@ -1348,6 +1342,7 @@ <h3>Algorithm</h3>
13481342
<a data-link-for="JsonLdErrorCode">invalid keyword alias</a>
13491343
error has been detected and processing is aborted.</li>
13501344
<li class="changed">If the <var>term</var> contains a colon (<code>:</code>)
1345+
anywhere but as the last character of <var>term</var>,
13511346
and the result of expanding <var>term</var>
13521347
using the <a href="#iri-expansion">IRI Expansion algorithm</a>
13531348
is not the same as the <a>IRI mapping</a> of <var>definition</var>,

tests/compact/ep09-context.jsonld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"@context": {
3-
"foo:bar": {"@id": "http://example/foo/bar/", "@prefix": true}
3+
"foo": "http://example/foo/",
4+
"foo:bar": {"@id": "http://example/foo/bar", "@prefix": true}
45
}
56
}

tests/compact/p007-context.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"@context": {
33
"foo": "http://example.org/",
4-
"foo:bar": "foo:baz/"
4+
"foo:bar": {"@type": "@id"}
55
}
66
}

tests/compact/p007-in.jsonld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"@id": "http://example.org/baz/a",
3-
"http://example.org/baz/b": "c"
2+
"@id": "http://example.org/bar/a",
3+
"http://example.org/bar/b": "c"
44
}

tests/compact/p007-out.jsonld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"@context": {
33
"foo": "http://example.org/",
4-
"foo:bar": "foo:baz/"
4+
"foo:bar": {"@type": "@id"}
55
},
6-
"@id": "foo:baz/a",
7-
"foo:baz/b": "c"
6+
"@id": "foo:bar/a",
7+
"foo:bar/b": "c"
88
}

tests/expand-manifest.jsonld

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@
187187
"name": "Term definition with @id: @type",
188188
"purpose": "Expanding term mapping to @type uses @type syntax",
189189
"input": "expand/0026-in.jsonld",
190-
"expect": "expand/0026-out.jsonld"
190+
"expect": "expand/0026-out.jsonld",
191+
"option": {"specVersion": "json-ld-1.0"}
191192
}, {
192193
"@id": "#t0027",
193194
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
@@ -502,7 +503,8 @@
502503
"name": "Redefine terms looking like compact IRIs",
503504
"purpose": "Term definitions may look like compact IRIs",
504505
"input": "expand/0071-in.jsonld",
505-
"expect": "expand/0071-out.jsonld"
506+
"expect": "expand/0071-out.jsonld",
507+
"option": {"specVersion": "json-ld-1.0"}
506508
}, {
507509
"@id": "#t0072",
508510
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
@@ -1225,6 +1227,22 @@
12251227
"purpose": "Verifies that an exception is raised on expansion when processing an invalid context attempting to define @container on a keyword",
12261228
"input": "expand/e042-in.jsonld",
12271229
"expect": "keyword redefinition"
1230+
}, {
1231+
"@id": "#te043",
1232+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
1233+
"name": "Term definition with @id: @type",
1234+
"purpose": "Expanding term mapping to @type uses @type syntax now illegal",
1235+
"input": "expand/e043-in.jsonld",
1236+
"expect": "invalid IRI mapping",
1237+
"option": {"specVersion": "json-ld-1.1"}
1238+
}, {
1239+
"@id": "#te044",
1240+
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
1241+
"name": "Redefine terms looking like compact IRIs",
1242+
"purpose": "Term definitions may look like compact IRIs, but must be consistent.",
1243+
"input": "expand/e044-in.jsonld",
1244+
"expect": "invalid IRI mapping",
1245+
"option": {"specVersion": "json-ld-1.1"}
12281246
}, {
12291247
"@id": "#tec01",
12301248
"@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ],

tests/expand/0025-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"@context": {
33
"foo": "http://example.com/foo/",
4-
"foo:bar": "http://example.com/bar",
4+
"foo:bar": "http://example.com/foo/bar",
55
"bar": {"@id": "foo:bar", "@type": "@id"},
66
"_": "http://example.com/underscore/"
77
},

tests/expand/0025-out.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[{
22
"@type": [
33
"http://example.com/foo/",
4-
"http://example.com/bar",
4+
"http://example.com/foo/bar",
55
"http://example.com/underscore/"
66
]
77
}]

tests/expand/e043-in.jsonld

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"@context": {
3+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {"@id": "@type", "@type": "@id"}
4+
},
5+
"@graph": [
6+
{
7+
"@id": "http://example.com/a",
8+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/b"
9+
}, {
10+
"@id": "http://example.com/c",
11+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
12+
"http://example.com/d",
13+
"http://example.com/e"
14+
]
15+
}, {
16+
"@id": "http://example.com/f",
17+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://example.com/g"
18+
}
19+
]
20+
}

tests/expand/e044-in.jsonld

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"@context": [
3+
{
4+
"v": "http://example.com/vocab#",
5+
"v:term": "v:somethingElse",
6+
"v:termId": { "@id": "v:somethingElseId" }
7+
}
8+
],
9+
"v:term": "value of v:term",
10+
"v:termId": "value of v:termId"
11+
}

tests/expand/e045-in.jsonld

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@context": [
3+
{
4+
"v": "http://example.com/vocab#",
5+
"v:term": "v:somethingElse",
6+
"v:termId": { "@id": "v:somethingElseId" }
7+
},
8+
{
9+
"v:term": "v:term",
10+
"v:termId": { "@id": "v:termId" }
11+
}
12+
],
13+
"v:term": "value of v:term",
14+
"v:termId": "value of v:termId"
15+
}

tests/flatten-manifest.jsonld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@
187187
"name": "Term definition with @id: @type",
188188
"purpose": "Flattening term mapping to @type uses @type syntax",
189189
"input": "flatten/0026-in.jsonld",
190-
"expect": "flatten/0026-out.jsonld"
190+
"expect": "flatten/0026-out.jsonld",
191+
"option": {"specVersion": "json-ld-1.0"}
191192
}, {
192193
"@id": "#t0027",
193194
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],

tests/flatten/0025-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"@context": {
33
"foo": "http://example.com/foo/",
4-
"foo:bar": "http://example.com/bar",
4+
"foo:bar": "http://example.com/foo/bar",
55
"bar": {"@id": "foo:bar", "@type": "@id"},
66
"_": "http://example.com/underscore/"
77
},

tests/flatten/0025-out.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@id": "_:b0",
44
"@type": [
55
"http://example.com/foo/",
6-
"http://example.com/bar",
6+
"http://example.com/foo/bar",
77
"http://example.com/underscore/"
88
]
99
}

tests/toRdf-manifest.jsonld

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@
432432
"name": "Expanding term mapping to @type uses @type syntax",
433433
"purpose": "RDF version of expand-0026",
434434
"input": "toRdf/0066-in.jsonld",
435-
"expect": "toRdf/0066-out.nq"
435+
"expect": "toRdf/0066-out.nq",
436+
"option": {"specVersion": "json-ld-1.0"}
436437
}, {
437438
"@id": "#t0067",
438439
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],
@@ -748,7 +749,8 @@
748749
"name": "Redefine terms looking like compact IRIs",
749750
"purpose": "RDF version of expand-0071",
750751
"input": "toRdf/0111-in.jsonld",
751-
"expect": "toRdf/0111-out.nq"
752+
"expect": "toRdf/0111-out.nq",
753+
"option": {"specVersion": "json-ld-1.0"}
752754
}, {
753755
"@id": "#t0112",
754756
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],

tests/toRdf/0065-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"@context": {
33
"foo": "http://example.com/foo/",
4-
"foo:bar": "http://example.com/bar",
4+
"foo:bar": "http://example.com/foo/bar",
55
"bar": {"@id": "foo:bar", "@type": "@id"},
66
"_": "http://example.com/underscore/"
77
},

tests/toRdf/0065-out.nq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/bar> .
21
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/> .
2+
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/bar> .
33
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/underscore/> .

0 commit comments

Comments
 (0)