From d6b60add050968639af2cd5cab59c2f4e100956c Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 23 Mar 2019 16:50:53 -0700 Subject: [PATCH] Add API text and tests for compaction and expansion of indexes using a property. For w3c/json-ld-syntax#145. --- index.html | 90 +++++++++++++++++++++---------- tests/compact-manifest.jsonld | 54 +++++++++++++++++++ tests/compact/pi01-context.jsonld | 8 +++ tests/compact/pi01-in.jsonld | 8 +++ tests/compact/pi01-out.jsonld | 13 +++++ tests/compact/pi02-context.jsonld | 8 +++ tests/compact/pi02-in.jsonld | 8 +++ tests/compact/pi02-out.jsonld | 16 ++++++ tests/compact/pi03-context.jsonld | 9 ++++ tests/compact/pi03-in.jsonld | 8 +++ tests/compact/pi03-out.jsonld | 17 ++++++ tests/compact/pi04-context.jsonld | 9 ++++ tests/compact/pi04-in.jsonld | 8 +++ tests/compact/pi04-out.jsonld | 17 ++++++ tests/compact/pi05-context.jsonld | 8 +++ tests/compact/pi05-in.jsonld | 8 +++ tests/compact/pi05-out.jsonld | 12 +++++ tests/compact/pi06-context.jsonld | 8 +++ tests/compact/pi06-in.jsonld | 8 +++ tests/compact/pi06-out.jsonld | 16 ++++++ tests/expand-manifest.jsonld | 88 ++++++++++++++++++++++++++++++ tests/expand/pi01-in.jsonld | 11 ++++ tests/expand/pi02-in.jsonld | 12 +++++ tests/expand/pi03-in.jsonld | 16 ++++++ tests/expand/pi04-in.jsonld | 16 ++++++ tests/expand/pi05-in.jsonld | 16 ++++++ tests/expand/pi06-in.jsonld | 13 +++++ tests/expand/pi06-out.jsonld | 8 +++ tests/expand/pi07-in.jsonld | 16 ++++++ tests/expand/pi07-out.jsonld | 8 +++ tests/expand/pi08-in.jsonld | 14 +++++ tests/expand/pi08-out.jsonld | 8 +++ tests/expand/pi09-in.jsonld | 17 ++++++ tests/expand/pi09-out.jsonld | 8 +++ tests/expand/pi10-in.jsonld | 17 ++++++ tests/expand/pi10-out.jsonld | 8 +++ tests/expand/pi11-in.jsonld | 10 ++++ tests/expand/pi11-out.jsonld | 8 +++ 38 files changed, 600 insertions(+), 27 deletions(-) create mode 100644 tests/compact/pi01-context.jsonld create mode 100644 tests/compact/pi01-in.jsonld create mode 100644 tests/compact/pi01-out.jsonld create mode 100644 tests/compact/pi02-context.jsonld create mode 100644 tests/compact/pi02-in.jsonld create mode 100644 tests/compact/pi02-out.jsonld create mode 100644 tests/compact/pi03-context.jsonld create mode 100644 tests/compact/pi03-in.jsonld create mode 100644 tests/compact/pi03-out.jsonld create mode 100644 tests/compact/pi04-context.jsonld create mode 100644 tests/compact/pi04-in.jsonld create mode 100644 tests/compact/pi04-out.jsonld create mode 100644 tests/compact/pi05-context.jsonld create mode 100644 tests/compact/pi05-in.jsonld create mode 100644 tests/compact/pi05-out.jsonld create mode 100644 tests/compact/pi06-context.jsonld create mode 100644 tests/compact/pi06-in.jsonld create mode 100644 tests/compact/pi06-out.jsonld create mode 100644 tests/expand/pi01-in.jsonld create mode 100644 tests/expand/pi02-in.jsonld create mode 100644 tests/expand/pi03-in.jsonld create mode 100644 tests/expand/pi04-in.jsonld create mode 100644 tests/expand/pi05-in.jsonld create mode 100644 tests/expand/pi06-in.jsonld create mode 100644 tests/expand/pi06-out.jsonld create mode 100644 tests/expand/pi07-in.jsonld create mode 100644 tests/expand/pi07-out.jsonld create mode 100644 tests/expand/pi08-in.jsonld create mode 100644 tests/expand/pi08-out.jsonld create mode 100644 tests/expand/pi09-in.jsonld create mode 100644 tests/expand/pi09-out.jsonld create mode 100644 tests/expand/pi10-in.jsonld create mode 100644 tests/expand/pi10-out.jsonld create mode 100644 tests/expand/pi11-in.jsonld create mode 100644 tests/expand/pi11-out.jsonld diff --git a/index.html b/index.html index a4a34f16..231d6509 100644 --- a/index.html +++ b/index.html @@ -942,6 +942,7 @@

