From 38b1d79cfe4a0d5029a6281afe67dc25faf11a44 Mon Sep 17 00:00:00 2001 From: Pierre Maillot Date: Wed, 28 Aug 2024 17:18:02 +0200 Subject: [PATCH] Convertion test added for known turtle difficulties --- .../corese/command/programs/ConvertTest.java | 16 +++++++++++++ .../input/knownDifficultiesInTurtle.ttl | 9 +++++++ .../ttl.knownDifficultiesInTurtle.jsonld | 24 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 corese-command/src/test/resources/fr/inria/corese/command/programs/convert/input/knownDifficultiesInTurtle.ttl create mode 100644 corese-command/src/test/resources/fr/inria/corese/command/programs/convert/references/ttl.knownDifficultiesInTurtle.jsonld diff --git a/corese-command/src/test/java/fr/inria/corese/command/programs/ConvertTest.java b/corese-command/src/test/java/fr/inria/corese/command/programs/ConvertTest.java index 0ed207552..d80158853 100644 --- a/corese-command/src/test/java/fr/inria/corese/command/programs/ConvertTest.java +++ b/corese-command/src/test/java/fr/inria/corese/command/programs/ConvertTest.java @@ -775,4 +775,20 @@ public void testGraphUtilsLoadWithInvalidFormat() { } } + @Test + public void testConvertDifficultTurtleToJsonld() { + String pathInputBeatlesTTL = Paths.get(inputPath, "knownDifficultiesInTurtle.ttl").toString(); + String pathRefBeatlesJSON = Paths.get(referencesPath, "ttl.knownDifficultiesInTurtle.jsonld").toString(); + String pathOutBeatlesJSON = Paths.get(resultPath, "ttl.knownDifficultiesInTurtle.jsonld").toString(); + + int exitCode = cmd.execute("-i", pathInputBeatlesTTL, "-of", "JSONLD", "-o", pathOutBeatlesJSON); + + assertEquals(0, exitCode); + assertEquals(out.toString(), ""); + assertEquals(err.toString(), ""); + assertEquals(canonicalize(pathRefBeatlesJSON), canonicalize(pathOutBeatlesJSON)); + assertNotEquals("", pathOutBeatlesJSON); + + } + } \ No newline at end of file diff --git a/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/input/knownDifficultiesInTurtle.ttl b/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/input/knownDifficultiesInTurtle.ttl new file mode 100644 index 000000000..4b230b263 --- /dev/null +++ b/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/input/knownDifficultiesInTurtle.ttl @@ -0,0 +1,9 @@ +@prefix dc: . +@prefix orcid: . +@prefix ex: . + +ex:1 ex:property ex:%3CspanStyle . + +ex: dc:contributor orcid:0000-0001-6938-0820 ; + dc:contributor orcid:0000-0002-0643-3144 ; + dc:contributor orcid:0000-0002-5711-4872 . diff --git a/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/references/ttl.knownDifficultiesInTurtle.jsonld b/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/references/ttl.knownDifficultiesInTurtle.jsonld new file mode 100644 index 000000000..7eb2a7180 --- /dev/null +++ b/corese-command/src/test/resources/fr/inria/corese/command/programs/convert/references/ttl.knownDifficultiesInTurtle.jsonld @@ -0,0 +1,24 @@ +[ + { + "@id": "http://example.org", + "http://purl.org/dc/elements/1.1/contributor": [ + { + "@id": "http://orcid.org/0000-0001-6938-0820" + }, + { + "@id": "http://orcid.org/0000-0002-0643-3144" + }, + { + "@id": "http://orcid.org/0000-0002-5711-4872" + } + ] + }, + { + "@id": "http://example.com/1", + "http://example.com/property": [ + { + "@id": "http://example.com/%3CspanStyle" + } + ] + } +] \ No newline at end of file