Search in sources :

Example 86 with Graph

use of org.apache.jena.graph.Graph in project jena by apache.

the class TestDelta method testAddThenDelete.

public void testAddThenDelete() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    delta.add(triple("a T b"));
    delta.delete(triple("a T b"));
    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 87 with Graph

use of org.apache.jena.graph.Graph in project jena by apache.

the class TestDelta method testRedundantDeleteNoOp.

public void testRedundantDeleteNoOp() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    delta.delete(triple("a T b"));
    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 88 with Graph

use of org.apache.jena.graph.Graph in project jena by apache.

the class TestDelta method testRedundantAddNoOp.

public void testRedundantAddNoOp() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    delta.add(triple("x R y"));
    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 89 with Graph

use of org.apache.jena.graph.Graph in project jena by apache.

the class TestDelta method testAddGoesToAdditions.

public void testAddGoesToAdditions() {
    Graph base = graphWith(DEFAULT_TRIPLES);
    Delta delta = new Delta(base);
    delta.add(triple("x R z"));
    assertIsomorphic(graphWith(DEFAULT_TRIPLES), base);
    assertIsomorphic(graphWith("x R z"), delta.getAdditions());
    assertIsomorphic(graphWith(""), delta.getDeletions());
    assertIsomorphic(graphWith(DEFAULT_TRIPLES + "; x R z"), delta);
}
Also used : AbstractTestGraph(org.apache.jena.graph.test.AbstractTestGraph) Graph(org.apache.jena.graph.Graph) Delta(org.apache.jena.graph.compose.Delta)

Example 90 with Graph

use of org.apache.jena.graph.Graph 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)

Aggregations

Graph (org.apache.jena.graph.Graph)247 Test (org.junit.Test)90 BaseTest (org.apache.jena.atlas.junit.BaseTest)56 Triple (org.apache.jena.graph.Triple)56 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)54 Node (org.apache.jena.graph.Node)46 AbstractTestGraph (org.apache.jena.graph.test.AbstractTestGraph)16 InfGraph (org.apache.jena.reasoner.InfGraph)16 ContractTest (org.xenei.junit.contract.ContractTest)16 Model (org.apache.jena.rdf.model.Model)14 MultiUnion (org.apache.jena.graph.compose.MultiUnion)9 Delta (org.apache.jena.graph.compose.Delta)8 BuilderGraph (org.apache.jena.sparql.sse.builders.BuilderGraph)8 StreamRDF (org.apache.jena.riot.system.StreamRDF)7 PrefixMapping (org.apache.jena.shared.PrefixMapping)7 GraphUnionRead (org.apache.jena.sparql.graph.GraphUnionRead)7 IOException (java.io.IOException)6 Dataset (org.apache.jena.query.Dataset)6 Rule (org.apache.jena.reasoner.rulesys.Rule)6 ConfigTest (org.apache.jena.tdb.ConfigTest)6