diff --git a/common/extract-examples.rb b/common/extract-examples.rb
index 44fc8eb3..6b589061 100755
--- a/common/extract-examples.rb
+++ b/common/extract-examples.rb
@@ -119,6 +119,13 @@ def table_to_dataset(table)
# We might think something was an IRI, but determine that it's not
object = RDF::Literal(object.to_s, language: cell.to_sym)
end
+ when 'Direction'
+ case cell
+ when '-', /^\s*$/
+ else
+ object = RDF::Literal(object.to_s, datatype: RDF::URI("https://www.w3.org/i18n##{object.language}_#{cell}"))
+ # We might think something was an IRI, but determine that it's not
+ end
end
end
repo << RDF::Statement.new(subject, predicate, object, graph_name: gname)
diff --git a/common/terms.html b/common/terms.html
index 2f75e8ae..1a122622 100644
--- a/common/terms.html
+++ b/common/terms.html
@@ -174,6 +174,10 @@
whose value MUST be a string representing a [[BCP47]] language code or null
.
@default
key.@direction
key
+ whose value MUST be one of the strings `"ltr"`, `"rtl"`, or null
.@context
entry of one of the following:
diff --git a/index.html b/index.html
index 756ff3f6..1aad6bb1 100644
--- a/index.html
+++ b/index.html
@@ -966,18 +966,21 @@ When processing, active context is initialized without any term definitions, - vocabulary mapping, or default language. + vocabulary mapping, default base direction, or default language. If a local context is encountered during processing, a new active context is created by cloning the existing active context. Then the information from the @@ -1023,10 +1026,20 @@
If context is a map,
it is a context definition.
- We first update the
- base IRI, the vocabulary mapping, processing mode, and the
- default language by processing three specific keywords:
- @base
, @vocab
, @version
, and @language
.
+ We first update
+ the base IRI,
+ the default base direction,
+ the default language,
+ context propagation,
+ the processing mode,
+ and the vocabulary mapping
+ by processing six specific keywords:
+ @base
,
+ @direction
,
+ @language
,
+ @propagate
,
+ @version
,
+ and @vocab
.
These are handled before any other entries in the local context because
they affect how the other entries are processed.
If context contains @import
, it is retrieved and is reverse-merged
@@ -1261,6 +1274,19 @@ Algorithm
error has been detected and processing is aborted.
+ @direction
entry:
+
+
+ @direction
entry.null
, remove
+ any base direction from result.@propagate
entry:
json-ld-1.0
,
@@ -1279,6 +1305,7 @@ Algorithm
@base
,
+ @direction
,
@import
,
@language
,
@propagate
,
@@ -1333,8 +1360,10 @@ Overview
the information in the local context for the given
term is taken into account, creating the appropriate
IRI mapping, container mapping, and
- type mapping or language mapping for the
- term.
@direction
and
+ does not contain the entry @type
:
+ @direction
entry, which MUST be either null
,
+ `"ltr"`, or `"rtl"`. Otherwise, an
+ invalid base direction
+ error has been detected and processing is aborted.@nest
:
json-ld-1.0
, an
@@ -1801,7 +1842,6 @@ false
,
- and element does not contain a entry expanding to @value
,
+ and element does not contain an entry expanding to @value
,
and element does not consist of a single entry expanding to @id
,
set active context to previous context from active context,
as the scope of a term-scoped context does not apply when processing new node objects.@direction
and
+ value is neither `"ltr"` nor `"rtl"`, an
+ invalid base direction
+ error has been detected and processing is aborted.
+ Otherwise, set expanded value to value.
+ When the {{JsonLdOptions/frameExpansion}} flag is set, value
+ may also be an empty map or an array of zero or
+ strings. expanded value will be an
+ array of one or more string values.@index
and
value is not a string, an
invalid @index value
@@ -2206,6 +2255,10 @@ true
:
null
,
+ @value
-item)
and (@language
-lowercased
- language),
- unless item is null
.
- If language is @none
,
- or expands to @none
, do not set the @language
entry.@none
,
+ or expands to @none
, remove @language
from v.@value
:
@value
, @language
, @type
,
- and @index
. It must not contain both a
- @language
entry and an @type
entry.
- Otherwise, an
- invalid value object
+ @direction
,
+ `@index`,
+ `@language`,
+ `@type`,
+ and `@value`.
+ It must not contain an `@type` entry if it contains either `@language` or `@direction` entries.
+ Otherwise, an invalid value object
error has been detected and processing is aborted.@value
entry is
null
, then set result to null
.@id
, @vocab
, or @none
,
- add an @type
entry to
+ add @type
to
result and set its value to the value associated with the
type mapping.@language
to result and set its
- value to the language code associated with the
- language mapping; unless the
- language mapping is set to null
in
- which case no such entry is added.@language
- to result and set its value to the
- default language.@language
to result with the value language.@direction
to result with the value direction.@index
container, drop the @index
entry by continuing
to the next expanded property.@index
,
- @value
, or @language
:
+ @direction
,
+ @index
,
+ @language
,
+ or @value
:
@none
. If the
- active context has a default language,
- set default language to it.@none
.
+ If the active context has a default language,
+ set default language to the default language from the active context.@none
set to the term being processed.@type
+ entry in type/language map using the variable
+ type map.@type
- entry in type/language map using the variable
- type map.@reverse
entry, create one and set its value to the term
being processed.@any
entry, create one and set its value to the term
being processed.@type
- entry in type/language map using the variable
- type map.@any
entry, create one and set its value to the term
being processed.@type
- entry in type/language map using the variable
- type map.@language
+ entry in type/language map using the variable
+ language map.null
):
@language
- entry in type/language map using the variable
- language map.null
,
set language to @null
; otherwise set it
- to the language code in language mapping.null
):
+ null
,
+ set direction to @none
; otherwise set it
+ to direction mapping preceded by an underscore (`"_"`).@language
- entry in type/language map using the variable
- language map.@none
entry, create one and set its value to the term
being processed.@type
- entry in type/language map using the variable
- type map.@none
entry, create one and set its value to the term
being processed.If the passed IRI is null
, we simply
- return null
. Otherwise, we first try to find a term
- that the IRI or keyword can be compacted to if
- it is relative to active context's
- vocabulary mapping. In order to select the most appropriate
- term, we may have to collect information about the passed
- value. This information includes which
- container mapping
- would be preferred for expressing the value, and what its
- type mapping or language mapping is. For
- JSON-LD lists, the type mapping
+
If the passed IRI is null
,
+ we simply return null
.
+ Otherwise, we first try to find a term that the IRI or keyword
+ can be compacted to if it is relative to
+ active context's vocabulary mapping.
+ In order to select the most appropriate term,
+ we may have to collect information about the passed value.
+ This information includes determining the preferred container mapping,
+ type mapping or language mapping
+ for expressing the value.
+ For JSON-LD lists, the type mapping
or language mapping will be chosen based on the most
- specific values that work for all items in the list. Once this
- information is gathered, it is passed to the
- Term Selection algorithm, which will
- return the most appropriate term to use.
If no term was found that could be used to compact the - IRI, an attempt is made to compact the IRI using the - active context's vocabulary mapping, - if there is one. If the IRI could not be compacted, an - attempt is made to find a compact IRI. + specific values that work for all items in the list. + Once this information is gathered, + it is passed to the Term Selection algorithm, + which will return the most appropriate term.
+ +If no term was found that could be used to compact the IRI,
+ an attempt is made to compact the IRI
+ using the active context's vocabulary mapping,
+ if there is one.
+ If the IRI could not be compacted,
+ an attempt is made to find a compact IRI.
A term will be used to create a compact IRI
only if the term definition contains the prefix flag
with the value true
.
If there is no appropriate compact IRI,
- and the compactToRelative option is true
,
- the IRI is
- transformed to a relative IRI using the document's
- base IRI. Finally, if the IRI or
- keyword still could not be compacted, it is returned
- as is.
true
,
+ the IRI is transformed to a relative IRI
+ using the document's base IRI.
+ Finally, if the IRI or keyword still could not be compacted,
+ it is returned as is.
+
+ When considering language mapping, + the direction mapping is also considered, either with, or without, + a language mapping.
In the case were this algorithm would return the input IRI as is, and that IRI can be mistaken for a compact IRI in the active context, @@ -3435,24 +3534,31 @@
This algorithm takes three required inputs and three optional inputs.
The required inputs are an active context, an inverse context,
- and the var to be compacted. The optional inputs are a value associated
- with the var, a vocab flag which specifies whether the
- passed var should be compacted using the
- active context's
- vocabulary mapping, and a reverse flag which specifies whether
- a reverse property is being compacted. If not passed, value is set to
- null
and vocab and reverse are both set to
- false
.
null
+ and both vocab and reverse are both set to false
.
null
, return null
.true
and var is an
entry of inverse context:
@none
.@preserve
, use the first
element from the value of @preserve
as value.@none
.@value
entry:
@language
entry,
+ @language
entry,
then set item language to its associated
value.@language
entry
+ @language
entry
and does not contain an @index
entry,
then set type/language value to its associated
value and, append @language
@@ -3590,12 +3707,12 @@ json-ld-1.1
and value does not contain an @index
entry, append
- @index
and @index@set
to containers.
+ If processing mode is json-ld-1.1
and value does not contain an @index
entry,
+ append @index
and @index@set
to containers.
json-ld-1.1
and value contains only an @value
entry, append
- @language
and @language@set
to containers.
+ If processing mode is json-ld-1.1
and value contains only an @value
entry,
+ append @language
and @language@set
to containers.
null
, set it to
@null
. This is the key under which null
values
@@ -3628,6 +3745,10 @@ @any
.@any
to preferred values.@index
entry and the
- container mapping associated to active property
- includes @index
, decrease number entries by
- 1
.2
, return
- value as it cannot be compacted.@none
,
- leave value as is, as value compaction is disabled.
+ @id
entry
+ and has no other entries other than `@index`:
@type
in value with the result of using the
- IRI compaction algorithm,
- passing active context, inverse context,
- the value of the @type
entry for var, and
- true
for vocab.true
for vocab.@id
entry:
- 1
and
+ @id
, return the result of using the
+ is set to @id
, set result to the result of using the
IRI compaction algorithm,
passing active context, inverse context,
and the value of the @id
entry for var.1
and
- the type mapping of active property
- is set to @vocab
, return the result of using the
+ @vocab
, set result to the result of using the
IRI compaction algorithm,
passing active context, inverse context,
the value of the @id
entry for var, and
true
for vocab.@type
entry whose
value matches the type mapping of active property,
- return the value associated with the @value
entry
+ set result to the value associated with the @value
entry
of value.@language
entry whose
- value matches the language mapping of
- active property, return the value associated with the
- @value
entry of value.1
and either
- the value of the @value
entry is not a string,
- or the active context has no default language,
- or the language mapping of active property
- is set to null
, return the value associated with the
- @value
entry.@type
in value with the result of using the
+ @none
,
+ or value has an `@type` entry,
+ and the value of `@type` in value does not match the type mapping of active property,
+ leave value as is, as value compaction is disabled.
+ @type
in result with the result of using the
IRI compaction algorithm,
passing active context, inverse context,
the value of the @type
entry for var, and
true
for vocab.true
for vocab.@value
entry is not a string:
+ @index
,
+ set result to the value associated with the `@value` entry.@index
,
+ or value has no `@index` entry,
+ set result to the value associated with the `@value` entry.true
for vocab.@default
entry, all other graphs are
stored under their graph name.
@@ -4239,7 +4356,7 @@ null
for identifier.@id
whose
value is id.The use of blank node identifiers to label properties is obsolete, and may be removed in a future version of JSON-LD.
+If the {{JsonLdOptions/rdfDirection}} option is not `null`, then special processing is used to + convert from an `i18n-datatype` or `compound-literal` form.
+ +The support for both `i18n-datatype` and `compound-literal` + algorithm steps are non-normative, and are AT RISK for JSON-LD 1.1. + They may be replaced with normative algorithm steps in a future version. + Either or both of these transformation methods may be removed prior to + JSON-LD 1.1 being finalized. + The JSON-LD Working Group solicits feedback from the community on the + usefulness of these transformations.
+Implementations MUST generate only well-formed triples and graph names:
The algorithm takes a map node map, which
is the result of the Node Map Generation algorithm and
an RDF dataset dataset into which new graphs and triples are added.
+ It also takes two optional input variables {{JsonLdOptions/produceGeneralizedRdf}}
+ and {{JsonLdOptions/rdfDirection}}.
Unless the {{JsonLdOptions/produceGeneralizedRdf}} option
is set to true
, triple
containing a blank node predicate
@@ -4618,7 +4748,7 @@
@type
entry of item or null
if
- item does not have such a entry.null
.@language
entry which is not well-formed, return null
.null
, set it to
xsd:string
or rdf:langString
, depending on if
item has an @language
entry.@language
entry, add the value associated with the
@language
entry as the language tag of literal.rdf:type
predicates will be serialized as @type
as long as the associated object is
either an IRI or blank node identifier.
+
+ If the {{JsonLdOptions/rdfDirection}} option is not `null`, then special processing is used to + convert from an `i18n-datatype` or `compound-literal` form.
+ +The support for both `i18n-datatype` and `compound-literal` + algorithm steps are non-normative, and are AT RISK for JSON-LD 1.1. + They may be replaced with normative algorithm steps in a future version. + Either or both of these transformation methods may be removed prior to + JSON-LD 1.1 being finalized. + The JSON-LD Working Group solicits feedback from the community on the + usefulness of these transformations.
The algorithm takes one required and three optional inputs: an RDF dataset dataset - and the three flags useNativeTypes, useRdfType, - and the {{JsonLdOptions/ordered}} flag, used to order - map entry keys lexicographically, where noted +
The algorithm takes one required and five optional inputs:
+ an RDF dataset dataset
+ and the five flags
+ {{JsonLdOptions/ordered}}, used to order
+ map entry keys lexicographically, where noted,
+ {{JsonLdOptions/rdfDirection}},
+ useNativeTypes,
+ and the useRdfType,
that all default to false
.
The dataset is iterable to iterate over graphs and graph names @@ -4781,6 +4956,7 @@
@default
whose value references
default graph.@id
whose value is name.rdf:nil
entry, continue
with the next name-graph object pair as the graph does
not contain any lists that need to be converted.RDF literals are transformed to
value objects whereas IRIs and
blank node identifiers are
- transformed to node objects.
- Literals with datatype rdf:JSON
- are transformed into a value object using the internal representation
- based on the lexical-to-value mapping defined in
- JSON datatype in [[JSON-LD11]],
- and @type
of @json
.
- If the useNativeTypes flag is set to true
,
+ transformed to node objects.
Literals with datatype rdf:JSON
+ are transformed into a value object using the internal representation
+ based on the lexical-to-value mapping defined in
+ JSON datatype in [[JSON-LD11]],
+ and @type
of @json
.
With the {{JsonLdOptions/rdfDirection}} option set to `i18n-datatype`, + literals with datatype starting with `https://w3.org/ns/i18n#` + are transformed into a value object by decoding + the language tag and base direction from the datatype.
+With the {{JsonLdOptions/rdfDirection}} option set to `compound-literal`, + blank node objects using `rdf:direction` are + are transformed into a value object by decoding + the `rdf:value`, `rdf:language`, and `rdf:direction` properties.
+If the useNativeTypes flag is set to true
,
RDF literals with a
datatype IRI
that equals xsd:integer
or xsd:double
are converted
@@ -4972,8 +5199,10 @@
This algorithm takes two required inputs: a value to be converted - to a map and a flag useNativeTypes.
+This algorithm takes three required inputs: + a value to be converted to a map, + {{JsonLdOptions/rdfDirection}}, + and a flag useNativeTypes.
json-ld-1.1
,
and value is a JSON literal,
- set the @value
entry to the result of
+ set converted value to the result of
turning the lexical value of value
into the JSON-LD internal representation, and set type to @json
.
If the lexical value of value is not valid JSON according to
the JSON Grammar [[RFC8259]],
an invalid JSON literal
error has been detected and processing is aborted.@language
to result and set its value to the
+ add an entry @language
to result and set its value to the
language tag of value.xsd:string
which is ignored.@value
to result whose value
+ @value
to result whose value
is set to converted value.null
, add a entry @type
+ null
, add an entry @type
to result whose value is set to type.true
,
certain algorithm processing steps where indicated are ordered lexicographically.
If false
, order is not considered in processing.null
and thus invalid.@nest
entry, which identifies a term expanding to
@nest
which is used for containing properties using the same
- @nest
mapping. When expanding, the values of a entry
+ @nest
mapping. When expanding, the values of an entry
expanding to @nest
are treated as if they were contained
within the enclosing node object directly.@container
values within an expanded term definition may now
@@ -6389,6 +6654,8 @@