Search in sources :

Example 1 with DisjointUnion

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

the class TestDisjointUnion method testRightUnion.

public void testRightUnion() {
    Graph g = graphWith("");
    testSingleComponent(g, new DisjointUnion(Graph.emptyGraph, g));
}
Also used : Graph(org.apache.jena.graph.Graph) DisjointUnion(org.apache.jena.graph.compose.DisjointUnion)

Example 2 with DisjointUnion

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

the class TestDisjointUnion method testBothComponents.

public void testBothComponents() {
    Graph L = graphWith(""), R = graphWith("");
    Graph du = new DisjointUnion(L, R);
    assertIsomorphic(Graph.emptyGraph, du);
    L.add(triple("x P y"));
    assertIsomorphic(graphWith("x P y"), du);
    R.add(triple("A rdf:type Route"));
    assertIsomorphic(graphWith("x P y; A rdf:type Route"), du);
}
Also used : Graph(org.apache.jena.graph.Graph) DisjointUnion(org.apache.jena.graph.compose.DisjointUnion)

Example 3 with DisjointUnion

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

the class TestDisjointUnion method testLeftUnion.

public void testLeftUnion() {
    Graph g = graphWith("");
    testSingleComponent(g, new DisjointUnion(g, Graph.emptyGraph));
}
Also used : Graph(org.apache.jena.graph.Graph) DisjointUnion(org.apache.jena.graph.compose.DisjointUnion)

Example 4 with DisjointUnion

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

the class TestDisjointUnion method testAddLeftOnlyIfNecessary.

public void testAddLeftOnlyIfNecessary() {
    Graph L = graphWith(""), R = graphWith("x R y");
    Graph du = new DisjointUnion(L, R);
    graphAdd(du, "x R y");
    assertEquals(true, L.isEmpty());
    graphAdd(du, " a P b");
    assertIsomorphic(graphWith("a P b"), L);
    assertIsomorphic(graphWith("x R y"), R);
}
Also used : Graph(org.apache.jena.graph.Graph) DisjointUnion(org.apache.jena.graph.compose.DisjointUnion)

Example 5 with DisjointUnion

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

the class TestDisjointUnion method testRemoveBoth.

public void testRemoveBoth() {
    Graph L = graphWith("x R y; a P b"), R = graphWith("x R y; p Q r");
    Graph du = new DisjointUnion(L, R);
    du.delete(triple("x R y"));
    assertIsomorphic(graphWith("a P b"), L);
    assertIsomorphic(graphWith("p Q r"), R);
}
Also used : Graph(org.apache.jena.graph.Graph) DisjointUnion(org.apache.jena.graph.compose.DisjointUnion)

Aggregations

DisjointUnion (org.apache.jena.graph.compose.DisjointUnion)6 Graph (org.apache.jena.graph.Graph)5