From d3f09c79809be8d0f803bc2b47eb13b45837efbe Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 9 Jan 2017 18:38:05 -0800 Subject: [PATCH] Transparent properties/nesting. --- spec/latest/common/terms.html | 4 + spec/latest/json-ld-api/index.html | 52 ++++++++- spec/latest/json-ld/index.html | 105 ++++++++++++++++++- test-suite/tests/compact-manifest.jsonld | 44 ++++++++ test-suite/tests/compact-n001-context.jsonld | 6 ++ test-suite/tests/compact-n001-in.jsonld | 4 + test-suite/tests/compact-n001-out.jsonld | 10 ++ test-suite/tests/compact-n002-context.jsonld | 7 ++ test-suite/tests/compact-n002-in.jsonld | 4 + test-suite/tests/compact-n002-out.jsonld | 11 ++ test-suite/tests/compact-n003-context.jsonld | 7 ++ test-suite/tests/compact-n003-in.jsonld | 4 + test-suite/tests/compact-n003-out.jsonld | 11 ++ test-suite/tests/compact-n004-context.jsonld | 6 ++ test-suite/tests/compact-n004-in.jsonld | 4 + test-suite/tests/compact-n004-out.jsonld | 10 ++ test-suite/tests/error-manifest.jsonld | 40 +++++++ test-suite/tests/error-n001-in.jsonld | 4 + test-suite/tests/error-n002-in.jsonld | 4 + test-suite/tests/error-n003-in.jsonld | 4 + test-suite/tests/error-n004-in.jsonld | 4 + test-suite/tests/expand-manifest.jsonld | 70 +++++++++++++ test-suite/tests/expand-n001-in.jsonld | 7 ++ test-suite/tests/expand-n001-out.jsonld | 4 + test-suite/tests/expand-n002-in.jsonld | 10 ++ test-suite/tests/expand-n002-out.jsonld | 4 + test-suite/tests/expand-n003-in.jsonld | 11 ++ test-suite/tests/expand-n003-out.jsonld | 7 ++ test-suite/tests/expand-n004-in.jsonld | 15 +++ test-suite/tests/expand-n004-out.jsonld | 8 ++ test-suite/tests/expand-n005-in.jsonld | 13 +++ test-suite/tests/expand-n005-out.jsonld | 8 ++ test-suite/tests/expand-n006-in.jsonld | 11 ++ test-suite/tests/expand-n006-out.jsonld | 9 ++ test-suite/tests/expand-n007-in.jsonld | 13 +++ test-suite/tests/expand-n007-out.jsonld | 9 ++ 36 files changed, 539 insertions(+), 5 deletions(-) create mode 100644 test-suite/tests/compact-n001-context.jsonld create mode 100644 test-suite/tests/compact-n001-in.jsonld create mode 100644 test-suite/tests/compact-n001-out.jsonld create mode 100644 test-suite/tests/compact-n002-context.jsonld create mode 100644 test-suite/tests/compact-n002-in.jsonld create mode 100644 test-suite/tests/compact-n002-out.jsonld create mode 100644 test-suite/tests/compact-n003-context.jsonld create mode 100644 test-suite/tests/compact-n003-in.jsonld create mode 100644 test-suite/tests/compact-n003-out.jsonld create mode 100644 test-suite/tests/compact-n004-context.jsonld create mode 100644 test-suite/tests/compact-n004-in.jsonld create mode 100644 test-suite/tests/compact-n004-out.jsonld create mode 100644 test-suite/tests/error-n001-in.jsonld create mode 100644 test-suite/tests/error-n002-in.jsonld create mode 100644 test-suite/tests/error-n003-in.jsonld create mode 100644 test-suite/tests/error-n004-in.jsonld create mode 100644 test-suite/tests/expand-n001-in.jsonld create mode 100644 test-suite/tests/expand-n001-out.jsonld create mode 100644 test-suite/tests/expand-n002-in.jsonld create mode 100644 test-suite/tests/expand-n002-out.jsonld create mode 100644 test-suite/tests/expand-n003-in.jsonld create mode 100644 test-suite/tests/expand-n003-out.jsonld create mode 100644 test-suite/tests/expand-n004-in.jsonld create mode 100644 test-suite/tests/expand-n004-out.jsonld create mode 100644 test-suite/tests/expand-n005-in.jsonld create mode 100644 test-suite/tests/expand-n005-out.jsonld create mode 100644 test-suite/tests/expand-n006-in.jsonld create mode 100644 test-suite/tests/expand-n006-out.jsonld create mode 100644 test-suite/tests/expand-n007-in.jsonld create mode 100644 test-suite/tests/expand-n007-out.jsonld diff --git a/spec/latest/common/terms.html b/spec/latest/common/terms.html index 897c85134..8537ed998 100644 --- a/spec/latest/common/terms.html +++ b/spec/latest/common/terms.html @@ -180,6 +180,10 @@

