Skip to content

Commit cec9e5d

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 e256dd0 commit cec9e5d

11 files changed

+98
-2
lines changed

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,8 +2365,9 @@ <h3>Algorithm</h3>
23652365
<ol>
23662366
<li>Set <var>active context</var> to the result of the
23672367
<a href="#context-processing-algorithm">Context Processing algorithm</a>,
2368-
passing <var>active context</var> and the value of the
2369-
<var>active property</var>'s <a>local context</a> as <var>local context</var>.</li>
2368+
passing <var>active context</var>, the value of the
2369+
<var>active property</var>'s <a>local context</a> as <var>local context</var>,
2370+
<span class="changed">and <code>true</code> for <var>from term</var></span>.</li>
23702371
<li>Set <var>inverse context</var> using the
23712372
<a href="#inverse-context-creation">Inverse Context Creation algorithm</a>
23722373
using <var>active context</var>.</li>

tests/compact-manifest.jsonld

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,33 @@
15981598
"input": "compact/p008-in.jsonld",
15991599
"context": "compact/p008-context.jsonld",
16001600
"expect": "compact/p008-out.jsonld"
1601+
}, {
1602+
"@id": "#tpr01",
1603+
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
1604+
"name": "Check illegal clearing of context with protected terms",
1605+
"purpose": "Check error when clearing a context with protected terms.",
1606+
"option": {"specVersion": "json-ld-1.1"},
1607+
"input": "compact/pr01-in.jsonld",
1608+
"context": "compact/pr01-context.jsonld",
1609+
"expect": "invalid context nullification"
1610+
}, {
1611+
"@id": "#tpr03",
1612+
"@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"],
1613+
"name": "Check illegal overriding of protected term",
1614+
"purpose": "Check error when overriding a protected term.",
1615+
"option": {"specVersion": "json-ld-1.1"},
1616+
"input": "compact/pr02-in.jsonld",
1617+
"context": "compact/pr02-context.jsonld",
1618+
"expect": "protected term redefinition"
1619+
}, {
1620+
"@id": "#tpr04",
1621+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1622+
"name": "Check legal overriding of protected term from property-scoped context",
1623+
"purpose": "Check overriding a protected term from property-scoped context.",
1624+
"option": {"specVersion": "json-ld-1.1"},
1625+
"input": "compact/pr04-in.jsonld",
1626+
"context": "compact/pr04-context.jsonld",
1627+
"expect": "compact/pr04-out.jsonld"
16011628
}, {
16021629
"@id": "#tr001",
16031630
"@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)