ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
provider.serialize(serializedGraph, mGraph.getGraph(),
"text/turtle");
InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());
Graph deserializedGraph = parse(in, "TURTLE");
// due to http://issues.trialox.org/jira/browse/RDF-6 we cannot just
// check
// that the two graphs are equals
Assert.assertEquals(deserializedGraph.size(), mGraph.getGraph().size());
Assert.assertEquals(deserializedGraph.hashCode(), mGraph.getGraph()
.hashCode());
// isomorphism delegated to jena
JenaGraph jenaGraphFromNTriples = new JenaGraph(deserializedGraph);
JenaGraph jenaGraphFromTurtle = new JenaGraph(mGraph.getGraph());
Assert.assertTrue(jenaGraphFromNTriples