[
https://issues.apache.org/jira/browse/JENA-908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14389311#comment-14389311
]
Andy Seaborne commented on JENA-908:
------------------------------------
Commit 4717ce78a is a partial fix.
> Turtle output can be empty when graph contains cyclic blank node references
> ---------------------------------------------------------------------------
>
> Key: JENA-908
> URL: https://issues.apache.org/jira/browse/JENA-908
> Project: Apache Jena
> Issue Type: Bug
> Components: RIOT
> Affects Versions: Jena 2.13.0
> Reporter: Rob Vesse
> Assignee: Andy Seaborne
> Priority: Critical
> Labels: BNodes, BlankNodes, Turtle
>
> 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:
> {noformat}
> @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));
> }
> {noformat}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)