Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
Jena 2.13.0
Description
Discovered a bug in writing Turtle with the latest release, haven't checked whether it applies to past versions of ARQ.
Simple test case using test data from the DAWG tests:
@Test public void bnode_cycles() { Model m = RDFDataMgr.loadModel("testing/DAWG-Final/construct/data-ident.ttl"); Assert.assertTrue(m.size() > 0); ByteArrayOutputStream output = new ByteArrayOutputStream(); RDFDataMgr.write(output, m, Lang.TURTLE); ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray()); System.out.println(new String(output.toByteArray(), Charset.forName("utf-8"))); Model m2 = ModelFactory.createDefaultModel(); RDFDataMgr.read(m2, input, Lang.TURTLE); Assert.assertTrue(m2.size() > 0); Assert.assertTrue(m.isIsomorphicWith(m2)); }
Debugging this I can see that the problem appears to lie in TurtleShell which refuses to write any triples because each subject appears as the object of some other triple. This creates a cycle resulting in no data being output.
TurtleShell needs to detect and arbitrarily break the cycles such that it can output the data successfully.
I'll commit this as a disabled test case in TestLangTurtle to make it easy to start debugging.