diff --git a/index.html b/index.html index caf3f8d5..653df659 100644 --- a/index.html +++ b/index.html @@ -1192,7 +1192,7 @@

Algorithm

This algorithm specifies how a new active context is updated with a local context. The algorithm takes three required - and three optional + and four optional input variables. The required inputs are an active context, @@ -1204,8 +1204,10 @@

Algorithm

override protected, defaulting to false, which is used to allow changes to protected terms, - and propagate, defaulting to true - to mark term definitions associated with non-propagated contexts.. + propagate, defaulting to true + to mark term definitions associated with non-propagated contexts, + and validate scoped context defaulting to true, + which is used to limit recursion when validating possibly recusive scoped contexts..

    @@ -1259,6 +1261,10 @@

    Algorithm

    context overflow error has been detected and processing is aborted; otherwise, add context to remote contexts. +
  1. If validate scoped context is false, + and remote contexts already includes context + do not process context further and continue to any next + context in local context.
  2. If context was previously dereferenced, then the processor MUST NOT do a further dereference, and context is set to the @@ -1296,7 +1302,8 @@

    Algorithm

    the {{RemoteDocument/documentUrl}} of context document for base URL, - and a copy of remote contexts. + a copy of remote contexts, + and validate scoped context.
    If context was previously dereferenced, processors MUST make provisions for retaining the base URL of that context for this step to enable the resolution of any @@ -1470,9 +1477,11 @@

    Algorithm

    defined, base URL, - and the value of the @protected - entry from context, if any, for protected - . + the value of the @protected + entry from context, if any, for protected, + a copy of remote contexts, + and validate scoped context. +
@@ -1519,7 +1528,7 @@

Overview

Algorithm

-

The algorithm has four required and three optional inputs. +

The algorithm has four required and five optional inputs. The required inputs are an active context, a local context, @@ -1529,7 +1538,11 @@

Algorithm

base URL defaulting to null, protected which defaults to false, and override protected, defaulting to false, - which is used to allow changes to protected terms.. + which is used to allow changes to protected terms, + an array remote contexts, + defaulting to a new empty array, which is used to detect cyclical context inclusions, + and validate scoped context defaulting to true, + which is used to limit recursion when validating possibly recusive scoped contexts..

  1. If defined contains the entry term and the associated @@ -1805,7 +1818,9 @@

    Algorithm

  2. Invoke the Context Processing algorithm using the active context, context as local context, base URL, - and true for override protected. + true for override protected, + a copy of remote contexts, + and false for validate scoped context. If any error is detected, an invalid scoped context error has been detected and processing is aborted. @@ -6641,7 +6656,7 @@

    JsonLdErrorCode

    conflicting indexes
    Multiple conflicting indexes have been found for the same node.
    context overflow
    -
    maximum number of @context URLs exceeded.
    +
    Maximum number of @context URLs exceeded.
    cyclic IRI mapping
    A cycle in IRI mappings has been detected.
    invalid @id value
    @@ -6985,7 +7000,7 @@

    Changes since Candidate Release of 05 March 2020

    within an active context, and initialized as necessary. This simplifies calling sequences and better represents actual implementation experience.
  3. Update step 12.8.9.6
  4. -
  5. Update step 12.8.1 of the +
  6. Update step 12.8.10 of the Compaction Algorithm to add values to nest result instead of result as was originally intended.
  7. @@ -6993,6 +7008,14 @@

    Changes since Candidate Release of 05 March 2020

    of to exclude `@type`, leaving it to the next step. This could cause type values from a node to be left out of the merge. +
  8. Added step 5.2.3 + to the Context Processing algorithm, + which is added validate scoped context as a new + optional argument, and passed to the + Create Term Definition algorithm, + which in turn uses it with the value `false` when recursively calling + the Context Processing algorithm + when validating a scoped context.
