From d5d52c095176fe65af6d5f759a2b897b3f19972d Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Fri, 14 Feb 2020 15:08:17 -0800
Subject: [PATCH 01/11] Make _expandContext_ `@type: @id` and set option values
to be relative to the manifest location.
Fixes #369.
---
tests/context.jsonld | 2 +-
tests/expand-manifest.jsonld | 2 +-
tests/toRdf-manifest.jsonld | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/context.jsonld b/tests/context.jsonld
index dd15e370..25e9cee0 100644
--- a/tests/context.jsonld
+++ b/tests/context.jsonld
@@ -23,7 +23,7 @@
"compactArrays": { "@type": "xsd:boolean" },
"compactToRelative": { "@type": "xsd:boolean" },
"contentType": { "@type": "xsd:boolean" },
- "expandContext": { "@type": "xsd:string" },
+ "expandContext": { "@type": "@id" },
"httpLink": { "@type": "xsd:string", "@container": "@set" },
"httpStatus": { "@type": "xsd:integer" },
"processingMode": { "@type": "xsd:string" },
diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld
index 4a64055a..8afec4f0 100644
--- a/tests/expand-manifest.jsonld
+++ b/tests/expand-manifest.jsonld
@@ -550,7 +550,7 @@
"name": "expandContext option",
"purpose": "Use of the expandContext option to expand the input document",
"option": {
- "expandContext": "0077-context.jsonld"
+ "expandContext": "expand/0077-context.jsonld"
},
"input": "expand/0077-in.jsonld",
"expect": "expand/0077-out.jsonld"
diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld
index 1fca1871..f246f52c 100644
--- a/tests/toRdf-manifest.jsonld
+++ b/tests/toRdf-manifest.jsonld
@@ -1324,7 +1324,7 @@
"name": "expandContext option",
"purpose": "Use of the expandContext option to expand the input document",
"option": {
- "expandContext": "e077-context.jsonld"
+ "expandContext": "toRdf/e077-context.jsonld"
},
"input": "toRdf/e077-in.jsonld",
"expect": "toRdf/e077-out.nq"
From 9d410cc82bad312a1efba2e1078d01ec24e67676 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Fri, 14 Feb 2020 15:28:28 -0800
Subject: [PATCH 02/11] Set a fallback in `expand()` processing if there is no
`documentUrl`. This uses `JsonLdOptions/base`, which could be null, or
something else appropriate for when the `input` or `expandContext` is not a
URL.
For #370.
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index e8952b7e..4ed3fdf9 100644
--- a/index.html
+++ b/index.html
@@ -5743,7 +5743,7 @@ Algorithm
Initialize a new empty active context.
The base IRI and original base URL of the active context is set to the {{RemoteDocument/documentUrl}}
from remote document, if available;
- otherwise to null
.
+ otherwise to {{JsonLdOptions/base}}.
If set, the {{JsonLdOptions/base}} option from options overrides the base IRI.
If the {{JsonLdOptions/expandContext}} option in options is set,
update the active context using the Context Processing algorithm,
@@ -5759,7 +5759,7 @@ Algorithm
passing the active context,
{{RemoteDocument/document}} from remote document or input
if there is no remote document as element,
- {{RemoteDocument/documentUrl}} as base URL,
+ {{RemoteDocument/documentUrl}} as base URL, if available, otherwise to {{JsonLdOptions/base}},
and {{JsonLdOptions/frameExpansion}}
and and {{JsonLdOptions/ordered}}
flags from options.
From 317034e0c944b05c387f5bb22e2326db94e1f88c Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 14:32:51 -0800
Subject: [PATCH 03/11] Describe that if `documentUrl` is not available, values
come from `JsonLdOptions/base`, which now defaults to `null`.
Fixes #375.
---
index.html | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 4ed3fdf9..aec724cb 100644
--- a/index.html
+++ b/index.html
@@ -1159,7 +1159,8 @@ Overview
When an active context is initialized, the value
of the original base URL
is initialized from the original {{RemoteDocument/documentUrl}}
- of the document containing the initial context.
+ of the document containing the initial context, if available,
+ otherwise from the {{JsonLdOptions/base}} API option.
This is necessary when resetting the active context
by setting it to `null`
to retain the original default base IRI.
@@ -5743,7 +5744,7 @@ Algorithm
Initialize a new empty active context.
The base IRI and original base URL of the active context is set to the {{RemoteDocument/documentUrl}}
from remote document, if available;
- otherwise to {{JsonLdOptions/base}}.
+ otherwise to the {{JsonLdOptions/base}} option from options.
If set, the {{JsonLdOptions/base}} option from options overrides the base IRI.
If the {{JsonLdOptions/expandContext}} option in options is set,
update the active context using the Context Processing algorithm,
@@ -6092,7 +6093,7 @@ Algorithm
dictionary JsonLdOptions {
- USVString? base;
+ USVString? base = null;
boolean compactArrays = true;
boolean compactToRelative = true;
LoadDocumentCallback? documentLoader = null;
From 71e1f0c6d799141deb67ccdc75184bff90154146 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 14:41:42 -0800
Subject: [PATCH 04/11] Reorder clauses in 5.1.2 to make it more clear that
setting _base IRI_ and _original base URL_ of the new _active context_ is
unconditional, unlinke _previous_context_.
---
index.html | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/index.html b/index.html
index aec724cb..f563021e 100644
--- a/index.html
+++ b/index.html
@@ -1224,10 +1224,12 @@ Algorithm
has been detected and processing is aborted.
Initialize result as a
newly-initialized active context,
- setting previous context in result
- to the previous value of result if propagate is false
- and both base IRI and original base URL to the value of
- original base URL in active context.
+
+ setting both base IRI and original base URL to the value of
+ original base URL in active context,
+ and, if propagate is false
,
+ previous context in result
+ to the previous value of result.
Continue with the next context.
From cca90b1fd5a9f85cb55a750430459bb46d3abe1c Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 14:51:28 -0800
Subject: [PATCH 05/11] Create values for _context document_ and _loaded
context_ in the case that the previous document was cached in 5.2.3 of the
Create Context Algorithm.
Fixes #372.
---
index.html | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index f563021e..ae0076ad 100644
--- a/index.html
+++ b/index.html
@@ -1250,7 +1250,10 @@ Algorithm
If context was previously dereferenced,
then the processor MUST NOT do a further dereference, and
context is set to the
- previously established internal representation.
+ previously established internal representation,
+ set context document to the previously dereferenced document,
+ and set loaded context to the value of the `@context`
+ entry from the document in context document.
Only the `@context`
entry need be retained.
Otherwise, set context document
From 9f9275472473efcd0a27f48f74890a5279589b7d Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 15:12:06 -0800
Subject: [PATCH 06/11] Describe how to handle a remote context that is not a
valid IRI (not absolute) when it can't be resolved against _base URL_,
because it is also not a valid IRI. Update `expand()` to pass the _original
base URL_ from the current _active context_ when creating a new _active
context_ using _expandContext_.
Fixes #373.
---
index.html | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index ae0076ad..63752acc 100644
--- a/index.html
+++ b/index.html
@@ -1236,7 +1236,10 @@ Algorithm
If context is a string,
- Initialize context to the result of resolving context against
- base URL.
+ base URL. If base URL is not a valid IRI,
+ then context MUST be a valid IRI, otherwise
+ a loading document failed error
+ has been detected and processing is aborted.
base URL is often not the same as {{JsonLdOptions/base}}
or the
base IRI of the
active context.
@@ -5754,9 +5757,9 @@
Algorithm
- If the {{JsonLdOptions/expandContext}} option in options is set,
update the active context using the Context Processing algorithm,
passing the {{JsonLdOptions/expandContext}} as local context
- and {{JsonLdOptions/expandContext}} as base URL.
+ and the original base URL from active context as base URL.
If {{JsonLdOptions/expandContext}} is a map having an
@context
entry,
- pass that entry's value instead.
+ pass that
entry's value instead for
local context.
- If remote document has a {{RemoteDocument/contextUrl}},
update the active context using the Context Processing algorithm,
passing the {{RemoteDocument/contextUrl}} as local context,
From 8765cc263270339591da5d83d3330dd9db782637 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 15:14:52 -0800
Subject: [PATCH 07/11] Pass `null` for _active property_ on initial call to
the Expansion algorithm from `expand()`.
Fixes #374.
---
index.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 63752acc..aabda199 100644
--- a/index.html
+++ b/index.html
@@ -5768,8 +5768,9 @@
Algorithm
passing the active context,
{{RemoteDocument/document}} from remote document or input
if there is no remote document as element,
+ `null` as active property,
{{RemoteDocument/documentUrl}} as base URL, if available, otherwise to {{JsonLdOptions/base}},
- and {{JsonLdOptions/frameExpansion}}
+ and the {{JsonLdOptions/frameExpansion}}
and and {{JsonLdOptions/ordered}}
flags from options.
From 946e30e6ed2696e0a378bc620cff9706c47ffa2a Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 16:00:47 -0800
Subject: [PATCH 08/11] Add a description for `expandContext` as being an IRI
relative to the containing manifest.
For #369.
(cherry picked from commit 01dd367461e094427611e05cd3ddfd8a3ab08d9e)
---
tests/README.md | 6 ++++++
tests/expand-manifest.html | 3 +++
tests/html-manifest.html | 3 +++
tests/manifest.html | 6 ++++++
tests/remote-doc-manifest.html | 3 +++
tests/template.haml | 6 ++++++
6 files changed, 27 insertions(+)
diff --git a/tests/README.md b/tests/README.md
index 0ea120a1..770c48ac 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -18,6 +18,9 @@ Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [
* [expand](expand-manifest.jsonld) tests have _input_ and _expected_ documents.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output.
+ Expansion tests may have a `expandContext` option, which is treated
+ as an IRI relative to the manifest.
+
For *NegativeEvaluationTests*, the result is a string associated with the expected error code.
* [html](html.jsonld) tests have _input_ and _expected_ documents and an optional _context_ document.
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output
@@ -46,6 +49,9 @@ Tests driven from a top-level [manifest](manifest.jsonld) and are defined into [
* [toRdf](toRdf-manifest.jsonld) tests have _input_ and _expected_ documents.
The _expected_ results can be compared using [RDF Dataset Isomorphism](https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism).
+ ToRdf tests may have a `expandContext` option, which is treated
+ as an IRI relative to the manifest.
+
Unless `processingMode` is set explicitly in a test entry, `processingMode` is compatible with both `json-ld-1.0` and `json-ld-1.1`.
Test results that include a context input presume that the context is provided locally, and not from the referenced location, thus the results will include the content of the context file, rather than a reference.
diff --git a/tests/expand-manifest.html b/tests/expand-manifest.html
index 8420f334..63e8fb7c 100644
--- a/tests/expand-manifest.html
+++ b/tests/expand-manifest.html
@@ -32,6 +32,9 @@ expand tests have input and The expected results can be compared using JSON-LD object comparison with the processor output.
+Expansion tests may have a expandContext
option, which is treated
+as an IRI relative to the manifest.
+
For NegativeEvaluationTests, the result is a string associated with the expected error code.
Unless processingMode
is set explicitly in a test entry, processingMode
is compatible with both json-ld-1.0
and json-ld-1.1
.
diff --git a/tests/html-manifest.html b/tests/html-manifest.html
index 11c927ae..a58b077a 100644
--- a/tests/html-manifest.html
+++ b/tests/html-manifest.html
@@ -37,6 +37,9 @@ expand tests have input and The expected results can be compared using JSON-LD object comparison with the processor output.
+Expansion tests may have a expandContext
option, which is treated
+as an IRI relative to the manifest.
+
For NegativeEvaluationTests, the result is a string associated with the expected error code.
html tests have input and expected documents and an optional context document.
diff --git a/tests/manifest.html b/tests/manifest.html
index 76c5731a..fb7f792c 100644
--- a/tests/manifest.html
+++ b/tests/manifest.html
@@ -37,6 +37,9 @@ expand tests have input and The expected results can be compared using JSON-LD object comparison with the processor output.
+Expansion tests may have a expandContext
option, which is treated
+as an IRI relative to the manifest.
+
For NegativeEvaluationTests, the result is a string associated with the expected error code.
html tests have input and expected documents and an optional context document.
@@ -70,6 +73,9 @@ toRdf tests have input and
Some tests require the use of JSON Canonicalization Scheme to properly generate RDF Literals from JSON literal values. This algorithm is non-normative, but is assumed to be used to properly compare results. These tests are marked using the useJCS
option.
The expected results can be compared using RDF Dataset Isomorphism.
+
+ToRdf tests may have a expandContext
option, which is treated
+as an IRI relative to the manifest.
Unless processingMode
is set explicitly in a test entry, processingMode
is compatible with both json-ld-1.0
and json-ld-1.1
.
Test results that include a context input presume that the context is provided locally, and not from the referenced location, thus the results will include the content of the context file, rather than a reference.
diff --git a/tests/remote-doc-manifest.html b/tests/remote-doc-manifest.html
index 9ab5aea1..3306022e 100644
--- a/tests/remote-doc-manifest.html
+++ b/tests/remote-doc-manifest.html
@@ -32,6 +32,9 @@ expand tests have input and The expected results can be compared using JSON-LD object comparison with the processor output.
+Expansion tests may have a expandContext
option, which is treated
+as an IRI relative to the manifest.
+
For NegativeEvaluationTests, the result is a string associated with the expected error code.
remote-doc tests have input and expected documents.
diff --git a/tests/template.haml b/tests/template.haml
index 7d2baa02..4d50a1df 100644
--- a/tests/template.haml
+++ b/tests/template.haml
@@ -42,6 +42,9 @@
The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output.
+ Expansion tests may have a `expandContext` option, which is treated
+ as an IRI relative to the manifest.
+
For *NegativeEvaluationTests*, the result is a string associated with the expected error code.
- if manifest['sequence'].first.is_a?(String) || manifest['sequence'].any? {|te| te['@type'].include?('jld:HtmlTest')}
@@ -89,6 +92,9 @@
The _expected_ results can be compared using [RDF Dataset Isomorphism](https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism).
+ ToRdf tests may have a `expandContext` option, which is treated
+ as an IRI relative to the manifest.
+
:markdown
Unless `processingMode` is set explicitly in a test entry, `processingMode` is compatible with both `json-ld-1.0` and `json-ld-1.1`.
From a6bd9f54f31466f7232b76320856e3ee2c9e28b7 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Sat, 15 Feb 2020 16:12:57 -0800
Subject: [PATCH 09/11] Create a "context-base-iri" definition used for
referencing the _base IRI_ property of an _active context_.
For #371.
---
index.html | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/index.html b/index.html
index aabda199..cac17e30 100644
--- a/index.html
+++ b/index.html
@@ -1069,7 +1069,7 @@ RDF Serialization/Deserialization
- the active term definitions which specify how
keys and values have to be interpreted (array of term definitions),
- - the current base IRI (IRI),
+ - the current base IRI (IRI),
- the original base URL (IRI),
- an optional vocabulary mapping (IRI),
- an optional default language (string),
@@ -1131,7 +1131,7 @@ Overview
If context is a map,
it is a context definition.
We first update
- the base IRI,
+ the base IRI,
the default base direction,
the default language,
context propagation,
@@ -1163,7 +1163,7 @@
Overview
otherwise from the {{JsonLdOptions/base}} API option.
This is necessary when resetting the active context
by setting it to `null`
- to retain the original default base IRI.
+ to retain the original default base IRI.
Then, for every other entry in local context, we update
the term definition in result. Since
@@ -1225,7 +1225,7 @@
Algorithm
- Initialize result as a
newly-initialized active context,
- setting both base IRI and original base URL to the value of
+ setting both base IRI and original base URL to the value of
original base URL in active context,
and, if propagate is
false
,
previous context in result
@@ -1242,7 +1242,7 @@ Algorithm
has been detected and processing is aborted.
base URL is often not the same as {{JsonLdOptions/base}}
- or the
base IRI of the
active context.
+ or the
base IRI of the
active context.
- If the number of entries in the remote contexts array
@@ -1359,13 +1359,13 @@
Algorithm
- Initialize value to the value associated with the
@base
entry.
- If value is
null
, remove the
- base IRI of result.
+ base IRI of result.
- Otherwise, if value is an IRI,
- the base IRI of result is set to value.
+ the
base IRI of
result is set to
value.
- Otherwise, if value is a relative IRI reference and
- the base IRI of result is not
null
,
- set the base IRI of result to the result of
- resolving value against the current base IRI
+ the base IRI of result is not null
,
+ set the base IRI of result to the result of
+ resolving value against the current base IRI
of result.
- Otherwise, an
invalid base IRI
@@ -3215,7 +3215,7 @@
Algorithm
with value.
- Otherwise, if document relative is
true
set value to the result of resolving value against
- the base IRI from active context. Only the basic algorithm in
+ the base IRI from active context. Only the basic algorithm in
section 5.2
of [[RFC3986]] is used; neither
Syntax-Based Normalization nor
@@ -4187,7 +4187,7 @@ Algorithm
and processing is aborted.
- If vocab is
false
,
transform var to a relative IRI reference using
- the base IRI from active context, if it exists.
+ the
base IRI from active context, if it exists.
- Finally, return var as is.
@@ -5750,10 +5750,10 @@
Algorithm
If {{RemoteDocument/document}} cannot be transformed to the
internal representation,
reject
promise passing a
loading document failed error.
- Initialize a new empty active context.
- The base IRI and original base URL of the active context is set to the {{RemoteDocument/documentUrl}}
+ The base IRI and original base URL of the active context is set to the {{RemoteDocument/documentUrl}}
from remote document, if available;
otherwise to the {{JsonLdOptions/base}} option from options.
- If set, the {{JsonLdOptions/base}} option from options overrides the base IRI.
+ If set, the {{JsonLdOptions/base}} option from
options overrides the
base IRI.
- If the {{JsonLdOptions/expandContext}} option in options is set,
update the active context using the Context Processing algorithm,
passing the {{JsonLdOptions/expandContext}} as local context
From d78d8d21bb0fbcd9c23460375c0a9ae91a682c71 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Mon, 17 Feb 2020 11:20:23 -0800
Subject: [PATCH 10/11] Initialize _base URL_ in Create Term Definition to
`null`. For #375.
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index cac17e30..01144398 100644
--- a/index.html
+++ b/index.html
@@ -1517,7 +1517,7 @@
Algorithm
a term,
and a map defined.
The optional inputs are
- base URL,
+ 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..
From 45f077accf14a99fae4412d6434ca4b2ca439653 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg
Date: Tue, 18 Feb 2020 11:38:06 -0800
Subject: [PATCH 11/11] Slight update from @pchampin.
Co-Authored-By: Pierre-Antoine Champin
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 01144398..cf186565 100644
--- a/index.html
+++ b/index.html
@@ -1253,7 +1253,7 @@ Algorithm
- If context was previously dereferenced,
then the processor MUST NOT do a further dereference, and
context is set to the
- previously established internal representation,
+ previously established internal representation:
set context document to the previously dereferenced document,
and set loaded context to the value of the `@context`
entry from the document in context document.