From 83f52d4ba500d5dfd523e729c69c7ffb70c0b3e4 Mon Sep 17 00:00:00 2001 From: Tom Morris Date: Sat, 27 Jun 2020 17:40:21 -0400 Subject: [PATCH] Fall back to Apache Jena 3.9.0 (from 3.15.0) (#2826) Fixes #2824 Versions up through 3.14.0 appear to work, but since odfdom bundles Jena 3.9.0, we're going to be conservative and match that. As an added bonus, includes a blank node test which will trigger the failure. --- main/pom.xml | 5 ++- .../importers/RdfTripleImporterTests.java | 34 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/main/pom.xml b/main/pom.xml index c2705a24a..e3a730b35 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -19,7 +19,10 @@ 3333 /tmp/refine 2.0.7 - 3.15.0 + + 3.9.0 diff --git a/main/tests/server/src/com/google/refine/importers/RdfTripleImporterTests.java b/main/tests/server/src/com/google/refine/importers/RdfTripleImporterTests.java index 455dcc3ed..5e91decd5 100644 --- a/main/tests/server/src/com/google/refine/importers/RdfTripleImporterTests.java +++ b/main/tests/server/src/com/google/refine/importers/RdfTripleImporterTests.java @@ -286,7 +286,39 @@ public class RdfTripleImporterTests extends ImporterTest { Assert.assertEquals(project.rows.get(0).cells.get(2).value, "mailto:fred@example.com"); Assert.assertEquals(project.rows.get(0).cells.get(3).value, "http://meetings.example.com/cal#m1"); } - + + @Test + public void canParseTurtleBlankNode() throws UnsupportedEncodingException { + String sampleRdf = "@prefix ex: .\n" + + " ex:title \"Web Data\" ;\n" + + " ex:professor [ ex:fullName \"Alice Carol\" ;\n" + + " ex:homePage ] ."; + + InputStream input = new ByteArrayInputStream(sampleRdf.getBytes("UTF-8")); + + SUT = new RdfTripleImporter(RdfTripleImporter.Mode.TTL); + parseOneFile(SUT, input); + + String[] columns = {"subject", + "http://example.org/data#professor", + "http://example.org/data#title", + "http://example.org/data#homePage", + "http://example.org/data#fullName", + }; + + Assert.assertEquals(project.columnModel.columns.size(), columns.length); + for (int i = 0; i < columns.length; i++) { + Assert.assertEquals(project.columnModel.columns.get(i).getName(), columns[i]); + } + + Assert.assertEquals(project.rows.size(), 2); + Assert.assertEquals(project.rows.get(0).cells.size(), 3); + Assert.assertEquals(project.rows.get(1).cells.size(), 5); + Assert.assertEquals(project.rows.get(0).cells.get(0).value, "http://example.org/web-data"); + // Generated blank node ID is random, but should match + Assert.assertEquals(project.rows.get(0).cells.get(1).value, project.rows.get(1).cells.get(0).value); + } + @Test public void canParseJsonld() throws UnsupportedEncodingException { String sampleJsonld = "{\n "+