diff --git a/spec/latest/common/common.js b/spec/latest/common/common.js index 6a85089e9..52b2207fb 100644 --- a/spec/latest/common/common.js +++ b/spec/latest/common/common.js @@ -12,7 +12,7 @@ var jsonld = { }, "JSON-LD-API": { title: "JSON-LD 1.1 Processing Algorithms and API", - href: "http://json-ld.org/spec/latest/json-ld/", + href: "http://json-ld.org/spec/latest/json-ld-api/", authors: ["Markus Lanthaler", "Gregg Kellogg", "Manu Sporny"], publisher: "W3C", status: 'CG Draft' diff --git a/spec/latest/common/terms.html b/spec/latest/common/terms.html index 66945b3e3..77b2b569c 100644 --- a/spec/latest/common/terms.html +++ b/spec/latest/common/terms.html @@ -213,10 +213,10 @@
null
, set result to a
newly-initialized active context and continue with the
- next context. The base IRI of the
- active context is set to the IRI of the currently being processed
- document (which might be different from the currently being processed context),
- if available; otherwise to null
. If set, the
- base
- option of a JSON-LD API Implementation overrides the base IRI
.@context
, an
invalid keyword alias
error has been detected and processing is aborted.:
),
+ and if processing mode is json-ld-1.0
, and the,
+ IRI mapping of definition ends with a URI
+ gen-delim character,
+ set the prefix flag in definition to true
.
+ If processing mode is not json-ld-1.0, and the IRI mapping ends with a URI
+ gen-delim character,
+ set the prefix flag in definition to true
, only if
+ value was originally a string.json-ld-1.0
, an
invalid term definition
has been detected and processing is aborted.@nest
key, which must be a string and
must not be a keyword other than @nest
. Otherwise, an
invalid @nest value
error has been detected and processing is aborted.@prefix
:
+ json-ld-1.0
, or if
+ term contains a colon (:
), an
+ invalid term definition
+ has been detected and processing is aborted.@prefix
key, which must be a boolean. Otherwise, an
+ invalid @prefix value
+ error has been detected and processing is aborted.@id
,
@reverse
, @container
,
- @context
, @nest
, or @type
, an
+ @context
, @nest
,
+ @prefix
, or @type
, an
invalid term definition error has
been detected and processing is aborted.true
for vocab, and
inside reverse.@nest
- member, that value (nest term) must be
+ in the active context has a nest value, that value (nest term) must be
@nest
, or a term definition in the
active context that expands to @nest
,
otherwise an invalid @nest
@@ -2172,7 +2193,7 @@ true
for vocab, and
inside reverse.@nest
+ in the active context has a nest value
member, that value (nest term) must be
@nest
, or a term definition in the
active context that expands to @nest
,
@@ -2511,8 +2532,13 @@ 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
@@ -2699,18 +2725,16 @@ null
. This variable will be used to
tore the created compact IRI, if any.:
),
- then continue to the next term because
- terms with colons can't be
- used as prefixes.null
,
- its IRI mapping equals iri, or its
+ its IRI mapping equals iri, its
IRI mapping is not a substring at the beginning of
- iri, the term cannot be used as a prefix
- because it is not a partial match with iri.
+ iri,
+ or the term definition does not contain
+ the prefix flag having a value of true
,
+ the term cannot be used as a prefix.
Continue with the next term.:
), and the substring of iri
@@ -2729,7 +2753,7 @@ null
, return compact IRI.false
then
transform iri to a relative IRI using
- the document's base IRI.@context
member, set
context to that member's value, otherwise to context.null
.null
as property,
expanded input as element, and if passed, the
@@ -4138,12 +4169,20 @@ @context
member, set
context to that member's value, otherwise to context.null
.0
)
to be used by the
Generate Blank Node Identifier algorithm.json-ld
as they are reserved for future versions
of this specification.@nest
has been found.@prefix
has been found.@reverse
member has been detected,
i.e., the value was not a dictionary.@set
(other than @list
).
This allows a way to ensure that such property values will always
be expressed in array form.
+ @prefix
member with the value true. The 1.0 algorithm has
+ been updated to only consider terms that map to a value that ends with a URI
+ gen-delim character.The following is a list of open issues being worked on for the next release.
- - - + - - - + diff --git a/spec/latest/json-ld-framing/index.html b/spec/latest/json-ld-framing/index.html index 3e1c32a15..9a2cffbe0 100644 --- a/spec/latest/json-ld-framing/index.html +++ b/spec/latest/json-ld-framing/index.html @@ -1222,13 +1222,21 @@@context
from frame, if it exists, or to
a new empty context, otherwise.null
.@graph
set the frameDefault
option to options with the
value true
.@nest
@prefix
@version
_
), the value is interpreted as blank node identifier
instead.
+ In JSON-LD 1.0, terms will be used as compact IRI prefixes when
+ compacting only if they map to a value that ends with a URI gen-delim character (e.g, /
,
+ #
and others, see [[!RFC3986]]).
This represents a small change to the 1.0 algorithm to prevent IRIs + that are not really intended to be used as prefixes from being used for creating + compact IRIs.
+ +When processing mode is set to json-ld-1.1
, terms will be used as compact IRI prefixes
+ when compacting only if their expanded term definition contains
+ a @prefix
member with the value true, or if it has a
+ a simple term definition where the value ends with a URI gen-delim character
+ (e.g, /
, #
and others, see [[!RFC3986]]).
It's also possible to use compact IRIs within the context as shown in the following example:
@@ -2228,7 +2245,7 @@Scoping on @type
is useful when common properties are used to relate things of different types, where the vocabularies in use within different entities calls for different context scoping. For example, `hasPart`/`partOf` may be common terms used in a document, but mean different things depending on the context.
Scoped Contexts are a new feature in JSON-LD 1.1, requiring
- processing mode set to json-ld-1.1
json-ld-1.1
.
@@ -2788,7 +2805,7 @@ Id maps are a new feature in JSON-LD 1.1, requiring
- processing mode set to json-ld-1.1
json-ld-1.1
.
Type maps are a new feature in JSON-LD 1.1, requiring
- processing mode set to json-ld-1.1
json-ld-1.1
.
Nested properties are a new feature in JSON-LD 1.1, requiring
- processing mode set to json-ld-1.1
json-ld-1.1
.
An expanded term definition MUST be a JSON object
composed of zero or more keys from @id
, @reverse
,
- @type
, @language
, @context
or @container
. An
+ @type
, @language
, @context
,
+ @prefix
or @container
. An
expanded term definition SHOULD NOT contain any other keys.
If an expanded term definition has an @reverse
member,
@@ -3727,14 +3745,17 @@
If an expanded term definition has an @context
member,
it MUST be a valid context definition
.
If the expanded term definition contains the @nest
+ keyword, its value MUST be either @nest
, or a term
+ which expands to @nest
.
If the expanded term definition contains the @prefix
+ keyword, its value MUST be true
or false
.
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.
-If the expanded term definition contains the @nest
- keyword, its value MUST be either @nest
, or a term
- which expands to @nest
.
@set
(other than @list
).
This allows a way to ensure that such property values will always
be expressed in array form.
+ @prefix
member with the value true. The 1.0 algorithm has
+ been updated to only consider terms that map to a value that ends with a URI
+ gen-delim character.The following is a list of open issues being worked on for the next release.
- - - diff --git a/test-suite/context.jsonld b/test-suite/context.jsonld index 238bbb6f6..727c57d49 100644 --- a/test-suite/context.jsonld +++ b/test-suite/context.jsonld @@ -20,6 +20,7 @@ "description": "rdfs:comment", "base": { "@type": "@id" }, "compactArrays": { "@type": "xsd:boolean" }, + "compactToRelative": { "@type": "xsd:boolean" }, "documentLoader": { "@type": "xsd:string" }, "expandContext": { "@type": "xsd:string" }, "processingMode": { "@type": "xsd:string" }, diff --git a/test-suite/tests/compact-0038-out.jsonld b/test-suite/tests/compact-0038-out.jsonld index 78369d193..a8f965894 100644 --- a/test-suite/tests/compact-0038-out.jsonld +++ b/test-suite/tests/compact-0038-out.jsonld @@ -20,19 +20,19 @@ "title": { "en": { "@type": "site-cd:field-types/title_field", - "title:/value": "This is the English title" + "site-cd:node/article/title/value": "This is the English title" }, "es": { "@type": "site-cd:field-types/title_field", - "title:/value": "Este es el t’tulo espa–ol" + "site-cd:node/article/title/value": "Este es el t’tulo espa–ol" } }, "body": { "en": { "@type": "site-cd:field-types/text_with_summary", - "body:/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.", - "body:/summary": "This is the teaser for the body.", - "body:/format": "full_html" + "site-cd:node/article/body/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.", + "site-cd:node/article/body/summary": "This is the teaser for the body.", + "site-cd:node/article/body/format": "full_html" } }, "field_tags": { diff --git a/test-suite/tests/compact-0045-context.jsonld b/test-suite/tests/compact-0045-context.jsonld index 005f5e16d..5854b8a04 100644 --- a/test-suite/tests/compact-0045-context.jsonld +++ b/test-suite/tests/compact-0045-context.jsonld @@ -1,7 +1,7 @@ { "@context": { "term": "http://example.com/terms-are-not-considered-in-id", - "compact-iris": "http://example.com/compact-iris-", + "compact-iris": "http://example.com/compact-iris#", "property": "http://example.com/property", "@vocab": "http://example.org/vocab-is-not-considered-for-id" }, diff --git a/test-suite/tests/compact-0045-in.jsonld b/test-suite/tests/compact-0045-in.jsonld index 990d67b3d..6aa647ea2 100644 --- a/test-suite/tests/compact-0045-in.jsonld +++ b/test-suite/tests/compact-0045-in.jsonld @@ -3,7 +3,7 @@ "@id": "http://json-ld.org/test-suite/tests/term", "http://example.com/property": [ { - "@id": "http://example.com/compact-iris-are-considered", + "@id": "http://example.com/compact-iris#are-considered", "http://example.com/property": [ { "@value": "@id supports the following values: relative, absolute, and compact IRIs" } ] diff --git a/test-suite/tests/compact-0045-out.jsonld b/test-suite/tests/compact-0045-out.jsonld index 005f5e16d..5854b8a04 100644 --- a/test-suite/tests/compact-0045-out.jsonld +++ b/test-suite/tests/compact-0045-out.jsonld @@ -1,7 +1,7 @@ { "@context": { "term": "http://example.com/terms-are-not-considered-in-id", - "compact-iris": "http://example.com/compact-iris-", + "compact-iris": "http://example.com/compact-iris#", "property": "http://example.com/property", "@vocab": "http://example.org/vocab-is-not-considered-for-id" }, diff --git a/test-suite/tests/compact-manifest.jsonld b/test-suite/tests/compact-manifest.jsonld index 1cf5c3953..eebe0a15a 100644 --- a/test-suite/tests/compact-manifest.jsonld +++ b/test-suite/tests/compact-manifest.jsonld @@ -836,6 +836,87 @@ "context": "compact-n010-context.jsonld", "expect": "compact-n010-out.jsonld", "option": {"processingMode": "json-ld-1.1"} + }, { + "@id": "#tp001", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI does may use an expanded term definition in 1.0", + "purpose": "Terms with an expanded term definition may be used for creating compact IRIs", + "option": {"processingMode": "json-ld-1.0"}, + "input": "compact-p001-in.jsonld", + "context": "compact-p001-context.jsonld", + "expect": "compact-p001-out.jsonld" + }, { + "@id": "#tp002", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI does not use expanded term definition in 1.1", + "purpose": "Terms with an expanded term definition are not used for creating compact IRIs", + "option": {"processingMode": "json-ld-1.1"}, + "input": "compact-p002-in.jsonld", + "context": "compact-p002-context.jsonld", + "expect": "compact-p002-out.jsonld" + }, { + "@id": "#tp003", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI does not use simple term that does not end with a gen-delim", + "purpose": "Terms not ending with a gen-delim are not used for creating compact IRIs", + "input": "compact-p003-in.jsonld", + "context": "compact-p003-context.jsonld", + "expect": "compact-p003-out.jsonld" + }, { + "@id": "#tp004", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRIs using simple terms ending with gen-delim", + "purpose": "All simple terms ending with gen-delim are suitable for compaction", + "input": "compact-p004-in.jsonld", + "context": "compact-p004-context.jsonld", + "expect": "compact-p004-out.jsonld" + }, { + "@id": "#tp005", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI uses term with definition including @prefix: true", + "purpose": "Expanded term definition may set prefix explicitly in 1.1", + "option": {"processingMode": "json-ld-1.1"}, + "input": "compact-p005-in.jsonld", + "context": "compact-p005-context.jsonld", + "expect": "compact-p005-out.jsonld" + }, { + "@id": "#tp006", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI uses term with definition including @prefix: true", + "purpose": "Expanded term definition may set prefix explicitly in 1.1", + "option": {"processingMode": "json-ld-1.1"}, + "input": "compact-p006-in.jsonld", + "context": "compact-p006-context.jsonld", + "expect": "compact-p006-out.jsonld" + }, { + "@id": "#tp007", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Compact IRI not used as prefix", + "purpose": "Terms including a colon are excluded from being used as a prefix", + "input": "compact-p007-in.jsonld", + "context": "compact-p007-context.jsonld", + "expect": "compact-p007-out.jsonld" + }, { + "@id": "#tr001", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Expands and compacts to document base by default", + "purpose": "Compact IRI attempts to compact document-relative IRIs", + "input": "compact-r001-in.jsonld", + "context": "compact-r001-context.jsonld", + "expect": "compact-r001-out.jsonld", + "option": {"base": "http://example.org/", "processingMode": "json-ld-1.1"} + }, { + "@id": "#tr002", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Expands and does not compact to document base with compactToRelative false", + "purpose": "With compactToRelative option set to false, IRIs which could be made relative to the document base are not made relative.", + "input": "compact-r002-in.jsonld", + "context": "compact-r002-context.jsonld", + "expect": "compact-r002-out.jsonld", + "option": { + "processingMode": "json-ld-1.1", + "compactToRelative": false + } }, { "@id": "#ts001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], @@ -846,7 +927,7 @@ "expect": "compact-s001-out.jsonld", "option": {"processingMode": "json-ld-1.1"} }, { - "@id": "#ts001", + "@id": "#ts002", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], "name": "@context with array including @set uses array values", "purpose": "@context values may include @set along with another compatible value", diff --git a/test-suite/tests/compact-p001-context.jsonld b/test-suite/tests/compact-p001-context.jsonld new file mode 100644 index 000000000..2d72ed662 --- /dev/null +++ b/test-suite/tests/compact-p001-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "ex": {"@id": "http://example.org/"} + } +} diff --git a/test-suite/tests/compact-p001-in.jsonld b/test-suite/tests/compact-p001-in.jsonld new file mode 100644 index 000000000..19beb0f3d --- /dev/null +++ b/test-suite/tests/compact-p001-in.jsonld @@ -0,0 +1,5 @@ +{ + "@id": "http://example.org/id1", + "@type": ["http://example.org/Type1", "http://example.org/Type2"], + "http://example.org/term": {"@id": "http://example.org/id2"} +} diff --git a/test-suite/tests/compact-p001-out.jsonld b/test-suite/tests/compact-p001-out.jsonld new file mode 100644 index 000000000..e9d795226 --- /dev/null +++ b/test-suite/tests/compact-p001-out.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "ex": {"@id": "http://example.org/"} + }, + "@id": "ex:id1", + "@type": ["ex:Type1", "ex:Type2"], + "ex:term": {"@id": "ex:id2"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-p002-context.jsonld b/test-suite/tests/compact-p002-context.jsonld new file mode 100644 index 000000000..2d72ed662 --- /dev/null +++ b/test-suite/tests/compact-p002-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "ex": {"@id": "http://example.org/"} + } +} diff --git a/test-suite/tests/compact-p002-in.jsonld b/test-suite/tests/compact-p002-in.jsonld new file mode 100644 index 000000000..19beb0f3d --- /dev/null +++ b/test-suite/tests/compact-p002-in.jsonld @@ -0,0 +1,5 @@ +{ + "@id": "http://example.org/id1", + "@type": ["http://example.org/Type1", "http://example.org/Type2"], + "http://example.org/term": {"@id": "http://example.org/id2"} +} diff --git a/test-suite/tests/compact-p002-out.jsonld b/test-suite/tests/compact-p002-out.jsonld new file mode 100644 index 000000000..5dfd781a7 --- /dev/null +++ b/test-suite/tests/compact-p002-out.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "ex": {"@id": "http://example.org/"} + }, + "@id": "http://example.org/id1", + "@type": ["http://example.org/Type1", "http://example.org/Type2"], + "http://example.org/term": {"@id": "http://example.org/id2"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-p003-context.jsonld b/test-suite/tests/compact-p003-context.jsonld new file mode 100644 index 000000000..589074441 --- /dev/null +++ b/test-suite/tests/compact-p003-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "compact-iris:": "http://example.com/compact-iris-", + "property": "http://example.com/property" + } +} diff --git a/test-suite/tests/compact-p003-in.jsonld b/test-suite/tests/compact-p003-in.jsonld new file mode 100644 index 000000000..948a5d52a --- /dev/null +++ b/test-suite/tests/compact-p003-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.com/property": { + "@id": "http://example.com/compact-iris-are-considered", + "http://example.com/property": "Prefix terms must end in a gen-delim" + } +} diff --git a/test-suite/tests/compact-p003-out.jsonld b/test-suite/tests/compact-p003-out.jsonld new file mode 100644 index 000000000..be552f3b9 --- /dev/null +++ b/test-suite/tests/compact-p003-out.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "compact-iris:": "http://example.com/compact-iris-", + "property": "http://example.com/property" + }, + "property": { + "@id": "http://example.com/compact-iris-are-considered", + "property": "Prefix terms must end in a gen-delim" + } +} diff --git a/test-suite/tests/compact-p004-context.jsonld b/test-suite/tests/compact-p004-context.jsonld new file mode 100644 index 000000000..f4348ae16 --- /dev/null +++ b/test-suite/tests/compact-p004-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "ex": "http://example.com/", + "colon": "http://example.org/:", + "question": "http://example.org/?", + "hash": "http://example.org/#", + "lbracket": "http://example.org/[", + "rbracket": "http://example.org/]", + "at": "http://example.org/@" + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-p004-in.jsonld b/test-suite/tests/compact-p004-in.jsonld new file mode 100644 index 000000000..4f9847f97 --- /dev/null +++ b/test-suite/tests/compact-p004-in.jsonld @@ -0,0 +1,9 @@ +{ + "http://example.com/foo": "Use term with IRI ending in '/'", + "http://example.org/:foo": "Use term with IRI ending in ':'", + "http://example.org/?foo": "Use term with IRI ending in '?'", + "http://example.org/#foo": "Use term with IRI ending in '#'", + "http://example.org/[foo": "Use term with IRI ending in '['", + "http://example.org/]foo": "Use term with IRI ending in ']'", + "http://example.org/@foo": "Use term with IRI ending in '@'" +} diff --git a/test-suite/tests/compact-p004-out.jsonld b/test-suite/tests/compact-p004-out.jsonld new file mode 100644 index 000000000..20de37219 --- /dev/null +++ b/test-suite/tests/compact-p004-out.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "ex": "http://example.com/", + "colon": "http://example.org/:", + "question": "http://example.org/?", + "hash": "http://example.org/#", + "lbracket": "http://example.org/[", + "rbracket": "http://example.org/]", + "at": "http://example.org/@" + }, + "ex:foo": "Use term with IRI ending in '/'", + "colon:foo": "Use term with IRI ending in ':'", + "question:foo": "Use term with IRI ending in '?'", + "hash:foo": "Use term with IRI ending in '#'", + "lbracket:foo": "Use term with IRI ending in '['", + "rbracket:foo": "Use term with IRI ending in ']'", + "at:foo": "Use term with IRI ending in '@'" +} \ No newline at end of file diff --git a/test-suite/tests/compact-p005-context.jsonld b/test-suite/tests/compact-p005-context.jsonld new file mode 100644 index 000000000..daa9107db --- /dev/null +++ b/test-suite/tests/compact-p005-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "compact-iris": {"@id": "http://example.com/compact-iris-", "@prefix": true}, + "property": "http://example.com/property" + } +} diff --git a/test-suite/tests/compact-p005-in.jsonld b/test-suite/tests/compact-p005-in.jsonld new file mode 100644 index 000000000..cef01fc88 --- /dev/null +++ b/test-suite/tests/compact-p005-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.com/property": { + "@id": "http://example.com/compact-iris-are-considered", + "http://example.com/property": "@prefix does not require a gen-delim" + } +} diff --git a/test-suite/tests/compact-p005-out.jsonld b/test-suite/tests/compact-p005-out.jsonld new file mode 100644 index 000000000..6920c1935 --- /dev/null +++ b/test-suite/tests/compact-p005-out.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "compact-iris": {"@id": "http://example.com/compact-iris-", "@prefix": true}, + "property": "http://example.com/property" + }, + "property": { + "@id": "compact-iris:are-considered", + "property": "@prefix does not require a gen-delim" + } +} diff --git a/test-suite/tests/compact-p006-context.jsonld b/test-suite/tests/compact-p006-context.jsonld new file mode 100644 index 000000000..daa9107db --- /dev/null +++ b/test-suite/tests/compact-p006-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "compact-iris": {"@id": "http://example.com/compact-iris-", "@prefix": true}, + "property": "http://example.com/property" + } +} diff --git a/test-suite/tests/compact-p006-in.jsonld b/test-suite/tests/compact-p006-in.jsonld new file mode 100644 index 000000000..cef01fc88 --- /dev/null +++ b/test-suite/tests/compact-p006-in.jsonld @@ -0,0 +1,6 @@ +{ + "http://example.com/property": { + "@id": "http://example.com/compact-iris-are-considered", + "http://example.com/property": "@prefix does not require a gen-delim" + } +} diff --git a/test-suite/tests/compact-p006-out.jsonld b/test-suite/tests/compact-p006-out.jsonld new file mode 100644 index 000000000..6920c1935 --- /dev/null +++ b/test-suite/tests/compact-p006-out.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "compact-iris": {"@id": "http://example.com/compact-iris-", "@prefix": true}, + "property": "http://example.com/property" + }, + "property": { + "@id": "compact-iris:are-considered", + "property": "@prefix does not require a gen-delim" + } +} diff --git a/test-suite/tests/compact-p007-context.jsonld b/test-suite/tests/compact-p007-context.jsonld new file mode 100644 index 000000000..29d4f9743 --- /dev/null +++ b/test-suite/tests/compact-p007-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "foo": "http://example.org/", + "foo:bar": "foo:baz/" + } +} diff --git a/test-suite/tests/compact-p007-in.jsonld b/test-suite/tests/compact-p007-in.jsonld new file mode 100644 index 000000000..0594114e8 --- /dev/null +++ b/test-suite/tests/compact-p007-in.jsonld @@ -0,0 +1,4 @@ +{ + "@id": "http://example.org/baz/a", + "http://example.org/baz/b": "c" +} diff --git a/test-suite/tests/compact-p007-out.jsonld b/test-suite/tests/compact-p007-out.jsonld new file mode 100644 index 000000000..48b60a7bd --- /dev/null +++ b/test-suite/tests/compact-p007-out.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "foo": "http://example.org/", + "foo:bar": "foo:baz/" + }, + "@id": "foo:baz/a", + "foo:baz/b": "c" +} diff --git a/test-suite/tests/compact-r001-context.jsonld b/test-suite/tests/compact-r001-context.jsonld new file mode 100644 index 000000000..304ef521a --- /dev/null +++ b/test-suite/tests/compact-r001-context.jsonld @@ -0,0 +1,3 @@ +{ + "@context": {"b": "http://example.com/b"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-r001-in.jsonld b/test-suite/tests/compact-r001-in.jsonld new file mode 100644 index 000000000..543c3609a --- /dev/null +++ b/test-suite/tests/compact-r001-in.jsonld @@ -0,0 +1,4 @@ +{ + "@id": "a", + "http://example.com/b": {"@id": "c"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-r001-out.jsonld b/test-suite/tests/compact-r001-out.jsonld new file mode 100644 index 000000000..89a6b5566 --- /dev/null +++ b/test-suite/tests/compact-r001-out.jsonld @@ -0,0 +1,5 @@ +{ + "@context": {"b": "http://example.com/b"}, + "@id": "a", + "b": {"@id": "c"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-r002-context.jsonld b/test-suite/tests/compact-r002-context.jsonld new file mode 100644 index 000000000..304ef521a --- /dev/null +++ b/test-suite/tests/compact-r002-context.jsonld @@ -0,0 +1,3 @@ +{ + "@context": {"b": "http://example.com/b"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-r002-in.jsonld b/test-suite/tests/compact-r002-in.jsonld new file mode 100644 index 000000000..765625c35 --- /dev/null +++ b/test-suite/tests/compact-r002-in.jsonld @@ -0,0 +1,4 @@ +{ + "@id": "http://example.org/a", + "http://example.com/b": {"@id": "http://example.org/c"} +} \ No newline at end of file diff --git a/test-suite/tests/compact-r002-out.jsonld b/test-suite/tests/compact-r002-out.jsonld new file mode 100644 index 000000000..b87865393 --- /dev/null +++ b/test-suite/tests/compact-r002-out.jsonld @@ -0,0 +1,5 @@ +{ + "@context": {"b": "http://example.com/b"}, + "@id": "http://example.org/a", + "b": {"@id": "http://example.org/c"} +} \ No newline at end of file diff --git a/test-suite/tests/error-manifest.jsonld b/test-suite/tests/error-manifest.jsonld index d2d3a4d1d..bda5a3cfb 100644 --- a/test-suite/tests/error-manifest.jsonld +++ b/test-suite/tests/error-manifest.jsonld @@ -429,6 +429,33 @@ "input": "error-p006-in.jsonld", "context": "error-p006-context.jsonld", "expect": "invalid @version value" + }, { + "@id": "#tp007", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "@prefix is not allowed in 1.0", + "purpose": "@prefix is not allowed in a term definitionin 1.0", + "option": {"processingMode": "json-ld-1.0"}, + "input": "error-p007-in.jsonld", + "context": "error-p007-context.jsonld", + "expect": "invalid term definition" + }, { + "@id": "#tp008", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "@prefix must be a boolean", + "purpose": "@prefix must be a boolean in a term definition in 1.1", + "option": {"processingMode": "json-ld-1.1"}, + "input": "error-p008-in.jsonld", + "context": "error-p008-context.jsonld", + "expect": "invalid @prefix value" + }, { + "@id": "#tp009", + "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], + "name": "@prefix not allowed on compact IRI term", + "purpose": "If processingMode is json-ld-1.0, or if term contains a colon (:), an invalid term definition has been detected and processing is aborted.", + "option": {"processingMode": "json-ld-1.1"}, + "input": "error-p009-in.jsonld", + "context": "error-p009-context.jsonld", + "expect": "invalid term definition" }, { "@id": "#ts001", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/test-suite/tests/error-p007-context.jsonld b/test-suite/tests/error-p007-context.jsonld new file mode 100644 index 000000000..f2829c077 --- /dev/null +++ b/test-suite/tests/error-p007-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "foo": {"@id": "http://example/foo", "@prefix": true} + } +} \ No newline at end of file diff --git a/test-suite/tests/error-p007-in.jsonld b/test-suite/tests/error-p007-in.jsonld new file mode 100644 index 000000000..ffc25a6b7 --- /dev/null +++ b/test-suite/tests/error-p007-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example/foo": "bar" +} \ No newline at end of file diff --git a/test-suite/tests/error-p008-context.jsonld b/test-suite/tests/error-p008-context.jsonld new file mode 100644 index 000000000..1fde76ae9 --- /dev/null +++ b/test-suite/tests/error-p008-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "foo": {"@id": "http://example/foo", "@prefix": "string"} + } +} \ No newline at end of file diff --git a/test-suite/tests/error-p008-in.jsonld b/test-suite/tests/error-p008-in.jsonld new file mode 100644 index 000000000..ffc25a6b7 --- /dev/null +++ b/test-suite/tests/error-p008-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example/foo": "bar" +} \ No newline at end of file diff --git a/test-suite/tests/error-p009-context.jsonld b/test-suite/tests/error-p009-context.jsonld new file mode 100644 index 000000000..7d7d2eae9 --- /dev/null +++ b/test-suite/tests/error-p009-context.jsonld @@ -0,0 +1,5 @@ +{ + "@context": { + "foo:bar": {"@id": "http://example/foo/bar/", "@prefix": true} + } +} \ No newline at end of file diff --git a/test-suite/tests/error-p009-in.jsonld b/test-suite/tests/error-p009-in.jsonld new file mode 100644 index 000000000..6a50fcaa1 --- /dev/null +++ b/test-suite/tests/error-p009-in.jsonld @@ -0,0 +1,3 @@ +{ + "http://example/foo/bar/": "bar" +} \ No newline at end of file diff --git a/test-suite/vocab.html b/test-suite/vocab.html index 6a18c5696..c4d7a1ebd 100644 --- a/test-suite/vocab.html +++ b/test-suite/vocab.html @@ -1,392 +1,433 @@ - - - - - - - - - -Test case manifest vocabulary extensions
-A CompactTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the compact method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file in expanded form, context from :input
(aliased as "context" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A ExpandTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the expand method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FlattenTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the flatten method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, optional context from :input
(aliased as "context" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FrameTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the frame method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, frame from :input
(aliased as "frame" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FromRDFTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the RDF to Object Conversion algorithm with the input argument from mf:action
(aliased as "input" in test manifest) referencing an N-Quads file and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action. Negative syntax tests are tests of which the result should be a parser error.
A Negative Evaluation test is successful when the result of processing the input file specified as mf:action
(aliased as "input" in test manifest) results in the error identified by the literal value of mf:result
(aliased as "expect" in test manifest). The specifics of invoking test, including the interpretation of options (:option
) and other input files are specified through another class.
A Positive Evaluation test is successful when the result of processing the input file specified as mf:action
(aliased as "input" in test manifest) exactly matches the output file specified as mf:result
(aliased as "expect" in test manifest) using the comparison defined in another class. The specifics of invoking test, including the interpretation of options (:option
) and other input files are specified through another class.
A Negative Evaluation test is successful when the result of processing the input file specified as mf:action
(aliased as "input" in test manifest) results in the error identified by the literal value of mf:result
(aliased as "expect" in test manifest). The specifics of invoking test, including the interpretation of options (:option
) and other input files are specified through another class.
A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.
Options passed to the test runner to affect invocation of the appropriate API method.
All JSON-LD tests have an input file referenced using mf:action
(aliased as "input" in test manifest). Positive and Negative Evaluation Tests also have a result file referenced using mf:result
(aliased as "expect" in test manifest). Other tests may take different inputs and options as defined for each test class. Tests should be run with the processingMode option set to "json-ld-1.1", unless specified explicitly as a test option.
A ToRDFTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the Deserialize JSON-LD to RDF algorithm with the input argument from mf:action
(aliased as "input" in test manifest) referencing an JSON-LD file and optional options from :option
. The expected results for a PositiveEvaluationTest
are N-Quads serialized in lexographical order and MUST be compared either string comparison or Dataset as defined in RDF11-CONCEPTS.
An HTTP Link header to be added to the result of requesting the input file.
-jld:Test
- xsd:boolean
- The HTTP status code that must be returned when the input file is requested. This is typically used along with the redirectTo
property.
jld:Test
- xsd:boolean
- The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.
-jld:Test
- rdfs:Resource
- If set to true
, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.
jld:Test
- xsd:boolean
- The HTTP Content-Type used for the input file, in case it is a non-registered type.
-jld:Test
- xsd:boolean
- A context that is used to initialize the active context when expanding a document.
-jld:Test
- rdfs:Resource
- Secondary input file
-jld:Test
- rdfs:Resource
- Options affecting processing
-jld:Test
- jld:Option
- If set to "json-ld-1.1", the JSON-LD processor must produce exactly the same results as the algorithms defined in this specification. If set to another value, the JSON-LD processor is allowed to extend or modify the algorithms defined in this specification to enable application-specific optimizations. The definition of such optimizations is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.
-jld:Option
- xsd:string
- Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.
-jld:ToRDFTest
- xsd:boolean
- The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.
-jld:Test
- xsd:boolean
- If the use rdf type flag is set to true
, statements with an rdf:type
predicate will not use @type
, but will be transformed as a normal property.
jld:FromRDFTest
- xsd:boolean
- Test runners must implement a callback method with a method signature as defined in LoadDocumentCallback. Specifying this option requires the test runner to provide this callback to the appropriate API method using the documentLoader
option.
jld:Test
- xsd:boolean
- If the use native types flag is set to true
, RDF literals with a datatype IRI that equal xsd:integer
or xsd:double
are converted to a JSON numbers and RDF literals with a datatype IRI that equals xsd:boolean
are converted to true
or false
based on their lexical form.
jld:FromRDFTest
- xsd:boolean
- Test case manifest vocabulary extensions
+A CompactTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the compact method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file in expanded form, context from :input
(aliased as "context" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A ExpandTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the expand method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FlattenTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the flatten method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, optional context from :input
(aliased as "context" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FrameTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the frame method with the input argument from mf:action
(aliased as "input" in test manifest) referencing a JSON-LD file, frame from :input
(aliased as "frame" in the test manifest) and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A FromRDFTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the RDF to Object Conversion algorithm with the input argument from mf:action
(aliased as "input" in test manifest) referencing an N-Quads file and optional options from :option
. The expected results for a PositiveEvaluationTest
MUST be compared using JSON object comparison with the processor output.
A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action. Negative syntax tests are tests of which the result should be a parser error.
+A Negative Evaluation test is successful when the result of processing the input file specified as mf:action
(aliased as "input" in test manifest) results in the error identified by the literal value of mf:result
(aliased as "expect" in test manifest). The specifics of invoking test, including the interpretation of options (:option
) and other input files are specified through another class.
A Positive Evaluation test is successful when the result of processing the input file specified as mf:action
(aliased as "input" in test manifest) exactly matches the output file specified as mf:result
(aliased as "expect" in test manifest) using the comparison defined in another class. The specifics of invoking test, including the interpretation of options (:option
) and other input files are specified through another class.
A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.
+Options passed to the test runner to affect invocation of the appropriate API method.
+All JSON-LD tests have an input file referenced using mf:action
(aliased as "input" in test manifest). Positive and Negative Evaluation Tests also have a result file referenced using mf:result
(aliased as "expect" in test manifest). Other tests may take different inputs and options as defined for each test class. Tests should be run with the processingMode option set to "json-ld-1.1", unless specified explicitly as a test option.
A ToRDFTest
modifies either a PositiveEvaluationTest
, NegativeEvaluationTest
, PositiveSyntaxTest
or NegativeSyntaxTest
. Tests are run using the Deserialize JSON-LD to RDF algorithm with the input argument from mf:action
(aliased as "input" in test manifest) referencing an JSON-LD file and optional options from :option
. The expected results for a PositiveEvaluationTest
are N-Quads serialized in lexographical order and MUST be compared either string comparison or Dataset as defined in RDF11-CONCEPTS.
An HTTP Link header to be added to the result of requesting the input file.
+ +jld:Option
+xsd:boolean
+The HTTP status code that must be returned when the input file is requested. This is typically used along with the redirectTo
property.
jld:Option
+xsd:boolean
+The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.
+ +jld:Option
+rdfs:Resource
+If set to true
, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.
jld:Option
+xsd:boolean
+If set to false
, the JSON-LD processor will not attempt to compact using document-relative IRIs.
jld:Option
+xsd:boolean
+The HTTP Content-Type used for the input file, in case it is a non-registered type.
+ +jld:Option
+xsd:boolean
+A context that is used to initialize the active context when expanding a document.
+ +jld:Option
+rdfs:Resource
+Secondary input file
+ +jld:Test
+rdfs:Resource
+Options affecting processing
+ +jld:Test
+jld:Option
+If set to "json-ld-1.1", the JSON-LD processor must produce exactly the same results as the algorithms defined in this specification. If set to another value, the JSON-LD processor is allowed to extend or modify the algorithms defined in this specification to enable application-specific optimizations. The definition of such optimizations is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.
+ +jld:Option
+xsd:string
+Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.
+ +jld:Option
+xsd:boolean
+The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.
+ +jld:Option
+xsd:boolean
+If the use rdf type flag is set to true
, statements with an rdf:type
predicate will not use @type
, but will be transformed as a normal property.
jld:Option
+xsd:boolean
+Test runners must implement a callback method with a method signature as defined in LoadDocumentCallback. Specifying this option requires the test runner to provide this callback to the appropriate API method using the documentLoader
option.
jld:Option
+xsd:boolean
+If the use native types flag is set to true
, RDF literals with a datatype IRI that equal xsd:integer
or xsd:double
are converted to a JSON numbers and RDF literals with a datatype IRI that equals xsd:boolean
are converted to true
or false
based on their lexical form.
jld:Option
+xsd:boolean
+