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 @@

General Terminology

object
An object is a node in a linked data graph with at least one incoming edge. See RDF objectin [[RDF11-CONCEPTS]].
-
prefix
- A prefix is a term that expands to a vocabulary base IRI. It - is typically used along with a suffix to form a compact IRI to create an IRI - within a vocabulary.
+
prefix
+ A prefix is the first component of a compact IRI which comes from a + term that maps to a string that, when prepended to the suffix of the compact IRI + results in an absolute IRI.
processing mode
The processing mode defines how a JSON-LD document is processed. By default, all documents are assumed to be conformat with @@ -252,7 +252,7 @@

General Terminology

term definition
A term definition is an entry in a context, where the key defines a term which may be used within a JSON object as a property, type, or elsewhere that a string is interpreted as a vocabulary item. - Its value is either a string, expanding to an absolute IRI, or an expanded term definition. + Its value is either a string (simple term definition), expanding to an absolute IRI, or an expanded term definition.
type map
An type map is a JSON object value of a term defined with diff --git a/spec/latest/json-ld-api/index.html b/spec/latest/json-ld-api/index.html index 7e4e0a1d7..6df36d9c6 100644 --- a/spec/latest/json-ld-api/index.html +++ b/spec/latest/json-ld-api/index.html @@ -684,7 +684,9 @@

Context Processing Algorithm

term definition consists of an IRI mapping, a boolean flag reverse property, an optional type mapping or language mapping, - an optional context, + an optional context, + an optional nest value, + an optional prefix flag, and an optional container mapping. A term definition can not only be used to map a term to an IRI, but also to map a term to a keyword, @@ -768,12 +770,10 @@

Algorithm

  1. If context is 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.
  2. + next context. + In JSON-LD 1.0, the base IRI was given + a default value here; this is now described conditionally + in .
  3. If context is a string,
    1. Set context to the result of resolving value against @@ -1034,6 +1034,15 @@

      Algorithm

      error has been detected and processing is aborted; if it equals @context, an invalid keyword alias error has been detected and processing is aborted.
    2. +
    3. If term does not contain a colon (:), + 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.
  4. @@ -1118,16 +1127,29 @@

    Algorithm

  5. If processingMode is json-ld-1.0, an invalid term definition has been detected and processing is aborted.
  6. -
  7. Initialize nest to the value associated with the +
  8. Initialize nest value in defined to the value associated with the @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.
