Search in sources :

Example 6 with Delta

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

the class TestDelta method testAddAndDelete.

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

Example 7 with Delta

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

the class TestDelta method testDeltaMirrorsBase.

public void testDeltaMirrorsBase() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    assertIsomorphic(base, delta);
}
Also used : AbstractTestGraph(org.apache.jena.graph.test.AbstractTestGraph) Graph(org.apache.jena.graph.Graph) Delta(org.apache.jena.graph.compose.Delta)

Example 8 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)

Aggregations

Graph (org.apache.jena.graph.Graph)8 Delta (org.apache.jena.graph.compose.Delta)8 AbstractTestGraph (org.apache.jena.graph.test.AbstractTestGraph)8