From ad3182c912d8dd1deb4fdaf17eadaa2a89d0a9f6 Mon Sep 17 00:00:00 2001
From: Gregg Kellogg Each of the JSON-LD keywords,
except for All keys, keywords, and values in JSON-LD are case-sensitive.Using the Document Base for the Default Vocabulary
Aliasing Keywords
-
@context
, may be aliased to application-specific
keywords. This feature allows legacy JSON content to be utilized
From 39ca24f6b2d52e12e14feba242118770910f775f Mon Sep 17 00:00:00 2001
From: Gregg Kellogg Syntax Tokens and Keywords
Used as the @type
value of a JSON literal.
This keyword is described in .
- :
:
Using the Document Base for the Default Vocabulary
different things depending on the context.
A context scoped on @type
is only in effect for the node object on which
the type is used; the previous in-scope contexts are placed back into
- effect when traversing into another node object.
Any property-scoped or local contexts that were introduced in the node object would still be in effect when traversing into another node object.
@@ -3520,6 +3532,103 @@json-ld-1.1
.
+Once introduced, contexts remain in effect until a subsequent + context removes it by setting `@context` to `null`, + or by redefining terms, + with the exception of type-scoped contexts, + which limits the affect of that context until the next node object is entered. + This behavior can be changed using the `@propagate` keyword.
+ +The following example illustrates how terms defined in a context with `@propagate` set to `false` + are effectively removed when descending into new node object.
+ + + +Contexts included within an array must all have the same value for `@propagate` + due to the way that rollback is defined in [[[JSON-LD11-API]]].
+JSON-LD is used in many specifications as the specified data format. However, there is also a desire to allow some JSON-LD contents to be processed as plain JSON, @@ -11713,10 +11822,12 @@
@reverse
,
@type
,
@language
,
+ @container
,
@context
,
- @prefix
, or
- @container
. An
- expanded term definition SHOULD NOT contain any other keys.
+ @prefix
,
+ @propagate
, or
+ @source
.
+ An expanded term definition SHOULD NOT contain any other keys.
If the term being defined is not a compact IRI or absolute IRI and the active context does not have an @@ -11782,6 +11893,12 @@
If the expanded term definition contains the @prefix
keyword, its value MUST be true
or false
.
If the expanded term definition contains the @propagate
+ keyword, its value MUST be true
or false
.
If the expanded term definition contains the @source
+ keyword, its value MUST be an absolute IRI or relative IRI.
Terms MUST NOT be used in a circular manner. That is, the definition of a term cannot depend on the definition of another term if that other term also depends on the first term.
@@ -11789,7 +11906,7 @@JSON-LD keywords are described in , this section describes where each keyword may appear within different JSON-LD structures.
@@ -11806,17 +11923,17 @@@set
,
@language
,
@index
,
- @id
,
- @graph
,
- @type
, or be
+ @id
,
+ @graph
,
+ @type
, or be
null,
- or an array containing exactly any one of those keywords, or a
- combination of @set
and any of @index
,
- @id
, @graph
, @type
,
- @language
in any order.
- The value may also be an array
- containing @graph
along with either @id
or
- @index
and also optionally including @set
.
+ or an array containing exactly any one of those keywords, or a
+ combination of @set
and any of @index
,
+ @id
, @graph
, @type
,
+ @language
in any order.
+ The value may also be an array
+ containing @graph
along with either @id
or
+ @index
and also optionally including @set
.
@context
@context
keyword MUST NOT be aliased, and MAY be used as a key in the following objects:
@@ -11836,6 +11953,12 @@ @container
key within an expanded term definition.
+ The value of the `@graph` key MUST be a value object, node object, or an array of either value objects or node objects.
+ See .
+ @id
@id
keyword MAY be aliased and MAY be used as a key in a node object or a graph object.
The unaliased @id
MAY be used as a key in an expanded term definition,
@@ -11878,7 +12001,7 @@ @nest
@nest
@nest
keyword MAY be aliased and MAY be used as a key in a node object.
The unaliased @nest
MAY be used as the value of a simple term definition,
or as a key in an expanded term definition.
@@ -11887,7 +12010,7 @@ @none
@none
@none
keyword MAY be aliased and MAY be used as a key in an
index map, id map, language map, type map.
See ,
@@ -11897,13 +12020,18 @@ @prefix
@prefix
@prefix
keyword MUST NOT be aliased, and MAY be used as a key in an expanded term definition.
Its value MUST be true
or false
.
See
and
for a further discussion.
true
or false
.
+ See for a further discussion.
+ @reverse
@reverse
keyword MAY be aliased and MAY be used as a key in a node object.
The unaliased @reverse
MAY be used as a key in an expanded term definition.
@@ -11929,6 +12057,11 @@ @type
@type
keyword MAY be aliased and MAY be used as a key in a node object or a value object.
The unaliased @type
MAY be used as a key in an expanded term definition,
@@ -11944,7 +12077,7 @@ true
, false
or null.
This keyword is described further in .
@version
@version
@version
keyword MUST NOT be aliased and MAY be used as a key in a context definition.
Its value MUST be a number with the value 1.1
.
This keyword is described further in .
@@ -12875,6 +13008,12 @@ @type
, which defines a context to use for node objects including the associated type.@propagate
+ entry in a local context.@source
entry used to reference a remote context
+ within a context, allowing JSON-LD 1.1
features to be added to contexts originally
+ authored for JSON-LD 1.0
.JSON-LD 1.0 included a mechanisms for modifying the context that + is in effect. This included the capability to load and process a remote + context and then apply further changes to it via new contexts. +
+ +However, with the introduction of JSON-LD 1.1, it is also desirable to + be able to load a remote context, in particular an existing JSON-LD + 1.0 context, and apply JSON-LD 1.1 features to it prior to + processing.
+ +By using the `@source` keyword in a context, another remote + context, referred to as a sourced context, can be loaded and + modified prior to processing. The modifications are expressed in the + context that includes the `@source` keyword, referred to as the + wrapping context. Once a sourced context is loaded, the + contents of the wrapping context are merged into it prior to + processing. The merge operation will cause each key-value pair in the + wrapping context to be added to the loaded sourced context, + key-value pairs taking precedence.
+ +By enabling existing contexts to be reused and edited inline prior + to processing, context-wide keywords can be applied to adjust all term + definitions in the sourced context. Similarly, term definitions can + be replaced prior to processing, enabling adjustments that, for instance, ensure term + definitions match previously protected terms or that they include + additional type coercion information.
+ +The following example illustrates how `@source` can be used to express + a type-scoped context that loads a sourced context and + sets `@propagate` to `true`.
+ +Suppose there was a context that could be referenced remotely
+ via the URL http://example.org/remote-context
:
+ ++ +
A wrapping context could be used to source it and modify it:
+ ++ ++ +
The effect would be the same as if the entire sourced context + had been copied into the type-scoped context:
+ ++ ++ +
Similarly, the wrapping context may replace term definitions or + set other context-wide keywords that may effect how the sourced + context term definitions will be processed:
+ ++ ++ +
Again, the effect would be the same as if the entire sourced context + had been copied into the type-scoped context:
+ ++ ++ +
The result of loading a sourced contexts must be + an object, not an array.
JSON-LD 1.0 included a mechanisms for modifying the context that +
JSON-LD 1.0 included mechanisms for modifying the context that is in effect. This included the capability to load and process a remote context and then apply further changes to it via new contexts.
From 0767e74260244497464e40b8890089611bb9675c Mon Sep 17 00:00:00 2001 From: Dave LongleyBy enabling existing contexts to be reused and edited inline prior
to processing, context-wide keywords can be applied to adjust all term
From 82b117130c1ca942b845a6ce4aa0f85575bb35fb Mon Sep 17 00:00:00 2001
From: Dave Longley Using the Document Base for the Default Vocabulary
definitions match previously protected terms or that they include
additional type coercion information.
The following example illustrates how `@source` can be used to express +
The following examples illustrate how `@source` can be used to express a type-scoped context that loads a sourced context and - sets `@propagate` to `true`.
+ sets `@propagate` to `true` and how to make similar modifications.Suppose there was a context that could be referenced remotely
via the URL http://example.org/remote-context
:
Again, the effect would be the same as if the entire sourced context - had been copied into the type-scoped context:
+ had been copied into the context:From 63216c84ab658f44504397c78251f84dee2349fa Mon Sep 17 00:00:00 2001 From: Gregg KelloggDate: Fri, 12 Jul 2019 12:09:02 -0700 Subject: [PATCH 9/9] Update `@source` to `@import`. --- Gemfile.lock | 6 +++--- index.html | 56 ++++++++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d611bdbb..37866348 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: git://github.com/ruby-rdf/json-ld.git - revision: 813e1ff914cc1a1025db14de392fd738b4cbb674 + remote: https://github.com/ruby-rdf/json-ld.git + revision: 74095b73cdb722b681f34d0f165599c9cb48d844 branch: develop specs: json-ld (3.0.2) @@ -176,4 +176,4 @@ DEPENDENCIES rake BUNDLED WITH - 1.17.3 + 2.0.2 diff --git a/index.html b/index.html index b660b6ed..1e73b713 100644 --- a/index.html +++ b/index.html @@ -600,7 +600,7 @@ Syntax Tokens and Keywords
(other than for type-scoped contexts, which default to `false`). Setting this to `false` causes term definitions created within that context to be removed when entering a new node object. -`@source` + `@import` Used in a context definition to load an external context within which the containing context definition is merged. This can be useful to add JSON-LD 1.1 features to JSON-LD 1.0 contexts. @@ -3626,7 +3626,7 @@Using the Document Base for the Default Vocabulary
due to the way that rollback is defined in [[[JSON-LD11-API]]].
JSON-LD 1.0 included mechanisms for modifying the context that is in effect. This included the capability to load and process a remote context and then apply further changes to it via new contexts. @@ -3637,39 +3637,39 @@
By using the `@source` keyword in a context, another remote - context, referred to as a sourced context, can be loaded and +
By using the `@import` keyword in a context, another remote + context, referred to as an imported context, can be loaded and modified prior to processing. The modifications are expressed in the - context that includes the `@source` keyword, referred to as the - wrapping context. Once a sourced context is loaded, the + context that includes the `@import` keyword, referred to as the + wrapping context. Once an imported context is loaded, the contents of the wrapping context are merged into it prior to processing. The merge operation will cause each key-value pair in the - wrapping context to be added to the loaded sourced context, + wrapping context to be added to the loaded imported context, with the wrapping context key-value pairs taking precedence.
By enabling existing contexts to be reused and edited inline prior to processing, context-wide keywords can be applied to adjust all term - definitions in the sourced context. Similarly, term definitions can + definitions in the imported context. Similarly, term definitions can be replaced prior to processing, enabling adjustments that, for instance, ensure term definitions match previously protected terms or that they include additional type coercion information.
-The following examples illustrate how `@source` can be used to express - a type-scoped context that loads a sourced context and +
The following examples illustrate how `@import` can be used to express + a type-scoped context that loads an imported context and sets `@propagate` to `true` and how to make similar modifications.
Suppose there was a context that could be referenced remotely
- via the URL http://example.org/remote-context
:
https://json-ld.org/contexts/remote-context.jsonld
:
+ title="A remote context to be imported in a type-scoped context">-
The effect would be the same as if the entire sourced context +
The effect would be the same as if the entire imported context had been copied into the type-scoped context:
Using the Document Base for the Default Vocabulary "Type1": "http://example.com/vocab/Type1", "Type2": "http://example.com/vocab/Type2", "term1": "http://example.com/vocab#term1", - "term2": "http://example.com/vocab#term2",####, + "term2": "http://example.com/vocab#term2",#### ...#### "@propagate": true } @@ -3724,7 +3724,7 @@Using the Document Base for the Default Vocabulary
Similarly, the wrapping context may replace term definitions or - set other context-wide keywords that may effect how the sourced + set other context-wide keywords that may effect how the imported context term definitions will be processed:
Using the Document Base for the Default Vocabulary { "@context": { "@version": 1.1, - "@source": "https://example.org/remote-context", + "@import": "https://json-ld.org/contexts/remote-context.jsonld", "@vocab": "http://example.org/vocab#", #### ↑ This will replace any previous @vocab definition prior to processing it#### "term1": { @@ -3746,7 +3746,7 @@-Using the Document Base for the Default Vocabulary
-->
Again, the effect would be the same as if the entire sourced context +
Again, the effect would be the same as if the entire imported context had been copied into the context:
Using the Document Base for the Default Vocabulary -->-
The result of loading a sourced contexts must be +
The result of loading imported contexts must be an object, not an array.
An expanded term definition MUST be a map
composed of zero or more keys from
@id
,
+ @import
,
@reverse
,
@type
,
@language
,
@container
,
@context
,
- @prefix
,
- @propagate
, or
- @source
.
+ @prefix
, or
+ @propagate
.
An expanded term definition SHOULD NOT contain any other keys.
If the term being defined is not a compact IRI or @@ -12041,7 +12041,7 @@
If the expanded term definition contains the @propagate
keyword, its value MUST be true
or false
.
If the expanded term definition contains the @source
+
If the expanded term definition contains the @import
keyword, its value MUST be an absolute IRI or relative IRI.
Terms MUST NOT be used in a circular manner. That is, @@ -12202,10 +12202,10 @@
See for further discussion on sets and lists.
-@type
@type
keyword MAY be aliased and MAY be used as a key in a node object or a value object.
@@ -13156,7 +13156,7 @@ @propagate
entry in a local context.@source
entry used to reference a remote context
+ @import
entry used to reference a remote context
within a context, allowing JSON-LD 1.1
features to be added to contexts originally
authored for JSON-LD 1.0
.