+
  • If value contains the key @prefix: +
      +
    1. If processingMode is json-ld-1.0, or if + term contains a colon (:), an + invalid term definition + has been detected and processing is aborted.
    2. +
    3. Initialize the prefix flag to the value associated with the + @prefix key, which must be a boolean. Otherwise, an + invalid @prefix value + error has been detected and processing is aborted.
    4. +
    +
  • If the value contains any key other than @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.
  • Set the term definition of term in @@ -2137,8 +2159,7 @@

    Algorithm

    true for vocab, and inside reverse.
  • If the term definition for item active property - in the active context has a @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 @@

    Algorithm

    true for vocab, and inside reverse.
  • If the term definition for item active property - in the active context has a @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 @@

    Overview

    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. If there is no - appropriate compact IRI, the IRI is + 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 @@ -2699,18 +2725,16 @@

    Algorithm

    Try to create a compact IRI, starting by initializing compact IRI to null. This variable will be used to tore the created compact IRI, if any.
  • -
  • For each key term and value term definition in +
  • or each key term and value term definition in the active context:
      -
    1. If the term contains a colon (:), - then continue to the next term because - terms with colons can't be - used as prefixes.
    2. If the term definition is 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.
    3. Initialize candidate by concatenating term, a colon (:), and the substring of iri @@ -2729,7 +2753,7 @@

      Algorithm

    4. If compact IRI is not null, return compact IRI.
    5. If vocab is false then transform iri to a relative IRI using - the document's base IRI.
    6. + the base IRI from active context, if it exists.
    7. Finally, return iri as is.
    @@ -4036,9 +4060,16 @@

    The JsonLdProcessor Interface

    method using input and options.
  • If context is a dictionary having an @context member, set context to that member's value, otherwise to context.
  • +
  • Initialize an active context using context; + the base IRI is set to + the base option from + options, if set; + otherwise, if the + compactToRelative option is + true, to the IRI of the currently being processed + document, if available; otherwise to null.
  • Set compacted output to the result of using the - Compaction algorithm, passing - context as active context, + Compaction algorithm, using active context, an empty dictionary as inverse context, null as property, expanded input as element, and if passed, the @@ -4138,12 +4169,20 @@

    The JsonLdProcessor Interface

    method using input and options.
  • If context is a dictionary having an @context member, set context to that member's value, otherwise to context.
  • +
  • Initialize an active context using context; + the base IRI is set to + the base option from + options, if set; + otherwise, if the + compactToRelative option is + true, to the IRI of the currently being processed + document, if available; otherwise to null.
  • Initialize an empty identifier map and a counter (set to 0) to be used by the Generate Blank Node Identifier algorithm.
  • Set flattened output to the result of using the Flattening algorithm, passing - expanded input as element, context, and if passed, the + expanded input as element, active context, and if passed, the compactArrays flag in options (which is internally passed to the Compaction algorithm).
  • @@ -4209,6 +4248,7 @@

    The JsonLdOptions Type

    (JsonLdDictionary? or USVString) expandContext = null; boolean produceGeneralizedRdf = true; USVString processingMode = null; + boolean compactToRelative = true; }; --> @@ -4243,6 +4283,9 @@

    The JsonLdOptions Type

    different optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.
    +
    compactToRelative
    +
    Determines if IRIs are compacted relative to the + base option or document location when compacting.
    @@ -4352,6 +4395,7 @@

    JsonLdErrorCode

    "invalid @id value", "invalid @index value", "invalid @nest value", + "invalid @prefix value", "invalid @reverse value", "invalid @version value", "invalid base IRI", @@ -4407,6 +4451,8 @@

    JsonLdErrorCode

    not a string.
    invalid @nest value
    An invalid value for @nest has been found.
    +
    invalid @prefix value
    +
    An invalid value for @prefix has been found.
    invalid @reverse value
    An invalid value for an @reverse member has been detected, i.e., the value was not a dictionary.
    @@ -4550,6 +4596,15 @@

    Changes since 1.0 Recommendation of 16 January 2014

    keyword along with @set (other than @list). This allows a way to ensure that such property values will always be expressed in array form. +
  • Added support for the compactToRelative option to allow IRI compaction () + to document relative IRIs to be disabled.
  • +
  • In JSON-LD 1.1, terms will be used as compact IRI prefixes + when compacting only if + a simple term definition is used where the value ends with a URI gen-delim character, + or if their expanded term definition contains + a @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.
  • @@ -4557,15 +4612,11 @@

    Changes since 1.0 Recommendation of 16 January 2014

    Open Issues

    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 @@

    JsonLdProcessor

  • Set context to the value of @context from frame, if it exists, or to a new empty context, otherwise.
  • +
  • Initialize an active context using context; + the base IRI is set to + the base option from + options, if set; + otherwise, if the + compactToRelative option is + true, to the IRI of the currently being processed + document, if available; otherwise to null.
  • If frame has a top-level property which expands to @graph set the frameDefault option to options with the value true.
  • Set framed to the result of using the Framing algorithm, passing - expanded input, expanded frame, context, and options.
  • + expanded input, expanded frame, active context, and options.
  • Fulfill the promise passing framed.
  • diff --git a/spec/latest/json-ld/index.html b/spec/latest/json-ld/index.html index 83b2766aa..21ea54c84 100644 --- a/spec/latest/json-ld/index.html +++ b/spec/latest/json-ld/index.html @@ -404,6 +404,9 @@

    Syntax Tokens and Keywords

    This keyword is described in .
    @nest
    Collects a set of nested properties within a node object.
    +
    @prefix
    + With the value true, allows this term to be used to construct a compact IRI + when compacting.
    @version
    Used in a context definition to set the processing mode. New features since JSON-LD 1.0 [[!JSON-LD-20140116]] described in this specification are @@ -1043,6 +1046,20 @@

    Compact IRIs

    underscore (_), 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 @@

    Scoped Contexts

    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

    + processing mode set to json-ld-1.1.

    @@ -2788,7 +2805,7 @@

    Node Identifier Indexing

    Id maps are a new feature in JSON-LD 1.1, requiring - processing mode set to json-ld-1.1

    + processing mode set to json-ld-1.1.

    @@ -2869,7 +2886,7 @@

    Node Type Indexing

    Type maps are a new feature in JSON-LD 1.1, requiring - processing mode set to json-ld-1.1

    + processing mode set to json-ld-1.1.

    @@ -2951,7 +2968,7 @@

    Nested Properties

    Nested properties are a new feature in JSON-LD 1.1, requiring - processing mode set to json-ld-1.1

    + processing mode set to json-ld-1.1.

    @@ -3682,7 +3699,8 @@

    Context Definitions

    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 @@

    Context Definitions

    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.

    -

    See for further discussion on contexts.

    @@ -3937,6 +3958,13 @@

    Changes since 1.0 Recommendation of 16 January 2014

    keyword along with @set (other than @list). This allows a way to ensure that such property values will always be expressed in array form. +
  • In JSON-LD 1.1, terms will be used as compact IRI prefixes + when compacting only if + a simple term definition is used where the value ends with a URI gen-delim character, + or if their expanded term definition contains + a @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.
  • @@ -3944,10 +3972,7 @@

    Changes since 1.0 Recommendation of 16 January 2014

    Open Issues

    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 - - - - - - -
    -

    Test case manifest vocabulary extensions

    -

    Test case manifest vocabulary extensions

    -
    -
    -
    -

    - Test Case Classes -

    -
    -
    -
    -
    -
    Compact Evaluation Test
    -

    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.

    -
    Expand Evaluation Test
    -

    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.

    -
    Flatten Evaluation Test
    -

    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.

    -
    Frame Evaluation Test
    -

    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.

    -
    From RDF Evaluation Test
    -

    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.

    -
    Negative Syntax Test
    -

    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.

    -
    Positive Evaluation Test
    -

    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.

    -
    Positive Evaluation Test
    -

    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.

    -
    Positive Evaluation Test
    -

    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.

    -
    Positive Syntax Test
    -

    A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.

    -
    Processor Options
    -

    Options passed to the test runner to affect invocation of the appropriate API method.

    -
    Superclass of all JSON-LD tests
    -

    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.

    -
    To RDF Evaluation Test
    -

    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.

    -
    -
    -
    -
    -

    - Test Case Properties -

    -
    -
    -
    -
    -
    HTTP link
    -
    -

    An HTTP Link header to be added to the result of requesting the input file.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    HTTP status
    -
    -

    The HTTP status code that must be returned when the input file is requested. This is typically used along with the redirectTo property.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    base
    -
    -

    The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - rdfs:Resource -
    -
    -
    compact arrays
    -
    -

    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.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    content type
    -
    -

    The HTTP Content-Type used for the input file, in case it is a non-registered type.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    expand context
    -
    -

    A context that is used to initialize the active context when expanding a document.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - rdfs:Resource -
    -
    -
    input
    -
    -

    Secondary input file

    -
    - - domain: - - jld:Test -
    -
    - - range: - - rdfs:Resource -
    -
    -
    option
    -
    -

    Options affecting processing

    -
    - - domain: - - jld:Test -
    -
    - - range: - - jld:Option -
    -
    -
    processing mode
    -
    -

    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.

    -
    - - domain: - - jld:Option -
    -
    - - range: - - xsd:string -
    -
    -
    produce generalized RDF
    -
    -

    Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.

    -
    - - domain: - - jld:ToRDFTest -
    -
    - - range: - - xsd:boolean -
    -
    -
    redirect to
    -
    -

    The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    use RDF types
    -
    -

    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.

    -
    - - domain: - - jld:FromRDFTest -
    -
    - - range: - - xsd:boolean -
    -
    -
    use document loader
    -
    -

    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.

    -
    - - domain: - - jld:Test -
    -
    - - range: - - xsd:boolean -
    -
    -
    use native types
    -
    -

    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.

    -
    - - domain: - - jld:FromRDFTest -
    -
    - - range: - - xsd:boolean -
    -
    -
    -
    -
    -
    - - - + + + + + + + + + + +Test case manifest vocabulary extensions + + + + + + +
    +

    Test case manifest vocabulary extensions

    +

    Test case manifest vocabulary extensions

    +
    +
    +
    +

    +Test Case Classes +

    +
    +
    +
    +
    +
    Compact Evaluation Test
    +

    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.

    +
    +
    Expand Evaluation Test
    +

    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.

    +
    +
    Flatten Evaluation Test
    +

    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.

    +
    +
    Frame Evaluation Test
    +

    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.

    +
    +
    From RDF Evaluation Test
    +

    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.

    +
    +
    Negative Syntax Test
    +

    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.

    +
    +
    Positive Evaluation Test
    +

    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.

    +
    +
    Positive Evaluation Test
    +

    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.

    +
    +
    Positive Syntax Test
    +

    A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.

    +
    +
    Processor Options
    +

    Options passed to the test runner to affect invocation of the appropriate API method.

    +
    +
    Superclass of all JSON-LD tests
    +

    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.

    +
    +
    To RDF Evaluation Test
    +

    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.

    +
    +
    +
    +
    +
    +

    +Test Case Properties +

    +
    +
    +
    +
    +
    HTTP link
    +
    +

    An HTTP Link header to be added to the result of requesting the input file.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    HTTP status
    +
    +

    The HTTP status code that must be returned when the input file is requested. This is typically used along with the redirectTo property.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    base
    +
    +

    The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +rdfs:Resource +
    +
    +
    compact arrays
    +
    +

    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.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    compact to relative
    +
    +

    If set to false, the JSON-LD processor will not attempt to compact using document-relative IRIs.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    content type
    +
    +

    The HTTP Content-Type used for the input file, in case it is a non-registered type.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    expand context
    +
    +

    A context that is used to initialize the active context when expanding a document.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +rdfs:Resource +
    +
    +
    input
    +
    +

    Secondary input file

    +
    +
    + +domain: + +jld:Test +
    +
    + +range: + +rdfs:Resource +
    +
    +
    option
    +
    +

    Options affecting processing

    +
    +
    + +domain: + +jld:Test +
    +
    + +range: + +jld:Option +
    +
    +
    processing mode
    +
    +

    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.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:string +
    +
    +
    produce generalized RDF
    +
    +

    Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    redirect to
    +
    +

    The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    use RDF types
    +
    +

    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.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    use document loader
    +
    +

    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.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    use native types
    +
    +

    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.

    +
    +
    + +domain: + +jld:Option +
    +
    + +range: + +xsd:boolean +
    +
    +
    +
    +
    +
    + + + diff --git a/test-suite/vocab.jsonld b/test-suite/vocab.jsonld index e6ef2a448..66fdf6100 100644 --- a/test-suite/vocab.jsonld +++ b/test-suite/vocab.jsonld @@ -113,7 +113,7 @@ "@id": "jld:base", "@type": "rdf:Property", "rdfs:comment": "The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "base", "rdfs:range": "rdfs:Resource" }, @@ -121,15 +121,23 @@ "@id": "jld:compactArrays", "@type": "rdf:Property", "rdfs:comment": "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.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "compact arrays", "rdfs:range": "xsd:boolean" }, + { + "@id": "jld:compactToRelative", + "@type": "rdf:Property", + "rdfs:comment": "If set to `false`, the JSON-LD processor will not attempt to compact using document-relative IRIs.", + "rdfs:domain": "jld:Option", + "rdfs:label": "compact to relative", + "rdfs:range": "xsd:boolean" + }, { "@id": "jld:contentType", "@type": "rdf:Property", "rdfs:comment": "The HTTP Content-Type used for the input file, in case it is a non-registered type.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "content type", "rdfs:range": "xsd:boolean" }, @@ -137,7 +145,7 @@ "@id": "jld:expandContext", "@type": "rdf:Property", "rdfs:comment": "A context that is used to initialize the active context when expanding a document.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "expand context", "rdfs:range": "rdfs:Resource" }, @@ -145,7 +153,7 @@ "@id": "jld:httpLink", "@type": "rdf:Property", "rdfs:comment": "An HTTP Link header to be added to the result of requesting the input file.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "HTTP link", "rdfs:range": "xsd:boolean" }, @@ -153,7 +161,7 @@ "@id": "jld:httpStatus", "@type": "rdf:Property", "rdfs:comment": "The HTTP status code that must be returned when the input file is requested. This is typically used along with the `redirectTo` property.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "HTTP status", "rdfs:range": "xsd:boolean" }, @@ -185,7 +193,7 @@ "@id": "jld:produceGeneralizedRdf", "@type": "rdf:Property", "rdfs:comment": "Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.", - "rdfs:domain": "jld:ToRDFTest", + "rdfs:domain": "jld:Option", "rdfs:label": "produce generalized RDF", "rdfs:range": "xsd:boolean" }, @@ -193,7 +201,7 @@ "@id": "jld:redirectTo", "@type": "rdf:Property", "rdfs:comment": "The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "redirect to", "rdfs:range": "xsd:boolean" }, @@ -201,7 +209,7 @@ "@id": "jld:useDocumentLoader", "@type": "rdf:Property", "rdfs:comment": "Test runners must implement a callback method with a method signature as defined in [LoadDocumentCallback](http://json-ld.org/spec/latest/json-ld-api/index.html#idl-def-LoadDocumentCallback). Specifying this option requires the test runner to provide this callback to the appropriate API method using the `documentLoader` option.", - "rdfs:domain": "jld:Test", + "rdfs:domain": "jld:Option", "rdfs:label": "use document loader", "rdfs:range": "xsd:boolean" }, @@ -209,7 +217,7 @@ "@id": "jld:useNativeTypes", "@type": "rdf:Property", "rdfs:comment": "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.", - "rdfs:domain": "jld:FromRDFTest", + "rdfs:domain": "jld:Option", "rdfs:label": "use native types", "rdfs:range": "xsd:boolean" }, @@ -217,7 +225,7 @@ "@id": "jld:useRdfType", "@type": "rdf:Property", "rdfs:comment": "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.", - "rdfs:domain": "jld:FromRDFTest", + "rdfs:domain": "jld:Option", "rdfs:label": "use RDF types", "rdfs:range": "xsd:boolean" } diff --git a/test-suite/vocab.ttl b/test-suite/vocab.ttl index eeaed9c59..84e95a321 100644 --- a/test-suite/vocab.ttl +++ b/test-suite/vocab.ttl @@ -171,7 +171,7 @@ The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range rdfs:Resource . :compactArrays a rdf:Property ; @@ -181,7 +181,15 @@ with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:compactToRelative a rdf:Property ; + rdfs:label "compact to relative"; + rdfs:comment """ + If set to `false`, the JSON-LD processor will not attempt to compact using document-relative IRIs. + """ ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :useDocumentLoader a rdf:Property ; @@ -192,13 +200,13 @@ Specifying this option requires the test runner to provide this callback to the appropriate API method using the `documentLoader` option. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :expandContext a rdf:Property ; rdfs:label "expand context"; rdfs:comment "A context that is used to initialize the active context when expanding a document." ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range rdfs:Resource . :processingMode a rdf:Property ; @@ -218,7 +226,7 @@ :produceGeneralizedRdf a rdf:Property ; rdfs:label "produce generalized RDF"; rdfs:comment "Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output." ; - rdfs:domain :ToRDFTest ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :useNativeTypes a rdf:Property ; @@ -229,7 +237,7 @@ with a datatype IRI that equals `xsd:boolean` are converted to `true` or `false` based on their lexical form. """ ; - rdfs:domain :FromRDFTest ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :useRdfType a rdf:Property ; @@ -238,7 +246,7 @@ 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. """ ; - rdfs:domain :FromRDFTest ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :contentType a rdf:Property ; @@ -246,7 +254,7 @@ rdfs:comment """ The HTTP Content-Type used for the input file, in case it is a non-registered type. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :redirectTo a rdf:Property ; @@ -255,7 +263,7 @@ The location of a URL for redirection. A request made of the input file must be redirected to the designated URL. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :httpStatus a rdf:Property ; @@ -264,7 +272,7 @@ The HTTP status code that must be returned when the input file is requested. This is typically used along with the `redirectTo` property. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range xsd:boolean . :httpLink a rdf:Property ; @@ -272,5 +280,5 @@ rdfs:comment """ An HTTP Link header to be added to the result of requesting the input file. """ ; - rdfs:domain :Test ; + rdfs:domain :Option ; rdfs:range xsd:boolean .