From 4eb8e6c6bd23da9d0fd728149700f30ebe56b6a9 Mon Sep 17 00:00:00 2001 From: "David I. Lehn" Date: Mon, 20 May 2019 21:56:36 -0400 Subject: [PATCH 1/2] Add more type-scoped compaction tests. --- tests/compact-manifest.jsonld | 54 +++++++++++++++++++++++++++++++ tests/compact/c014-context.jsonld | 11 +++++++ tests/compact/c014-in.jsonld | 8 +++++ tests/compact/c014-out.jsonld | 15 +++++++++ tests/compact/c015-context.jsonld | 12 +++++++ tests/compact/c015-in.jsonld | 10 ++++++ tests/compact/c015-out.jsonld | 20 ++++++++++++ tests/compact/c016-context.jsonld | 10 ++++++ tests/compact/c016-in.jsonld | 16 +++++++++ tests/compact/c016-out.jsonld | 18 +++++++++++ tests/compact/c017-context.jsonld | 19 +++++++++++ tests/compact/c017-in.jsonld | 14 ++++++++ tests/compact/c017-out.jsonld | 24 ++++++++++++++ tests/compact/c018-context.jsonld | 21 ++++++++++++ tests/compact/c018-in.jsonld | 11 +++++++ tests/compact/c018-out.jsonld | 24 ++++++++++++++ tests/compact/c019-context.jsonld | 20 ++++++++++++ tests/compact/c019-in.jsonld | 26 +++++++++++++++ tests/compact/c019-out.jsonld | 30 +++++++++++++++++ 19 files changed, 363 insertions(+) create mode 100644 tests/compact/c014-context.jsonld create mode 100644 tests/compact/c014-in.jsonld create mode 100644 tests/compact/c014-out.jsonld create mode 100644 tests/compact/c015-context.jsonld create mode 100644 tests/compact/c015-in.jsonld create mode 100644 tests/compact/c015-out.jsonld create mode 100644 tests/compact/c016-context.jsonld create mode 100644 tests/compact/c016-in.jsonld create mode 100644 tests/compact/c016-out.jsonld create mode 100644 tests/compact/c017-context.jsonld create mode 100644 tests/compact/c017-in.jsonld create mode 100644 tests/compact/c017-out.jsonld create mode 100644 tests/compact/c018-context.jsonld create mode 100644 tests/compact/c018-in.jsonld create mode 100644 tests/compact/c018-out.jsonld create mode 100644 tests/compact/c019-context.jsonld create mode 100644 tests/compact/c019-in.jsonld create mode 100644 tests/compact/c019-out.jsonld diff --git a/tests/compact-manifest.jsonld b/tests/compact-manifest.jsonld index cedd7384..c8488652 100644 --- a/tests/compact-manifest.jsonld +++ b/tests/compact-manifest.jsonld @@ -1031,6 +1031,60 @@ "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": "#te001", "@type": [ "jld:NegativeEvaluationTest", "jld:CompactTest" ], 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..4f147686 --- /dev/null +++ b/tests/compact/c015-in.jsonld @@ -0,0 +1,10 @@ +[{ + "@id": "http://example/base-base#base-id", + "http://example/p": [{ + "@id": "http://example/typed-base#typed-id", + "@type": ["http://example/Type"], + "http://example/nested": [{ + "@id": "http://example/base-base#nested-id" + }] + }] +}] diff --git a/tests/compact/c015-out.jsonld b/tests/compact/c015-out.jsonld new file mode 100644 index 00000000..76766dab --- /dev/null +++ b/tests/compact/c015-out.jsonld @@ -0,0 +1,20 @@ +{ + "@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", + "nested": { + "@id": "#nested-id" + } + } +} 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" + } +} From 514b4d67607d3d2c7e57d072c76b396252ed689b Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Tue, 21 May 2019 11:04:22 -0400 Subject: [PATCH 2/2] Differentiate between subject references and nested nodes. --- tests/compact/c015-in.jsonld | 10 ++++++++-- tests/compact/c015-out.jsonld | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/compact/c015-in.jsonld b/tests/compact/c015-in.jsonld index 4f147686..2f3427a5 100644 --- a/tests/compact/c015-in.jsonld +++ b/tests/compact/c015-in.jsonld @@ -3,8 +3,14 @@ "http://example/p": [{ "@id": "http://example/typed-base#typed-id", "@type": ["http://example/Type"], - "http://example/nested": [{ - "@id": "http://example/base-base#nested-id" + "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 index 76766dab..83bb63d5 100644 --- a/tests/compact/c015-out.jsonld +++ b/tests/compact/c015-out.jsonld @@ -13,8 +13,12 @@ "p": { "@id": "#typed-id", "@type": "Type", - "nested": { - "@id": "#nested-id" + "subjectReference": { + "@id": "#subject-reference-id" + }, + "nestedNode": { + "@id": "#nested-id", + "foo": "bar" } } }