General Terminology

specified via the @context keyword.
named graph
A linked data graph that is identified by an IRI or blank node +
nested property
+ A nested property is a property which is contained within an object referenced by + a semantically meaningless nesting property. +
(the graph name) and a graph.
node
Every node is an IRI, a blank node, diff --git a/spec/latest/json-ld-api/index.html b/spec/latest/json-ld-api/index.html index 65f611441..bd6358a0e 100644 --- a/spec/latest/json-ld-api/index.html +++ b/spec/latest/json-ld-api/index.html @@ -987,8 +987,8 @@

Algorithm

  • Initialize container to the value associated with the @container key, which must be either @list, @set, @index, - @id, @type - or @language. Otherwise, an + @id, @type, + @nest, or @language. Otherwise, an invalid container mapping has been detected and processing is aborted.
  • Set the container mapping of definition to @@ -1270,7 +1270,7 @@

    Algorithm

    passing active context and the value of the @context key as local context.
  • Initialize an empty JSON object, result.
  • -
  • For each key and value in element, +
  • For each key and value in element, ordered lexicographically by key:
    1. If key is @context, continue to @@ -1418,6 +1418,10 @@

      Algorithm

    2. Continue with the next key from element.
  • +
  • If expanded property is @nest, + add key to nests, initializing it to an empty array, + if necessary. + Continue with the next key from element.
  • When the frame expansion flag is set, if expanded property is any other framing keyword (@explicit, @default, @@ -1559,6 +1563,22 @@

    Algorithm

    member of result.
  • +
  • For each key nesting-key in nests +
      +
    1. Set nested values to the value of nesting-key + in element, ensuring that it is an array.
    2. +
    3. For each nested value in nested values: +
        +
      1. If nested value is not a JSON object, or any key within + nested value expands to @value, an + invalid @nest value error + has been detected and processing is aborted.
      2. +
      3. Recursively repeat step 7 + using nested value for element.
      4. +
      +
    4. +
    +
  • If result contains the key @value: @@ -2049,6 +2069,25 @@

    Algorithm

    compacted item to it.
  • +
  • If container is @nest: +
      +
    1. Set nest prop to the result of the + IRI Compaction algorithm + passing active context, + item active property as iri, and true + for vocab.
    2. +
    3. If nest prop is not a key in + result, initialize it to an empty JSON object. + Initialize map object to the value of nest prop + in result.
    4. +
    5. If item active property is not a key in map object, + then set this key's value in map object + to compacted item. Otherwise, if the value + is not an array, then set it to one + containing only the value and then append + compacted item to it.
    6. +
    +
  • Otherwise,
      @@ -2401,7 +2440,9 @@

      Algorithm

    1. Otherwise, set type/language to @type and set type/language value to @id.
    2. -
    3. Append @set to containers.
    4. +
    5. Append + @nest and + @set to containers.
  • Append @none to containers. This represents @@ -4092,6 +4133,7 @@

    JsonLdErrorCode

    "invalid language mapping", "invalid language-tagged string", "invalid language-tagged value", + "invalid @nest value", "invalid local context", "invalid remote context", "invalid reverse property", @@ -4168,6 +4210,8 @@

    JsonLdErrorCode

    associated language tag was detected.
  • invalid local context
    In invalid local context was detected.
    +
    invalid @nest value
    +
    An invalid value for @nest has been found.
    invalid remote context
    No valid context document has been found for a referenced, remote context.
    diff --git a/spec/latest/json-ld/index.html b/spec/latest/json-ld/index.html index 7dcf77131..b93f878a9 100644 --- a/spec/latest/json-ld/index.html +++ b/spec/latest/json-ld/index.html @@ -395,6 +395,8 @@

    Syntax Tokens and Keywords

    IRI. This keyword is described in .
    @graph
    Used to express a graph. This keyword is described in .
    +
    @nest
    Collects a set of nested properties within + a node object.
    :
    The separator for JSON keys and values that use compact IRIs.
    @@ -2684,6 +2686,86 @@

    Node Type Indexing

    as the @type property of the node object value.

    +
    +

    Nested Properties

    + +

    Many JSON APIs separate properties from their entities using an + intermediate object; in JSON-LD these are called nested properties. + For example, a set of possible labels may be grouped + under a common property:

    +
    +  
    +  
    + +

    By defining labels using the keyword @nest, + a JSON-LD processor will ignore the nesting created by using the + labels property and process the contents as if it were declared + directly within containing object. In this case, the labels + property is semantically meaningless. Defining it as equivalent to + @nest causes it to be ignored when expanding, making it + equivalent to the following:

    + +
    +  
    +  
    + +

    Similarly, properties may be marked with "@container": "@nest", to cause + them to be nested. Note that the @nest keyword can also be aliased in the + context.

    +
    +  
    +  
    +
    +

    Expanded Document Form

    @@ -3090,6 +3172,7 @@

    Node Objects

  • @context,
  • @id,
  • @graph,
  • +
  • @nest,
  • @type,
  • @reverse, or
  • @index
  • @@ -3145,6 +3228,12 @@

    Node Objects

    for further discussion on @index values.

    +

    If the node object contains the @nest key, + its value MUST be an JSON object or an array of JSON objects + which MUST NOT include a value object. See + for further discussion + on @nest values.

    +

    Keys in a node object that are not keyword MAY expand to an absolute IRI using the active context. The values associated with keys that expand @@ -3315,6 +3404,19 @@

    Type Maps

    the @id of the node object value when expanding.

    +
    +

    Property Nesting

    + +

    A nested property is used to gather properties of a node object in a separate + JSON object, or array of JSON objects which are not + value objects. It is semantically transparent and is removed + during the process of expansion. Property nesting is recursive, and + collections of nested properties may contain further nesting.

    + +

    Semantically, nesting is treated as if the properties and values were declared directly + within the containing node object.

    +
    +

    Context Definitions

    @@ -3581,7 +3683,8 @@

    Changes since 1.0 Recommendation of 16 January 2014

    @context property, which defines a context used for values of a property identified with such a term.
  • @container values within an expanded term definition may now - include @id and @type, corresponding to id maps and type maps.
  • + include @id @type, and @nest, + corresponding to id maps, type maps and nested properties.
    diff --git a/test-suite/tests/compact-manifest.jsonld b/test-suite/tests/compact-manifest.jsonld index 750afcc16..bf682c637 100644 --- a/test-suite/tests/compact-manifest.jsonld +++ b/test-suite/tests/compact-manifest.jsonld @@ -657,6 +657,50 @@ "input": "compact-m004-in.jsonld", "context": "compact-m004-context.jsonld", "expect": "compact-m004-out.jsonld" + }, { + "@id": "#tn001", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Indexes to @nest for property with @container: @nest", + "purpose": "Compaction using @container: @nest", + "input": "compact-n001-in.jsonld", + "context": "compact-n001-context.jsonld", + "expect": "compact-n001-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn002", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Indexes to @nest for all properties with @container: @nest", + "purpose": "Compaction using @container: @nest", + "input": "compact-n002-in.jsonld", + "context": "compact-n002-context.jsonld", + "expect": "compact-n002-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn003", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Nests using alias of @nest", + "purpose": "Compaction using @container: @nest", + "input": "compact-n003-in.jsonld", + "context": "compact-n003-context.jsonld", + "expect": "compact-n003-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn004", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Arrays of nested values", + "purpose": "Compaction using @container: @nest", + "input": "compact-n004-in.jsonld", + "context": "compact-n004-context.jsonld", + "expect": "compact-n004-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } } ] } diff --git a/test-suite/tests/compact-n001-context.jsonld b/test-suite/tests/compact-n001-context.jsonld new file mode 100644 index 000000000..a41d4f305 --- /dev/null +++ b/test-suite/tests/compact-n001-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p2": {"@container": "@nest"} + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n001-in.jsonld b/test-suite/tests/compact-n001-in.jsonld new file mode 100644 index 000000000..c03734564 --- /dev/null +++ b/test-suite/tests/compact-n001-in.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}] +}] \ No newline at end of file diff --git a/test-suite/tests/compact-n001-out.jsonld b/test-suite/tests/compact-n001-out.jsonld new file mode 100644 index 000000000..6677ecc38 --- /dev/null +++ b/test-suite/tests/compact-n001-out.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p2": {"@container": "@nest"} + }, + "p1": "v1", + "@nest": { + "p2": "v2" + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n002-context.jsonld b/test-suite/tests/compact-n002-context.jsonld new file mode 100644 index 000000000..915972f86 --- /dev/null +++ b/test-suite/tests/compact-n002-context.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p1": {"@container": "@nest"}, + "p2": {"@container": "@nest"} + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n002-in.jsonld b/test-suite/tests/compact-n002-in.jsonld new file mode 100644 index 000000000..c03734564 --- /dev/null +++ b/test-suite/tests/compact-n002-in.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}] +}] \ No newline at end of file diff --git a/test-suite/tests/compact-n002-out.jsonld b/test-suite/tests/compact-n002-out.jsonld new file mode 100644 index 000000000..14a92555f --- /dev/null +++ b/test-suite/tests/compact-n002-out.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p1": {"@container": "@nest"}, + "p2": {"@container": "@nest"} + }, + "@nest": { + "p1": "v1", + "p2": "v2" + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n003-context.jsonld b/test-suite/tests/compact-n003-context.jsonld new file mode 100644 index 000000000..dc6339ddb --- /dev/null +++ b/test-suite/tests/compact-n003-context.jsonld @@ -0,0 +1,7 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest", + "p2": {"@container": "@nest"} + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n003-in.jsonld b/test-suite/tests/compact-n003-in.jsonld new file mode 100644 index 000000000..c03734564 --- /dev/null +++ b/test-suite/tests/compact-n003-in.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}] +}] \ No newline at end of file diff --git a/test-suite/tests/compact-n003-out.jsonld b/test-suite/tests/compact-n003-out.jsonld new file mode 100644 index 000000000..69455682c --- /dev/null +++ b/test-suite/tests/compact-n003-out.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest", + "p2": {"@container": "@nest"} + }, + "p1": "v1", + "nest": { + "p2": "v2" + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n004-context.jsonld b/test-suite/tests/compact-n004-context.jsonld new file mode 100644 index 000000000..a41d4f305 --- /dev/null +++ b/test-suite/tests/compact-n004-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p2": {"@container": "@nest"} + } +} \ No newline at end of file diff --git a/test-suite/tests/compact-n004-in.jsonld b/test-suite/tests/compact-n004-in.jsonld new file mode 100644 index 000000000..5b70771a3 --- /dev/null +++ b/test-suite/tests/compact-n004-in.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}, {"@value": "v3"}] +}] \ No newline at end of file diff --git a/test-suite/tests/compact-n004-out.jsonld b/test-suite/tests/compact-n004-out.jsonld new file mode 100644 index 000000000..a26408fdc --- /dev/null +++ b/test-suite/tests/compact-n004-out.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "p2": {"@container": "@nest"} + }, + "p1": "v1", + "@nest": { + "p2": ["v2", "v3"] + } +} \ No newline at end of file diff --git a/test-suite/tests/error-manifest.jsonld b/test-suite/tests/error-manifest.jsonld index 0c6ff8ead..fcaa92cb7 100644 --- a/test-suite/tests/error-manifest.jsonld +++ b/test-suite/tests/error-manifest.jsonld @@ -328,6 +328,46 @@ "option": { "processingMode": "json-ld-1.1" } + }, { + "@id": "#tn001", + "@type": [ "jld:NegativeEvaluationTest", "jld:FlattenTest" ], + "name": "@nest MUST NOT have a string value", + "purpose": "container: @nest", + "input": "error-n001-in.jsonld", + "expect": "invalid @nest value", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn002", + "@type": [ "jld:NegativeEvaluationTest", "jld:FlattenTest" ], + "name": "@nest MUST NOT have a boolen value", + "purpose": "container: @nest", + "input": "error-n002-in.jsonld", + "expect": "invalid @nest value", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn003", + "@type": [ "jld:NegativeEvaluationTest", "jld:FlattenTest" ], + "name": "@nest MUST NOT have a numeric value", + "purpose": "container: @nest", + "input": "error-n003-in.jsonld", + "expect": "invalid @nest value", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn004", + "@type": [ "jld:NegativeEvaluationTest", "jld:FlattenTest" ], + "name": "@nest MUST NOT have a value object value", + "purpose": "container: @nest", + "input": "error-n004-in.jsonld", + "expect": "invalid @nest value", + "option": { + "processingMode": "json-ld-1.1" + } } ] } diff --git a/test-suite/tests/error-n001-in.jsonld b/test-suite/tests/error-n001-in.jsonld new file mode 100644 index 000000000..81408e661 --- /dev/null +++ b/test-suite/tests/error-n001-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": {"@vocab": "http://example.org/"}, + "@nest": "This should generate an error" +} \ No newline at end of file diff --git a/test-suite/tests/error-n002-in.jsonld b/test-suite/tests/error-n002-in.jsonld new file mode 100644 index 000000000..7af5e3b47 --- /dev/null +++ b/test-suite/tests/error-n002-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": {"@vocab": "http://example.org/"}, + "@nest": true +} \ No newline at end of file diff --git a/test-suite/tests/error-n003-in.jsonld b/test-suite/tests/error-n003-in.jsonld new file mode 100644 index 000000000..91d338864 --- /dev/null +++ b/test-suite/tests/error-n003-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": {"@vocab": "http://example.org/"}, + "@nest": 1 +} \ No newline at end of file diff --git a/test-suite/tests/error-n004-in.jsonld b/test-suite/tests/error-n004-in.jsonld new file mode 100644 index 000000000..11e246a32 --- /dev/null +++ b/test-suite/tests/error-n004-in.jsonld @@ -0,0 +1,4 @@ +{ + "@context": {"@vocab": "http://example.org/"}, + "@nest": {"@value": "This should generate an error"} +} \ No newline at end of file diff --git a/test-suite/tests/expand-manifest.jsonld b/test-suite/tests/expand-manifest.jsonld index 3a0d45dbc..a24ca3d0e 100644 --- a/test-suite/tests/expand-manifest.jsonld +++ b/test-suite/tests/expand-manifest.jsonld @@ -621,6 +621,76 @@ "purpose": "Expansion using @container: @type", "input": "expand-m004-in.jsonld", "expect": "expand-m004-out.jsonld" + }, { + "@id": "#tn001", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n001-in.jsonld", + "expect": "expand-n001-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn002", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n002-in.jsonld", + "expect": "expand-n002-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn003", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n003-in.jsonld", + "expect": "expand-n003-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn004", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n004-in.jsonld", + "expect": "expand-n004-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn005", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n005-in.jsonld", + "expect": "expand-n005-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn006", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n006-in.jsonld", + "expect": "expand-n006-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } + }, { + "@id": "#tn007", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Expands input using @nest", + "purpose": "Expansion using @container: @nest", + "input": "expand-n007-in.jsonld", + "expect": "expand-n007-out.jsonld", + "option": { + "processingMode": "json-ld-1.1" + } } ] } diff --git a/test-suite/tests/expand-n001-in.jsonld b/test-suite/tests/expand-n001-in.jsonld new file mode 100644 index 000000000..f07430585 --- /dev/null +++ b/test-suite/tests/expand-n001-in.jsonld @@ -0,0 +1,7 @@ +{ + "@context": {"@vocab": "http://example.org/"}, + "p1": "v1", + "@nest": { + "p2": "v2" + } +} \ No newline at end of file diff --git a/test-suite/tests/expand-n001-out.jsonld b/test-suite/tests/expand-n001-out.jsonld new file mode 100644 index 000000000..c03734564 --- /dev/null +++ b/test-suite/tests/expand-n001-out.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n002-in.jsonld b/test-suite/tests/expand-n002-in.jsonld new file mode 100644 index 000000000..36e57b95d --- /dev/null +++ b/test-suite/tests/expand-n002-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest" + }, + "p1": "v1", + "nest": { + "p2": "v2" + } +} \ No newline at end of file diff --git a/test-suite/tests/expand-n002-out.jsonld b/test-suite/tests/expand-n002-out.jsonld new file mode 100644 index 000000000..c03734564 --- /dev/null +++ b/test-suite/tests/expand-n002-out.jsonld @@ -0,0 +1,4 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [{"@value": "v2"}] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n003-in.jsonld b/test-suite/tests/expand-n003-in.jsonld new file mode 100644 index 000000000..c1ec90227 --- /dev/null +++ b/test-suite/tests/expand-n003-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest" + }, + "p1": "v1", + "nest": { + "p2": "v3" + }, + "p2": "v2" +} \ No newline at end of file diff --git a/test-suite/tests/expand-n003-out.jsonld b/test-suite/tests/expand-n003-out.jsonld new file mode 100644 index 000000000..c8fc8de29 --- /dev/null +++ b/test-suite/tests/expand-n003-out.jsonld @@ -0,0 +1,7 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [ + {"@value": "v2"}, + {"@value": "v3"} + ] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n004-in.jsonld b/test-suite/tests/expand-n004-in.jsonld new file mode 100644 index 000000000..eeffff0a6 --- /dev/null +++ b/test-suite/tests/expand-n004-in.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest1": "@nest", + "nest2": "@nest" + }, + "p1": "v1", + "nest2": { + "p2": "v4" + }, + "p2": "v2", + "nest1": { + "p2": "v3" + } +} \ No newline at end of file diff --git a/test-suite/tests/expand-n004-out.jsonld b/test-suite/tests/expand-n004-out.jsonld new file mode 100644 index 000000000..90e1950b1 --- /dev/null +++ b/test-suite/tests/expand-n004-out.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [ + {"@value": "v2"}, + {"@value": "v3"}, + {"@value": "v4"} + ] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n005-in.jsonld b/test-suite/tests/expand-n005-in.jsonld new file mode 100644 index 000000000..a9f394978 --- /dev/null +++ b/test-suite/tests/expand-n005-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@vocab": "http://example.org/" + }, + "p1": "v1", + "@nest": { + "p2": "v3", + "@nest": { + "p2": "v4" + } + }, + "p2": "v2" +} \ No newline at end of file diff --git a/test-suite/tests/expand-n005-out.jsonld b/test-suite/tests/expand-n005-out.jsonld new file mode 100644 index 000000000..90e1950b1 --- /dev/null +++ b/test-suite/tests/expand-n005-out.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [ + {"@value": "v2"}, + {"@value": "v3"}, + {"@value": "v4"} + ] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n006-in.jsonld b/test-suite/tests/expand-n006-in.jsonld new file mode 100644 index 000000000..9b02d605d --- /dev/null +++ b/test-suite/tests/expand-n006-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest" + }, + "p1": "v1", + "nest": { + "p2": ["v4", "v5"] + }, + "p2": ["v2", "v3"] +} \ No newline at end of file diff --git a/test-suite/tests/expand-n006-out.jsonld b/test-suite/tests/expand-n006-out.jsonld new file mode 100644 index 000000000..d5c104074 --- /dev/null +++ b/test-suite/tests/expand-n006-out.jsonld @@ -0,0 +1,9 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [ + {"@value": "v2"}, + {"@value": "v3"}, + {"@value": "v4"}, + {"@value": "v5"} + ] +}] \ No newline at end of file diff --git a/test-suite/tests/expand-n007-in.jsonld b/test-suite/tests/expand-n007-in.jsonld new file mode 100644 index 000000000..aa9e84681 --- /dev/null +++ b/test-suite/tests/expand-n007-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "nest": "@nest" + }, + "p1": "v1", + "nest": [{ + "p2": "v4" + }, { + "p2": "v5" + }], + "p2": ["v2", "v3"] +} \ No newline at end of file diff --git a/test-suite/tests/expand-n007-out.jsonld b/test-suite/tests/expand-n007-out.jsonld new file mode 100644 index 000000000..d5c104074 --- /dev/null +++ b/test-suite/tests/expand-n007-out.jsonld @@ -0,0 +1,9 @@ +[{ + "http://example.org/p1": [{"@value": "v1"}], + "http://example.org/p2": [ + {"@value": "v2"}, + {"@value": "v3"}, + {"@value": "v4"}, + {"@value": "v5"} + ] +}] \ No newline at end of file