From cb225ffe15ec02a15aad8f18544097f929d94bc5 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Wed, 13 Dec 2023 12:37:37 -0500 Subject: [PATCH] Add graph container array tests. - Add tests for `@graph` `@container` with and without nullified context with an array of plain literals. - Add tests for `@graph` `@id` `@container` with and without nullified context with an array of IRIs. --- tests/expand-manifest.jsonld | 32 ++++++++++++++++++++++++++++++++ tests/expand/0200-in.jsonld | 13 +++++++++++++ tests/expand/0200-out.jsonld | 1 + tests/expand/0201-in.jsonld | 14 ++++++++++++++ tests/expand/0201-out.jsonld | 1 + tests/expand/0202-in.jsonld | 14 ++++++++++++++ tests/expand/0202-out.jsonld | 1 + tests/expand/0203-in.jsonld | 15 +++++++++++++++ tests/expand/0203-out.jsonld | 1 + tests/toRdf-manifest.jsonld | 28 ++++++++++++++++++++++++++++ tests/toRdf/0200-in.jsonld | 13 +++++++++++++ tests/toRdf/0200-out.nq | 0 tests/toRdf/0201-in.jsonld | 14 ++++++++++++++ tests/toRdf/0201-out.nq | 0 tests/toRdf/0202-in.jsonld | 14 ++++++++++++++ tests/toRdf/0202-out.nq | 0 tests/toRdf/0203-in.jsonld | 15 +++++++++++++++ tests/toRdf/0203-out.nq | 0 18 files changed, 176 insertions(+) create mode 100644 tests/expand/0200-in.jsonld create mode 100644 tests/expand/0200-out.jsonld create mode 100644 tests/expand/0201-in.jsonld create mode 100644 tests/expand/0201-out.jsonld create mode 100644 tests/expand/0202-in.jsonld create mode 100644 tests/expand/0202-out.jsonld create mode 100644 tests/expand/0203-in.jsonld create mode 100644 tests/expand/0203-out.jsonld create mode 100644 tests/toRdf/0200-in.jsonld create mode 100644 tests/toRdf/0200-out.nq create mode 100644 tests/toRdf/0201-in.jsonld create mode 100644 tests/toRdf/0201-out.nq create mode 100644 tests/toRdf/0202-in.jsonld create mode 100644 tests/toRdf/0202-out.nq create mode 100644 tests/toRdf/0203-in.jsonld create mode 100644 tests/toRdf/0203-out.nq diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index c18f12bb..1173d960 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -986,6 +986,38 @@ "input": "expand/0131-in.jsonld", "expect": "expand/0131-out.jsonld", "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0200", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand @graph @container with plain literals", + "purpose": "Expanding a @graph @container containing plain literals.", + "input": "expand/0200-in.jsonld", + "expect": "expand/0200-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0201", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand @type:@id @graph @container with IRIs", + "purpose": "Expanding a @type:@id @graph @container containing IRIs.", + "input": "expand/0201-in.jsonld", + "expect": "expand/0201-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0202", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand @graph @container with nullified @context with plain literals", + "purpose": "Expanding a @graph @container with nullified @context containing plain literals.", + "input": "expand/0202-in.jsonld", + "expect": "expand/0202-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} + }, { + "@id": "#t0203", + "@type": [ "jld:PositiveEvaluationTest", "jld:ExpandTest" ], + "name": "Expand @type:@id @graph @container with nullified @context with IRIs", + "purpose": "Expanding a @type:@id @graph @container with nullified @context containing IRIs.", + "input": "expand/0203-in.jsonld", + "expect": "expand/0203-out.jsonld", + "option": {"specVersion": "json-ld-1.1"} }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/0200-in.jsonld b/tests/expand/0200-in.jsonld new file mode 100644 index 00000000..83d61650 --- /dev/null +++ b/tests/expand/0200-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@container": "@graph" + } + }, + "@id": "ex:outer", + "p": [ + "test1", + "test2" + ] +} diff --git a/tests/expand/0200-out.jsonld b/tests/expand/0200-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/0200-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/0201-in.jsonld b/tests/expand/0201-in.jsonld new file mode 100644 index 00000000..503268ee --- /dev/null +++ b/tests/expand/0201-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@type": "@id", + "@container": "@graph" + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/expand/0201-out.jsonld b/tests/expand/0201-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/0201-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/0202-in.jsonld b/tests/expand/0202-in.jsonld new file mode 100644 index 00000000..e3f8b34b --- /dev/null +++ b/tests/expand/0202-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@container": "@graph", + "@context": null + } + }, + "@id": "ex:outer", + "p": [ + "test1", + "test2" + ] +} diff --git a/tests/expand/0202-out.jsonld b/tests/expand/0202-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/0202-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/expand/0203-in.jsonld b/tests/expand/0203-in.jsonld new file mode 100644 index 00000000..b632d858 --- /dev/null +++ b/tests/expand/0203-in.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@type": "@id", + "@container": "@graph", + "@context": null + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/expand/0203-out.jsonld b/tests/expand/0203-out.jsonld new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/tests/expand/0203-out.jsonld @@ -0,0 +1 @@ +[] diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index b5448d5f..fa0de9d5 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -403,6 +403,34 @@ "purpose": "Expanding a reverse term using @container: @index and @index set to a property (from expand#t0131)", "input": "toRdf/0133-in.jsonld", "expect": "toRdf/0133-out.nq" + }, { + "@id": "#t0200", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand @graph @container with plain literals", + "purpose": "Expanding a @graph @container containing plain literals.", + "input": "toRdf/0200-in.jsonld", + "expect": "toRdf/0200-out.nq" + }, { + "@id": "#t0201", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand @type:@id @graph @container with IRIs", + "purpose": "Expanding a @type:@id @graph @container containing IRIs.", + "input": "toRdf/0201-in.jsonld", + "expect": "toRdf/0201-out.nq" + }, { + "@id": "#t0202", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand @graph @container with nullified @context with plain literals", + "purpose": "Expanding a @graph @container with nullified @context containing plain literals.", + "input": "toRdf/0202-in.jsonld", + "expect": "toRdf/0202-out.nq" + }, { + "@id": "#t0203", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Expand @type:@id @graph @container with nullified @context with IRIs", + "purpose": "Expanding a @type:@id @graph @container with nullified @context containing IRIs.", + "input": "toRdf/0203-in.jsonld", + "expect": "toRdf/0203-out.nq" }, { "@id": "#tc001", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/0200-in.jsonld b/tests/toRdf/0200-in.jsonld new file mode 100644 index 00000000..0d382a1c --- /dev/null +++ b/tests/toRdf/0200-in.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@container": "@graph" + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/toRdf/0200-out.nq b/tests/toRdf/0200-out.nq new file mode 100644 index 00000000..e69de29b diff --git a/tests/toRdf/0201-in.jsonld b/tests/toRdf/0201-in.jsonld new file mode 100644 index 00000000..503268ee --- /dev/null +++ b/tests/toRdf/0201-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@type": "@id", + "@container": "@graph" + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/toRdf/0201-out.nq b/tests/toRdf/0201-out.nq new file mode 100644 index 00000000..e69de29b diff --git a/tests/toRdf/0202-in.jsonld b/tests/toRdf/0202-in.jsonld new file mode 100644 index 00000000..705d374e --- /dev/null +++ b/tests/toRdf/0202-in.jsonld @@ -0,0 +1,14 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@container": "@graph", + "@context": null + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/toRdf/0202-out.nq b/tests/toRdf/0202-out.nq new file mode 100644 index 00000000..e69de29b diff --git a/tests/toRdf/0203-in.jsonld b/tests/toRdf/0203-in.jsonld new file mode 100644 index 00000000..b632d858 --- /dev/null +++ b/tests/toRdf/0203-in.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "p": { + "@id": "ex:p", + "@type": "@id", + "@container": "@graph", + "@context": null + } + }, + "@id": "ex:outer", + "p": [ + "ex:test1", + "ex:test2" + ] +} diff --git a/tests/toRdf/0203-out.nq b/tests/toRdf/0203-out.nq new file mode 100644 index 00000000..e69de29b