From 442aa29c0377577b4d7994743c799eabbe20af7b Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Wed, 21 Jun 2023 23:53:42 -0400 Subject: [PATCH] Add similar id protected term redefinition test. - Add test of redefining equivalent id terms in different forms: - `"foo": {"@id": "ex:foo"}` - `"foo": "ex:foo"` --- tests/expand-manifest.jsonld | 8 ++++++++ tests/expand/pr41-in.jsonld | 16 ++++++++++++++++ tests/expand/pr41-out.jsonld | 6 ++++++ tests/toRdf-manifest.jsonld | 8 ++++++++ tests/toRdf/pr41-in.jsonld | 16 ++++++++++++++++ tests/toRdf/pr41-out.nq | 1 + 6 files changed, 55 insertions(+) create mode 100644 tests/expand/pr41-in.jsonld create mode 100644 tests/expand/pr41-out.jsonld create mode 100644 tests/toRdf/pr41-in.jsonld create mode 100644 tests/toRdf/pr41-out.nq diff --git a/tests/expand-manifest.jsonld b/tests/expand-manifest.jsonld index 57bc6b85..1f3f3beb 100644 --- a/tests/expand-manifest.jsonld +++ b/tests/expand-manifest.jsonld @@ -2827,6 +2827,14 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "expand/pr40-in.jsonld", "expect": "expand/pr40-out.jsonld" + }, { + "@id": "#tpr41", + "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"], + "name": "Allows protected redefinition of equivalent id terms", + "purpose": "Check protected redefinition of equivalent id terms in different forms.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "expand/pr41-in.jsonld", + "expect": "expand/pr41-out.jsonld" }, { "@id": "#tso01", "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], diff --git a/tests/expand/pr41-in.jsonld b/tests/expand/pr41-in.jsonld new file mode 100644 index 00000000..2a4b739e --- /dev/null +++ b/tests/expand/pr41-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@protected": true, + "foo": { + "@id": "ex:foo" + } + }, + "@id": "ex:outer", + "foo": { + "@context": { + "@protected": true, + "foo": "ex:foo" + }, + "@id": "ex:inner" + } +} diff --git a/tests/expand/pr41-out.jsonld b/tests/expand/pr41-out.jsonld new file mode 100644 index 00000000..fcc813bc --- /dev/null +++ b/tests/expand/pr41-out.jsonld @@ -0,0 +1,6 @@ +[{ + "@id": "ex:outer", + "ex:foo": [{ + "@id": "ex:inner" + }] +}] diff --git a/tests/toRdf-manifest.jsonld b/tests/toRdf-manifest.jsonld index e13eab49..08ff2f54 100644 --- a/tests/toRdf-manifest.jsonld +++ b/tests/toRdf-manifest.jsonld @@ -3357,6 +3357,14 @@ "option": {"specVersion": "json-ld-1.1"}, "input": "toRdf/pr40-in.jsonld", "expect": "toRdf/pr40-out.nq" + }, { + "@id": "#tpr41", + "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], + "name": "Allows protected redefinition of equivalent id terms", + "purpose": "Check protected redefinition of equivalent id terms in different forms.", + "option": {"specVersion": "json-ld-1.1"}, + "input": "toRdf/pr41-in.jsonld", + "expect": "toRdf/pr41-out.nq" }, { "@id": "#trt01", "@type": ["jld:PositiveEvaluationTest", "jld:ToRDFTest"], diff --git a/tests/toRdf/pr41-in.jsonld b/tests/toRdf/pr41-in.jsonld new file mode 100644 index 00000000..2a4b739e --- /dev/null +++ b/tests/toRdf/pr41-in.jsonld @@ -0,0 +1,16 @@ +{ + "@context": { + "@protected": true, + "foo": { + "@id": "ex:foo" + } + }, + "@id": "ex:outer", + "foo": { + "@context": { + "@protected": true, + "foo": "ex:foo" + }, + "@id": "ex:inner" + } +} diff --git a/tests/toRdf/pr41-out.nq b/tests/toRdf/pr41-out.nq new file mode 100644 index 00000000..17f37759 --- /dev/null +++ b/tests/toRdf/pr41-out.nq @@ -0,0 +1 @@ + .