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

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


   * @param arguments  specification of the transformation
   * @throws IOException  If an IO error occurs.
   */
  public SchemaGen(SchemaGenArguments arguments)
      throws IOException, URISyntaxException {
    Parser parser = Parser.getInstance();
    InputStream serializedGraph = arguments.getSchemaUrl().openStream();
    schemaGraph = parser.parse(serializedGraph,
        arguments.getFormatIdentifier());
    className = arguments.getClassName();

    if (arguments.getNamespace() == null) {
      namespace = getOntologyUri();
View Full Code Here


      tcManager.getMGraph(graphName);
    } catch (NoSuchEntityException nsee) {
      tc = tcManager.createMGraph(graphName);
      InputStream fin = null;
      fin = getClass().getResourceAsStream("data.turtle");
      Parser parser = Parser.getInstance();
      tc.addAll(parser.parse(fin, "text/turtle"));
    }
  }
View Full Code Here

    final URLConnection con = url.openConnection();
    con.addRequestProperty("Accept", "application/rdf+xml");
    final InputStream inputStream = con.getInputStream();

    //get the singleton instance of Parser
    final Parser parser = Parser.getInstance();
    Graph deserializedGraph = parser.parse(inputStream, "application/rdf+xml");

    mGraph.addAll(deserializedGraph);
    for (GraphChangedListener graphChangedListener : graphChangedListeners) {
      graphChangedListener.graphChanged();
    }
View Full Code Here

  }

  @Test
  public void foaf() throws IOException {
    TripleCollection mGraph = new SimpleMGraph();
    final Parser parser = Parser.getInstance();

    try {
      Graph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
      mGraph.addAll(deserializedGraph);
      UriRef document = new UriRef("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");

      Assert.assertTrue((mGraph.size() > 0));
View Full Code Here

  }

  @Test
  public void foafSorted() throws IOException {
    TripleCollection mGraph = new SimpleMGraph();
    final Parser parser = Parser.getInstance();

    try {
      Graph deserializedGraph = parser.parse(getClass().getResourceAsStream("libby-foaf.rdf"), "application/rdf+xml");
      mGraph.addAll(deserializedGraph);
      UriRef document = new UriRef("http://swordfish.rdfweb.org/people/libby/rdfweb/webwho.xrdf");

      Assert.assertTrue((mGraph.size() > 0));
View Full Code Here

  @Test
  public void RDFTestCases() {
    StableSerializerProvider ssp = new StableSerializerProvider();

    Parser parser = Parser.getInstance();
    Graph deserializedGraphOld = parser.parse(
        getClass().getResourceAsStream(inputFileName), format);

    TripleCollection tc = new SimpleMGraph();
    tc.addAll(deserializedGraphOld);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ssp.serialize(baos, tc, "text/rdf+nt");

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());

    Graph deserializedGraphNew = parser.parse(bais, "text/rdf+nt");

    Assert.assertEquals(deserializedGraphOld, deserializedGraphNew);

  }
View Full Code Here

  @Test
  public void RDFTestCases() {
    NTriplesSerializer nts = new NTriplesSerializer();

    Parser parser = Parser.getInstance();
    Graph deserializedGraphOld = parser.parse(
        getClass().getResourceAsStream(inputFileName), format);

    TripleCollection tc = new SimpleMGraph();
    tc.addAll(deserializedGraphOld);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    nts.serialize(baos, tc);

    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());

    Graph deserializedGraphNew = parser.parse(bais, "text/rdf+nt");

    Assert.assertEquals(deserializedGraphNew, deserializedGraphOld);
  }
View Full Code Here

public class DocumentationStabilityTest {
 
  @Test
  public void RDFTestCases() throws Exception {
   
    Parser parser = Parser.getInstance();
    Graph tc1 = parser.parse(
        getClass().getResourceAsStream("documentation-example.nt"), SupportedFormat.N_TRIPLE);
    final Set<String> lines1 = serializeToLines(tc1);
    TripleCollection tc2 = new SimpleMGraph();
    tc2.addAll(tc1);
    //add <bundle:///intro> <http://clerezza.org/2009/08/documentation#after> <bundle://org.apache.clerezza.platform.documentation/intro> .
View Full Code Here

     */
    public static void reset() {
        // 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());
View Full Code Here

            protected org.apache.clerezza.rdf.core.serializedform.Serializer getSerializer() {
                return serializer;
            };
        };

        final Parser parser = new Parser();
        parser.bindParsingProvider(new JenaParserProvider());
        ciReader = new ContentItemReader(null){
            @Override
            protected Parser getParser() {
                return parser;
            }
View Full Code Here

TOP

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

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.