Context Processing Algorithm

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 @@ -1389,6 +1390,20 @@

Algorithm

container. +
  • If value contains the member @index: +
      +
    1. If processing mode is json-ld-1.0 or + container mapping does not include @index, + an invalid term definition + has been detected and processing is aborted.
    2. +
    3. Initialize index to the value associated with the + @index member, which MUST a string expanding to an absolute IRI. + Otherwise, an + invalid term definition + has been detected and processing is aborted.
    4. +
    5. Set the index mapping of definition to index
    6. +
    +
  • If value contains the member @context:
    1. If processing mode is json-ld-1.0, an @@ -1972,8 +1987,10 @@

      Algorithm

      value is a dictionary then value is expanded from an map as follows:
        -
      1. Initialize expanded value to an empty - array.
      2. +
      3. Initialize expanded value to an empty array.
      4. +
      5. Initialize index key to + the key's index mapping in active context, + or @index, if it does not exist.
      6. For each key-value pair index-index value in value, ordered lexicographically by index if ordered is true: @@ -2003,36 +2020,41 @@

        Algorithm

        and ordered flags.
      7. For each item in index value:
          -
        1. If container mapping includes - @graph and if item is not a - graph object, set item to a new - dictionary containing the key-value pair - @graph-item, ensuring that the - value is represented using an array.
        2. -
        3. If container mapping includes @index - and item does not have the member - @index and expanded index is not @none, - add the key-value pair - (@index-index) to item.
        4. +
        5. If container mapping includes @graph + and if item is not a graph object, + set item to a new dictionary containing the key-value pair + @graph-item, + ensuring that the value is represented using an array.
        6. +
        7. If container mapping includes @index, + index key is not @index, + item does not have a member @index + and expanded index is not @none, + set index property values to the concatenation of + expanded index with any existing values of + index key in item. + Add the key-value pair (expanded index-index property values) to item. + If expanded value is a value object, + it MUST NOT contain any extra properties; + an invalid value object + error has been detected and processing is aborted.
        8. +
        9. Otherwise, if container mapping includes @index, + item does not have a member @index, + and expanded index is not @none, + add the key-value pair (@index-index) to item.
        10. Otherwise, if container mapping includes @id - and item does not have the member - @id, add the key-value pair - (@id-expanded index) to - item, where expanded index is set to the result of - using the + and item does not have the member @id, + add the key-value pair (@id-expanded index) to item, + where expanded index is set to the result of using the IRI Expansion algorithm, passing active context, index, and true for document relative, unless expanded index is already set to @none.
        11. Otherwise, if container mapping includes @type - set types to the concatenation of - expanded index with any existing values of - @type in item. + set types to the concatenation of expanded index + with any existing values of @type in item. If expanded index is @none, do not concatenate expanded index to types. - Add the key-value pair - (@type-types) to - item.
        12. + Add the key-value pair (@type-types) to item.
        13. Append item to expanded value.
      8. @@ -2792,17 +2814,31 @@

        Algorithm

        either @language, @index, @id, or @type based on the contents of container, as var, and true for vocab. +
      9. Set index key to the value of index mapping in + the term definition associated with item active property in active context, + or @index, if no such value exists.
      10. If container includes @language and expanded item contains a @value member, then set compacted item to the value associated with its @value member. Set map key to the value of @language in expanded item, if any.
      11. -
      12. If container includes @index set map key to the value of @index in expanded item, if any, +
      13. Otherwise, if container includes @index + and index key is @index, + set map key to the value of @index in expanded item, if any, and remove container key from compacted item.
      14. -
      15. If container includes @id, set +
      16. Otherwise, if container includes @index + and index key is not @index, + Set map key to the first value of container key in compacted item, if any. + If there are remaining values in compacted item + for compacted container, set the value of + compacted container in compacted value + to those remaining values. Otherwise, remove that + member from compacted item. +
      17. +
      18. Otherwise, if container includes @id, set map key to the value of container key in compacted item and remove container key from compacted item.
      19. -
      20. If container is @type, +
      21. Otherwise, if container is @type, set map key to the first value of container key in compacted item, if any. If there are remaining values in compacted item for compacted container, set the value of diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index 2a9f4d93..e4aad10e 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1598,6 +1598,60 @@ "input": "compact/p008-in.jsonld", "context": "compact/p008-context.jsonld", "expect": "compact/p008-out.jsonld" + }, { + "@id": "#tpi01", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes property value, instead of property (value)", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi01-in.jsonld", + "context": "compact/pi01-context.jsonld", + "expect": "compact/pi01-out.jsonld" + }, { + "@id": "#tpi02", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes property value, instead of property (multiple values)", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi02-in.jsonld", + "context": "compact/pi02-context.jsonld", + "expect": "compact/pi02-out.jsonld" + }, { + "@id": "#tpi03", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes property value, instead of property (node)", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi03-in.jsonld", + "context": "compact/pi03-context.jsonld", + "expect": "compact/pi03-out.jsonld" + }, { + "@id": "#tpi04", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes property value, instead of property (multiple nodes)", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi04-in.jsonld", + "context": "compact/pi04-context.jsonld", + "expect": "compact/pi04-out.jsonld" + }, { + "@id": "#tpi05", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes using @none if no property value exists", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi05-in.jsonld", + "context": "compact/pi05-context.jsonld", + "expect": "compact/pi05-out.jsonld" + }, { + "@id": "#tpi06", + "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], + "name": "property-valued index indexes using @none if no property value does not compact to string", + "purpose": "Compacting property-valued indexes.", + "option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}, + "input": "compact/pi06-in.jsonld", + "context": "compact/pi06-context.jsonld", + "expect": "compact/pi06-out.jsonld" }, { "@id": "#tr001", "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], diff --git a/tests/compact/pi01-context.jsonld b/tests/compact/pi01-context.jsonld new file mode 100644 index 00000000..f2a62b3e --- /dev/null +++ b/tests/compact/pi01-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + } +} \ No newline at end of file diff --git a/tests/compact/pi01-in.jsonld b/tests/compact/pi01-in.jsonld new file mode 100644 index 00000000..391db54d --- /dev/null +++ b/tests/compact/pi01-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@value": "regular"}]}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@value": "guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@value": "guest"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi01-out.jsonld b/tests/compact/pi01-out.jsonld new file mode 100644 index 00000000..7a92c136 --- /dev/null +++ b/tests/compact/pi01-out.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "regular": {"@id": "person/1"}, + "guest": [{"@id": "person/2"}, {"@id": "person/3"}] + } +} \ No newline at end of file diff --git a/tests/compact/pi02-context.jsonld b/tests/compact/pi02-context.jsonld new file mode 100644 index 00000000..f2a62b3e --- /dev/null +++ b/tests/compact/pi02-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + } +} \ No newline at end of file diff --git a/tests/compact/pi02-in.jsonld b/tests/compact/pi02-in.jsonld new file mode 100644 index 00000000..6068c779 --- /dev/null +++ b/tests/compact/pi02-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@value": "regular"}, {"@value": "foo"}]}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@value": "guest"}, {"@value": "foo"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@value": "guest"}, {"@value": "foo"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi02-out.jsonld b/tests/compact/pi02-out.jsonld new file mode 100644 index 00000000..850558eb --- /dev/null +++ b/tests/compact/pi02-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "regular": {"@id": "person/1", "prop": "foo"}, + "guest": [ + {"@id": "person/2", "prop": "foo"}, + {"@id": "person/3", "prop": "foo"} + ] + } +} \ No newline at end of file diff --git a/tests/compact/pi03-context.jsonld b/tests/compact/pi03-context.jsonld new file mode 100644 index 00000000..cb0fd5dd --- /dev/null +++ b/tests/compact/pi03-context.jsonld @@ -0,0 +1,9 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@vocab", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@id"} + } +} \ No newline at end of file diff --git a/tests/compact/pi03-in.jsonld b/tests/compact/pi03-in.jsonld new file mode 100644 index 00000000..165092dc --- /dev/null +++ b/tests/compact/pi03-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@id": "http://example.com/regular"}]}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi03-out.jsonld b/tests/compact/pi03-out.jsonld new file mode 100644 index 00000000..2e9e5780 --- /dev/null +++ b/tests/compact/pi03-out.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@vocab", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@id"} + }, + "@id": "article", + "author": { + "regular": {"@id": "person/1"}, + "guest": [ + {"@id": "person/2"}, + {"@id": "person/3"} + ] + } +} \ No newline at end of file diff --git a/tests/compact/pi04-context.jsonld b/tests/compact/pi04-context.jsonld new file mode 100644 index 00000000..cb0fd5dd --- /dev/null +++ b/tests/compact/pi04-context.jsonld @@ -0,0 +1,9 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@vocab", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@id"} + } +} \ No newline at end of file diff --git a/tests/compact/pi04-in.jsonld b/tests/compact/pi04-in.jsonld new file mode 100644 index 00000000..3b4ffdeb --- /dev/null +++ b/tests/compact/pi04-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@id": "http://example.com/regular"}, {"@id": "http://example.com/foo"}]}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}, {"@id": "http://example.com/foo"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}, {"@id": "http://example.com/foo"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi04-out.jsonld b/tests/compact/pi04-out.jsonld new file mode 100644 index 00000000..11dd58c2 --- /dev/null +++ b/tests/compact/pi04-out.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@vocab", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@id"} + }, + "@id": "article", + "author": { + "regular": {"@id": "person/1", "prop": "foo"}, + "guest": [ + {"@id": "person/2", "prop": "foo"}, + {"@id": "person/3", "prop": "foo"} + ] + } +} \ No newline at end of file diff --git a/tests/compact/pi05-context.jsonld b/tests/compact/pi05-context.jsonld new file mode 100644 index 00000000..f2a62b3e --- /dev/null +++ b/tests/compact/pi05-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + } +} \ No newline at end of file diff --git a/tests/compact/pi05-in.jsonld b/tests/compact/pi05-in.jsonld new file mode 100644 index 00000000..4f8d91d2 --- /dev/null +++ b/tests/compact/pi05-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1"}, + {"@id": "http://example.com/person/2"}, + {"@id": "http://example.com/person/3"} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi05-out.jsonld b/tests/compact/pi05-out.jsonld new file mode 100644 index 00000000..c0d89078 --- /dev/null +++ b/tests/compact/pi05-out.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "@none": ["person/1", "person/2", "person/3"] + } +} \ No newline at end of file diff --git a/tests/compact/pi06-context.jsonld b/tests/compact/pi06-context.jsonld new file mode 100644 index 00000000..f2a62b3e --- /dev/null +++ b/tests/compact/pi06-context.jsonld @@ -0,0 +1,8 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + } +} \ No newline at end of file diff --git a/tests/compact/pi06-in.jsonld b/tests/compact/pi06-in.jsonld new file mode 100644 index 00000000..165092dc --- /dev/null +++ b/tests/compact/pi06-in.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@id": "http://example.com/regular"}]}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}]} + ] +}] \ No newline at end of file diff --git a/tests/compact/pi06-out.jsonld b/tests/compact/pi06-out.jsonld new file mode 100644 index 00000000..146f10fe --- /dev/null +++ b/tests/compact/pi06-out.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "@none": [ + {"@id": "person/1", "prop": {"@id": "regular"}}, + {"@id": "person/2", "prop": {"@id": "guest"}}, + {"@id": "person/3", "prop": {"@id": "guest"}} + ] + } +} \ No newline at end of file diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 6a892f59..2ab66bfa 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -1785,6 +1785,94 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/p004-in.jsonld", "expect": "expand/p004-out.jsonld" + }, { + "@id": "#tpi01", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "error if @version is not json-ld-1.1 for property-valued index", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi01-in.jsonld", + "expect": "invalid term definition" + }, { + "@id": "#tpi02", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "error if @container does not include @index for property-valued index", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi02-in.jsonld", + "expect": "invalid term definition" + }, { + "@id": "#tpi03", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "error if @index is a keyword for property-valued index", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi03-in.jsonld", + "expect": "invalid term definition" + }, { + "@id": "#tpi04", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "error if @index is not a string for property-valued index", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi04-in.jsonld", + "expect": "invalid term definition" + }, { + "@id": "#tpi05", + "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], + "name": "error if attempting to add property to value object for property-valued index", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi05-in.jsonld", + "expect": "invalid value object" + }, { + "@id": "#tpi06", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index expands to property value, instead of @index (value)", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi06-in.jsonld", + "expect": "expand/pi06-out.jsonld" + }, { + "@id": "#tpi07", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index appends to property value, instead of @index (value)", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi07-in.jsonld", + "expect": "expand/pi07-out.jsonld" + }, { + "@id": "#tpi08", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index expands to property value, instead of @index (node)", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi08-in.jsonld", + "expect": "expand/pi08-out.jsonld" + }, { + "@id": "#tpi09", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index appends to property value, instead of @index (node)", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi09-in.jsonld", + "expect": "expand/pi09-out.jsonld" + }, { + "@id": "#tpi10", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index does not output property for @none", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi10-in.jsonld", + "expect": "expand/pi10-out.jsonld" + }, { + "@id": "#tpi11", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "property-valued index adds property to graph object", + "purpose": "Expanding index maps where index is a property.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pi11-in.jsonld", + "expect": "expand/pi11-out.jsonld" }, { "@id": "#tl001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pi01-in.jsonld b/tests/expand/pi01-in.jsonld new file mode 100644 index 00000000..50e86117 --- /dev/null +++ b/tests/expand/pi01-in.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://example.com/", + "container": {"@container": "@index", "@index": "prop"} + }, + "@id": "http://example.com/annotationsTest", + "container": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/pi02-in.jsonld b/tests/expand/pi02-in.jsonld new file mode 100644 index 00000000..45f7b965 --- /dev/null +++ b/tests/expand/pi02-in.jsonld @@ -0,0 +1,12 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "container": {"@index": "prop"} + }, + "@id": "http://example.com/annotationsTest", + "container": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/pi03-in.jsonld b/tests/expand/pi03-in.jsonld new file mode 100644 index 00000000..d0803e11 --- /dev/null +++ b/tests/expand/pi03-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "container": { + "@id": "http://example.com/container", + "@container": "@index", + "@index": "@index" + } + }, + "@id": "http://example.com/annotationsTest", + "container": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/pi04-in.jsonld b/tests/expand/pi04-in.jsonld new file mode 100644 index 00000000..e30adb37 --- /dev/null +++ b/tests/expand/pi04-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "container": { + "@id": "http://example.com/container", + "@container": "@index", + "@index": true + } + }, + "@id": "http://example.com/annotationsTest", + "container": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/pi05-in.jsonld b/tests/expand/pi05-in.jsonld new file mode 100644 index 00000000..e9325a44 --- /dev/null +++ b/tests/expand/pi05-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.com/", + "container": { + "@id": "http://example.com/container", + "@container": "@index", + "@index": "prop" + } + }, + "@id": "http://example.com/annotationsTest", + "container": { + "en": "The Queen", + "de": [ "Die Königin", "Ihre Majestät" ] + } +} \ No newline at end of file diff --git a/tests/expand/pi06-in.jsonld b/tests/expand/pi06-in.jsonld new file mode 100644 index 00000000..c57f9382 --- /dev/null +++ b/tests/expand/pi06-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "regular": "person/1", + "guest": ["person/2", "person/3"] + } +} \ No newline at end of file diff --git a/tests/expand/pi06-out.jsonld b/tests/expand/pi06-out.jsonld new file mode 100644 index 00000000..7bd1df81 --- /dev/null +++ b/tests/expand/pi06-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@value": "guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@value": "guest"}]}, + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@value": "regular"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/pi07-in.jsonld b/tests/expand/pi07-in.jsonld new file mode 100644 index 00000000..e05de77c --- /dev/null +++ b/tests/expand/pi07-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"} + }, + "@id": "article", + "author": { + "regular": {"@id": "person/1", "http://example.com/prop": "foo"}, + "guest": [ + {"@id": "person/2", "prop": "foo"}, + {"@id": "person/3", "prop": "foo"} + ] + } +} \ No newline at end of file diff --git a/tests/expand/pi07-out.jsonld b/tests/expand/pi07-out.jsonld new file mode 100644 index 00000000..b8fb6b17 --- /dev/null +++ b/tests/expand/pi07-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@value": "guest"}, {"@value": "foo"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@value": "guest"}, {"@value": "foo"}]}, + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@value": "regular"}, {"@value": "foo"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/pi08-in.jsonld b/tests/expand/pi08-in.jsonld new file mode 100644 index 00000000..17b42ddd --- /dev/null +++ b/tests/expand/pi08-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@vocab"} + }, + "@id": "http://example.com/article", + "author": { + "regular": "person/1", + "guest": ["person/2", "person/3"] + } +} \ No newline at end of file diff --git a/tests/expand/pi08-out.jsonld b/tests/expand/pi08-out.jsonld new file mode 100644 index 00000000..ed4bb030 --- /dev/null +++ b/tests/expand/pi08-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}]}, + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@id": "http://example.com/regular"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/pi09-in.jsonld b/tests/expand/pi09-in.jsonld new file mode 100644 index 00000000..5811c345 --- /dev/null +++ b/tests/expand/pi09-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@vocab"} + }, + "@id": "http://example.com/article", + "author": { + "regular": {"@id": "person/1", "prop": "foo"}, + "guest": [ + {"@id": "person/2", "prop": "foo"}, + {"@id": "person/3", "prop": "foo"} + ] + } +} \ No newline at end of file diff --git a/tests/expand/pi09-out.jsonld b/tests/expand/pi09-out.jsonld new file mode 100644 index 00000000..a4556ede --- /dev/null +++ b/tests/expand/pi09-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}, {"@id": "http://example.com/foo"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}, {"@id": "http://example.com/foo"}]}, + {"@id": "http://example.com/person/1", "http://example.com/prop": [{"@id": "http://example.com/regular"}, {"@id": "http://example.com/foo"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/pi10-in.jsonld b/tests/expand/pi10-in.jsonld new file mode 100644 index 00000000..a62aba22 --- /dev/null +++ b/tests/expand/pi10-in.jsonld @@ -0,0 +1,17 @@ +{ + "@context": { + "@version": 1.1, + "@base": "http://example.com/", + "@vocab": "http://example.com/", + "author": {"@type": "@id", "@container": "@index", "@index": "prop"}, + "prop": {"@type": "@vocab"} + }, + "@id": "http://example.com/article", + "author": { + "@none": {"@id": "person/1"}, + "guest": [ + {"@id": "person/2"}, + {"@id": "person/3"} + ] + } +} \ No newline at end of file diff --git a/tests/expand/pi10-out.jsonld b/tests/expand/pi10-out.jsonld new file mode 100644 index 00000000..22faa368 --- /dev/null +++ b/tests/expand/pi10-out.jsonld @@ -0,0 +1,8 @@ +[{ + "@id": "http://example.com/article", + "http://example.com/author": [ + {"@id": "http://example.com/person/1"}, + {"@id": "http://example.com/person/2", "http://example.com/prop": [{"@id": "http://example.com/guest"}]}, + {"@id": "http://example.com/person/3", "http://example.com/prop": [{"@id": "http://example.com/guest"}]} + ] +}] \ No newline at end of file diff --git a/tests/expand/pi11-in.jsonld b/tests/expand/pi11-in.jsonld new file mode 100644 index 00000000..e3dd902a --- /dev/null +++ b/tests/expand/pi11-in.jsonld @@ -0,0 +1,10 @@ +{ + "@context": { + "@version": 1.1, + "@vocab": "http://example.org/", + "input": {"@container": ["@graph", "@index"], "@index": "prop"} + }, + "input": { + "g1": {"value": "x"} + } +} \ No newline at end of file diff --git a/tests/expand/pi11-out.jsonld b/tests/expand/pi11-out.jsonld new file mode 100644 index 00000000..c67c64bd --- /dev/null +++ b/tests/expand/pi11-out.jsonld @@ -0,0 +1,8 @@ +[{ + "http://example.org/input": [{ + "http://example.org/prop": [{"@value": "g1"}], + "@graph": [{ + "http://example.org/value": [{"@value": "x"}] + }] + }] +}] \ No newline at end of file