+
+Test t0126 A scoped context may include itself recursively (direct) +
+
+
+
id
+
#t0126
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing a scoped context referencing itself directly
+
input
+
+expand/0126-in.jsonld +
+
expect
+
+expand/0126-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+Test t0127 A scoped context may include itself recursively (indirect) +
+
+
+
id
+
#t0127
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing a scoped context referencing itself indirectly
+
input
+
+expand/0127-in.jsonld +
+
expect
+
+expand/0127-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+Test t0128 Two scoped context may include a shared context +
+
+
+
id
+
#t0128
+
Type
+
jld:PositiveEvaluationTest, jld:ExpandTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing two scoped contexts referencing a shared context
+
input
+
+expand/0128-in.jsonld +
+
expect
+
+expand/0128-out.jsonld +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tc001 adding new term
diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index e5ad6fec..577d650b 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -940,6 +940,30 @@ "input": "expand/0125-in.jsonld", "expect": "expand/0125-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0126", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "A scoped context may include itself recursively (direct)", + "purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself directly", + "input": "expand/0126-in.jsonld", + "expect": "expand/0126-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0127", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "A scoped context may include itself recursively (indirect)", + "purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself indirectly", + "input": "expand/0127-in.jsonld", + "expect": "expand/0127-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0128", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Two scoped context may include a shared context", + "purpose": "Verifies that no exception is raised on expansion when processing two scoped contexts referencing a shared context", + "input": "expand/0128-in.jsonld", + "expect": "expand/0128-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/0126-context.jsonld b/tests/expand/0126-context.jsonld new file mode 100644 index 00000000..928397cb --- /dev/null +++ b/tests/expand/0126-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "0126-context.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/expand/0126-in.jsonld b/tests/expand/0126-in.jsonld new file mode 100644 index 00000000..b36e1085 --- /dev/null +++ b/tests/expand/0126-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": "0126-context.jsonld", + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/expand/0126-out.jsonld b/tests/expand/0126-out.jsonld new file mode 100644 index 00000000..bdf762a6 --- /dev/null +++ b/tests/expand/0126-out.jsonld @@ -0,0 +1,14 @@ +[ + { + "@id": "ex:id", + "ex:prop": [ + { + "ex:value": [ + { + "@value": "v" + } + ] + } + ] + } +] diff --git a/tests/expand/0127-context-1.jsonld b/tests/expand/0127-context-1.jsonld new file mode 100644 index 00000000..80615617 --- /dev/null +++ b/tests/expand/0127-context-1.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "0127-context-2.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/expand/0127-context-2.jsonld b/tests/expand/0127-context-2.jsonld new file mode 100644 index 00000000..2d23df43 --- /dev/null +++ b/tests/expand/0127-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "0127-context-1.jsonld" +} diff --git a/tests/expand/0127-in.jsonld b/tests/expand/0127-in.jsonld new file mode 100644 index 00000000..3b5668fd --- /dev/null +++ b/tests/expand/0127-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": "0127-context-1.jsonld", + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/expand/0127-out.jsonld b/tests/expand/0127-out.jsonld new file mode 100644 index 00000000..bdf762a6 --- /dev/null +++ b/tests/expand/0127-out.jsonld @@ -0,0 +1,14 @@ +[ + { + "@id": "ex:id", + "ex:prop": [ + { + "ex:value": [ + { + "@value": "v" + } + ] + } + ] + } +] diff --git a/tests/expand/0128-context-1.jsonld b/tests/expand/0128-context-1.jsonld new file mode 100644 index 00000000..9d520ad8 --- /dev/null +++ b/tests/expand/0128-context-1.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "0128-context-3.jsonld" +} diff --git a/tests/expand/0128-context-2.jsonld b/tests/expand/0128-context-2.jsonld new file mode 100644 index 00000000..9d520ad8 --- /dev/null +++ b/tests/expand/0128-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "0128-context-3.jsonld" +} diff --git a/tests/expand/0128-context-3.jsonld b/tests/expand/0128-context-3.jsonld new file mode 100644 index 00000000..31bcb7b8 --- /dev/null +++ b/tests/expand/0128-context-3.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "0128-context-3.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/expand/0128-in.jsonld b/tests/expand/0128-in.jsonld new file mode 100644 index 00000000..8ef7fafa --- /dev/null +++ b/tests/expand/0128-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": [ + "0128-context-1.jsonld", + "0128-context-2.jsonld" + ], + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/expand/0128-out.jsonld b/tests/expand/0128-out.jsonld new file mode 100644 index 00000000..bdf762a6 --- /dev/null +++ b/tests/expand/0128-out.jsonld @@ -0,0 +1,14 @@ +[ + { + "@id": "ex:id", + "ex:prop": [ + { + "ex:value": [ + { + "@value": "v" + } + ] + } + ] + } +] diff --git a/tests/expand/e003-context.jsonld b/tests/expand/e003-context.jsonld new file mode 100644 index 00000000..8629f916 --- /dev/null +++ b/tests/expand/e003-context.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e003-in.jsonld" +} diff --git a/tests/expand/e052-in.jsonld b/tests/expand/e052-in.jsonld new file mode 100644 index 00000000..7e3013c5 --- /dev/null +++ b/tests/expand/e052-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": "e052-in.jsonld", + "@id": "http://example/test#example" +} diff --git a/tests/expand/e053-context.jsonld b/tests/expand/e053-context.jsonld new file mode 100644 index 00000000..2da63c09 --- /dev/null +++ b/tests/expand/e053-context.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e053-in.jsonld" +} diff --git a/tests/expand/e053-in.jsonld b/tests/expand/e053-in.jsonld new file mode 100644 index 00000000..5f672792 --- /dev/null +++ b/tests/expand/e053-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": "e053-context.jsonld", + "@id": "http://example/test#example" +} diff --git a/tests/expand/e054-context-1.jsonld b/tests/expand/e054-context-1.jsonld new file mode 100644 index 00000000..5f536da4 --- /dev/null +++ b/tests/expand/e054-context-1.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e054-context-2.jsonld" +} diff --git a/tests/expand/e054-context-2.jsonld b/tests/expand/e054-context-2.jsonld new file mode 100644 index 00000000..16c05b52 --- /dev/null +++ b/tests/expand/e054-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e054-context-1.jsonld" +} diff --git a/tests/expand/e054-in.jsonld b/tests/expand/e054-in.jsonld new file mode 100644 index 00000000..e3ac866e --- /dev/null +++ b/tests/expand/e054-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": [ + "e054-context-1.jsonld", + "e054-context-2.jsonld" + ], + "@id": "ex:id" +} diff --git a/tests/toRdf-manifest.html b/tests/toRdf-manifest.html index 825c7378..08e54e57 100644 --- a/tests/toRdf-manifest.html +++ b/tests/toRdf-manifest.html @@ -5561,6 +5561,90 @@

