Skip to content

Commit 6348f43

Browse files
committed
Add _from term_ to context processing from Compaction algorithm when _active property_ has a _local context_.
Add tests to be sure attempts to change a context with protected terms fail, unless from a scoped context used for a property.
1 parent 28eb774 commit 6348f43

11 files changed

+98
-2
lines changed

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,8 +2403,9 @@ <h3>Algorithm</h3>
24032403
<ol>
24042404
<li>Set <var>active context</var> to the result of the
24052405
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
2406-
passing <var>active context</var> and the value of the
2407-
<var>active property</var>'s <a>local context</a> as <var>local context</var>.</li>
2406+
passing <var>active context</var>, the value of the
2407+
<var>active property</var>'s <a>local context</a> as <var>local context</var>,
2408+
<span class="changed">and <code>true</code> for <var>from term</var></span>.</li>
24082409
<li>Set <var>inverse context</var> using the
24092410
<a href="#inverse-context-creation">Inverse Context Creation algorithm</a>
24102411
using <var>active context</var>.</li>

tests/compact-manifest.jsonld

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,33 @@
16521652
"input": "compact/pi06-in.jsonld",
16531653
"context": "compact/pi06-context.jsonld",
16541654
"expect": "compact/pi06-out.jsonld"
1655+
}, {
1656+
"@id": "#tpr01",
1657+
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
1658+
"name": "Check illegal clearing of context with protected terms",
1659+
"purpose": "Check error when clearing a context with protected terms.",
1660+
"option": {"specVersion": "json-ld-1.1"},
1661+
"input": "compact/pr01-in.jsonld",
1662+
"context": "compact/pr01-context.jsonld",
1663+
"expect": "invalid context nullification"
1664+
}, {
1665+
"@id": "#tpr03",
1666+
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
1667+
"name": "Check illegal overriding of protected term",
1668+
"purpose": "Check error when overriding a protected term.",
1669+
"option": {"specVersion": "json-ld-1.1"},
1670+
"input": "compact/pr02-in.jsonld",
1671+
"context": "compact/pr02-context.jsonld",
1672+
"expect": "protected term redefinition"
1673+
}, {
1674+
"@id": "#tpr04",
1675+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1676+
"name": "Check legal overriding of protected term from property-scoped context",
1677+
"purpose": "Check overriding a protected term from property-scoped context.",
1678+
"option": {"specVersion": "json-ld-1.1"},
1679+
"input": "compact/pr04-in.jsonld",
1680+
"context": "compact/pr04-context.jsonld",
1681+
"expect": "compact/pr04-out.jsonld"
16551682
}, {
16561683
"@id": "#tr001",
16571684
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],

tests/compact/pr01-context.jsonld

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

tests/compact/pr01-in.jsonld

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

tests/compact/pr02-context.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"@context": [{
3+
"@vocab": "http://example.com/",
4+
"@version": 1.1,
5+
"protected": {"@protected": true}
6+
}, {
7+
"protected": "http://example.com/protected"
8+
}]
9+
}

tests/compact/pr02-in.jsonld

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

tests/compact/pr03-context.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.com/",
5+
"protected": {"@protected": true},
6+
"Type": {"@context": {"protected": {"@type": "@id"},}}
7+
}
8+
}

tests/compact/pr03-in.jsonld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[{
2+
"http://example.com/protected": [{"@value": "p === http://example.com/protected"}],
3+
"http://example.com/unprotected": [{
4+
"@type": "http://example.com/Type",
5+
"http://example.com/protected": [{"@value": "p === http://example.com/protected"}]
6+
}]
7+
}]

tests/compact/pr04-context.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"@context": {
3+
"@version": 1.1,
4+
"@vocab": "http://example.com/",
5+
"protected": {"@protected": true},
6+
"unprotected": {"@context": {"protected": {"@language": "en"}}}
7+
}
8+
}

tests/compact/pr04-in.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[{
2+
"http://example.com/protected": [{"@value": "p === http://example.com/protected"}],
3+
"http://example.com/unprotected": [{
4+
"http://example.com/protected": [{
5+
"@value": "p === http://example.com/protected",
6+
"@language": "en"
7+
}]
8+
}]
9+
}]

tests/compact/pr04-out.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.com/",
5+
"protected": {"@protected": true},
6+
"unprotected": {
7+
"@context": {"protected": {"@language": "en"}}
8+
}
9+
},
10+
"protected": "p === http://example.com/protected",
11+
"unprotected": {
12+
"protected": "p === http://example.com/protected"
13+
}
14+
}

0 commit comments

Comments
 (0)