Package org.apache.clerezza.rdf.rdfjson.parser

Examples of org.apache.clerezza.rdf.rdfjson.parser.RdfJsonParsingProvider


    ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
    provider.serialize(serializedGraph, mGraph, "application/rdf+json");

//    System.out.println(serializedGraph.toString());

    ParsingProvider parsingProvider = new RdfJsonParsingProvider();
    ByteArrayInputStream jsonIn = new ByteArrayInputStream(serializedGraph.toByteArray());
    MGraph parsedMGraph = new SimpleMGraph();
    parsingProvider.parse(parsedMGraph, jsonIn, "application/rdf+json", null);

    Assert.assertEquals(mGraph.getGraph(), parsedMGraph.getGraph());
  }
View Full Code Here


    SerializingProvider provider = new RdfJsonSerializingProvider();
    ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
    provider.serialize(serializedGraph, mGraph, "application/rdf+json");
//        System.out.println(serializedGraph.toString());
    ParsingProvider parsingProvider = new RdfJsonParsingProvider();
    ByteArrayInputStream jsonIn = new ByteArrayInputStream(serializedGraph.toByteArray());
    MGraph parsedMGraph = new SimpleMGraph();
    parsingProvider.parse(parsedMGraph, jsonIn, "application/rdf+json", null);

    Assert.assertEquals(6, parsedMGraph.size());
    Assert.assertEquals(mGraph.getGraph(), parsedMGraph.getGraph());
  }
View Full Code Here

    SerializingProvider provider = new RdfJsonSerializingProvider();
    ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream();
    long start = System.currentTimeMillis();
    provider.serialize(serializedGraph, mGraph, "application/rdf+json");
    System.out.println("Serialized " + mGraph.size() + " Triples in " + (System.currentTimeMillis() - start) + " ms");
        ParsingProvider parsingProvider = new RdfJsonParsingProvider();
        ByteArrayInputStream jsonIn = new ByteArrayInputStream(serializedGraph.toByteArray());
        MGraph parsedMGraph = new SimpleMGraph();
        parsingProvider.parse(parsedMGraph, jsonIn, "application/rdf+json", null);
        Assert.assertEquals(originalSize, parsedMGraph.size());
        sortedTriples = parsedMGraph.toArray(new Triple[parsedMGraph.size()]);
        Arrays.sort(sortedTriples, RdfJsonSerializingProvider.SUBJECT_COMPARATOR);
        Assert.assertEquals(mGraph.getGraph(), parsedMGraph.getGraph());
  }
View Full Code Here

        // reset Clerezza objects
        tcManager = new TcManager();
        tcManager.addWeightedTcProvider(new SimpleTcProvider());
        parser = new Parser(); // add Jena-supported formats + RDF/JSON
        parser.bindParsingProvider(new JenaParserProvider());
        parser.bindParsingProvider(new RdfJsonParsingProvider());
        serializer = new Serializer(); // add Jena-supported formats + RDF/JSON
        serializer.bindSerializingProvider(new JenaSerializerProvider());
        serializer.bindSerializingProvider(new RdfJsonSerializingProvider());

        // reset Stanbol objects
View Full Code Here

        // reset Clerezza objects
        tcManager = new TcManager();
        tcManager.addWeightedTcProvider(new SimpleTcProvider());
        parser = new Parser(); // add Jena-supported formats + RDF/JSON
        parser.bindParsingProvider(new JenaParserProvider());
        parser.bindParsingProvider(new RdfJsonParsingProvider());
        serializer = new Serializer(); // add Jena-supported formats + RDF/JSON
        serializer.bindSerializingProvider(new JenaSerializerProvider());
        serializer.bindSerializingProvider(new RdfJsonSerializingProvider());

        // reset Stanbol objects
View Full Code Here

    @BeforeClass
    public static void init() throws IOException {
        //init the RDF parser
        rdfParser = new Parser();
        rdfParser.bindParsingProvider(new JenaParserProvider());
        rdfParser.bindParsingProvider(new RdfJsonParsingProvider());
        //init theTestData
    }
View Full Code Here

        serializer.bindSerializingProvider(new JenaSerializerProvider());
        serializer.bindSerializingProvider(new RdfJsonSerializingProvider());
       
        parser = new Parser();
        parser.bindParsingProvider(new JenaParserProvider());
        parser.bindParsingProvider(new RdfJsonParsingProvider());
    }
View Full Code Here

        tcManager = new TcManager();
        tcManager.addWeightedTcProvider(new SimpleTcProvider());

        parser = new Parser();
        parser.bindParsingProvider(new JenaParserProvider());
        parser.bindParsingProvider(new RdfJsonParsingProvider());

        serializer = new Serializer();
        serializer.bindSerializingProvider(new JenaSerializerProvider());
        serializer.bindSerializingProvider(new RdfJsonSerializingProvider());
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.rdfjson.parser.RdfJsonParsingProvider

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.