From 1c4dc63578d538e30023c872793ec20a71dd603c Mon Sep 17 00:00:00 2001 From: Lukas Plank Date: Tue, 13 Aug 2024 16:40:51 +0200 Subject: [PATCH] test: Add/modify tests for XSD-typed JSON-LD serialization Modify test "t#0018" in JSON-LD test-suite: Add XSD types to the expected JSON-LD output. Add test "t#0020" in JSON-LD test-suite: Add another test with mixed explicit typing in the input source. --- .../test-suite/tests/fromRdf-0018-out.jsonld | 35 +++++++++++++------ .../test-suite/tests/fromRdf-0020-in.nq | 5 +++ .../test-suite/tests/fromRdf-0020-out.jsonld | 25 +++++++++++++ .../test-suite/tests/fromRdf-manifest.jsonld | 10 ++++++ 4 files changed, 65 insertions(+), 10 deletions(-) create mode 100644 test/jsonld/test-suite/tests/fromRdf-0020-in.nq create mode 100644 test/jsonld/test-suite/tests/fromRdf-0020-out.jsonld diff --git a/test/jsonld/test-suite/tests/fromRdf-0018-out.jsonld b/test/jsonld/test-suite/tests/fromRdf-0018-out.jsonld index 3412f7a6e..ddc564539 100644 --- a/test/jsonld/test-suite/tests/fromRdf-0018-out.jsonld +++ b/test/jsonld/test-suite/tests/fromRdf-0018-out.jsonld @@ -1,12 +1,27 @@ [ - { - "@id": "http://example.com/Subj1", - "http://example.com/prop": [ - { "@value": true }, - { "@value": false }, - { "@value": 1 }, - { "@value": "1.1", "@type": "http://www.w3.org/2001/XMLSchema#decimal"}, - { "@value": 0.11 } - ] - } + { + "@id": "http://example.com/Subj1", + "http://example.com/prop": [ + { + "@type": "http://www.w3.org/2001/XMLSchema#boolean", + "@value": true + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#boolean", + "@value": false + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#integer", + "@value": 1 + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#decimal", + "@value": "1.1" + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#double", + "@value": 0.11 + } + ] + } ] diff --git a/test/jsonld/test-suite/tests/fromRdf-0020-in.nq b/test/jsonld/test-suite/tests/fromRdf-0020-in.nq new file mode 100644 index 000000000..c45293a46 --- /dev/null +++ b/test/jsonld/test-suite/tests/fromRdf-0020-in.nq @@ -0,0 +1,5 @@ + "true"^^ . + "false" . + "1" . + "1.1"^^ . + "1.1E-1"^^ . \ No newline at end of file diff --git a/test/jsonld/test-suite/tests/fromRdf-0020-out.jsonld b/test/jsonld/test-suite/tests/fromRdf-0020-out.jsonld new file mode 100644 index 000000000..352e96c7f --- /dev/null +++ b/test/jsonld/test-suite/tests/fromRdf-0020-out.jsonld @@ -0,0 +1,25 @@ +[ + { + "@id": "http://example.com/Subj1", + "http://example.com/prop": [ + { + "@type": "http://www.w3.org/2001/XMLSchema#boolean", + "@value": true + }, + { + "@value": "false" + }, + { + "@value": "1" + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#decimal", + "@value": "1.1" + }, + { + "@type": "http://www.w3.org/2001/XMLSchema#double", + "@value": 0.11 + } + ] + } +] diff --git a/test/jsonld/test-suite/tests/fromRdf-manifest.jsonld b/test/jsonld/test-suite/tests/fromRdf-manifest.jsonld index 451791ab9..d07577255 100644 --- a/test/jsonld/test-suite/tests/fromRdf-manifest.jsonld +++ b/test/jsonld/test-suite/tests/fromRdf-manifest.jsonld @@ -145,6 +145,16 @@ }, "input": "fromRdf-0019-in.nq", "expect": "fromRdf-0019-out.jsonld" + }, { + "@id": "#t0020", + "@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"], + "name": "Mixed explicit XSD typing", + "purpose": "Explicitly XSD-typed Literals in the input are reflected in the JSON-LD output.", + "option": { + "useNativeTypes": true + }, + "input": "fromRdf-0020-in.nq", + "expect": "fromRdf-0020-out.jsonld" } ] }