Search in sources :

Example 11 with Delta

use of org.apache.jena.graph.compose.Delta in project jena by apache.

the class TestDelta method testDeleteThenAdd.

public void testDeleteThenAdd() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    delta.delete(triple("p S q"));
    delta.add(triple("p S q"));
    assertIsomorphic(graphWith(DEFAULT_TRIPLES), base);
    assertIsomorphic(graphWith(""), delta.getAdditions());
    assertIsomorphic(graphWith(""), delta.getDeletions());
    assertIsomorphic(graphWith(DEFAULT_TRIPLES), delta);
}
Also used : AbstractTestGraph(org.apache.jena.graph.test.AbstractTestGraph) Graph(org.apache.jena.graph.Graph) Delta(org.apache.jena.graph.compose.Delta)

Example 12 with Delta

use of org.apache.jena.graph.compose.Delta in project jena by apache.

the class TestDelta method testTerms1.

public void testTerms1() {
    Triple t1 = triple("s p 1");
    Triple t01 = triple("s p 01");
    Graph base = newGraph();
    base.add(t1);
    Delta delta = new Delta(base);
    delta.add(t01);
    assertTrue(delta.getAdditions().contains(triple("s p 01")));
    assertFalse(delta.getAdditions().contains(triple("s p 1")));
    assertTrue(delta.contains(t1));
    assertTrue(delta.contains(t01));
}
Also used : Triple(org.apache.jena.graph.Triple) AbstractTestGraph(org.apache.jena.graph.test.AbstractTestGraph) Graph(org.apache.jena.graph.Graph) Delta(org.apache.jena.graph.compose.Delta)

Aggregations

Graph (org.apache.jena.graph.Graph)12 Delta (org.apache.jena.graph.compose.Delta)12 AbstractTestGraph (org.apache.jena.graph.test.AbstractTestGraph)12 Triple (org.apache.jena.graph.Triple)4