Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.Graph


  }

  @Test
  public void getGraphFromAAfterUnbinding() {
    graphAccess.unbindWeightedTcProvider(weightedA);
    Graph graphA = graphAccess.getGraph(uriRefA);
    Iterator<Triple> iterator = graphA.iterator();
    assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1), iterator.next());
    assertFalse(iterator.hasNext());
    TripleCollection triplesA = graphAccess.getTriples(uriRefA);
    iterator = triplesA.iterator();
    assertEquals(new TripleImpl(uriRefA1, uriRefA1, uriRefA1), iterator.next());
View Full Code Here


  @Test
  public void getGraphFromAWithHeavy() {
    final WeightedAHeavy weightedAHeavy = new WeightedAHeavy();
    graphAccess.bindWeightedTcProvider(weightedAHeavy);
    Graph graphA = graphAccess.getGraph(uriRefA);
    Iterator<Triple> iterator = graphA.iterator();
    assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy), iterator.next());
    assertFalse(iterator.hasNext());
    TripleCollection triplesA = graphAccess.getTriples(uriRefA);
    iterator = triplesA.iterator();
    assertEquals(new TripleImpl(uriRefAHeavy, uriRefAHeavy, uriRefAHeavy), iterator.next());
View Full Code Here

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

  @Test
  public void testTurtleParser() {
    ParsingProvider provider = new JenaParserProvider();
    InputStream nTriplesIn = getClass().getResourceAsStream("test-04.nt");
    InputStream turtleIn = getClass().getResourceAsStream("test-04.ttl");
    Graph graphFromNTriples = parse(provider, nTriplesIn, "text/rdf+nt", null);
    Graph graphFromTurtle = parse(provider, turtleIn, "text/turtle", null);
    Assert.assertEquals(graphFromNTriples, graphFromTurtle);
  }
View Full Code Here

  @Test
  public void testRdfXmlParser() {
    ParsingProvider provider = new JenaParserProvider();
    InputStream nTriplesIn = getClass().getResourceAsStream("test-04.nt");
    InputStream rdfIn = getClass().getResourceAsStream("test-04.rdf");
    Graph graphFromNTriples = parse(provider, nTriplesIn, "text/rdf+nt", null);
    Graph graphFromTurtle = parse(provider, rdfIn, "application/rdf+xml", null);
    Assert.assertEquals(graphFromNTriples, graphFromTurtle);
  }
View Full Code Here

  @Test
  public void testTurtleParserWithArgument() {
    ParsingProvider provider = new JenaParserProvider();
    InputStream nTriplesIn = getClass().getResourceAsStream("test-04.nt");
    InputStream turtleIn = getClass().getResourceAsStream("test-04.ttl");
    Graph graphFromNTriples = parse(provider, nTriplesIn, "text/rdf+nt", null);
    Graph graphFromTurtle = parse(provider, turtleIn, "text/turtle;charset=UTF-", null);
    Assert.assertEquals(graphFromNTriples, graphFromTurtle);
  }
View Full Code Here

    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

    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

    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

    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.Graph

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.