+
+Test te126 A scoped context may include itself recursively (direct) +
+
+
+
id
+
#te126
+
Type
+
jld:PositiveEvaluationTest, jld:ToRDFTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing a scoped context referencing itself directly
+
input
+
+toRdf/e126-in.jsonld +
+
expect
+
+toRdf/e126-out.nq +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+Test te127 A scoped context may include itself recursively (indirect) +
+
+
+
id
+
#te127
+
Type
+
jld:PositiveEvaluationTest, jld:ToRDFTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing a scoped context referencing itself indirectly
+
input
+
+toRdf/e127-in.jsonld +
+
expect
+
+toRdf/e127-out.nq +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
+
+Test te128 Two scoped context may include a shared context +
+
+
+
id
+
#te128
+
Type
+
jld:PositiveEvaluationTest, jld:ToRDFTest
+
Purpose
+
Verifies that no exception is raised on expansion when processing two scoped contexts referencing a shared context
+
input
+
+toRdf/e128-in.jsonld +
+
expect
+
+toRdf/e128-out.nq +
+
Options
+
+
+
specVersion
+
json-ld-1.1
+
+
+
+
Test tec01 Invalid keyword in term definition
diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index 30c64a33..6f623012 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -1708,6 +1708,30 @@ "input": "toRdf/e125-in.jsonld", "expect": "toRdf/e125-out.nq", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#te126", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "A scoped context may include itself recursively (direct)", + "purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself directly", + "input": "toRdf/e126-in.jsonld", + "expect": "toRdf/e126-out.nq", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#te127", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "A scoped context may include itself recursively (indirect)", + "purpose": "Verifies that no exception is raised on expansion when processing a scoped context referencing itself indirectly", + "input": "toRdf/e127-in.jsonld", + "expect": "toRdf/e127-out.nq", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#te128", + "@type": [ "jld:PositiveEvaluationTest", "jld:ToRDFTest" ], + "name": "Two scoped context may include a shared context", + "purpose": "Verifies that no exception is raised on expansion when processing two scoped contexts referencing a shared context", + "input": "toRdf/e128-in.jsonld", + "expect": "toRdf/e128-out.nq", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tec01", "@type": [ "jld:NegativeEvaluationTest", "jld:ToRDFTest" ], diff --git a/tests/toRdf/e124-context.jsonld b/tests/toRdf/e124-context.jsonld new file mode 100644 index 00000000..bd77d9a1 --- /dev/null +++ b/tests/toRdf/e124-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e124-context.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e125-context-1.jsonld b/tests/toRdf/e125-context-1.jsonld new file mode 100644 index 00000000..514b9f12 --- /dev/null +++ b/tests/toRdf/e125-context-1.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e125-context-2.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e125-context-2.jsonld b/tests/toRdf/e125-context-2.jsonld new file mode 100644 index 00000000..539fc478 --- /dev/null +++ b/tests/toRdf/e125-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e125-context-1.jsonld" +} diff --git a/tests/toRdf/e126-context-1.jsonld b/tests/toRdf/e126-context-1.jsonld new file mode 100644 index 00000000..7c22a4f5 --- /dev/null +++ b/tests/toRdf/e126-context-1.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e126-context-3.jsonld" +} diff --git a/tests/toRdf/e126-context-2.jsonld b/tests/toRdf/e126-context-2.jsonld new file mode 100644 index 00000000..7c22a4f5 --- /dev/null +++ b/tests/toRdf/e126-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e126-context-3.jsonld" +} diff --git a/tests/toRdf/e126-context-3.jsonld b/tests/toRdf/e126-context-3.jsonld new file mode 100644 index 00000000..6b150166 --- /dev/null +++ b/tests/toRdf/e126-context-3.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e126-context-3.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e126-context.jsonld b/tests/toRdf/e126-context.jsonld new file mode 100644 index 00000000..548ae93f --- /dev/null +++ b/tests/toRdf/e126-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e126-context.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e126-in.jsonld b/tests/toRdf/e126-in.jsonld new file mode 100644 index 00000000..32f41007 --- /dev/null +++ b/tests/toRdf/e126-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": "e126-context.jsonld", + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/toRdf/e126-out.nq b/tests/toRdf/e126-out.nq new file mode 100644 index 00000000..77fbff8f --- /dev/null +++ b/tests/toRdf/e126-out.nq @@ -0,0 +1,2 @@ + _:b0 . +_:b0 "v" . diff --git a/tests/toRdf/e127-context-1.jsonld b/tests/toRdf/e127-context-1.jsonld new file mode 100644 index 00000000..bd82f33d --- /dev/null +++ b/tests/toRdf/e127-context-1.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e127-context-2.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e127-context-2.jsonld b/tests/toRdf/e127-context-2.jsonld new file mode 100644 index 00000000..d7c1f2c9 --- /dev/null +++ b/tests/toRdf/e127-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e127-context-1.jsonld" +} diff --git a/tests/toRdf/e127-in.jsonld b/tests/toRdf/e127-in.jsonld new file mode 100644 index 00000000..dcde2823 --- /dev/null +++ b/tests/toRdf/e127-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": "e127-context-1.jsonld", + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/toRdf/e127-out.nq b/tests/toRdf/e127-out.nq new file mode 100644 index 00000000..77fbff8f --- /dev/null +++ b/tests/toRdf/e127-out.nq @@ -0,0 +1,2 @@ + _:b0 . +_:b0 "v" . diff --git a/tests/toRdf/e128-context-1.jsonld b/tests/toRdf/e128-context-1.jsonld new file mode 100644 index 00000000..6586e453 --- /dev/null +++ b/tests/toRdf/e128-context-1.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e128-context-3.jsonld" +} diff --git a/tests/toRdf/e128-context-2.jsonld b/tests/toRdf/e128-context-2.jsonld new file mode 100644 index 00000000..6586e453 --- /dev/null +++ b/tests/toRdf/e128-context-2.jsonld @@ -0,0 +1,3 @@ +{ + "@context": "e128-context-3.jsonld" +} diff --git a/tests/toRdf/e128-context-3.jsonld b/tests/toRdf/e128-context-3.jsonld new file mode 100644 index 00000000..5f71478b --- /dev/null +++ b/tests/toRdf/e128-context-3.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "prop": { + "@id": "ex:prop", + "@context": "e128-context-3.jsonld" + }, + "value": { + "@id": "ex:value" + } + } +} diff --git a/tests/toRdf/e128-in.jsonld b/tests/toRdf/e128-in.jsonld new file mode 100644 index 00000000..4da4e6c8 --- /dev/null +++ b/tests/toRdf/e128-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": [ + "e128-context-1.jsonld", + "e128-context-2.jsonld" + ], + "@id": "ex:id", + "prop": { + "value": "v" + } +} diff --git a/tests/toRdf/e128-out.nq b/tests/toRdf/e128-out.nq new file mode 100644 index 00000000..77fbff8f --- /dev/null +++ b/tests/toRdf/e128-out.nq @@ -0,0 +1,2 @@ + _:b0 . +_:b0 "v" .