Package org.apache.clerezza.rdf.core.serializedform

Examples of org.apache.clerezza.rdf.core.serializedform.SerializingProvider


   */
  public static Model clerezzaMGraphToJenaModel(MGraph mGraph){
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
   
    SerializingProvider serializingProvider = new JenaSerializerProvider();
   
    serializingProvider.serialize(out, mGraph, SupportedFormat.RDF_XML);
   
    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
   
    Model jenaModel = ModelFactory.createDefaultModel();
   
View Full Code Here


         * If it works, just add all the triples to a TripleCollection, but no, we don't want to store that
         * change.
         */

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        SerializingProvider serializingProvider = new JenaSerializerProvider();
        serializingProvider.serialize(out, graph, SupportedFormat.RDF_XML);
        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        OWLOntology ontology = null;
        try {
            ontology = ontologyManager.loadOntologyFromOntologyDocument(in);
        } catch (OWLOntologyAlreadyExistsException e) {
View Full Code Here

     * Serialize Graph to turtle format and deserialize.
     */
    @Test
    public void testTurtleSerializer() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();

        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
View Full Code Here

    }

    @Test
    public void testTurtleSerializerWithParam() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();

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

        Graph deserializedGraph = parse(in, "TURTLE");
        Assert.assertEquals(mGraph.getGraph(), deserializedGraph);
View Full Code Here

     */
    @Test
    public void testRdfXmlSerializer() {
        initializeGraph();

        SerializingProvider provider = new JenaSerializerProvider();

        ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
        provider.serialize(serializedGraph, mGraph.getGraph(),
                "application/rdf+xml");
        InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());

        Graph deserializedGraph = parse(in, "RDF/XML-ABBREV");
        Assert.assertEquals(mGraph.getGraph(), deserializedGraph);
View Full Code Here

     * Serialize Graph to rdf+nt format and deserialize.
     */
    @Test
    public void testRdfNtSerializer() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();

        ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
        provider.serialize(serializedGraph, mGraph.getGraph(), "text/rdf+nt");
        InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());

        Graph deserializedGraph = parse(in, "N-TRIPLE");
        Assert.assertEquals(mGraph.getGraph(), deserializedGraph);
    }
View Full Code Here

     * Serialize Graph to rdf+n3 format and deserialize.
     */
    @Test
    public void testRdfN3Serializer() {
        initializeGraph();
        SerializingProvider provider = new JenaSerializerProvider();

        ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
        provider.serialize(serializedGraph, mGraph.getGraph(), "text/rdf+n3");
        InputStream in = new ByteArrayInputStream(serializedGraph.toByteArray());

        Graph deserializedGraph = parse(in, "N3");
        Assert.assertEquals(mGraph.getGraph(), deserializedGraph);
    }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.serializedform.SerializingProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.