[
https://issues.apache.org/jira/browse/JENA-908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14388546#comment-14388546
]
Rob Vesse commented on JENA-908:
--------------------------------
Have added several variants of the test case that test all the Turtle writer
variants.
{{RDFFormat.TURTLE_PRETTY}} is the one with the issue, unfortunately the
default mapping for {{Lang.TURTLE}} is to this variant so writing with either
the format or the language can reproduce the issue.
The failing test cases are currently JUnit {{@Ignore}} until such time as this
issue is fixed
> 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)