From 2122c34197bbbff5e3bb7095fe90495831ec7aa9 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Thu, 28 Feb 2019 21:01:27 -0500 Subject: [PATCH 1/7] Make `@protected` test strict. - Check for errors when `@protected` conditions are violated. --- tests/expand-manifest.jsonld | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 2ab66bfa..52880e83 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1963,12 +1963,12 @@ "expect": "expand/li10-out.jsonld" }, { "@id": "#tpr01", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Protect a term", "purpose": "Protected Contexts", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr01-in.jsonld", - "expect": "expand/pr01-out.jsonld" + "expect": "protected term redefinition" }, { "@id": "#tpr02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -1979,28 +1979,28 @@ "expect": "expand/pr02-out.jsonld" }, { "@id": "#tpr03", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Protect all terms in context", "purpose": "A protected context protects all term definitions.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr03-in.jsonld", - "expect": "expand/pr03-out.jsonld" + "expect": "protected term redefinition" }, { "@id": "#tpr04", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Do not protect term with @protected: false", "purpose": "A protected context does not protect terms with @protected: false.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr04-in.jsonld", - "expect": "expand/pr04-out.jsonld" + "expect": "protected term redefinition" }, { "@id": "#tpr05", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Clear active context with protected terms from an embedded context", "purpose": "The Active context be set to null from an embedded context.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr05-in.jsonld", - "expect": "expand/pr05-out.jsonld" + "expect": "invalid context nullification" }, { "@id": "#tpr06", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2011,20 +2011,20 @@ "expect": "expand/pr06-out.jsonld" }, { "@id": "#tpr08", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Term with protected scoped context.", "purpose": "A scoped context can protect terms.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr08-in.jsonld", - "expect": "expand/pr08-out.jsonld" + "expect": "protected term redefinition" }, { "@id": "#tpr09", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Attempt to redefine term in other protected context.", "purpose": "A protected term cannot redefine another protected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr09-in.jsonld", - "expect": "expand/pr09-out.jsonld" + "expect": "protected term redefinition" }, { "@id": "#ttn01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], From c72fe5c503764db4a4d014f5d07ebbe281d388e6 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Thu, 28 Feb 2019 21:04:16 -0500 Subject: [PATCH 2/7] Add more `@protected` tests. --- tests/expand-manifest.jsonld | 56 ++++++++++++++++++++++++++++++++++++ tests/expand/pr10-in.jsonld | 14 +++++++++ tests/expand/pr10-out.jsonld | 18 ++++++++++++ tests/expand/pr11-in.jsonld | 17 +++++++++++ tests/expand/pr11-out.jsonld | 1 + tests/expand/pr12-in.jsonld | 15 ++++++++++ tests/expand/pr12-out.jsonld | 1 + tests/expand/pr13-in.jsonld | 18 ++++++++++++ tests/expand/pr13-out.jsonld | 18 ++++++++++++ tests/expand/pr14-in.jsonld | 18 ++++++++++++ tests/expand/pr14-out.jsonld | 18 ++++++++++++ tests/expand/pr15-in.jsonld | 22 ++++++++++++++ tests/expand/pr15-out.jsonld | 1 + tests/expand/pr16-in.jsonld | 19 ++++++++++++ tests/expand/pr16-out.jsonld | 1 + 15 files changed, 237 insertions(+) create mode 100644 tests/expand/pr10-in.jsonld create mode 100644 tests/expand/pr10-out.jsonld create mode 100644 tests/expand/pr11-in.jsonld create mode 100644 tests/expand/pr11-out.jsonld create mode 100644 tests/expand/pr12-in.jsonld create mode 100644 tests/expand/pr12-out.jsonld create mode 100644 tests/expand/pr13-in.jsonld create mode 100644 tests/expand/pr13-out.jsonld create mode 100644 tests/expand/pr14-in.jsonld create mode 100644 tests/expand/pr14-out.jsonld create mode 100644 tests/expand/pr15-in.jsonld create mode 100644 tests/expand/pr15-out.jsonld create mode 100644 tests/expand/pr16-in.jsonld create mode 100644 tests/expand/pr16-out.jsonld diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 52880e83..b553635e 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -2025,6 +2025,62 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr09-in.jsonld", "expect": "protected term redefinition" + }, { + "@id": "#tpr10", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr10-in.jsonld", + "expect": "expand/pr10-out.jsonld" + }, { + "@id": "#tpr11", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr11-in.jsonld", + "expect": "protected term redefinition" + }, { + "@id": "#tpr12", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr12-in.jsonld", + "expect": "protected term redefinition" + }, { + "@id": "#tpr13", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr13-in.jsonld", + "expect": "expand/pr13-out.jsonld" + }, { + "@id": "#tpr14", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr14-in.jsonld", + "expect": "expand/pr14-out.jsonld" + }, { + "@id": "#tpr15", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr15-in.jsonld", + "expect": "invalid context nullification" + }, { + "@id": "#tpr16", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "", + "purpose": "", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr16-in.jsonld", + "expect": "invalid context nullification" }, { "@id": "#ttn01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pr10-in.jsonld b/tests/expand/pr10-in.jsonld new file mode 100644 index 00000000..a8933fe3 --- /dev/null +++ b/tests/expand/pr10-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "@version": 1.1, + "protected": { + "@id": "ex:protected", + "@protected": true + }, + "unprotected": "ex:unprotected" + }, + "protected": "p === ex:protected", + "unprotected": { + "protected": "p === ex:protected" + } +} diff --git a/tests/expand/pr10-out.jsonld b/tests/expand/pr10-out.jsonld new file mode 100644 index 00000000..3f10151e --- /dev/null +++ b/tests/expand/pr10-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "ex:protected": [ + { + "@value": "p === ex:protected" + } + ], + "ex:unprotected": [ + { + "ex:protected": [ + { + "@value": "p === ex:protected" + } + ] + } + ] + } +] diff --git a/tests/expand/pr11-in.jsonld b/tests/expand/pr11-in.jsonld new file mode 100644 index 00000000..de185630 --- /dev/null +++ b/tests/expand/pr11-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "protected": { + "@id": "ex:protected", + "@protected": true + }, + "unprotected": "ex:unprotected" + }, + "protected": "p === ex:protected", + "unprotected": { + "@context": { + "protected": "ex:protected2" + }, + "protected": "p === ex:protected" + } +} diff --git a/tests/expand/pr11-out.jsonld b/tests/expand/pr11-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/pr11-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/pr12-in.jsonld b/tests/expand/pr12-in.jsonld new file mode 100644 index 00000000..c4af2629 --- /dev/null +++ b/tests/expand/pr12-in.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": "ex:protected2" + }, + "protected1": "p1", + "protected2": { + "@context": { + "protected1": "ex:protected1:error" + }, + "protected1": "p1error" + } +} diff --git a/tests/expand/pr12-out.jsonld b/tests/expand/pr12-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/pr12-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/pr13-in.jsonld b/tests/expand/pr13-in.jsonld new file mode 100644 index 00000000..6f8ff006 --- /dev/null +++ b/tests/expand/pr13-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected": "ex:protected", + "unprotected": { + "@id": "ex:unprotected1", + "@protected": false + } + }, + "protected": { + "@context": { + "unprotected": "ex:unprotected2" + }, + "unprotected": "p === ex:unprotected2" + }, + "unprotected": "p === ex:unprotected1" +} diff --git a/tests/expand/pr13-out.jsonld b/tests/expand/pr13-out.jsonld new file mode 100644 index 00000000..256cc41a --- /dev/null +++ b/tests/expand/pr13-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "ex:protected": [ + { + "ex:unprotected2": [ + { + "@value": "p === ex:unprotected2" + } + ] + } + ], + "ex:unprotected1": [ + { + "@value": "p === ex:unprotected1" + } + ] + } +] diff --git a/tests/expand/pr14-in.jsonld b/tests/expand/pr14-in.jsonld new file mode 100644 index 00000000..a3a1caf3 --- /dev/null +++ b/tests/expand/pr14-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": { + "@id": "ex:protected2", + "@context": [null] + } + }, + "protected1": "p === ex:protected1", + "protected2": { + "@context": { + "protected": "ex:protected3" + }, + "protected": "p === ex:protected3" + } +} diff --git a/tests/expand/pr14-out.jsonld b/tests/expand/pr14-out.jsonld new file mode 100644 index 00000000..52c399e9 --- /dev/null +++ b/tests/expand/pr14-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "ex:protected1": [ + { + "@value": "p === ex:protected1" + } + ], + "ex:protected2": [ + { + "ex:protected3": [ + { + "@value": "p === ex:protected3" + } + ] + } + ] + } +] diff --git a/tests/expand/pr15-in.jsonld b/tests/expand/pr15-in.jsonld new file mode 100644 index 00000000..196da8bd --- /dev/null +++ b/tests/expand/pr15-in.jsonld @@ -0,0 +1,22 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": "ex:protected2", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null + ] + } + }, + "protected1": "p === protected1", + "protected2": { + "@type": "Protected", + "@context": { + "protected": "ex:protected3" + }, + "protected": "error" + } +} diff --git a/tests/expand/pr15-out.jsonld b/tests/expand/pr15-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/pr15-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/pr16-in.jsonld b/tests/expand/pr16-in.jsonld new file mode 100644 index 00000000..0f7571ae --- /dev/null +++ b/tests/expand/pr16-in.jsonld @@ -0,0 +1,19 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": "ex:protected2", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null, + { + "protected": "ex:protected3" + } + ] + } + }, + "@type": "Protected", + "protected": "error" +} diff --git a/tests/expand/pr16-out.jsonld b/tests/expand/pr16-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/pr16-out.jsonld @@ -0,0 +1 @@ +[] From 2d4cc1e04021b8964532106e693df0c14f209ac3 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Fri, 8 Mar 2019 22:18:37 -0500 Subject: [PATCH 3/7] Add more `@protected` tests. - Simplify text in older tests. - Support 'protectedMode' option of 'error' or 'warn'. - Test both 'protectedMode' types where needed. - Using 'e' or 'w' suffix for test id but same input file. - Add more tests of various situations. --- tests/expand-manifest.jsonld | 210 +++++++++++++++++++++++++++++------ tests/expand/pr01-in.jsonld | 10 +- tests/expand/pr01-out.jsonld | 2 +- tests/expand/pr02-in.jsonld | 14 ++- tests/expand/pr02-out.jsonld | 2 +- tests/expand/pr03-in.jsonld | 12 +- tests/expand/pr03-out.jsonld | 4 +- tests/expand/pr04-in.jsonld | 12 +- tests/expand/pr04-out.jsonld | 4 +- tests/expand/pr05-in.jsonld | 9 +- tests/expand/pr05-out.jsonld | 2 +- tests/expand/pr06-in.jsonld | 9 +- tests/expand/pr08-in.jsonld | 28 +++-- tests/expand/pr08-out.jsonld | 4 +- tests/expand/pr09-in.jsonld | 6 +- tests/expand/pr09-out.jsonld | 2 +- tests/expand/pr11-out.jsonld | 19 +++- tests/expand/pr12-in.jsonld | 4 +- tests/expand/pr12-out.jsonld | 19 +++- tests/expand/pr14-in.jsonld | 6 +- tests/expand/pr15-in.jsonld | 12 +- tests/expand/pr15-out.jsonld | 19 +++- tests/expand/pr16-in.jsonld | 23 +++- tests/expand/pr16-out.jsonld | 29 ++++- tests/expand/pr17-in.jsonld | 22 ++++ tests/expand/pr17-out.jsonld | 16 +++ tests/expand/pr18-in.jsonld | 18 +++ tests/expand/pr18-out.jsonld | 12 ++ tests/expand/pr19-in.jsonld | 29 +++++ tests/expand/pr19-out.jsonld | 23 ++++ tests/expand/pr20-in.jsonld | 24 ++++ tests/expand/pr20-out.jsonld | 17 +++ tests/expand/pr21-in.jsonld | 20 ++++ tests/expand/pr21-out.jsonld | 12 ++ 34 files changed, 557 insertions(+), 97 deletions(-) create mode 100644 tests/expand/pr17-in.jsonld create mode 100644 tests/expand/pr17-out.jsonld create mode 100644 tests/expand/pr18-in.jsonld create mode 100644 tests/expand/pr18-out.jsonld create mode 100644 tests/expand/pr19-in.jsonld create mode 100644 tests/expand/pr19-out.jsonld create mode 100644 tests/expand/pr20-in.jsonld create mode 100644 tests/expand/pr20-out.jsonld create mode 100644 tests/expand/pr21-in.jsonld create mode 100644 tests/expand/pr21-out.jsonld diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index b553635e..dc70e5f0 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1962,13 +1962,21 @@ "input": "expand/li10-in.jsonld", "expect": "expand/li10-out.jsonld" }, { - "@id": "#tpr01", + "@id": "#tpr01e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Protect a term", - "purpose": "Protected Contexts", + "name": "Protected a term (error mode)", + "purpose": "Check 'error' mode when overriding a protected term. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr01-in.jsonld", "expect": "protected term redefinition" + }, { + "@id": "#tpr01w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Protected a term (warn mode)", + "purpose": "Check 'warn' mode when overriding a protected term. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr01-in.jsonld", + "expect": "expand/pr01-out.jsonld" }, { "@id": "#tpr02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -1978,29 +1986,53 @@ "input": "expand/pr02-in.jsonld", "expect": "expand/pr02-out.jsonld" }, { - "@id": "#tpr03", + "@id": "#tpr03e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Protect all terms in context", - "purpose": "A protected context protects all term definitions.", + "name": "Protect all terms in context (error mode)", + "purpose": "A protected context protects all term definitions. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr03-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr04", + "@id": "#tpr03w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Protect all terms in context (warn mode)", + "purpose": "A protected context protects all term definitions. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr03-in.jsonld", + "expect": "expand/pr03-out.jsonld" + }, { + "@id": "#tpr04e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Do not protect term with @protected: false", - "purpose": "A protected context does not protect terms with @protected: false.", + "name": "Do not protect term with @protected: false (error mode)", + "purpose": "A protected context does not protect terms with @protected: false. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr04-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr05", + "@id": "#tpr04w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Do not protect term with @protected: false (warn mode)", + "purpose": "A protected context does not protect terms with @protected: false. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr04-in.jsonld", + "expect": "expand/pr04-out.jsonld" + }, { + "@id": "#tpr05e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Clear active context with protected terms from an embedded context", - "purpose": "The Active context be set to null from an embedded context.", + "name": "Clear active context with protected terms from an embedded context (error mode)", + "purpose": "The Active context be set to null from an embedded context. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr05-in.jsonld", "expect": "invalid context nullification" + }, { + "@id": "#tpr05w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Clear active context with protected terms from an embedded context (warn mode)", + "purpose": "The Active context be set to null from an embedded context. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr05-in.jsonld", + "expect": "expand/pr05-out.jsonld" }, { "@id": "#tpr06", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2010,77 +2042,181 @@ "input": "expand/pr06-in.jsonld", "expect": "expand/pr06-out.jsonld" }, { - "@id": "#tpr08", + "@id": "#tpr08e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Term with protected scoped context.", - "purpose": "A scoped context can protect terms.", + "name": "Term with protected scoped context. (error mode)", + "purpose": "A scoped context can protect terms. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr08-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr09", + "@id": "#tpr08w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Term with protected scoped context. (warn mode)", + "purpose": "A scoped context can protect terms. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr08-in.jsonld", + "expect": "expand/pr08-out.jsonld" + }, { + "@id": "#tpr09e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Attempt to redefine term in other protected context.", - "purpose": "A protected term cannot redefine another protected term.", + "name": "Attempt to redefine term in other protected context. (error mode)", + "purpose": "A protected term cannot redefine another protected term. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr09-in.jsonld", "expect": "protected term redefinition" + }, { + "@id": "#tpr09w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Attempt to redefine term in other protected context. (warn mode)", + "purpose": "A protected term cannot redefine another protected term. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr09-in.jsonld", + "expect": "expand/pr09-out.jsonld" }, { "@id": "#tpr10", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "name": "Simple protected and unprotected terms.", + "purpose": "Simple protected and unprotected terms.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr10-in.jsonld", "expect": "expand/pr10-out.jsonld" }, { - "@id": "#tpr11", + "@id": "#tpr11e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "name": "Fail to override protected term. (error mode)", + "purpose": "Fail to override protected term. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr11-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr12", + "@id": "#tpr11w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Fail to override protected term. (warn mode)", + "purpose": "Fail to override protected term. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr11-in.jsonld", + "expect": "expand/pr11-out.jsonld" + }, { + "@id": "#tpr12e", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "name": "Scoped context fail to override protected term. (error mode)", + "purpose": "Scoped context fail to override protected term. (error mode)", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr12-in.jsonld", "expect": "protected term redefinition" + }, { + "@id": "#tpr12w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Scoped context fail to override protected term. (warn mode)", + "purpose": "Scoped context fail to override protected term. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr12-in.jsonld", + "expect": "expand/pr12-out.jsonld" }, { "@id": "#tpr13", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "name": "Override unprotected term.", + "purpose": "Override unprotected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr13-in.jsonld", "expect": "expand/pr13-out.jsonld" }, { "@id": "#tpr14", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "name": "Clear protection with null context.", + "purpose": "Clear protection with null context.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr14-in.jsonld", "expect": "expand/pr14-out.jsonld" }, { "@id": "#tpr15", - "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Clear protection with array with null context", + "purpose": "Clear protection with array with null context", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr15-in.jsonld", - "expect": "invalid context nullification" + "expect": "expand/pr15-out.jsonld" }, { "@id": "#tpr16", - "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "", - "purpose": "", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Override protected terms after null.", + "purpose": "Override protected terms after null.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr16-in.jsonld", + "expect": "expand/pr16-out.jsonld" + }, { + "@id": "#tpr17e", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Fail to override protected terms with type. (error mode)", + "purpose": "Fail to override protected terms with type. (error mode)", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr17-in.jsonld", + "expect": "invalid context nullification" + }, { + "@id": "#tpr17w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Fail to override protected terms with type. (warn mode)", + "purpose": "Fail to override protected terms with type. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr17-in.jsonld", + "expect": "expand/pr17-out.jsonld" + }, { + "@id": "#tpr18e", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Fail to override protected terms with type+null+ctx. (error mode)", + "purpose": "Fail to override protected terms with type+null+ctx. (error mode)", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr18-in.jsonld", "expect": "invalid context nullification" + }, { + "@id": "#tpr18w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Fail to override protected terms with type+null+ctx. (warn mode)", + "purpose": "Fail to override protected terms with type+null+ctx. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr18-in.jsonld", + "expect": "expand/pr18-out.jsonld" + }, { + "@id": "#tpr19", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Mix of protected and unprotected terms.", + "purpose": "Mix of protected and unprotected terms.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr19-in.jsonld", + "expect": "expand/pr19-out.jsonld" + }, { + "@id": "#tpr20e", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Fail with mix of protected and unprotected terms with type+null+ctx. (error mode)", + "purpose": "Fail with mix of protected and unprotected terms with type+null+ctx. (error mode)", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr20-in.jsonld", + "expect": "invalid context nullification" + }, { + "@id": "#tpr20w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Fail with mix of protected and unprotected terms with type+null+ctx. (warn mode)", + "purpose": "Fail with mix of protected and unprotected terms with type+null+ctx. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr20-in.jsonld", + "expect": "expand/pr20-out.jsonld" + }, { + "@id": "#tpr21e", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Fail with mix of protected and unprotected terms with type+null. (error mode)", + "purpose": "Fail with mix of protected and unprotected terms with type+null. (error mode)", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr21-in.jsonld", + "expect": "invalid context nullification" + }, { + "@id": "#tpr21w", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Fail with mix of protected and unprotected terms with type+null. (warn mode)", + "purpose": "Fail with mix of protected and unprotected terms with type+null. (warn mode)", + "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, + "input": "expand/pr21-in.jsonld", + "expect": "expand/pr21-out.jsonld" }, { "@id": "#ttn01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pr01-in.jsonld b/tests/expand/pr01-in.jsonld index 5f688056..049d4cf6 100644 --- a/tests/expand/pr01-in.jsonld +++ b/tests/expand/pr01-in.jsonld @@ -2,10 +2,14 @@ "@context": { "@vocab": "http://example.com/", "@version": 1.1, - "protected": {"@protected": true} + "protected": { + "@protected": true + } }, "protected": { - "@context": {"protected": "http://example.com/something-else"}, - "protected": "this should have the property http://example.com/protected" + "@context": { + "protected": "http://example.com/something-else" + }, + "protected": "error / property http://example.com/protected" } } diff --git a/tests/expand/pr01-out.jsonld b/tests/expand/pr01-out.jsonld index c25e0875..976b0e69 100644 --- a/tests/expand/pr01-out.jsonld +++ b/tests/expand/pr01-out.jsonld @@ -1,7 +1,7 @@ [ { "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "this should have the property http://example.com/protected"}] + "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] }] } ] diff --git a/tests/expand/pr02-in.jsonld b/tests/expand/pr02-in.jsonld index 616db002..22fe4a86 100644 --- a/tests/expand/pr02-in.jsonld +++ b/tests/expand/pr02-in.jsonld @@ -2,13 +2,19 @@ "@context": { "@vocab": "http://example.com/", "@version": 1.1, - "protected": {"@protected": true}, - "unprotected": {"@protected": false} + "protected": { + "@protected": true + }, + "unprotected": { + "@protected": false + } }, "protected": true, "unprotected": true, "scope": { - "@context": {"unprotected": "http://example.com/something-else"}, - "unprotected": "this should have the property http://example.com/something-else" + "@context": { + "unprotected": "http://example.com/something-else" + }, + "unprotected": "property http://example.com/something-else" } } diff --git a/tests/expand/pr02-out.jsonld b/tests/expand/pr02-out.jsonld index c655f783..bb498495 100644 --- a/tests/expand/pr02-out.jsonld +++ b/tests/expand/pr02-out.jsonld @@ -3,7 +3,7 @@ "http://example.com/protected": [{"@value": true}], "http://example.com/unprotected": [{"@value": true}], "http://example.com/scope": [{ - "http://example.com/something-else": [{"@value": "this should have the property http://example.com/something-else"}] + "http://example.com/something-else": [{"@value": "property http://example.com/something-else"}] }] } ] diff --git a/tests/expand/pr03-in.jsonld b/tests/expand/pr03-in.jsonld index 05b2b233..c0a8aa2a 100644 --- a/tests/expand/pr03-in.jsonld +++ b/tests/expand/pr03-in.jsonld @@ -3,15 +3,19 @@ "@vocab": "http://example.com/", "@version": 1.1, "@protected": true, - "protected1": {"@id": "http://example.com/protected1"}, - "protected2": {"@id": "http://example.com/protected2"} + "protected1": { + "@id": "http://example.com/protected1" + }, + "protected2": { + "@id": "http://example.com/protected2" + } }, "protected1": { "@context": { "protected1": "http://example.com/something-else", "protected2": "http://example.com/something-else" }, - "protected1": "this should have the property http://example.com/protected1", - "protected2": "this should have the property http://example.com/protected2" + "protected1": "error / property http://example.com/protected1", + "protected2": "error / property http://example.com/protected2" } } diff --git a/tests/expand/pr03-out.jsonld b/tests/expand/pr03-out.jsonld index 45accb5e..e7bd0479 100644 --- a/tests/expand/pr03-out.jsonld +++ b/tests/expand/pr03-out.jsonld @@ -1,8 +1,8 @@ [ { "http://example.com/protected1": [{ - "http://example.com/protected1": [{"@value": "this should have the property http://example.com/protected1"}], - "http://example.com/protected2": [{"@value": "this should have the property http://example.com/protected2"}] + "http://example.com/protected1": [{"@value": "error / property http://example.com/protected1"}], + "http://example.com/protected2": [{"@value": "error / property http://example.com/protected2"}] }] } ] diff --git a/tests/expand/pr04-in.jsonld b/tests/expand/pr04-in.jsonld index 09c1a62b..5adc5228 100644 --- a/tests/expand/pr04-in.jsonld +++ b/tests/expand/pr04-in.jsonld @@ -3,15 +3,19 @@ "@vocab": "http://example.com/", "@version": 1.1, "@protected": true, - "protected": {"@id": "http://example.com/protected"}, - "unprotected": {"@id": "http://example.com/unprotected", "@protected": false} + "protected": { + "@id": "http://example.com/protected" + }, + "unprotected": { + "@id": "http://example.com/unprotected", "@protected": false + } }, "protected": { "@context": { "protected": "http://example.com/something-else1", "unprotected": "http://example.com/something-else2" }, - "protected": "this should have the property http://example.com/protected", - "unprotected": "this should have the property http://example.com/something-else2" + "protected": "error / property http://example.com/protected", + "unprotected": "property http://example.com/something-else2" } } diff --git a/tests/expand/pr04-out.jsonld b/tests/expand/pr04-out.jsonld index 753c50b5..9d86db31 100644 --- a/tests/expand/pr04-out.jsonld +++ b/tests/expand/pr04-out.jsonld @@ -1,8 +1,8 @@ [ { "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "this should have the property http://example.com/protected"}], - "http://example.com/something-else2": [{"@value": "this should have the property http://example.com/something-else2"}] + "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}], + "http://example.com/something-else2": [{"@value": "property http://example.com/something-else2"}] }] } ] diff --git a/tests/expand/pr05-in.jsonld b/tests/expand/pr05-in.jsonld index a1cf6c47..a7ccf05d 100644 --- a/tests/expand/pr05-in.jsonld +++ b/tests/expand/pr05-in.jsonld @@ -6,7 +6,12 @@ "protected": {"@language": null} }, "protected": { - "@context": [null, {"@vocab": "http://something-else/"}], - "protected": "this should have the property http://something-else/protected" + "@context": [ + null, + { + "@vocab": "http://something-else/" + } + ], + "protected": "error / property http://example.com/protected" } } diff --git a/tests/expand/pr05-out.jsonld b/tests/expand/pr05-out.jsonld index 97d3fee6..976b0e69 100644 --- a/tests/expand/pr05-out.jsonld +++ b/tests/expand/pr05-out.jsonld @@ -1,7 +1,7 @@ [ { "http://example.com/protected": [{ - "http://something-else/protected": [{"@value": "this should have the property http://something-else/protected"}] + "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] }] } ] diff --git a/tests/expand/pr06-in.jsonld b/tests/expand/pr06-in.jsonld index 1b525889..df894594 100644 --- a/tests/expand/pr06-in.jsonld +++ b/tests/expand/pr06-in.jsonld @@ -3,8 +3,13 @@ "@vocab": "http://example.com/", "@version": 1.1, "@protected": true, - "protected": {"@type": "@id"}, - "unprotected": {"@protected": false, "@context": null} + "protected": { + "@type": "@id" + }, + "unprotected": { + "@protected": false, + "@context": null + } }, "unprotected": { "protected": "not expanded, as protected is not a defined term" diff --git a/tests/expand/pr08-in.jsonld b/tests/expand/pr08-in.jsonld index c798a435..357c5cee 100644 --- a/tests/expand/pr08-in.jsonld +++ b/tests/expand/pr08-in.jsonld @@ -2,23 +2,37 @@ "@context": { "@vocab": "http://example.com/", "@version": 1.1, - "protected": {"@protected": false}, + "protected": { + "@protected": false + }, "scope1": { "@protected": false, - "@context": {"protected": {"@id": "http://example.com/something-else"}} + "@context": { + "protected": { + "@id": "http://example.com/something-else" + } + } }, "scope2": { "@protected": true, - "@context": {"protected": {"@protected": true}} + "@context": { + "protected": { + "@protected": true + } + } } }, "protected": false, "scope1": { - "@context": {"protected": "http://example.com/another-thing"}, - "protected": "this should have the property http://example.com/another-thing" + "@context": { + "protected": "http://example.com/another-thing" + }, + "protected": "property http://example.com/another-thing" }, "scope2": { - "@context": {"protected": "http://example.com/another-thing"}, - "protected": "this should have the property http://example.com/protected" + "@context": { + "protected": "http://example.com/another-thing" + }, + "protected": "error / property http://example.com/protected" } } diff --git a/tests/expand/pr08-out.jsonld b/tests/expand/pr08-out.jsonld index 8ec78391..073ee72f 100644 --- a/tests/expand/pr08-out.jsonld +++ b/tests/expand/pr08-out.jsonld @@ -2,10 +2,10 @@ { "http://example.com/protected": [{"@value": false}], "http://example.com/scope1": [{ - "http://example.com/another-thing": [{"@value": "this should have the property http://example.com/another-thing"}] + "http://example.com/another-thing": [{"@value": "property http://example.com/another-thing"}] }], "http://example.com/scope2": [{ - "http://example.com/protected": [{"@value": "this should have the property http://example.com/protected"}] + "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] }] } ] diff --git a/tests/expand/pr09-in.jsonld b/tests/expand/pr09-in.jsonld index d7c5c0b5..29895ff3 100644 --- a/tests/expand/pr09-in.jsonld +++ b/tests/expand/pr09-in.jsonld @@ -6,7 +6,9 @@ "protected2": "http://example.org/protected2" }, "protected2": { - "@context": {"protected1": "http://example.com/something-else"}, - "protected1": "this should have the property http://example.org/protected1" + "@context": { + "protected1": "http://example.org/something-else" + }, + "protected1": "error / property http://example.org/protected1" } } diff --git a/tests/expand/pr09-out.jsonld b/tests/expand/pr09-out.jsonld index 89dc604d..72cda458 100644 --- a/tests/expand/pr09-out.jsonld +++ b/tests/expand/pr09-out.jsonld @@ -1,7 +1,7 @@ [{ "http://example.org/protected2": [{ "http://example.org/protected1": [{ - "@value": "this should have the property http://example.org/protected1" + "@value": "error / property http://example.org/protected1" }] }] }] diff --git a/tests/expand/pr11-out.jsonld b/tests/expand/pr11-out.jsonld index fe51488c..3f10151e 100644 --- a/tests/expand/pr11-out.jsonld +++ b/tests/expand/pr11-out.jsonld @@ -1 +1,18 @@ -[] +[ + { + "ex:protected": [ + { + "@value": "p === ex:protected" + } + ], + "ex:unprotected": [ + { + "ex:protected": [ + { + "@value": "p === ex:protected" + } + ] + } + ] + } +] diff --git a/tests/expand/pr12-in.jsonld b/tests/expand/pr12-in.jsonld index c4af2629..2dc30da6 100644 --- a/tests/expand/pr12-in.jsonld +++ b/tests/expand/pr12-in.jsonld @@ -5,11 +5,11 @@ "protected1": "ex:protected1", "protected2": "ex:protected2" }, - "protected1": "p1", + "protected1": "p === ex:protected1", "protected2": { "@context": { "protected1": "ex:protected1:error" }, - "protected1": "p1error" + "protected1": "error / p === ex:protected1" } } diff --git a/tests/expand/pr12-out.jsonld b/tests/expand/pr12-out.jsonld index fe51488c..97887460 100644 --- a/tests/expand/pr12-out.jsonld +++ b/tests/expand/pr12-out.jsonld @@ -1 +1,18 @@ -[] +[ + { + "ex:protected1": [ + { + "@value": "p === ex:protected1" + } + ], + "ex:protected2": [ + { + "ex:protected1": [ + { + "@value": "error / p === ex:protected1" + } + ] + } + ] + } +] diff --git a/tests/expand/pr14-in.jsonld b/tests/expand/pr14-in.jsonld index a3a1caf3..e88b9ef2 100644 --- a/tests/expand/pr14-in.jsonld +++ b/tests/expand/pr14-in.jsonld @@ -5,14 +5,14 @@ "protected1": "ex:protected1", "protected2": { "@id": "ex:protected2", - "@context": [null] + "@context": null } }, "protected1": "p === ex:protected1", "protected2": { "@context": { - "protected": "ex:protected3" + "protected1": "ex:protected3" }, - "protected": "p === ex:protected3" + "protected1": "p === ex:protected3" } } diff --git a/tests/expand/pr15-in.jsonld b/tests/expand/pr15-in.jsonld index 196da8bd..d0cf99b1 100644 --- a/tests/expand/pr15-in.jsonld +++ b/tests/expand/pr15-in.jsonld @@ -3,20 +3,18 @@ "@version": 1.1, "@protected": true, "protected1": "ex:protected1", - "protected2": "ex:protected2", - "Protected": { - "@id": "ex:Protected", + "protected2": { + "@id": "ex:protected2", "@context": [ null ] } }, - "protected1": "p === protected1", + "protected1": "p === ex:protected1", "protected2": { - "@type": "Protected", "@context": { - "protected": "ex:protected3" + "protected1": "ex:protected3" }, - "protected": "error" + "protected1": "p === ex:protected3" } } diff --git a/tests/expand/pr15-out.jsonld b/tests/expand/pr15-out.jsonld index fe51488c..52c399e9 100644 --- a/tests/expand/pr15-out.jsonld +++ b/tests/expand/pr15-out.jsonld @@ -1 +1,18 @@ -[] +[ + { + "ex:protected1": [ + { + "@value": "p === ex:protected1" + } + ], + "ex:protected2": [ + { + "ex:protected3": [ + { + "@value": "p === ex:protected3" + } + ] + } + ] + } +] diff --git a/tests/expand/pr16-in.jsonld b/tests/expand/pr16-in.jsonld index 0f7571ae..61946e01 100644 --- a/tests/expand/pr16-in.jsonld +++ b/tests/expand/pr16-in.jsonld @@ -3,17 +3,28 @@ "@version": 1.1, "@protected": true, "protected1": "ex:protected1", - "protected2": "ex:protected2", - "Protected": { - "@id": "ex:Protected", + "protected2": { + "@id": "ex:protected2", "@context": [ null, { - "protected": "ex:protected3" + "protected1": "ex:protected3", + "unprotected": "ex:unprotected2" } ] + }, + "unprotected": { + "@protected": false, + "@id": "ex:unprotected1" } }, - "@type": "Protected", - "protected": "error" + "protected1": "p === ex:protected1", + "protected2": { + "@context": { + "protected1": "ex:protected3" + }, + "protected1": "p === ex:protected3", + "unprotected": "p === ex:unprotected2" + }, + "unprotected": "p === ex:unprotected1" } diff --git a/tests/expand/pr16-out.jsonld b/tests/expand/pr16-out.jsonld index fe51488c..264b8360 100644 --- a/tests/expand/pr16-out.jsonld +++ b/tests/expand/pr16-out.jsonld @@ -1 +1,28 @@ -[] +[ + { + "ex:protected1": [ + { + "@value": "p === ex:protected1" + } + ], + "ex:protected2": [ + { + "ex:protected3": [ + { + "@value": "p === ex:protected3" + } + ], + "ex:unprotected2": [ + { + "@value": "p === ex:unprotected2" + } + ] + } + ], + "ex:unprotected1": [ + { + "@value": "p === ex:unprotected1" + } + ] + } +] diff --git a/tests/expand/pr17-in.jsonld b/tests/expand/pr17-in.jsonld new file mode 100644 index 00000000..e2300354 --- /dev/null +++ b/tests/expand/pr17-in.jsonld @@ -0,0 +1,22 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": "ex:protected2", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null + ] + } + }, + "protected1": "p === protected1", + "protected2": { + "@context": { + "unprotected": "ex:unprotected" + }, + "@type": "Protected", + "unprotected": "error / omitted" + } +} diff --git a/tests/expand/pr17-out.jsonld b/tests/expand/pr17-out.jsonld new file mode 100644 index 00000000..8e360b73 --- /dev/null +++ b/tests/expand/pr17-out.jsonld @@ -0,0 +1,16 @@ +[ + { + "ex:protected1": [ + { + "@value": "p === protected1" + } + ], + "ex:protected2": [ + { + "@type": [ + "ex:Protected" + ] + } + ] + } +] diff --git a/tests/expand/pr18-in.jsonld b/tests/expand/pr18-in.jsonld new file mode 100644 index 00000000..a6648cd6 --- /dev/null +++ b/tests/expand/pr18-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected": "ex:protected1", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null, + { + "protected": "ex:protected2" + } + ] + } + }, + "@type": "Protected", + "protected": "error / p === ex:protected1" +} diff --git a/tests/expand/pr18-out.jsonld b/tests/expand/pr18-out.jsonld new file mode 100644 index 00000000..b293d4cb --- /dev/null +++ b/tests/expand/pr18-out.jsonld @@ -0,0 +1,12 @@ +[ + { + "@type": [ + "ex:Protected" + ], + "ex:protected1": [ + { + "@value": "error / p === ex:protected1" + } + ] + } +] diff --git a/tests/expand/pr19-in.jsonld b/tests/expand/pr19-in.jsonld new file mode 100644 index 00000000..e418cb12 --- /dev/null +++ b/tests/expand/pr19-in.jsonld @@ -0,0 +1,29 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": { + "@id": "ex:protected2", + "@context": [ + null, + { + "protected1": "ex:protected3" + } + ] + }, + "unprotected": { + "@protected": false, + "@id": "ex:unprotected1" + } + }, + "protected1": "p === ex:protected1", + "protected2": { + "@context": { + "protected1": "ex:protected3" + }, + "protected1": "p === ex:protected3", + "unprotected": "p === ex:unprotected2" + }, + "unprotected": "p === ex:unprotected1" +} diff --git a/tests/expand/pr19-out.jsonld b/tests/expand/pr19-out.jsonld new file mode 100644 index 00000000..0bca9e1b --- /dev/null +++ b/tests/expand/pr19-out.jsonld @@ -0,0 +1,23 @@ +[ + { + "ex:protected1": [ + { + "@value": "p === ex:protected1" + } + ], + "ex:protected2": [ + { + "ex:protected3": [ + { + "@value": "p === ex:protected3" + } + ] + } + ], + "ex:unprotected1": [ + { + "@value": "p === ex:unprotected1" + } + ] + } +] diff --git a/tests/expand/pr20-in.jsonld b/tests/expand/pr20-in.jsonld new file mode 100644 index 00000000..69edf670 --- /dev/null +++ b/tests/expand/pr20-in.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null, + { + "protected1": "ex:protected2", + "unprotected": "ex:unprotected2" + } + ] + }, + "unprotected": { + "@protected": false, + "@id": "ex:unprotected1" + } + }, + "@type": "Protected", + "protected1": "error / p === ex:protected1", + "unprotected": "p === ex:unprotected2" +} diff --git a/tests/expand/pr20-out.jsonld b/tests/expand/pr20-out.jsonld new file mode 100644 index 00000000..f07108db --- /dev/null +++ b/tests/expand/pr20-out.jsonld @@ -0,0 +1,17 @@ +[ + { + "@type": [ + "ex:Protected" + ], + "ex:protected1": [ + { + "@value": "error / p === ex:protected1" + } + ], + "ex:unprotected2": [ + { + "@value": "p === ex:unprotected2" + } + ] + } +] diff --git a/tests/expand/pr21-in.jsonld b/tests/expand/pr21-in.jsonld new file mode 100644 index 00000000..3be7f54f --- /dev/null +++ b/tests/expand/pr21-in.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected": "ex:protected", + "Protected": { + "@id": "ex:Protected", + "@context": [ + null + ] + }, + "unprotected": { + "@protected": false, + "@id": "ex:unprotected" + } + }, + "@type": "Protected", + "protected": "error / p === ex:protected", + "unprotected": "missing" +} diff --git a/tests/expand/pr21-out.jsonld b/tests/expand/pr21-out.jsonld new file mode 100644 index 00000000..77f8e6fe --- /dev/null +++ b/tests/expand/pr21-out.jsonld @@ -0,0 +1,12 @@ +[ + { + "@type": [ + "ex:Protected" + ], + "ex:protected": [ + { + "@value": "error / p === ex:protected" + } + ] + } +] From 48384cbedf4cb1ed7804c30c1cd9da56562e28a8 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 13 Apr 2019 14:06:50 -0700 Subject: [PATCH 4/7] Add spec text for detecting errors when changing protected term definitions unless from a term used as a property which has a scoped context. Remove protected term tests with warning option. --- index.html | 70 ++++++++++----- tests/expand-manifest.jsonld | 168 ++++++++--------------------------- tests/expand/pr01-out.jsonld | 7 -- tests/expand/pr03-out.jsonld | 8 -- tests/expand/pr04-out.jsonld | 8 -- tests/expand/pr05-out.jsonld | 7 -- tests/expand/pr08-out.jsonld | 11 --- tests/expand/pr09-out.jsonld | 7 -- tests/expand/pr11-out.jsonld | 18 ---- tests/expand/pr12-out.jsonld | 18 ---- tests/expand/pr17-out.jsonld | 16 ---- tests/expand/pr18-out.jsonld | 12 --- tests/expand/pr20-out.jsonld | 17 ---- tests/expand/pr21-out.jsonld | 12 --- 14 files changed, 84 insertions(+), 295 deletions(-) delete mode 100644 tests/expand/pr01-out.jsonld delete mode 100644 tests/expand/pr03-out.jsonld delete mode 100644 tests/expand/pr04-out.jsonld delete mode 100644 tests/expand/pr05-out.jsonld delete mode 100644 tests/expand/pr08-out.jsonld delete mode 100644 tests/expand/pr09-out.jsonld delete mode 100644 tests/expand/pr11-out.jsonld delete mode 100644 tests/expand/pr12-out.jsonld delete mode 100644 tests/expand/pr17-out.jsonld delete mode 100644 tests/expand/pr18-out.jsonld delete mode 100644 tests/expand/pr20-out.jsonld delete mode 100644 tests/expand/pr21-out.jsonld diff --git a/index.html b/index.html index c0eec129..48cdaa47 100644 --- a/index.html +++ b/index.html @@ -1011,11 +1011,14 @@

Algorithm

This algorithm specifies how a new active context is updated with a local context. The algorithm takes two required - and one optional + and two optional input variables. - The required inputs inputs are an active context and a local context. - The optional input is an array remote contexts, - defaulting to a new empty array, which is used to detect cyclical context inclusions.

+ The required inputs are an active context and a local context. + The optional inputs are an array remote contexts, + defaulting to a new empty array, which is used to detect cyclical context inclusions. + and from term, defaulting to false, + which is used to allow changes to protected terms.. +

  1. Initialize result to the result of cloning @@ -1026,12 +1029,20 @@

    Algorithm

  2. For each item context in local context:
      -
    1. If context is null, set result to a - newly-initialized active context and continue with the - next context. - In JSON-LD 1.0, the base IRI was given - a default value here; this is now described conditionally - in .
    2. +
    3. If context is null: +
        +
      1. If from term is false and active context + contains any protected term definitions, + an invalid context nullification + has been detected and processing is aborted.
      2. +
      3. Otherwise, set result to a + newly-initialized active context and continue with the + next context. + In JSON-LD 1.0, the base IRI was given + a default value here; this is now described conditionally + in .
      4. +
      +
    4. If context is a string,
      1. Set context to the result of resolving value against @@ -1153,8 +1164,9 @@

        Algorithm

        passing result for active context, context for local context, key, defined, - and the value of the @protected - member from context, if any, for protected.
      2. + the value of the @protected + member from context, if any, for protected, + and from term.
    5. Return result.
    6. @@ -1199,12 +1211,15 @@

      Overview

      Algorithm

      -

      The algorithm has four required and one optional inputs. +

      The algorithm has four required and two optional inputs. The required inputs are an active context, a local context, a term, and a map defined. - The optional input is - protected which defaults to false.

      + The optional inputs are + protected which defaults to false, + and from term, defaulting to false, + which is used to allow changes to protected terms.. +

      1. If defined contains the member term and the associated value is true (indicating that the @@ -1228,9 +1243,11 @@

        Algorithm

        term MUST NOT be a keyword and a keyword redefinition error has been detected and processing is aborted.
      2. -
      3. If the active context has an existing - term definition for term which is protected, processing is aborted; - processors SHOULD issue a warning that an attempt was made to redefine a protected term.
      4. +
      5. If the from term is false + and active context has an existing + term definition for term which is protected, + a protected term redefinition error has been detected, + and processing is aborted.
      6. Otherwise, remove any existing term definition for term in active context.
      7. If value is null or value @@ -1412,7 +1429,8 @@

        Algorithm

      8. Initialize context to the value associated with the @context member, which is treated as a local context.
      9. Invoke the Context Processing algorithm - using the active context and context as local context. + using the active context, context as local context, + and true for from term. If any error is detected, an invalid scoped context error has been detected and processing is aborted.
      10. @@ -1514,7 +1532,7 @@

        Overview

        Create Term Definition algorithm.

      -
      +

      Algorithm

      The algorithm takes two required and four optional input variables. The @@ -1938,8 +1956,9 @@

      Algorithm

    7. If key's term definition in active context has a local context, set term context to the result of the Context Processing algorithm, - passing active context and the value of the - key's local context as local context. Otherwise, + passing active context, the value of the + key's local context as local context, + and true for from term. Otherwise, set term context to active context.
    8. Set container mapping to key's container mapping in term context.
    9. @@ -5626,6 +5645,7 @@

      JsonLdErrorCode

      "invalid @version value", "invalid base IRI", "invalid container mapping", + "invalid context nullification", "invalid default language", "invalid IRI mapping", "invalid keyword alias", @@ -5653,6 +5673,7 @@

      JsonLdErrorCode

      "loading remote context failed", "multiple context link headers", "processing mode conflict", + "protected term redefinition", "context overflow" }; --> @@ -5769,6 +5790,11 @@

      JsonLdErrorCode

      which is incompatible with the previous specified version.
      context overflow
      maximum number of @context URLs exceeded.
      +
      invalid context nullification
      +
      An attempt was made to nullify a context + containing protected term definitions.
      +
      protected term redefinition
      +
      An attempt was made to redefine a protected term.
      diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index dc70e5f0..a6e5ace7 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1962,21 +1962,13 @@ "input": "expand/li10-in.jsonld", "expect": "expand/li10-out.jsonld" }, { - "@id": "#tpr01e", + "@id": "#tpr01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Protected a term (error mode)", - "purpose": "Check 'error' mode when overriding a protected term. (error mode)", + "name": "Protect a term", + "purpose": "Check error when overriding a protected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr01-in.jsonld", "expect": "protected term redefinition" - }, { - "@id": "#tpr01w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Protected a term (warn mode)", - "purpose": "Check 'warn' mode when overriding a protected term. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr01-in.jsonld", - "expect": "expand/pr01-out.jsonld" }, { "@id": "#tpr02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -1986,53 +1978,29 @@ "input": "expand/pr02-in.jsonld", "expect": "expand/pr02-out.jsonld" }, { - "@id": "#tpr03e", + "@id": "#tpr03", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Protect all terms in context (error mode)", - "purpose": "A protected context protects all term definitions. (error mode)", + "name": "Protect all terms in context", + "purpose": "A protected context protects all term definitions.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr03-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr03w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Protect all terms in context (warn mode)", - "purpose": "A protected context protects all term definitions. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr03-in.jsonld", - "expect": "expand/pr03-out.jsonld" - }, { - "@id": "#tpr04e", + "@id": "#tpr04", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Do not protect term with @protected: false (error mode)", - "purpose": "A protected context does not protect terms with @protected: false. (error mode)", + "name": "Do not protect term with @protected: false", + "purpose": "A protected context does not protect terms with @protected: false.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr04-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr04w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Do not protect term with @protected: false (warn mode)", - "purpose": "A protected context does not protect terms with @protected: false. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr04-in.jsonld", - "expect": "expand/pr04-out.jsonld" - }, { - "@id": "#tpr05e", + "@id": "#tpr05", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Clear active context with protected terms from an embedded context (error mode)", - "purpose": "The Active context be set to null from an embedded context. (error mode)", + "name": "Clear active context with protected terms from an embedded context", + "purpose": "The Active context be set to null from an embedded context.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr05-in.jsonld", "expect": "invalid context nullification" - }, { - "@id": "#tpr05w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Clear active context with protected terms from an embedded context (warn mode)", - "purpose": "The Active context be set to null from an embedded context. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr05-in.jsonld", - "expect": "expand/pr05-out.jsonld" }, { "@id": "#tpr06", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2042,37 +2010,21 @@ "input": "expand/pr06-in.jsonld", "expect": "expand/pr06-out.jsonld" }, { - "@id": "#tpr08e", + "@id": "#tpr08", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Term with protected scoped context. (error mode)", - "purpose": "A scoped context can protect terms. (error mode)", + "name": "Term with protected scoped context.", + "purpose": "A scoped context can protect terms.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr08-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr08w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Term with protected scoped context. (warn mode)", - "purpose": "A scoped context can protect terms. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr08-in.jsonld", - "expect": "expand/pr08-out.jsonld" - }, { - "@id": "#tpr09e", + "@id": "#tpr09", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Attempt to redefine term in other protected context. (error mode)", - "purpose": "A protected term cannot redefine another protected term. (error mode)", + "name": "Attempt to redefine term in other protected context.", + "purpose": "A protected term cannot redefine another protected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr09-in.jsonld", "expect": "protected term redefinition" - }, { - "@id": "#tpr09w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Attempt to redefine term in other protected context. (warn mode)", - "purpose": "A protected term cannot redefine another protected term. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr09-in.jsonld", - "expect": "expand/pr09-out.jsonld" }, { "@id": "#tpr10", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2082,37 +2034,21 @@ "input": "expand/pr10-in.jsonld", "expect": "expand/pr10-out.jsonld" }, { - "@id": "#tpr11e", + "@id": "#tpr11", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected term. (error mode)", - "purpose": "Fail to override protected term. (error mode)", + "name": "Fail to override protected term.", + "purpose": "Fail to override protected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr11-in.jsonld", "expect": "protected term redefinition" }, { - "@id": "#tpr11w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected term. (warn mode)", - "purpose": "Fail to override protected term. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr11-in.jsonld", - "expect": "expand/pr11-out.jsonld" - }, { - "@id": "#tpr12e", + "@id": "#tpr12", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Scoped context fail to override protected term. (error mode)", - "purpose": "Scoped context fail to override protected term. (error mode)", + "name": "Scoped context fail to override protected term.", + "purpose": "Scoped context fail to override protected term.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr12-in.jsonld", "expect": "protected term redefinition" - }, { - "@id": "#tpr12w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Scoped context fail to override protected term. (warn mode)", - "purpose": "Scoped context fail to override protected term. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr12-in.jsonld", - "expect": "expand/pr12-out.jsonld" }, { "@id": "#tpr13", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2146,37 +2082,21 @@ "input": "expand/pr16-in.jsonld", "expect": "expand/pr16-out.jsonld" }, { - "@id": "#tpr17e", + "@id": "#tpr17", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected terms with type. (error mode)", - "purpose": "Fail to override protected terms with type. (error mode)", + "name": "Fail to override protected terms with type.", + "purpose": "Fail to override protected terms with type.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr17-in.jsonld", "expect": "invalid context nullification" }, { - "@id": "#tpr17w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected terms with type. (warn mode)", - "purpose": "Fail to override protected terms with type. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr17-in.jsonld", - "expect": "expand/pr17-out.jsonld" - }, { - "@id": "#tpr18e", + "@id": "#tpr18", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected terms with type+null+ctx. (error mode)", - "purpose": "Fail to override protected terms with type+null+ctx. (error mode)", + "name": "Fail to override protected terms with type+null+ctx.", + "purpose": "Fail to override protected terms with type+null+ctx.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr18-in.jsonld", "expect": "invalid context nullification" - }, { - "@id": "#tpr18w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Fail to override protected terms with type+null+ctx. (warn mode)", - "purpose": "Fail to override protected terms with type+null+ctx. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr18-in.jsonld", - "expect": "expand/pr18-out.jsonld" }, { "@id": "#tpr19", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], @@ -2186,37 +2106,21 @@ "input": "expand/pr19-in.jsonld", "expect": "expand/pr19-out.jsonld" }, { - "@id": "#tpr20e", + "@id": "#tpr20", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Fail with mix of protected and unprotected terms with type+null+ctx. (error mode)", - "purpose": "Fail with mix of protected and unprotected terms with type+null+ctx. (error mode)", + "name": "Fail with mix of protected and unprotected terms with type+null+ctx.", + "purpose": "Fail with mix of protected and unprotected terms with type+null+ctx.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr20-in.jsonld", "expect": "invalid context nullification" }, { - "@id": "#tpr20w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Fail with mix of protected and unprotected terms with type+null+ctx. (warn mode)", - "purpose": "Fail with mix of protected and unprotected terms with type+null+ctx. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr20-in.jsonld", - "expect": "expand/pr20-out.jsonld" - }, { - "@id": "#tpr21e", + "@id": "#tpr21", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], - "name": "Fail with mix of protected and unprotected terms with type+null. (error mode)", - "purpose": "Fail with mix of protected and unprotected terms with type+null. (error mode)", + "name": "Fail with mix of protected and unprotected terms with type+null.", + "purpose": "Fail with mix of protected and unprotected terms with type+null.", "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr21-in.jsonld", "expect": "invalid context nullification" - }, { - "@id": "#tpr21w", - "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "Fail with mix of protected and unprotected terms with type+null. (warn mode)", - "purpose": "Fail with mix of protected and unprotected terms with type+null. (warn mode)", - "option": {"specVersion": "json-ld-1.1", "protectedMode": "warn"}, - "input": "expand/pr21-in.jsonld", - "expect": "expand/pr21-out.jsonld" }, { "@id": "#ttn01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pr01-out.jsonld b/tests/expand/pr01-out.jsonld deleted file mode 100644 index 976b0e69..00000000 --- a/tests/expand/pr01-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] - }] - } -] diff --git a/tests/expand/pr03-out.jsonld b/tests/expand/pr03-out.jsonld deleted file mode 100644 index e7bd0479..00000000 --- a/tests/expand/pr03-out.jsonld +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "http://example.com/protected1": [{ - "http://example.com/protected1": [{"@value": "error / property http://example.com/protected1"}], - "http://example.com/protected2": [{"@value": "error / property http://example.com/protected2"}] - }] - } -] diff --git a/tests/expand/pr04-out.jsonld b/tests/expand/pr04-out.jsonld deleted file mode 100644 index 9d86db31..00000000 --- a/tests/expand/pr04-out.jsonld +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}], - "http://example.com/something-else2": [{"@value": "property http://example.com/something-else2"}] - }] - } -] diff --git a/tests/expand/pr05-out.jsonld b/tests/expand/pr05-out.jsonld deleted file mode 100644 index 976b0e69..00000000 --- a/tests/expand/pr05-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] - }] - } -] diff --git a/tests/expand/pr08-out.jsonld b/tests/expand/pr08-out.jsonld deleted file mode 100644 index 073ee72f..00000000 --- a/tests/expand/pr08-out.jsonld +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "http://example.com/protected": [{"@value": false}], - "http://example.com/scope1": [{ - "http://example.com/another-thing": [{"@value": "property http://example.com/another-thing"}] - }], - "http://example.com/scope2": [{ - "http://example.com/protected": [{"@value": "error / property http://example.com/protected"}] - }] - } -] diff --git a/tests/expand/pr09-out.jsonld b/tests/expand/pr09-out.jsonld deleted file mode 100644 index 72cda458..00000000 --- a/tests/expand/pr09-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[{ - "http://example.org/protected2": [{ - "http://example.org/protected1": [{ - "@value": "error / property http://example.org/protected1" - }] - }] -}] diff --git a/tests/expand/pr11-out.jsonld b/tests/expand/pr11-out.jsonld deleted file mode 100644 index 3f10151e..00000000 --- a/tests/expand/pr11-out.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "ex:protected": [ - { - "@value": "p === ex:protected" - } - ], - "ex:unprotected": [ - { - "ex:protected": [ - { - "@value": "p === ex:protected" - } - ] - } - ] - } -] diff --git a/tests/expand/pr12-out.jsonld b/tests/expand/pr12-out.jsonld deleted file mode 100644 index 97887460..00000000 --- a/tests/expand/pr12-out.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "ex:protected1": [ - { - "@value": "p === ex:protected1" - } - ], - "ex:protected2": [ - { - "ex:protected1": [ - { - "@value": "error / p === ex:protected1" - } - ] - } - ] - } -] diff --git a/tests/expand/pr17-out.jsonld b/tests/expand/pr17-out.jsonld deleted file mode 100644 index 8e360b73..00000000 --- a/tests/expand/pr17-out.jsonld +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "ex:protected1": [ - { - "@value": "p === protected1" - } - ], - "ex:protected2": [ - { - "@type": [ - "ex:Protected" - ] - } - ] - } -] diff --git a/tests/expand/pr18-out.jsonld b/tests/expand/pr18-out.jsonld deleted file mode 100644 index b293d4cb..00000000 --- a/tests/expand/pr18-out.jsonld +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "@type": [ - "ex:Protected" - ], - "ex:protected1": [ - { - "@value": "error / p === ex:protected1" - } - ] - } -] diff --git a/tests/expand/pr20-out.jsonld b/tests/expand/pr20-out.jsonld deleted file mode 100644 index f07108db..00000000 --- a/tests/expand/pr20-out.jsonld +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "@type": [ - "ex:Protected" - ], - "ex:protected1": [ - { - "@value": "error / p === ex:protected1" - } - ], - "ex:unprotected2": [ - { - "@value": "p === ex:unprotected2" - } - ] - } -] diff --git a/tests/expand/pr21-out.jsonld b/tests/expand/pr21-out.jsonld deleted file mode 100644 index 77f8e6fe..00000000 --- a/tests/expand/pr21-out.jsonld +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "@type": [ - "ex:Protected" - ], - "ex:protected": [ - { - "@value": "error / p === ex:protected" - } - ] - } -] From 7ccd943b4046d03a16cff03f51916c25411e34e0 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Tue, 16 Apr 2019 11:47:49 +0200 Subject: [PATCH 5/7] typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 48cdaa47..5d52fa25 100644 --- a/index.html +++ b/index.html @@ -1243,7 +1243,7 @@

      Algorithm

      term MUST NOT be a keyword and a keyword redefinition error has been detected and processing is aborted. -
    10. If the from term is false +
    11. If from term is false and active context has an existing term definition for term which is protected, a protected term redefinition error has been detected, From 8b0e7745b2e7aec897c93bad461694ff4b331ad2 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 16 Apr 2019 16:06:07 -0700 Subject: [PATCH 6/7] 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. --- index.html | 5 +++-- tests/compact-manifest.jsonld | 27 +++++++++++++++++++++++++++ tests/compact/pr01-context.jsonld | 7 +++++++ tests/compact/pr01-in.jsonld | 3 +++ tests/compact/pr02-context.jsonld | 9 +++++++++ tests/compact/pr02-in.jsonld | 3 +++ tests/compact/pr03-context.jsonld | 8 ++++++++ tests/compact/pr03-in.jsonld | 7 +++++++ tests/compact/pr04-context.jsonld | 8 ++++++++ tests/compact/pr04-in.jsonld | 9 +++++++++ tests/compact/pr04-out.jsonld | 14 ++++++++++++++ 11 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 tests/compact/pr01-context.jsonld create mode 100644 tests/compact/pr01-in.jsonld create mode 100644 tests/compact/pr02-context.jsonld create mode 100644 tests/compact/pr02-in.jsonld create mode 100644 tests/compact/pr03-context.jsonld create mode 100644 tests/compact/pr03-in.jsonld create mode 100644 tests/compact/pr04-context.jsonld create mode 100644 tests/compact/pr04-in.jsonld create mode 100644 tests/compact/pr04-out.jsonld diff --git a/index.html b/index.html index 5d52fa25..c2a3ebd7 100644 --- a/index.html +++ b/index.html @@ -2403,8 +2403,9 @@

      Algorithm

      1. Set active context to the result of the Context Processing algorithm, - passing active context and the value of the - active property's local context as local context.
      2. + passing active context, the value of the + active property's local context as local context, + and true for from term.
      3. Set inverse context using the Inverse Context Creation algorithm using active context.
      4. diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index e4aad10e..c1cc1a06 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1652,6 +1652,33 @@ "input": "compact/pi06-in.jsonld", "context": "compact/pi06-context.jsonld", "expect": "compact/pi06-out.jsonld" + }, { + "@id": "#tpr01", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "Check illegal clearing of context with protected terms", + "purpose": "Check error when clearing a context with protected terms.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/pr01-in.jsonld", + "context": "compact/pr01-context.jsonld", + "expect": "invalid context nullification" + }, { + "@id": "#tpr03", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "Check illegal overriding of protected term", + "purpose": "Check error when overriding a protected term.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/pr02-in.jsonld", + "context": "compact/pr02-context.jsonld", + "expect": "protected term redefinition" + }, { + "@id": "#tpr04", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Check legal overriding of protected term from property-scoped context", + "purpose": "Check overriding a protected term from property-scoped context.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/pr04-in.jsonld", + "context": "compact/pr04-context.jsonld", + "expect": "compact/pr04-out.jsonld" }, { "@id": "#tr001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], diff --git a/tests/compact/pr01-context.jsonld b/tests/compact/pr01-context.jsonld new file mode 100644 index 00000000..a6875709 --- /dev/null +++ b/tests/compact/pr01-context.jsonld @@ -0,0 +1,7 @@ +{ + "@context": [{ + "@vocab": "http://example.com/", + "@version": 1.1, + "protected": {"@protected": true} + }, null] +} diff --git a/tests/compact/pr01-in.jsonld b/tests/compact/pr01-in.jsonld new file mode 100644 index 00000000..d6a85b74 --- /dev/null +++ b/tests/compact/pr01-in.jsonld @@ -0,0 +1,3 @@ +[{ + "http://example/a": [{"@id": "http://example.org/foo"}] +}] \ No newline at end of file diff --git a/tests/compact/pr02-context.jsonld b/tests/compact/pr02-context.jsonld new file mode 100644 index 00000000..90e03cea --- /dev/null +++ b/tests/compact/pr02-context.jsonld @@ -0,0 +1,9 @@ +{ + "@context": [{ + "@vocab": "http://example.com/", + "@version": 1.1, + "protected": {"@protected": true} + }, { + "protected": "http://example.com/protected" + }] +} diff --git a/tests/compact/pr02-in.jsonld b/tests/compact/pr02-in.jsonld new file mode 100644 index 00000000..d6a85b74 --- /dev/null +++ b/tests/compact/pr02-in.jsonld @@ -0,0 +1,3 @@ +[{ + "http://example/a": [{"@id": "http://example.org/foo"}] +}] \ No newline at end of file diff --git a/tests/compact/pr03-context.jsonld b/tests/compact/pr03-context.jsonld new file mode 100644 index 00000000..0e9cc8ea --- /dev/null +++ b/tests/compact/pr03-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "protected": {"@protected": true}, + "Type": {"@context": {"protected": {"@type": "@id"},}} + } +} diff --git a/tests/compact/pr03-in.jsonld b/tests/compact/pr03-in.jsonld new file mode 100644 index 00000000..0b780438 --- /dev/null +++ b/tests/compact/pr03-in.jsonld @@ -0,0 +1,7 @@ +[{ + "http://example.com/protected": [{"@value": "p === http://example.com/protected"}], + "http://example.com/unprotected": [{ + "@type": "http://example.com/Type", + "http://example.com/protected": [{"@value": "p === http://example.com/protected"}] + }] +}] diff --git a/tests/compact/pr04-context.jsonld b/tests/compact/pr04-context.jsonld new file mode 100644 index 00000000..1d351903 --- /dev/null +++ b/tests/compact/pr04-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "protected": {"@protected": true}, + "unprotected": {"@context": {"protected": {"@language": "en"}}} + } +} diff --git a/tests/compact/pr04-in.jsonld b/tests/compact/pr04-in.jsonld new file mode 100644 index 00000000..e108683c --- /dev/null +++ b/tests/compact/pr04-in.jsonld @@ -0,0 +1,9 @@ +[{ + "http://example.com/protected": [{"@value": "p === http://example.com/protected"}], + "http://example.com/unprotected": [{ + "http://example.com/protected": [{ + "@value": "p === http://example.com/protected", + "@language": "en" + }] + }] +}] diff --git a/tests/compact/pr04-out.jsonld b/tests/compact/pr04-out.jsonld new file mode 100644 index 00000000..41eaedee --- /dev/null +++ b/tests/compact/pr04-out.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "protected": {"@protected": true}, + "unprotected": { + "@context": {"protected": {"@language": "en"}} + } + }, + "protected": "p === http://example.com/protected", + "unprotected": { + "protected": "p === http://example.com/protected" + } +} \ No newline at end of file From 55c5440ad591ab490bb3b3e7bcb5113f0077f8a3 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 16 Apr 2019 18:44:24 -0700 Subject: [PATCH 7/7] Add missing pr02 for compact tests. --- tests/compact-manifest.jsonld | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index c1cc1a06..1437a12c 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1662,7 +1662,7 @@ "context": "compact/pr01-context.jsonld", "expect": "invalid context nullification" }, { - "@id": "#tpr03", + "@id": "#tpr02", "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], "name": "Check illegal overriding of protected term", "purpose": "Check error when overriding a protected term.", @@ -1670,6 +1670,15 @@ "input": "compact/pr02-in.jsonld", "context": "compact/pr02-context.jsonld", "expect": "protected term redefinition" + }, { + "@id": "#tpr03", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "Check illegal overriding of protected term from type-scoped context", + "purpose": "Check error when overriding a protected term from type-scoped context.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/pr02-in.jsonld", + "context": "compact/pr02-context.jsonld", + "expect": "protected term redefinition" }, { "@id": "#tpr04", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],