Skip to content

Commit c482f45

Browse files
committed
Update tests and Expand IRI to not consider terms where the _prefix flag_ is false when considering Compact IRIs.
Fixes w3c/json-ld-wg#90 and fixes w3c/json-ld-wg#87.
1 parent 1466f97 commit c482f45

11 files changed

+42
-12
lines changed

index.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,9 +1695,13 @@ <h3>Algorithm</h3>
16951695
<a href="#context-processing-algorithm">Context Processing</a>.</li>
16961696
<li>If <var>active context</var> contains a <a>term definition</a>
16971697
for <var>prefix</var>
1698-
<span class="changed">having a non-<code>null</code> <a>IRI mapping</a></span>,
1698+
<span class="changed">having a non-<code>null</code> <a>IRI mapping</a>
1699+
and the <a>prefix flag</a> of the <a>term definition</a> is <code>true</code></span>,
16991700
return the result of concatenating the <a>IRI mapping</a>
1700-
associated with <var>prefix</var> and <var>suffix</var>.</li>
1701+
associated with <var>prefix</var> and <var>suffix</var>.
1702+
<p class="ednote">A more conservative change, although more involved,
1703+
would to restrict looking at the <a>prefix flag</a> unless
1704+
the <a>processing mode</a> is <code>json-ld-1.1</code>.</p></li>
17011705
<li><span class="changed">If <var>value</var> has the form of an <a>absolute IRI</a></span>,
17021706
return <var>value</var>.</li>
17031707
</ol>

tests/expand-manifest.jsonld

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
272272
"name": "Expanding blank node labels",
273273
"purpose": "Blank nodes are not relabeled during expansion",
274-
"option": {"processingMode": "json-ld-1.0"},
274+
"option": {"specVersion": "json-ld-1.0"},
275275
"input": "expand/0038-in.jsonld",
276276
"expect": "expand/0038-out.jsonld"
277277
}, {
@@ -2347,6 +2347,14 @@
23472347
"option": {"specVersion": "json-ld-1.1"},
23482348
"input": "expand/pr28-in.jsonld",
23492349
"expect": "protected term redefinition"
2350+
}, {
2351+
"@id": "#tpr29",
2352+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
2353+
"name": "Does not expand a Compact IRI using a non-prefix term.",
2354+
"purpose": "Expansion of Compact IRIs considers if the term can be used as a prefix.",
2355+
"option": {"specVersion": "json-ld-1.1"},
2356+
"input": "expand/pr29-in.jsonld",
2357+
"expect": "expand/pr29-out.jsonld"
23502358
}, {
23512359
"@id": "#ttn01",
23522360
"@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],

tests/expand/0014-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"set": "@set",
1414
"value": "@value",
1515
"type": "@type",
16-
"xsd": { "@id": "http://www.w3.org/2001/XMLSchema#" }
16+
"xsd": "http://www.w3.org/2001/XMLSchema#"
1717
},
1818
"property1": {
1919
"uri": "ex:example2",

tests/expand/0048-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"@context": {
33
"term": "http://example.com/terms-are-not-considered-in-id",
4-
"compact-iris": "http://example.com/compact-iris-",
4+
"compact-iris": "http://example.com/compact-iris#",
55
"property": "http://example.com/property",
66
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
77
},

tests/expand/0048-out.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@id": "https://w3c.github.io/json-ld-api/tests/expand/term",
44
"http://example.com/property": [
55
{
6-
"@id": "http://example.com/compact-iris-are-considered",
6+
"@id": "http://example.com/compact-iris#are-considered",
77
"http://example.com/property": [
88
{ "@value": "@id supports the following values: relative, absolute, and compact IRIs" }
99
]

tests/expand/pr29-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+
"tag": {"@id": "http://example.org/ns/tag/", "@prefix": false}
5+
},
6+
"tag:champin.net,2019:prop": "This is not treated as a Compact IRI"
7+
}

tests/expand/pr29-out.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
{
3+
"tag:champin.net,2019:prop": [
4+
{
5+
"@value": "This is not treated as a Compact IRI"
6+
}
7+
]
8+
}
9+
]

tests/flatten-manifest.jsonld

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"name": "@set of @value objects with keyword aliases",
104104
"purpose": "Flattening aliased @set and @value",
105105
"input": "flatten/0014-in.jsonld",
106-
"expect": "flatten/0014-out.jsonld"
106+
"expect": "flatten/0014-out.jsonld",
107+
"option": {"specVersion": "json-ld-1.0"}
107108
}, {
108109
"@id": "#t0015",
109110
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
@@ -264,7 +265,7 @@
264265
"@type": ["jld:PositiveEvaluationTest", "jld:FlattenTest"],
265266
"name": "Flattening blank node labels",
266267
"purpose": "Blank nodes are not relabeled during expansion",
267-
"option": {"processingMode": "json-ld-1.0"},
268+
"option": {"specVersion": "json-ld-1.0"},
268269
"input": "flatten/0038-in.jsonld",
269270
"expect": "flatten/0038-out.jsonld"
270271
}, {

tests/toRdf-manifest.jsonld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@
348348
"name": "@set of @value objects with keyword aliases",
349349
"purpose": "RDF version of expand-0014",
350350
"input": "toRdf/0054-in.jsonld",
351-
"expect": "toRdf/0054-out.nq"
351+
"expect": "toRdf/0054-out.nq",
352+
"option": {"specVersion": "json-ld-1.0"}
352353
}, {
353354
"@id": "#t0055",
354355
"@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"],

tests/toRdf/0088-in.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"@context": {
33
"term": "http://example.com/terms-are-not-considered-in-id",
4-
"compact-iris": "http://example.com/compact-iris-",
4+
"compact-iris": "http://example.com/compact-iris#",
55
"property": "http://example.com/property",
66
"@vocab": "http://example.org/vocab-is-not-considered-for-id"
77
},

tests/toRdf/0088-out.nq

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<http://example.com/compact-iris-are-considered> <http://example.com/property> "@id supports the following values: relative, absolute, and compact IRIs" .
1+
<http://example.com/compact-iris#are-considered> <http://example.com/property> "@id supports the following values: relative, absolute, and compact IRIs" .
22
<https://w3c.github.io/json-ld-api/tests/parent-node> <http://example.com/property> "relative IRIs get resolved against the document's base IRI" .
3-
<https://w3c.github.io/json-ld-api/tests/toRdf/term> <http://example.com/property> <http://example.com/compact-iris-are-considered> .
3+
<https://w3c.github.io/json-ld-api/tests/toRdf/term> <http://example.com/property> <http://example.com/compact-iris#are-considered> .
44
<https://w3c.github.io/json-ld-api/tests/toRdf/term> <http://example.com/property> <https://w3c.github.io/json-ld-api/tests/parent-node> .

0 commit comments

Comments
 (0)