diff --git a/index.html b/index.html index 2e38aa08..10dbdc9c 100644 --- a/index.html +++ b/index.html @@ -974,17 +974,23 @@

Context Processing Algorithm

The active context contains the active term definitions which specify how keys and values have to be interpreted as well as the current base IRI, - the vocabulary mapping and the default language. Each - term definition consists of an IRI mapping, a boolean - flag reverse property, an optional type mapping - or language mapping, - an optional context, - an optional nest value, - an optional prefix flag, - an optional index mapping, - a protected, used to mark this as a protected term, - and an optional container mapping. - A term definition can not only be used to map a term + the vocabulary mapping, the default language, + and an optional previous context, + used when a type-scoped context is defined. + Each term definition consists of:

+ + +

A term definition can not only be used to map a term to an IRI, but also to map a term to a keyword, in which case it is referred to as a keyword alias.

@@ -1055,13 +1061,15 @@

Algorithm

This algorithm specifies how a new active context is updated with a local context. The algorithm takes two required - and two optional + and three optional input variables. The required inputs are an active context and a local context. The optional inputs are an array remote contexts, - defaulting to a new empty array, which is used to detect cyclical context inclusions. - and from term, defaulting to false, - which is used to allow changes to protected terms.. + defaulting to a new empty array, which is used to detect cyclical context inclusions, + , from property, defaulting to false, + which is used to allow changes to protected terms, + and from type, defaulting to false, + which is used to mark term definitions associated with a type-scoped context..

    @@ -1070,18 +1078,24 @@

    Algorithm

  1. If local context is not an array, set it to an array containing only local context.
  2. +
  3. + If from type is true, and result + does not have a previous context, set previous context + in result to active context.
  4. For each item context in local context:
    1. If context is null:
        -
      1. If from term is false and active context +
      2. If from property is false and active context contains any protected term definitions, an invalid context nullification has been detected and processing is aborted.
      3. Otherwise, set result to a - newly-initialized active context and continue with the - next context. + newly-initialized active context, + setting previous context in result + to the previous value of result if from type is true. + Continue with the next context. In JSON-LD 1.0, the base IRI was given a default value here; this is now described conditionally in .
      4. @@ -1213,7 +1227,7 @@

        Algorithm

        defined, the value of the @protected member from context, if any, for protected, - and from term. + from property, and from type.
    2. Return result.
    3. @@ -1258,14 +1272,15 @@

      Overview

      Algorithm

      -

      The algorithm has four required and two optional inputs. +

      The algorithm has four required and three optional inputs. The required inputs are an active context, a local context, a term, and a map defined. The optional inputs are protected which defaults to false, - and from term, defaulting to false, - which is used to allow changes to protected terms.. + from property, defaulting to false, + which is used to allow changes to protected terms, + and from type, defaulting to false..

      1. If defined contains the member term and the associated @@ -1290,18 +1305,20 @@

        Algorithm

        term MUST NOT be a keyword and a keyword redefinition error has been detected and processing is aborted.
      2. -
      3. If from term is false - and active context has an existing - term definition for term which is protected, +
      4. Set previous definition to any existing + term definition for term in active context.
      5. +
      6. If from property is false + and previous definition exists and is protected, a protected term redefinition error has been detected, and processing is aborted.
      7. -
      8. Otherwise, remove any existing term definition for term in +
      9. Otherwise, remove any previous definition from active context.
      10. If value is null or value is a dictionary containing the key-value pair @id-null, set the term definition in active context to - null, set the value associated with defined's + null, + and set the value associated with defined's member term to true, and return.
      11. Otherwise, if value is a string, convert it to a dictionary consisting of a single member whose @@ -1484,7 +1501,7 @@

        Algorithm

        @context member, which is treated as a local context.
      12. Invoke the Context Processing algorithm using the active context, context as local context, - and true for from term. + and true for from property. If any error is detected, an invalid scoped context error has been detected and processing is aborted.
      13. @@ -1723,14 +1740,16 @@

        Overview

        Algorithm

        -

        The algorithm takes three required and two optional input variables. +

        The algorithm takes three required and three optional input variables. The required inputs are an active context, an active property, and an element to be expanded. The optional inputs are the frameExpansion flag allowing special forms of input used for frame expansion, - and the ordered flag, used to order - dictionary member keys lexicographically, where noted. + the ordered flag, used to order + dictionary member keys lexicographically, where noted, + and the from map flag, used to control reverting + previous term definitions in the active context associated with a type-scoped context. To begin, the active property is set to null, and element is set to the JSON-LD input. If not passed, the both flags are set to false.

        @@ -1761,10 +1780,16 @@

        Algorithm

      14. If element is null, return null.
      15. If active property is @default, set the frameExpansion flag to false.
      16. +
      17. If active property has a term definition in active context + has a local context, set property scoped context to the that local context.
      18. If element is a scalar,
        1. If active property is null or @graph, drop the free-floating scalar by returning null.
        2. +
        3. If property scoped context is defined, + set active context to the result of the + Context Processing algorithm, + passing active context and property scoped context as local context.
        4. Return the result of the Value Expansion algorithm, passing the active context, active property, and @@ -1780,7 +1805,8 @@

          Algorithm

          algorithm recursively, passing active context, active property, item as element, the frameExpansion - and ordered flags.
        5. + ordered, + and from map flags.
        6. If the container mapping of active property includes @list, and expanded item is an @@ -1797,11 +1823,25 @@

          Algorithm

      19. Otherwise element is a dictionary.
      20. +
      21. If active context has a previous context, + the active context is type-scoped. + If from map is undefined or false, + and element does not contain a member expanding to @value, + and element does not consist of a single member expanding to @id, + set active context to previous context from active context, + as the scope of a term-scoped context does not apply when processing new node objects.
      22. +
      23. If property scoped context is defined, + set active context to the result of the + Context Processing algorithm, + passing active context and property scoped context as local context.
      24. If element contains the member @context, set active context to the result of the Context Processing algorithm, passing active context and the value of the @context member as local context.
      25. +
      26. Set type scoped context to active context. + This is used for expanding values that may be relevant to any previous + type-scoped context.
      27. For each key/value pair in element where key expands to @type using the IRI Expansion algorithm, @@ -1813,8 +1853,9 @@

        Algorithm

        has a local context, set active context to the result to the result of the Context Processing algorithm, - passing active context and the value of the - term's local context as local context.
      28. + passing active context, the value of the + term's local context as local context, + and true for from type.
    4. Initialize an empty dictionary, result.
    5. @@ -1865,7 +1906,8 @@

      Algorithm

      error has been detected and processing is aborted. Otherwise, set expanded value to the result of using the IRI Expansion algorithm, passing - active context, true for vocab, + type scoped context for active context, + true for vocab, and true for document relative to expand the value or each of its items. @@ -2007,15 +2049,8 @@

      Algorithm

    6. Continue with the next key from element.
  5. -
  6. If key's term definition in active context - has a local context, set term context to the result of the - Context Processing algorithm, - passing active context, the value of the - key's local context as local context, - and true for from term. Otherwise, - set term context to active context.
  7. Set container mapping to key's container mapping in - term context.
  8. + active context.
  9. If key's term definition in active context has a type mapping of @json, set expanded value to a new dictionary, set the member @@ -2068,15 +2103,20 @@

    Algorithm

    in value, ordered lexicographically by index if ordered is true:
      -
    1. If container mapping includes @type, - and index's term definition in - term context has a local context, set - map context to the result of the Context Processing - algorithm, passing term context as active context and the - value of the index's local context as - local context. Otherwise, set map context - to term context.
    2. +
    3. If container mapping includes @type: +
        +
      1. Set map context to the previous context + from active context if it exists, or active context otherwise.
      2. +
      3. If index's term definition in + map context has a local context, update + map context to the result of the + Context Processing algorithm, + passing map context as active context + and the value of the index's local context + as local context.
      4. +
      +
    4. +
    5. Otherwise, set map context to active context.
    6. Set expanded index to the result of using the IRI Expansion algorithm, passing active context, index, and true @@ -2136,7 +2176,7 @@

      Algorithm

  10. Otherwise, initialize expanded value to the result of - using this algorithm recursively, passing term context as active context, + using this algorithm recursively, passing active context, key for active property, value for element, and the frameExpansion and ordered flags.
  11. @@ -2452,19 +2492,9 @@

    Algorithm

    If not passed, the both flags are set to false.

      -
    1. If the term definition for active property has a - local context: -
        -
      1. Set active context to the result of the - Context Processing algorithm, - passing active context, the value of the - active property's local context as local context, - and true for from term.
      2. -
      3. Set inverse context using the - Inverse Context Creation algorithm - using active context.
      4. -
      -
    2. +
    3. Set type scoped context to active context. + This is used for compacting values that may be relevant to any previous + type-scoped context.
    4. If element is a scalar, it is already in its most compact form, so simply return element.
    5. If element is an array: @@ -2494,8 +2524,27 @@

      Algorithm

    6. Return result.
    -
  12. Otherwise element is a dictionary. - If element has an @value or @id +
  13. Otherwise element is a dictionary.
  14. +
  15. If active context has a previous context, + the active context is type-scoped. + If element does not contain an @value member, + and element does not consist of a single @id member, + set active context to previous context from active context, + as the scope of a term-scoped context does not apply when processing new node objects.
  16. +
  17. If the term definition for active property has a + local context: +
      +
    1. Set active context to the result of the + Context Processing algorithm, + passing active context, the value of the + active property's local context as local context, + and true for from property.
    2. +
    3. Set inverse context using the + Inverse Context Creation algorithm + using active context.
    4. +
    +
  18. +
  19. If element has an @value or @id member and the result of using the Value Compaction algorithm, passing active context, inverse context, @@ -2522,17 +2571,18 @@

    Algorithm

    by transforming each expanded type of that member into it's compacted form using the IRI Compaction algorithm, passing active context, inverse context, - expanded type for var, and - true for vocab. Then, for each term + expanded type for var, true for vocab, + and true for from type. + Then, for each term in compacted types ordered lexicographically:
      -
    1. If the term definition for term has a +
    2. If the term definition for term in type scoped context has a local context:
      1. Set active context to the result of the Context Processing algorithm, passing active context and the value of term's - local context as local context.
      2. + local context in type scoped context as local context.
      3. Set inverse context using the Inverse Context Creation algorithm using active context.
      4. @@ -2544,54 +2594,66 @@

        Algorithm

        in element, ordered lexicographically by expanded property if ordered is true:
          -
        1. If expanded property is @id or - @type: -
            -
          1. If expanded value is a string, - then initialize compacted value to the result - of using the IRI Compaction algorithm, - passing active context, inverse context, - expanded value for var, - and true for vocab if - expanded property is @type, - false otherwise.
          2. -
          3. Otherwise, expanded value must be a - @type array: -
              -
            1. Initialize compacted value to an empty - array.
            2. -
            3. For each item expanded type in - expanded value: -
                -
              1. Set term to the result of - of using the IRI Compaction algorithm, - passing active context, inverse context, - expanded type for var, and - true for vocab.
              2. -
              3. Append term, to compacted value.
              4. -
              -
            4. -
            5. If compacted value contains only one - item (it has a length of 1), then - set compacted value to its only item.
            6. -
            -
          4. -
          5. Initialize alias to the result of using the - IRI Compaction algorithm, - passing active context, inverse context, - expanded property for var, - and true for vocab.
          6. -
          7. If processing mode is json-ld-1.1, - element does not have an @value member, - expanded property is @type, - and the term definition for alias in the - active context has a container mapping including @set, - ensure that compacted value is an array.
          8. -
          9. Add a member alias to result whose value is - set to compacted value and continue to the next - expanded property.
          10. -
          -
        2. +
        3. If expanded property is @id: +
            +
          1. If expanded value is a string, + then initialize compacted value to the result + of using the IRI Compaction algorithm, + passing active context, inverse context, + and expanded value for var.
          2. +
          3. Initialize alias to the result of using the + IRI Compaction algorithm, + passing active context, inverse context, + expanded property for var, + and true for vocab.
          4. +
          5. Add a member alias to result whose value is + set to compacted value and continue to the next + expanded property.
          6. +
          +
        4. +
        5. If expanded property is @type: +
            +
          1. If expanded value is a string, + then initialize compacted value to the result + of using the IRI Compaction algorithm, + passing type scoped context for active context, inverse context, + expanded value for var, + and true for vocab.
          2. +
          3. Otherwise, expanded value must be a + @type array: +
              +
            1. Initialize compacted value to an empty + array.
            2. +
            3. For each item expanded type in + expanded value: +
                +
              1. Set term to the result of + of using the IRI Compaction algorithm, + passing type scoped context for active context, inverse context, + expanded type for var, and + true for vocab.
              2. +
              3. Append term, to compacted value.
              4. +
              +
            4. +
            5. If compacted value contains only one + item (it has a length of 1), then + set compacted value to its only item.
            6. +
            +
          4. +
          5. Initialize alias to the result of using the + IRI Compaction algorithm, + passing active context, inverse context, + expanded property for var, + and true for vocab.
          6. +
          7. If processing mode is json-ld-1.1, + and the term definition for alias in the + active context has a container mapping including @set, + ensure that compacted value is an array.
          8. +
          9. Add a member alias to result whose value is + set to compacted value and continue to the next + expanded property.
          10. +
          +
        6. If expanded property is @reverse:
          1. Initialize compacted value to the result of using this @@ -3324,6 +3386,8 @@

            Algorithm

            to containers.
          2. Append the values @index and @index@set to containers.
          3. +
          4. Set type/language to @type + and set type/language value to @id.
        7. Otherwise: diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index 1437a12c..1a76cef9 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -989,7 +989,7 @@ }, { "@id": "#tc009", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], - "name": "deep @context affects nested nodes", + "name": "deep @type-scoped @context does NOT affect nested nodes", "purpose": "scoped context on @type", "input": "compact/c009-in.jsonld", "context": "compact/c009-context.jsonld", @@ -1022,6 +1022,123 @@ "context": "compact/c012-context.jsonld", "expect": "compact/c012-out.jsonld", "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc013", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "deep property-term scoped @context in @type-scoped @context affects nested nodes", + "purpose": "scoped context on @type", + "input": "compact/c013-in.jsonld", + "context": "compact/c013-context.jsonld", + "expect": "compact/c013-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc014", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped context nullification", + "purpose": "type-scoped context nullification", + "input": "compact/c014-in.jsonld", + "context": "compact/c014-context.jsonld", + "expect": "compact/c014-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc015", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped base", + "purpose": "type-scoped base", + "input": "compact/c015-in.jsonld", + "context": "compact/c015-context.jsonld", + "expect": "compact/c015-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc016", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped vocab", + "purpose": "type-scoped vocab", + "input": "compact/c016-in.jsonld", + "context": "compact/c016-context.jsonld", + "expect": "compact/c016-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc017", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "multiple type-scoped contexts are properly reverted", + "purpose": "multiple type-scoped contexts are property reverted", + "input": "compact/c017-in.jsonld", + "context": "compact/c017-context.jsonld", + "expect": "compact/c017-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc018", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "multiple type-scoped types resolved against previous context", + "purpose": "multiple type-scoped types resolved against previous context", + "input": "compact/c018-in.jsonld", + "context": "compact/c018-context.jsonld", + "expect": "compact/c018-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc019", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped context with multiple property scoped terms", + "purpose": "type-scoped context with multiple property scoped terms", + "input": "compact/c019-in.jsonld", + "context": "compact/c019-context.jsonld", + "expect": "compact/c019-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc020", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped value", + "purpose": "type-scoped value", + "input": "compact/c020-in.jsonld", + "context": "compact/c020-context.jsonld", + "expect": "compact/c020-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc021", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped value mix", + "purpose": "type-scoped value mix", + "input": "compact/c021-in.jsonld", + "context": "compact/c021-context.jsonld", + "expect": "compact/c021-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc022", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped property-scoped contexts including @type:@vocab", + "purpose": "type-scoped property-scoped contexts including @type:@vocab", + "input": "compact/c022-in.jsonld", + "context": "compact/c022-context.jsonld", + "expect": "compact/c022-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc023", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "composed type-scoped property-scoped contexts including @type:@vocab", + "purpose": "composed type-scoped property-scoped contexts including @type:@vocab", + "input": "compact/c023-in.jsonld", + "context": "compact/c023-context.jsonld", + "expect": "compact/c023-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc024", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped + property-scoped + values evaluates against previous context", + "purpose": "type-scoped + property-scoped + values evaluates against previous context", + "input": "compact/c024-in.jsonld", + "context": "compact/c024-context.jsonld", + "expect": "compact/c024-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc025", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "type-scoped + graph container", + "purpose": "type-scoped + graph container", + "input": "compact/c025-in.jsonld", + "context": "compact/c025-context.jsonld", + "expect": "compact/c025-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} }, { "@id": "#te001", "@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ], @@ -1676,8 +1793,8 @@ "name": "Check illegal overriding of protected term from type-scoped context", "purpose": "Check error when overriding a protected term from type-scoped context.", "option": {"specVersion": "json-ld-1.1"}, - "input": "compact/pr02-in.jsonld", - "context": "compact/pr02-context.jsonld", + "input": "compact/pr03-in.jsonld", + "context": "compact/pr03-context.jsonld", "expect": "protected term redefinition" }, { "@id": "#tpr04", @@ -1688,6 +1805,15 @@ "input": "compact/pr04-in.jsonld", "context": "compact/pr04-context.jsonld", "expect": "compact/pr04-out.jsonld" + }, { + "@id": "#tpr05", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "Check legal overriding of type-scoped protected term from nested node", + "purpose": "Check legal overriding of type-scoped protected term from nested node.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "compact/pr05-in.jsonld", + "context": "compact/pr05-context.jsonld", + "expect": "compact/pr05-out.jsonld" }, { "@id": "#tr001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], diff --git a/tests/compact/c009-out.jsonld b/tests/compact/c009-out.jsonld index c2b6d110..dbd90730 100644 --- a/tests/compact/c009-out.jsonld +++ b/tests/compact/c009-out.jsonld @@ -4,5 +4,5 @@ "Foo": {"@context": {"baz": {"@type": "@vocab"}}} }, "@type": "Foo", - "bar": {"baz": "buzz"} -} \ No newline at end of file + "bar": {"baz": {"@id": "http://example/buzz"}} +} diff --git a/tests/compact/c013-context.jsonld b/tests/compact/c013-context.jsonld new file mode 100644 index 00000000..4b62d50f --- /dev/null +++ b/tests/compact/c013-context.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "@vocab": "http://example/", + "Foo": { + "@context": { + "bar": { + "@context": { + "baz": {"@type": "@vocab"} + } + } + } + } + } +} diff --git a/tests/compact/c013-in.jsonld b/tests/compact/c013-in.jsonld new file mode 100644 index 00000000..59a1fb53 --- /dev/null +++ b/tests/compact/c013-in.jsonld @@ -0,0 +1,8 @@ +[ + { + "@type": ["http://example/Foo"], + "http://example/bar": [{ + "http://example/baz": [{"@id": "http://example/buzz"}] + }] + } +] \ No newline at end of file diff --git a/tests/compact/c013-out.jsonld b/tests/compact/c013-out.jsonld new file mode 100644 index 00000000..bba1c9bf --- /dev/null +++ b/tests/compact/c013-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@vocab": "http://example/", + "Foo": { + "@context": { + "bar": { + "@context": { + "baz": {"@type": "@vocab"} + } + } + } + } + }, + "@type": "Foo", + "bar": {"baz": "buzz"} +} diff --git a/tests/compact/c014-context.jsonld b/tests/compact/c014-context.jsonld new file mode 100644 index 00000000..2d48593a --- /dev/null +++ b/tests/compact/c014-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": [ + null + ] + } + } +} diff --git a/tests/compact/c014-in.jsonld b/tests/compact/c014-in.jsonld new file mode 100644 index 00000000..5a68fc26 --- /dev/null +++ b/tests/compact/c014-in.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example/foo": [{ + "@value": "will-exist" + }], + "http://example/p": [{ + "@type": ["http://example/Type"] + }] +}] diff --git a/tests/compact/c014-out.jsonld b/tests/compact/c014-out.jsonld new file mode 100644 index 00000000..79138aed --- /dev/null +++ b/tests/compact/c014-out.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": [ + null + ] + } + }, + "foo": "will-exist", + "p": { + "@type": "Type" + } +} diff --git a/tests/compact/c015-context.jsonld b/tests/compact/c015-context.jsonld new file mode 100644 index 00000000..aea86625 --- /dev/null +++ b/tests/compact/c015-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@base": "http://example/base-base", + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": { + "@base": "http://example/typed-base" + } + } + } +} diff --git a/tests/compact/c015-in.jsonld b/tests/compact/c015-in.jsonld new file mode 100644 index 00000000..2f3427a5 --- /dev/null +++ b/tests/compact/c015-in.jsonld @@ -0,0 +1,16 @@ +[{ + "@id": "http://example/base-base#base-id", + "http://example/p": [{ + "@id": "http://example/typed-base#typed-id", + "@type": ["http://example/Type"], + "http://example/subjectReference": [{ + "@id": "http://example/typed-base#subject-reference-id" + }], + "http://example/nestedNode": [{ + "@id": "http://example/base-base#nested-id", + "http://example/foo": [{ + "@value": "bar" + }] + }] + }] +}] diff --git a/tests/compact/c015-out.jsonld b/tests/compact/c015-out.jsonld new file mode 100644 index 00000000..83bb63d5 --- /dev/null +++ b/tests/compact/c015-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@base": "http://example/base-base", + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": { + "@base": "http://example/typed-base" + } + } + }, + "@id": "#base-id", + "p": { + "@id": "#typed-id", + "@type": "Type", + "subjectReference": { + "@id": "#subject-reference-id" + }, + "nestedNode": { + "@id": "#nested-id", + "foo": "bar" + } + } +} diff --git a/tests/compact/c016-context.jsonld b/tests/compact/c016-context.jsonld new file mode 100644 index 00000000..45296bef --- /dev/null +++ b/tests/compact/c016-context.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "Type": { + "@context": { + "@vocab": "http://example.com/" + } + } + } +} diff --git a/tests/compact/c016-in.jsonld b/tests/compact/c016-in.jsonld new file mode 100644 index 00000000..37bc728a --- /dev/null +++ b/tests/compact/c016-in.jsonld @@ -0,0 +1,16 @@ +[{ + "http://example.org/foo": [{ + "@value": "org" + }], + "http://example.org/p": [{ + "@type": ["http://example.org/Type"], + "http://example.com/foo": [{ + "@value": "com" + }], + "http://example.com/nested": [{ + "http://example.org/nested-prop": [{ + "@value": "org" + }] + }] + }] +}] diff --git a/tests/compact/c016-out.jsonld b/tests/compact/c016-out.jsonld new file mode 100644 index 00000000..2f1186ff --- /dev/null +++ b/tests/compact/c016-out.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "Type": { + "@context": { + "@vocab": "http://example.com/" + } + } + }, + "foo": "org", + "p": { + "@type": "Type", + "foo": "com", + "nested": { + "nested-prop": "org" + } + } +} diff --git a/tests/compact/c017-context.jsonld b/tests/compact/c017-context.jsonld new file mode 100644 index 00000000..d1cca3ac --- /dev/null +++ b/tests/compact/c017-context.jsonld @@ -0,0 +1,19 @@ +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + { + "prop": "http://example/foo-prop" + } + ] + } + } +} diff --git a/tests/compact/c017-in.jsonld b/tests/compact/c017-in.jsonld new file mode 100644 index 00000000..7e7e49d9 --- /dev/null +++ b/tests/compact/c017-in.jsonld @@ -0,0 +1,14 @@ +[{ + "@type": [ + "http://example/Foo", + "http://example/Bar" + ], + "http://example/foo-prop": [{ + "@value": "foo" + }], + "http://example/nested": [{ + "http://example/prop": [{ + "@value": "vocab" + }] + }] +}] diff --git a/tests/compact/c017-out.jsonld b/tests/compact/c017-out.jsonld new file mode 100644 index 00000000..be32133c --- /dev/null +++ b/tests/compact/c017-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + { + "prop": "http://example/foo-prop" + } + ] + } + }, + "@type": ["Foo", "Bar"], + "prop": "foo", + "nested": { + "prop": "vocab" + } +} diff --git a/tests/compact/c018-context.jsonld b/tests/compact/c018-context.jsonld new file mode 100644 index 00000000..d0033bbe --- /dev/null +++ b/tests/compact/c018-context.jsonld @@ -0,0 +1,21 @@ +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + null, + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + null, + { + "prop": "http://example/foo-prop" + } + ] + } + } +} diff --git a/tests/compact/c018-in.jsonld b/tests/compact/c018-in.jsonld new file mode 100644 index 00000000..ee0c79e1 --- /dev/null +++ b/tests/compact/c018-in.jsonld @@ -0,0 +1,11 @@ +[{ + "@type": [ + "http://example/Foo", + "http://example/Bar" + ], + "http://example/foo-prop": [ + { + "@value": "foo" + } + ] +}] diff --git a/tests/compact/c018-out.jsonld b/tests/compact/c018-out.jsonld new file mode 100644 index 00000000..f702f56d --- /dev/null +++ b/tests/compact/c018-out.jsonld @@ -0,0 +1,24 @@ + +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + null, + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + null, + { + "prop": "http://example/foo-prop" + } + ] + } + }, + "@type": ["Foo", "Bar"], + "prop": "foo" +} diff --git a/tests/compact/c019-context.jsonld b/tests/compact/c019-context.jsonld new file mode 100644 index 00000000..a7b6543f --- /dev/null +++ b/tests/compact/c019-context.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "@vocab": "http://example/", + "prop": "http://example/base-prop", + "Type": { + "@context": { + "foo": { + "@context": { + "prop": "http://example/foo-prop" + } + }, + "bar": { + "@context": { + "prop": "http://example/bar-prop" + } + } + } + } + } +} diff --git a/tests/compact/c019-in.jsonld b/tests/compact/c019-in.jsonld new file mode 100644 index 00000000..3d25ead3 --- /dev/null +++ b/tests/compact/c019-in.jsonld @@ -0,0 +1,26 @@ +[{ + "@type": [ + "http://example/Type" + ], + "http://example/foo": [{ + "http://example/foo-prop": [ + { + "@value": "foo" + } + ] + }], + "http://example/bar": [{ + "http://example/bar-prop": [ + { + "@value": "bar" + } + ] + }], + "http://example/baz": [{ + "http://example/base-prop": [ + { + "@value": "baz" + } + ] + }] +}] diff --git a/tests/compact/c019-out.jsonld b/tests/compact/c019-out.jsonld new file mode 100644 index 00000000..418c9cbe --- /dev/null +++ b/tests/compact/c019-out.jsonld @@ -0,0 +1,30 @@ +{ + "@context": { + "@vocab": "http://example/", + "prop": "http://example/base-prop", + "Type": { + "@context": { + "foo": { + "@context": { + "prop": "http://example/foo-prop" + } + }, + "bar": { + "@context": { + "prop": "http://example/bar-prop" + } + } + } + } + }, + "@type": "Type", + "foo": { + "prop": "foo" + }, + "bar": { + "prop": "bar" + }, + "baz": { + "prop": "baz" + } +} diff --git a/tests/compact/c020-context.jsonld b/tests/compact/c020-context.jsonld new file mode 100644 index 00000000..216723fc --- /dev/null +++ b/tests/compact/c020-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example/", + "type": "@type", + "Type": { + "@context": { + "value": "@value" + } + } + } +} diff --git a/tests/compact/c020-in.jsonld b/tests/compact/c020-in.jsonld new file mode 100644 index 00000000..483b9ef0 --- /dev/null +++ b/tests/compact/c020-in.jsonld @@ -0,0 +1,7 @@ +[{ + "@type": ["http://example/Type"], + "http://example/v": [{ + "@type": "http://example/value-type", + "@value": "value" + }] +}] diff --git a/tests/compact/c020-out.jsonld b/tests/compact/c020-out.jsonld new file mode 100644 index 00000000..e504c397 --- /dev/null +++ b/tests/compact/c020-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@vocab": "http://example/", + "type": "@type", + "Type": { + "@context": { + "value": "@value" + } + } + }, + "type": "Type", + "v": { + "value": "value", + "type": "value-type" + } +} diff --git a/tests/compact/c021-context.jsonld b/tests/compact/c021-context.jsonld new file mode 100644 index 00000000..2826733c --- /dev/null +++ b/tests/compact/c021-context.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@vocab": "ex:", + "type": "@type", + "prop": "ex:untyped", + "Type": { + "@context": { + "prop": "ex:typed", + "value": "@value" + } + } + } +} diff --git a/tests/compact/c021-in.jsonld b/tests/compact/c021-in.jsonld new file mode 100644 index 00000000..c3f097e8 --- /dev/null +++ b/tests/compact/c021-in.jsonld @@ -0,0 +1,19 @@ +[{ + "ex:untyped": [{ + "@type": ["ex:Type"], + "ex:typed": [{ + "@value": "v1" + }, { + "@value": "v2" + }, { + "@value": "v3" + }, { + "ex:untyped": [{ + "@value": "v4" + }, { + "@type": ["ex:Type"], + "ex:typed": [{"@value": "v5"}] + }] + }] + }] +}] diff --git a/tests/compact/c021-out.jsonld b/tests/compact/c021-out.jsonld new file mode 100644 index 00000000..738dbfa5 --- /dev/null +++ b/tests/compact/c021-out.jsonld @@ -0,0 +1,30 @@ +{ + "@context": { + "@vocab": "ex:", + "type": "@type", + "prop": "ex:untyped", + "Type": { + "@context": { + "prop": "ex:typed", + "value": "@value" + } + } + }, + "prop": { + "type": "Type", + "prop": [ + "v1", + "v2", + "v3", + { + "prop": [ + "v4", + { + "type": "Type", + "prop": "v5" + } + ] + } + ] + } +} diff --git a/tests/compact/c022-context.jsonld b/tests/compact/c022-context.jsonld new file mode 100644 index 00000000..1d1fb201 --- /dev/null +++ b/tests/compact/c022-context.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@vocab": "ex:", + "Type": { + "@context": { + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "Foo": "ex:Foo", + "Bar": "ex:Bar" + } + } + } + } + } +} diff --git a/tests/compact/c022-in.jsonld b/tests/compact/c022-in.jsonld new file mode 100644 index 00000000..d77a5f5a --- /dev/null +++ b/tests/compact/c022-in.jsonld @@ -0,0 +1,4 @@ +[{ + "@type": ["ex:Type"], + "ex:foo": [{"@id": "ex:Bar"}] +}] diff --git a/tests/compact/c022-out.jsonld b/tests/compact/c022-out.jsonld new file mode 100644 index 00000000..c5ef4a2e --- /dev/null +++ b/tests/compact/c022-out.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "@vocab": "ex:", + "Type": { + "@context": { + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "Foo": "ex:Foo", + "Bar": "ex:Bar" + } + } + } + } + }, + "@type": "Type", + "foo": "Bar" +} diff --git a/tests/compact/c023-context.jsonld b/tests/compact/c023-context.jsonld new file mode 100644 index 00000000..5d69acb7 --- /dev/null +++ b/tests/compact/c023-context.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "Foo": "ex:Foo" + } + } + } + } + } +} diff --git a/tests/compact/c023-in.jsonld b/tests/compact/c023-in.jsonld new file mode 100644 index 00000000..3e47445a --- /dev/null +++ b/tests/compact/c023-in.jsonld @@ -0,0 +1,7 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@type": ["ex:Inner"], + "ex:foo": [{"@id": "ex:Foo"}] + }] +}] diff --git a/tests/compact/c023-out.jsonld b/tests/compact/c023-out.jsonld new file mode 100644 index 00000000..94272f95 --- /dev/null +++ b/tests/compact/c023-out.jsonld @@ -0,0 +1,29 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "Foo": "ex:Foo" + } + } + } + } + }, + "@type": "Outer", + "nested": { + "@type": "Inner", + "foo": "Foo" + } +} diff --git a/tests/compact/c024-context.jsonld b/tests/compact/c024-context.jsonld new file mode 100644 index 00000000..474de9db --- /dev/null +++ b/tests/compact/c024-context.jsonld @@ -0,0 +1,34 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "val": "@value", + "foo": { + "@id": "ex:foo", + "@container": "@set", + "@type": "ex:Number", + "@context": { + "value": "@value" + } + }, + "bar": { + "@id": "ex:bar", + "@container": "@set", + "@type": "@id", + "@context": { + "@base": "http://example/" + } + } + } + } + } +} diff --git a/tests/compact/c024-in.jsonld b/tests/compact/c024-in.jsonld new file mode 100644 index 00000000..d2b0b669 --- /dev/null +++ b/tests/compact/c024-in.jsonld @@ -0,0 +1,11 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@type": ["ex:Inner"], + "ex:foo": {"@type": "ex:Number", "@value": "1"}, + "ex:bar": [ + {"@id": "http://example/a"}, + {"@id": "http://example/b"} + ] + }] +}] diff --git a/tests/compact/c024-out.jsonld b/tests/compact/c024-out.jsonld new file mode 100644 index 00000000..3f2b5434 --- /dev/null +++ b/tests/compact/c024-out.jsonld @@ -0,0 +1,40 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "val": "@value", + "foo": { + "@id": "ex:foo", + "@container": "@set", + "@type": "ex:Number", + "@context": { + "value": "@value" + } + }, + "bar": { + "@id": "ex:bar", + "@container": "@set", + "@type": "@id", + "@context": { + "@base": "http://example/" + } + } + } + } + }, + "@type": "Outer", + "nested": { + "@type": "Inner", + "foo": ["1"], + "bar": ["a", "b"] + } +} diff --git a/tests/compact/c025-context.jsonld b/tests/compact/c025-context.jsonld new file mode 100644 index 00000000..cd868d35 --- /dev/null +++ b/tests/compact/c025-context.jsonld @@ -0,0 +1,22 @@ +{ + "@context": { + "@version": 1.1, + "type": "@type", + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": { + "@id": "ex:nested", + "@type": "@id", + "@container": "@graph" + } + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "foo": "ex:foo" + } + } + } +} diff --git a/tests/compact/c025-in.jsonld b/tests/compact/c025-in.jsonld new file mode 100644 index 00000000..d8246465 --- /dev/null +++ b/tests/compact/c025-in.jsonld @@ -0,0 +1,9 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@graph": [{ + "@type": ["ex:Inner"], + "ex:foo": [{"@value": "bar"}] + }] + }] +}] diff --git a/tests/compact/c025-out.jsonld b/tests/compact/c025-out.jsonld new file mode 100644 index 00000000..aa9b1fc7 --- /dev/null +++ b/tests/compact/c025-out.jsonld @@ -0,0 +1,27 @@ +{ + "@context": { + "@version": 1.1, + "type": "@type", + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": { + "@id": "ex:nested", + "@type": "@id", + "@container": "@graph" + } + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "foo": "ex:foo" + } + } + }, + "type": "Outer", + "nested": { + "type": "Inner", + "foo": "bar" + } +} diff --git a/tests/compact/pr03-context.jsonld b/tests/compact/pr03-context.jsonld index 0e9cc8ea..0863ce0d 100644 --- a/tests/compact/pr03-context.jsonld +++ b/tests/compact/pr03-context.jsonld @@ -3,6 +3,6 @@ "@version": 1.1, "@vocab": "http://example.com/", "protected": {"@protected": true}, - "Type": {"@context": {"protected": {"@type": "@id"},}} + "Type": {"@context": {"protected": {"@type": "@id"}}} } } diff --git a/tests/compact/pr05-context.jsonld b/tests/compact/pr05-context.jsonld new file mode 100644 index 00000000..a066af95 --- /dev/null +++ b/tests/compact/pr05-context.jsonld @@ -0,0 +1,12 @@ +{ + "@context": [{ + "@version": 1.1, + "@protected": true, + "@vocab": "http://example.com/", + "Parent": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }, { + "@version": 1.1, + "@protected": true, + "Child": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }] +} diff --git a/tests/compact/pr05-in.jsonld b/tests/compact/pr05-in.jsonld new file mode 100644 index 00000000..4e97b905 --- /dev/null +++ b/tests/compact/pr05-in.jsonld @@ -0,0 +1,20 @@ +[ + { + "@type": [ + "http://example.com/Parent" + ], + "http://example.com/foo": [ + { + "@type": [ + "http://example.com/Child" + ], + "http://example.com/foo": [ + { + "@id": "http://example.com/test" + } + ] + } + ] + } +] + diff --git a/tests/compact/pr05-out.jsonld b/tests/compact/pr05-out.jsonld new file mode 100644 index 00000000..7cd17cb8 --- /dev/null +++ b/tests/compact/pr05-out.jsonld @@ -0,0 +1,17 @@ +{ + "@context": [{ + "@version": 1.1, + "@protected": true, + "@vocab": "http://example.com/", + "Parent": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }, { + "@version": 1.1, + "@protected": true, + "Child": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }], + "@type": "Parent", + "foo": { + "@type": "Child", + "foo": "http://example.com/test" + } +} diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 9a4735fa..35b9056c 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -907,7 +907,7 @@ }, { "@id": "#tc009", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], - "name": "deep @context affects nested nodes", + "name": "deep @type-scoped @context does NOT affect nested nodes", "purpose": "scoped context on @type", "input": "expand/c009-in.jsonld", "expect": "expand/c009-out.jsonld", @@ -928,7 +928,119 @@ "input": "expand/c011-in.jsonld", "expect": "expand/c011-out.jsonld", "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} - }, { + }, { + "@id": "#tc012", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "deep property-term scoped @context in @type-scoped @context affects nested nodes", + "purpose": "scoped context on @type", + "input": "expand/c012-in.jsonld", + "expect": "expand/c012-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc013", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type maps use scoped context from type index and not scoped context from containing", + "purpose": "scoped context on @type", + "input": "expand/c013-in.jsonld", + "expect": "expand/c013-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc014", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped context nullification", + "purpose": "type-scoped context nullification", + "input": "expand/c014-in.jsonld", + "expect": "expand/c014-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc015", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped base", + "purpose": "type-scoped base", + "input": "expand/c015-in.jsonld", + "expect": "expand/c015-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc016", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped vocab", + "purpose": "type-scoped vocab", + "input": "expand/c016-in.jsonld", + "expect": "expand/c016-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc017", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "multiple type-scoped contexts are properly reverted", + "purpose": "multiple type-scoped contexts are property reverted", + "input": "expand/c017-in.jsonld", + "expect": "expand/c017-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc018", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "multiple type-scoped types resolved against previous context", + "purpose": "multiple type-scoped types resolved against previous context", + "input": "expand/c018-in.jsonld", + "expect": "expand/c018-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc019", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped context with multiple property scoped terms", + "purpose": "type-scoped context with multiple property scoped terms", + "input": "expand/c019-in.jsonld", + "expect": "expand/c019-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc020", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped value", + "purpose": "type-scoped value", + "input": "expand/c020-in.jsonld", + "expect": "expand/c020-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc021", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped value mix", + "purpose": "type-scoped value mix", + "input": "expand/c021-in.jsonld", + "expect": "expand/c021-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc022", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped property-scoped contexts including @type:@vocab", + "purpose": "type-scoped property-scoped contexts including @type:@vocab", + "input": "expand/c022-in.jsonld", + "expect": "expand/c022-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc023", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "composed type-scoped property-scoped contexts including @type:@vocab", + "purpose": "composed type-scoped property-scoped contexts including @type:@vocab", + "input": "expand/c023-in.jsonld", + "expect": "expand/c023-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc024", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped + property-scoped + values evaluates against previous context", + "purpose": "type-scoped + property-scoped + values evaluates against previous context", + "input": "expand/c024-in.jsonld", + "expect": "expand/c024-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { + "@id": "#tc025", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "type-scoped + graph container", + "purpose": "type-scoped + graph container", + "input": "expand/c025-in.jsonld", + "expect": "expand/c025-out.jsonld", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} + }, { "@id": "#te001", "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], "name": "Keywords cannot be aliased to other keywords", @@ -1251,7 +1363,7 @@ "input": "expand/ec01-in.jsonld", "expect": "invalid term definition", "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} - }, { + }, { "@id": "#tem01", "@type": [ "jld:NegativeEvaluationTest", "jld:ExpandTest" ], "name": "Invalid container mapping", @@ -1754,7 +1866,7 @@ "input": "expand/m016-in.jsonld", "expect": "expand/m016-out.jsonld", "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"} - }, { + }, { "@id": "#tn001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Expands input using @nest", @@ -1930,7 +2042,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pi11-in.jsonld", "expect": "expand/pi11-out.jsonld" - }, { + }, { "@id": "#tl001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Language map with null value", @@ -1938,7 +2050,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/l001-in.jsonld", "expect": "expand/l001-out.jsonld" - }, { + }, { "@id": "#tli01", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@list containing @list", @@ -1946,7 +2058,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li01-in.jsonld", "expect": "expand/li01-out.jsonld" - }, { + }, { "@id": "#tli02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@list containing empty @list", @@ -1954,7 +2066,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li02-in.jsonld", "expect": "expand/li02-out.jsonld" - }, { + }, { "@id": "#tli03", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@list containing @list (with coercion)", @@ -1962,7 +2074,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li03-in.jsonld", "expect": "expand/li03-out.jsonld" - }, { + }, { "@id": "#tli04", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@list containing empty @list (with coercion)", @@ -1970,7 +2082,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li04-in.jsonld", "expect": "expand/li04-out.jsonld" - }, { + }, { "@id": "#tli05", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing an array", @@ -1978,7 +2090,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li05-in.jsonld", "expect": "expand/li05-out.jsonld" - }, { + }, { "@id": "#tli06", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing an empty array", @@ -1986,7 +2098,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li06-in.jsonld", "expect": "expand/li06-out.jsonld" - }, { + }, { "@id": "#tli07", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing deep arrays", @@ -1994,7 +2106,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li07-in.jsonld", "expect": "expand/li07-out.jsonld" - }, { + }, { "@id": "#tli08", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing deep empty arrays", @@ -2002,7 +2114,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li08-in.jsonld", "expect": "expand/li08-out.jsonld" - }, { + }, { "@id": "#tli09", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing multiple lists", @@ -2010,7 +2122,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li09-in.jsonld", "expect": "expand/li09-out.jsonld" - }, { + }, { "@id": "#tli10", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "coerced @list containing mixed list values", @@ -2018,7 +2130,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/li10-in.jsonld", "expect": "expand/li10-out.jsonld" - }, { + }, { "@id": "#tpr01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Protect a term", @@ -2026,7 +2138,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr01-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Set a term to not be protected", @@ -2034,7 +2146,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr02-in.jsonld", "expect": "expand/pr02-out.jsonld" - }, { + }, { "@id": "#tpr03", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Protect all terms in context", @@ -2042,7 +2154,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr03-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr04", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Do not protect term with @protected: false", @@ -2050,7 +2162,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr04-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr05", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Clear active context with protected terms from an embedded context", @@ -2058,7 +2170,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr05-in.jsonld", "expect": "invalid context nullification" - }, { + }, { "@id": "#tpr06", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Clear active context of protected terms from a term.", @@ -2066,7 +2178,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr06-in.jsonld", "expect": "expand/pr06-out.jsonld" - }, { + }, { "@id": "#tpr08", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Term with protected scoped context.", @@ -2074,7 +2186,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr08-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr09", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Attempt to redefine term in other protected context.", @@ -2082,7 +2194,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr09-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr10", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Simple protected and unprotected terms.", @@ -2090,7 +2202,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr10-in.jsonld", "expect": "expand/pr10-out.jsonld" - }, { + }, { "@id": "#tpr11", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Fail to override protected term.", @@ -2098,7 +2210,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr11-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr12", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Scoped context fail to override protected term.", @@ -2106,7 +2218,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr12-in.jsonld", "expect": "protected term redefinition" - }, { + }, { "@id": "#tpr13", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Override unprotected term.", @@ -2114,7 +2226,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr13-in.jsonld", "expect": "expand/pr13-out.jsonld" - }, { + }, { "@id": "#tpr14", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Clear protection with null context.", @@ -2122,7 +2234,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr14-in.jsonld", "expect": "expand/pr14-out.jsonld" - }, { + }, { "@id": "#tpr15", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Clear protection with array with null context", @@ -2130,7 +2242,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr15-in.jsonld", "expect": "expand/pr15-out.jsonld" - }, { + }, { "@id": "#tpr16", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Override protected terms after null.", @@ -2138,7 +2250,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr16-in.jsonld", "expect": "expand/pr16-out.jsonld" - }, { + }, { "@id": "#tpr17", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Fail to override protected terms with type.", @@ -2146,7 +2258,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr17-in.jsonld", "expect": "invalid context nullification" - }, { + }, { "@id": "#tpr18", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Fail to override protected terms with type+null+ctx.", @@ -2154,7 +2266,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr18-in.jsonld", "expect": "invalid context nullification" - }, { + }, { "@id": "#tpr19", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "Mix of protected and unprotected terms.", @@ -2162,7 +2274,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr19-in.jsonld", "expect": "expand/pr19-out.jsonld" - }, { + }, { "@id": "#tpr20", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Fail with mix of protected and unprotected terms with type+null+ctx.", @@ -2170,7 +2282,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr20-in.jsonld", "expect": "invalid context nullification" - }, { + }, { "@id": "#tpr21", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "Fail with mix of protected and unprotected terms with type+null.", @@ -2178,7 +2290,15 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr21-in.jsonld", "expect": "invalid context nullification" - }, { + }, { + "@id": "#tpr22", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Check legal overriding of type-scoped protected term from nested node.", + "purpose": "Check legal overriding of type-scoped protected term from nested node.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr22-in.jsonld", + "expect": "expand/pr22-out.jsonld" + }, { "@id": "#ttn01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], "name": "@type: @none is illegal in 1.0.", @@ -2186,7 +2306,7 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/tn01-in.jsonld", "expect": "invalid type mapping" - }, { + }, { "@id": "#ttn02", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], "name": "@type: @none expands strings as value objects", diff --git a/tests/expand/c009-out.jsonld b/tests/expand/c009-out.jsonld index 59a1fb53..457f891c 100644 --- a/tests/expand/c009-out.jsonld +++ b/tests/expand/c009-out.jsonld @@ -2,7 +2,7 @@ { "@type": ["http://example/Foo"], "http://example/bar": [{ - "http://example/baz": [{"@id": "http://example/buzz"}] + "http://example/baz": [{"@value": "buzz"}] }] } -] \ No newline at end of file +] diff --git a/tests/expand/c012-in.jsonld b/tests/expand/c012-in.jsonld new file mode 100644 index 00000000..bba1c9bf --- /dev/null +++ b/tests/expand/c012-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@vocab": "http://example/", + "Foo": { + "@context": { + "bar": { + "@context": { + "baz": {"@type": "@vocab"} + } + } + } + } + }, + "@type": "Foo", + "bar": {"baz": "buzz"} +} diff --git a/tests/expand/c012-out.jsonld b/tests/expand/c012-out.jsonld new file mode 100644 index 00000000..8ff196e6 --- /dev/null +++ b/tests/expand/c012-out.jsonld @@ -0,0 +1,8 @@ +[ + { + "@type": ["http://example/Foo"], + "http://example/bar": [{ + "http://example/baz": [{"@id": "http://example/buzz"}] + }] + } +] diff --git a/tests/expand/c013-in.jsonld b/tests/expand/c013-in.jsonld new file mode 100644 index 00000000..63c4a0c5 --- /dev/null +++ b/tests/expand/c013-in.jsonld @@ -0,0 +1,28 @@ +{ + "@context": { + "@vocab": "http://example/", + "prop": {"@container": "@index"}, + "foo": "http://example/base-foo", + "Outer": { + "@context": { + "prop": { + "@id": "http://example/outer-prop", + "@container": "@type" + } + } + }, + "Inner": {"@context": {"foo": "http://example/inner-foo"}} + }, + "@type": "Outer", + "prop": { + "Inner": { + "prop": { + "index": { + "@id": "http://example/inner-with-index", + "foo": "inner-foo" + } + } + } + }, + "foo": "base-foo" +} diff --git a/tests/expand/c013-out.jsonld b/tests/expand/c013-out.jsonld new file mode 100644 index 00000000..a57f9394 --- /dev/null +++ b/tests/expand/c013-out.jsonld @@ -0,0 +1,12 @@ +[{ + "@type": ["http://example/Outer"], + "http://example/base-foo": [{"@value": "base-foo"}], + "http://example/outer-prop": [{ + "@type": ["http://example/Inner"], + "http://example/prop": [{ + "@id": "http://example/inner-with-index", + "@index": "index", + "http://example/inner-foo": [{"@value": "inner-foo"}] + }] + }] +}] \ No newline at end of file diff --git a/tests/expand/c014-in.jsonld b/tests/expand/c014-in.jsonld new file mode 100644 index 00000000..d89e3012 --- /dev/null +++ b/tests/expand/c014-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": [ + null + ] + } + }, + "foo": "will-exist", + "p": { + "@type": "Type", + "foo": "will-not-exist" + } +} diff --git a/tests/expand/c014-out.jsonld b/tests/expand/c014-out.jsonld new file mode 100644 index 00000000..5a68fc26 --- /dev/null +++ b/tests/expand/c014-out.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example/foo": [{ + "@value": "will-exist" + }], + "http://example/p": [{ + "@type": ["http://example/Type"] + }] +}] diff --git a/tests/expand/c015-in.jsonld b/tests/expand/c015-in.jsonld new file mode 100644 index 00000000..83bb63d5 --- /dev/null +++ b/tests/expand/c015-in.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@base": "http://example/base-base", + "@vocab": "http://example/", + "foo": "http://example/foo", + "Type": { + "@context": { + "@base": "http://example/typed-base" + } + } + }, + "@id": "#base-id", + "p": { + "@id": "#typed-id", + "@type": "Type", + "subjectReference": { + "@id": "#subject-reference-id" + }, + "nestedNode": { + "@id": "#nested-id", + "foo": "bar" + } + } +} diff --git a/tests/expand/c015-out.jsonld b/tests/expand/c015-out.jsonld new file mode 100644 index 00000000..2f3427a5 --- /dev/null +++ b/tests/expand/c015-out.jsonld @@ -0,0 +1,16 @@ +[{ + "@id": "http://example/base-base#base-id", + "http://example/p": [{ + "@id": "http://example/typed-base#typed-id", + "@type": ["http://example/Type"], + "http://example/subjectReference": [{ + "@id": "http://example/typed-base#subject-reference-id" + }], + "http://example/nestedNode": [{ + "@id": "http://example/base-base#nested-id", + "http://example/foo": [{ + "@value": "bar" + }] + }] + }] +}] diff --git a/tests/expand/c016-in.jsonld b/tests/expand/c016-in.jsonld new file mode 100644 index 00000000..2f1186ff --- /dev/null +++ b/tests/expand/c016-in.jsonld @@ -0,0 +1,18 @@ +{ + "@context": { + "@vocab": "http://example.org/", + "Type": { + "@context": { + "@vocab": "http://example.com/" + } + } + }, + "foo": "org", + "p": { + "@type": "Type", + "foo": "com", + "nested": { + "nested-prop": "org" + } + } +} diff --git a/tests/expand/c016-out.jsonld b/tests/expand/c016-out.jsonld new file mode 100644 index 00000000..37bc728a --- /dev/null +++ b/tests/expand/c016-out.jsonld @@ -0,0 +1,16 @@ +[{ + "http://example.org/foo": [{ + "@value": "org" + }], + "http://example.org/p": [{ + "@type": ["http://example.org/Type"], + "http://example.com/foo": [{ + "@value": "com" + }], + "http://example.com/nested": [{ + "http://example.org/nested-prop": [{ + "@value": "org" + }] + }] + }] +}] diff --git a/tests/expand/c017-in.jsonld b/tests/expand/c017-in.jsonld new file mode 100644 index 00000000..be32133c --- /dev/null +++ b/tests/expand/c017-in.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + { + "prop": "http://example/foo-prop" + } + ] + } + }, + "@type": ["Foo", "Bar"], + "prop": "foo", + "nested": { + "prop": "vocab" + } +} diff --git a/tests/expand/c017-out.jsonld b/tests/expand/c017-out.jsonld new file mode 100644 index 00000000..7e7e49d9 --- /dev/null +++ b/tests/expand/c017-out.jsonld @@ -0,0 +1,14 @@ +[{ + "@type": [ + "http://example/Foo", + "http://example/Bar" + ], + "http://example/foo-prop": [{ + "@value": "foo" + }], + "http://example/nested": [{ + "http://example/prop": [{ + "@value": "vocab" + }] + }] +}] diff --git a/tests/expand/c018-in.jsonld b/tests/expand/c018-in.jsonld new file mode 100644 index 00000000..b8fbd43d --- /dev/null +++ b/tests/expand/c018-in.jsonld @@ -0,0 +1,26 @@ +{ + "@context": { + "@vocab": "http://example/", + "Bar": { + "@context": [ + null, + { + "prop": "http://example/bar-prop" + } + ] + }, + "Foo": { + "@context": [ + null, + { + "prop": "http://example/foo-prop" + } + ] + } + }, + "@type": ["Foo", "Bar"], + "prop": "foo", + "nested": { + "prop": "will-not-exist" + } +} diff --git a/tests/expand/c018-out.jsonld b/tests/expand/c018-out.jsonld new file mode 100644 index 00000000..ee0c79e1 --- /dev/null +++ b/tests/expand/c018-out.jsonld @@ -0,0 +1,11 @@ +[{ + "@type": [ + "http://example/Foo", + "http://example/Bar" + ], + "http://example/foo-prop": [ + { + "@value": "foo" + } + ] +}] diff --git a/tests/expand/c019-in.jsonld b/tests/expand/c019-in.jsonld new file mode 100644 index 00000000..418c9cbe --- /dev/null +++ b/tests/expand/c019-in.jsonld @@ -0,0 +1,30 @@ +{ + "@context": { + "@vocab": "http://example/", + "prop": "http://example/base-prop", + "Type": { + "@context": { + "foo": { + "@context": { + "prop": "http://example/foo-prop" + } + }, + "bar": { + "@context": { + "prop": "http://example/bar-prop" + } + } + } + } + }, + "@type": "Type", + "foo": { + "prop": "foo" + }, + "bar": { + "prop": "bar" + }, + "baz": { + "prop": "baz" + } +} diff --git a/tests/expand/c019-out.jsonld b/tests/expand/c019-out.jsonld new file mode 100644 index 00000000..3d25ead3 --- /dev/null +++ b/tests/expand/c019-out.jsonld @@ -0,0 +1,26 @@ +[{ + "@type": [ + "http://example/Type" + ], + "http://example/foo": [{ + "http://example/foo-prop": [ + { + "@value": "foo" + } + ] + }], + "http://example/bar": [{ + "http://example/bar-prop": [ + { + "@value": "bar" + } + ] + }], + "http://example/baz": [{ + "http://example/base-prop": [ + { + "@value": "baz" + } + ] + }] +}] diff --git a/tests/expand/c020-in.jsonld b/tests/expand/c020-in.jsonld new file mode 100644 index 00000000..e504c397 --- /dev/null +++ b/tests/expand/c020-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@vocab": "http://example/", + "type": "@type", + "Type": { + "@context": { + "value": "@value" + } + } + }, + "type": "Type", + "v": { + "value": "value", + "type": "value-type" + } +} diff --git a/tests/expand/c020-out.jsonld b/tests/expand/c020-out.jsonld new file mode 100644 index 00000000..483b9ef0 --- /dev/null +++ b/tests/expand/c020-out.jsonld @@ -0,0 +1,7 @@ +[{ + "@type": ["http://example/Type"], + "http://example/v": [{ + "@type": "http://example/value-type", + "@value": "value" + }] +}] diff --git a/tests/expand/c021-in.jsonld b/tests/expand/c021-in.jsonld new file mode 100644 index 00000000..99d78bee --- /dev/null +++ b/tests/expand/c021-in.jsonld @@ -0,0 +1,34 @@ +{ + "@context": { + "@vocab": "ex:", + "type": "@type", + "prop": "ex:untyped", + "Type": { + "@context": { + "prop": "ex:typed", + "value": "@value" + } + } + }, + "prop": { + "type": "Type", + "prop": [ + "v1", + { + "value": "v2" + }, + { + "@value": "v3" + }, + { + "prop": [ + "v4", + { + "type": "Type", + "prop": "v5" + } + ] + } + ] + } +} diff --git a/tests/expand/c021-out.jsonld b/tests/expand/c021-out.jsonld new file mode 100644 index 00000000..c3f097e8 --- /dev/null +++ b/tests/expand/c021-out.jsonld @@ -0,0 +1,19 @@ +[{ + "ex:untyped": [{ + "@type": ["ex:Type"], + "ex:typed": [{ + "@value": "v1" + }, { + "@value": "v2" + }, { + "@value": "v3" + }, { + "ex:untyped": [{ + "@value": "v4" + }, { + "@type": ["ex:Type"], + "ex:typed": [{"@value": "v5"}] + }] + }] + }] +}] diff --git a/tests/expand/c022-in.jsonld b/tests/expand/c022-in.jsonld new file mode 100644 index 00000000..c5ef4a2e --- /dev/null +++ b/tests/expand/c022-in.jsonld @@ -0,0 +1,20 @@ +{ + "@context": { + "@vocab": "ex:", + "Type": { + "@context": { + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "@version": 1.1, + "Foo": "ex:Foo", + "Bar": "ex:Bar" + } + } + } + } + }, + "@type": "Type", + "foo": "Bar" +} diff --git a/tests/expand/c022-out.jsonld b/tests/expand/c022-out.jsonld new file mode 100644 index 00000000..d77a5f5a --- /dev/null +++ b/tests/expand/c022-out.jsonld @@ -0,0 +1,4 @@ +[{ + "@type": ["ex:Type"], + "ex:foo": [{"@id": "ex:Bar"}] +}] diff --git a/tests/expand/c023-in.jsonld b/tests/expand/c023-in.jsonld new file mode 100644 index 00000000..94272f95 --- /dev/null +++ b/tests/expand/c023-in.jsonld @@ -0,0 +1,29 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "foo": { + "@id": "ex:foo", + "@type": "@vocab", + "@context": { + "Foo": "ex:Foo" + } + } + } + } + }, + "@type": "Outer", + "nested": { + "@type": "Inner", + "foo": "Foo" + } +} diff --git a/tests/expand/c023-out.jsonld b/tests/expand/c023-out.jsonld new file mode 100644 index 00000000..3e47445a --- /dev/null +++ b/tests/expand/c023-out.jsonld @@ -0,0 +1,7 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@type": ["ex:Inner"], + "ex:foo": [{"@id": "ex:Foo"}] + }] +}] diff --git a/tests/expand/c024-in.jsonld b/tests/expand/c024-in.jsonld new file mode 100644 index 00000000..9fe803fa --- /dev/null +++ b/tests/expand/c024-in.jsonld @@ -0,0 +1,40 @@ +{ + "@context": { + "@version": 1.1, + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": "ex:nested" + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "@version": 1.1, + "val": "@value", + "foo": { + "@id": "ex:foo", + "@container": "@set", + "@type": "ex:Number", + "@context": { + "value": "@value" + } + }, + "bar": { + "@id": "ex:bar", + "@container": "@set", + "@type": "@id", + "@context": { + "@base": "http://example/" + } + } + } + } + }, + "@type": "Outer", + "nested": { + "@type": "Inner", + "foo": [{"value": "1"}, "2"], + "bar": [{"@id": "a"}, "b"] + } +} diff --git a/tests/expand/c024-out.jsonld b/tests/expand/c024-out.jsonld new file mode 100644 index 00000000..ef901dbd --- /dev/null +++ b/tests/expand/c024-out.jsonld @@ -0,0 +1,14 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@type": ["ex:Inner"], + "ex:foo": [ + {"@value": "1"}, + {"@type": "ex:Number", "@value": "2"} + ], + "ex:bar": [ + {"@id": "http://example/a"}, + {"@id": "http://example/b"} + ] + }] +}] diff --git a/tests/expand/c025-in.jsonld b/tests/expand/c025-in.jsonld new file mode 100644 index 00000000..aa9b1fc7 --- /dev/null +++ b/tests/expand/c025-in.jsonld @@ -0,0 +1,27 @@ +{ + "@context": { + "@version": 1.1, + "type": "@type", + "Outer": { + "@id": "ex:Outer", + "@context": { + "nested": { + "@id": "ex:nested", + "@type": "@id", + "@container": "@graph" + } + } + }, + "Inner": { + "@id": "ex:Inner", + "@context": { + "foo": "ex:foo" + } + } + }, + "type": "Outer", + "nested": { + "type": "Inner", + "foo": "bar" + } +} diff --git a/tests/expand/c025-out.jsonld b/tests/expand/c025-out.jsonld new file mode 100644 index 00000000..d8246465 --- /dev/null +++ b/tests/expand/c025-out.jsonld @@ -0,0 +1,9 @@ +[{ + "@type": ["ex:Outer"], + "ex:nested": [{ + "@graph": [{ + "@type": ["ex:Inner"], + "ex:foo": [{"@value": "bar"}] + }] + }] +}] diff --git a/tests/expand/pr22-in.jsonld b/tests/expand/pr22-in.jsonld new file mode 100644 index 00000000..7cd17cb8 --- /dev/null +++ b/tests/expand/pr22-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": [{ + "@version": 1.1, + "@protected": true, + "@vocab": "http://example.com/", + "Parent": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }, { + "@version": 1.1, + "@protected": true, + "Child": {"@context": {"@protected": true, "foo": {"@type": "@id"}}} + }], + "@type": "Parent", + "foo": { + "@type": "Child", + "foo": "http://example.com/test" + } +} diff --git a/tests/expand/pr22-out.jsonld b/tests/expand/pr22-out.jsonld new file mode 100644 index 00000000..4e97b905 --- /dev/null +++ b/tests/expand/pr22-out.jsonld @@ -0,0 +1,20 @@ +[ + { + "@type": [ + "http://example.com/Parent" + ], + "http://example.com/foo": [ + { + "@type": [ + "http://example.com/Child" + ], + "http://example.com/foo": [ + { + "@id": "http://example.com/test" + } + ] + } + ] + } +] +