diff --git a/index.html b/index.html index 554d7a72..f72dd518 100644 --- a/index.html +++ b/index.html @@ -1365,8 +1365,10 @@

Algorithm

  • If processing mode is json-ld-1.1 and term is @type, value - MUST be a map with the entry @container - and value @set. Any other value means that a + MUST be a map with only the entry @container + and value @set + and optional entry `@protected`. + Any other value means that a keyword redefinition error has been detected and processing is aborted.
  • Otherwise, since keywords cannot be overridden, diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html index 36057695..00eef5e7 100644 --- a/tests/expand-manifest.html +++ b/tests/expand-manifest.html @@ -8128,6 +8128,90 @@

    +
    +Test tpr30 Keywords may be protected. +
    +
    +
    +
    id
    +
    #tpr30
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +expand/pr30-in.jsonld +
    +
    expect
    +
    +expand/pr30-out.jsonld +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tpr31 Protected keyword aliases cannot be overridden. +
    +
    +
    +
    id
    +
    #tpr31
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +expand/pr31-in.jsonld +
    +
    expect
    +
    +protected term redefinition +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tpr32 Protected @type cannot be overridden. +
    +
    +
    +
    id
    +
    #tpr32
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ExpandTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +expand/pr32-in.jsonld +
    +
    expect
    +
    +protected term redefinition +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    Test tpr33 Fails if trying to declare a keyword alias as prefix.
    diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 8b16a8d1..22b15f35 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -2368,6 +2368,30 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr29-in.jsonld", "expect": "expand/pr29-out.jsonld" + }, { + "@id": "#tpr30", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Keywords may be protected.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr30-in.jsonld", + "expect": "expand/pr30-out.jsonld" + }, { + "@id": "#tpr31", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Protected keyword aliases cannot be overridden.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr31-in.jsonld", + "expect": "protected term redefinition" + }, { + "@id": "#tpr32", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "Protected @type cannot be overridden.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr32-in.jsonld", + "expect": "protected term redefinition" }, { "@id": "#tpr33", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pr30-in.jsonld b/tests/expand/pr30-in.jsonld new file mode 100644 index 00000000..5744284d --- /dev/null +++ b/tests/expand/pr30-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, + "id": "http://example.com/1", + "type": "http://example.org/ns/Foo", + "@type": "http://example.org/ns/Bar" +} \ No newline at end of file diff --git a/tests/expand/pr30-out.jsonld b/tests/expand/pr30-out.jsonld new file mode 100644 index 00000000..caa90d7e --- /dev/null +++ b/tests/expand/pr30-out.jsonld @@ -0,0 +1,9 @@ +[ + { + "@id": "http://example.com/1", + "@type": [ + "http://example.org/ns/Bar", + "http://example.org/ns/Foo" + ] + } +] \ No newline at end of file diff --git a/tests/expand/pr31-in.jsonld b/tests/expand/pr31-in.jsonld new file mode 100644 index 00000000..459d335a --- /dev/null +++ b/tests/expand/pr31-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": [{ + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, { + "@version": 1.1, + "id": "http://example.com/id" + }], + "id": "http://example.com/1", + "type": ["http://example.org/ns/Foo"] +} \ No newline at end of file diff --git a/tests/expand/pr32-in.jsonld b/tests/expand/pr32-in.jsonld new file mode 100644 index 00000000..3f287c01 --- /dev/null +++ b/tests/expand/pr32-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": [{ + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, { + "@version": 1.1, + "@type": {"@protected": true} + }], + "id": "http://example.com/1", + "type": ["http://example.org/ns/Foo"] +} \ No newline at end of file diff --git a/tests/toRdf-manifest.html b/tests/toRdf-manifest.html index 7d724f52..6e40ee2e 100644 --- a/tests/toRdf-manifest.html +++ b/tests/toRdf-manifest.html @@ -7066,6 +7066,90 @@

    +
    +Test tpr30 Keywords may be protected. +
    +
    +
    +
    id
    +
    #tpr30
    +
    Type
    +
    jld:PositiveEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +toRdf/pr30-in.jsonld +
    +
    expect
    +
    +toRdf/pr30-out.nq +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tpr31 Protected keyword aliases cannot be overridden. +
    +
    +
    +
    id
    +
    #tpr31
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +toRdf/pr31-in.jsonld +
    +
    expect
    +
    +term redefinition +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    +
    +Test tpr32 Protected @type cannot be overridden. +
    +
    +
    +
    id
    +
    #tpr32
    +
    Type
    +
    jld:NegativeEvaluationTest, jld:ToRDFTest
    +
    Purpose
    +
    Keywords may not be redefined other than to protect them.
    +
    input
    +
    +toRdf/pr32-in.jsonld +
    +
    expect
    +
    +protected term redefinition +
    +
    Options
    +
    +
    +
    specVersion
    +
    json-ld-1.1
    +
    +
    +
    +
    Test tpr33 Fails if trying to declare a keyword alias as prefix.
    diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 0cd3e3e3..d756f252 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -2110,6 +2110,30 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "toRdf/pr29-in.jsonld", "expect": "toRdf/pr29-out.nq" + }, { + "@id": "#tpr30", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Keywords may be protected.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/pr30-in.jsonld", + "expect": "toRdf/pr30-out.nq" + }, { + "@id": "#tpr31", + "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest"], + "name": "Protected keyword aliases cannot be overridden.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/pr31-in.jsonld", + "expect": "term redefinition" + }, { + "@id": "#tpr32", + "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest"], + "name": "Protected @type cannot be overridden.", + "purpose": "Keywords may not be redefined other than to protect them.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/pr32-in.jsonld", + "expect": "protected term redefinition" }, { "@id": "#tpr33", "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/pr30-in.jsonld b/tests/toRdf/pr30-in.jsonld new file mode 100644 index 00000000..5744284d --- /dev/null +++ b/tests/toRdf/pr30-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, + "id": "http://example.com/1", + "type": "http://example.org/ns/Foo", + "@type": "http://example.org/ns/Bar" +} \ No newline at end of file diff --git a/tests/toRdf/pr30-out.nq b/tests/toRdf/pr30-out.nq new file mode 100644 index 00000000..52703634 --- /dev/null +++ b/tests/toRdf/pr30-out.nq @@ -0,0 +1,2 @@ + . + . diff --git a/tests/toRdf/pr31-in.jsonld b/tests/toRdf/pr31-in.jsonld new file mode 100644 index 00000000..459d335a --- /dev/null +++ b/tests/toRdf/pr31-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": [{ + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, { + "@version": 1.1, + "id": "http://example.com/id" + }], + "id": "http://example.com/1", + "type": ["http://example.org/ns/Foo"] +} \ No newline at end of file diff --git a/tests/toRdf/pr32-in.jsonld b/tests/toRdf/pr32-in.jsonld new file mode 100644 index 00000000..3f287c01 --- /dev/null +++ b/tests/toRdf/pr32-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": [{ + "@version": 1.1, + "id": {"@id": "@id", "@protected": true}, + "type": {"@id" : "@type", "@container": "@set", "@protected" : true}, + "@type": {"@container": "@set", "@protected": true} + }, { + "@version": 1.1, + "@type": {"@protected": true} + }], + "id": "http://example.com/1", + "type": ["http://example.org/ns/Foo"] +} \ No newline at end of file