diff --git a/index.html b/index.html index c0eec129..c2a3ebd7 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 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. @@ -2384,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. @@ -5626,6 +5646,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 +5674,7 @@

        JsonLdErrorCode

        "loading remote context failed", "multiple context link headers", "processing mode conflict", + "protected term redefinition", "context overflow" }; --> @@ -5769,6 +5791,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/compact-manifest.jsonld b/tests/compact-manifest.jsonld index e4aad10e..1437a12c 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1652,6 +1652,42 @@ "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": "#tpr02", + "@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": "#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"], + "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 diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 2ab66bfa..a6e5ace7 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", + "purpose": "Check error when overriding a protected term.", "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,116 @@ "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": "#tpr10", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "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", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#tpr12", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#tpr13", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "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": "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: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": "expand/pr15-out.jsonld" + }, { + "@id": "#tpr16", + "@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": "#tpr17", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#tpr18", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#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": "#tpr20", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#tpr21", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "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": "#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 deleted file mode 100644 index c25e0875..00000000 --- a/tests/expand/pr01-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "http://example.com/protected": [{ - "http://example.com/protected": [{"@value": "this should have the 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 deleted file mode 100644 index 45accb5e..00000000 --- a/tests/expand/pr03-out.jsonld +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "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"}] - }] - } -] 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 deleted file mode 100644 index 753c50b5..00000000 --- a/tests/expand/pr04-out.jsonld +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "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"}] - }] - } -] 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 deleted file mode 100644 index 97d3fee6..00000000 --- a/tests/expand/pr05-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "http://example.com/protected": [{ - "http://something-else/protected": [{"@value": "this should have the property http://something-else/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 deleted file mode 100644 index 8ec78391..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": "this should have the property http://example.com/another-thing"}] - }], - "http://example.com/scope2": [{ - "http://example.com/protected": [{"@value": "this should have the 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 deleted file mode 100644 index 89dc604d..00000000 --- a/tests/expand/pr09-out.jsonld +++ /dev/null @@ -1,7 +0,0 @@ -[{ - "http://example.org/protected2": [{ - "http://example.org/protected1": [{ - "@value": "this should have the property http://example.org/protected1" - }] - }] -}] 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/pr12-in.jsonld b/tests/expand/pr12-in.jsonld new file mode 100644 index 00000000..2dc30da6 --- /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": "p === ex:protected1", + "protected2": { + "@context": { + "protected1": "ex:protected1:error" + }, + "protected1": "error / p === ex:protected1" + } +} 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..e88b9ef2 --- /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": { + "protected1": "ex:protected3" + }, + "protected1": "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..d0cf99b1 --- /dev/null +++ b/tests/expand/pr15-in.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": { + "@id": "ex:protected2", + "@context": [ + null + ] + } + }, + "protected1": "p === ex:protected1", + "protected2": { + "@context": { + "protected1": "ex:protected3" + }, + "protected1": "p === ex:protected3" + } +} diff --git a/tests/expand/pr15-out.jsonld b/tests/expand/pr15-out.jsonld new file mode 100644 index 00000000..52c399e9 --- /dev/null +++ b/tests/expand/pr15-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/pr16-in.jsonld b/tests/expand/pr16-in.jsonld new file mode 100644 index 00000000..61946e01 --- /dev/null +++ b/tests/expand/pr16-in.jsonld @@ -0,0 +1,30 @@ +{ + "@context": { + "@version": 1.1, + "@protected": true, + "protected1": "ex:protected1", + "protected2": { + "@id": "ex:protected2", + "@context": [ + null, + { + "protected1": "ex:protected3", + "unprotected": "ex:unprotected2" + } + ] + }, + "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/pr16-out.jsonld b/tests/expand/pr16-out.jsonld new file mode 100644 index 00000000..264b8360 --- /dev/null +++ b/tests/expand/pr16-out.jsonld @@ -0,0 +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/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/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/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" +}