src/test/java/org/apache/clerezza/rdf/jena/serializer/TestJenaSerializerProvider.java
@Test
    public void testTurtleSerializer() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();

        ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
        provider.serialize(serializedGraph, mGraph.getImmutableGraph(),
                "text/turtle");
        InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());

        ImmutableGraph deserializedGraph = parse(in, "TURTLE");
        // due to http://issues.trialox.org/jira/browse/RDF-6 we cannot just
        // check
        // that the two graphs are equals
        Assertions.assertEquals(deserializedGraph.size(), mGraph.getImmutableGraph().size());
        Assertions.assertEquals(deserializedGraph.hashCode(), mGraph.getImmutableGraph()
                .hashCode());
        // isomorphism delegated to jena
        JenaGraph jenaGraphFromNTriples = new JenaGraph(deserializedGraph);
        JenaGraph jenaGraphFromTurtle = new JenaGraph(mGraph.getImmutableGraph());
        Assertions.assertTrue(jenaGraphFromNTriples
                .isIsomorphicWith(jenaGraphFromTurtle));
    }
/*
     * Serialize ImmutableGraph to turtle format and deserialize.
     */
Serialize ImmutableGraph to turtle format and deserialize.
Serialize ImmutableGraph to turtle format and deserialize .
@Test
    public void testTurtleSerializer() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();
        ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
        provider.serialize(serializedGraph, mGraph.getImmutableGraph(),
                "text/turtle");
        InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());
        ImmutableGraph deserializedGraph = parse(in, "TURTLE");
        Assertions.assertEquals(deserializedGraph.size(), mGraph.getImmutableGraph().size());
        Assertions.assertEquals(deserializedGraph.hashCode(), mGraph.getImmutableGraph()
                .hashCode());
        JenaGraph jenaGraphFromNTriples = new JenaGraph(deserializedGraph);
        JenaGraph jenaGraphFromTurtle = new JenaGraph(mGraph.getImmutableGraph());
        Assertions.assertTrue(jenaGraphFromNTriples
                .isIsomorphicWith(jenaGraphFromTurtle));
    }
@ Test public void testTurtleSerializer ( ) { initializeGraph ( ) ; SerializingProvider provider = new JenaSerializerProvider ( ) ; ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream ( ) ; provider . serialize ( serializedGraph , mGraph . getImmutableGraph ( ) , "text/turtle" ) ; InputStream in = new ByteArrayInputStream ( serializedGraph . toByteArray ( ) ) ; ImmutableGraph deserializedGraph = parse ( in , "TURTLE" ) ; Assertions . assertEquals ( deserializedGraph . size ( ) , mGraph . getImmutableGraph ( ) . size ( ) ) ; Assertions . assertEquals ( deserializedGraph . hashCode ( ) , mGraph . getImmutableGraph ( ) . hashCode ( ) ) ; JenaGraph jenaGraphFromNTriples = new JenaGraph ( deserializedGraph ) ; JenaGraph jenaGraphFromTurtle = new JenaGraph ( mGraph . getImmutableGraph ( ) ) ; Assertions . assertTrue ( jenaGraphFromNTriples . isIsomorphicWith ( jenaGraphFromTurtle ) ) ; }
Serialize ImmutableGraph to turtle format and deserialize.
Serialize ImmutableGraph to turtle format and deserialize .
// due to http://issues.trialox.org/jira/browse/RDF-6 we cannot just // check // that the two graphs are equals // isomorphism delegated to jena