use of org.apache.jena.graph.Graph in project jena by apache.
the class TestIsoMatcher method testGraph$.
private void testGraph$(String s1, String s2, boolean iso) {
s1 = "(graph " + s1 + ")";
s2 = "(graph " + s2 + ")";
Graph g1 = SSE.parseGraph(s1);
Graph g2 = SSE.parseGraph(s2);
boolean b = IsoMatcher.isomorphic(g1, g2);
if (b != iso) {
System.out.println("====");
SSE.write(g1);
System.out.println("----");
SSE.write(g2);
System.out.println("Expected: " + iso + " ; got: " + b);
}
assertEquals(iso, b);
// Check with the other code.
assertEquals(b, g1.isIsomorphicWith(g2));
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class AbstractTestGraph2 method graph_01.
@Test
public void graph_01() {
Graph g = emptyGraph();
assertEquals(0, g.size());
returnGraph(g);
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class AbstractTestGraph2 method graph_add_02.
@Test
public void graph_add_02() {
Graph g = emptyGraph();
Triple t = triple(s1, p1, o1);
g.add(t);
g.add(t);
assertEquals(1, g.size());
assertTrue(g.contains(t));
assertTrue(g.contains(s1, p1, o1));
returnGraph(g);
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class AbstractTestGraph2 method remove_03.
@Test
public void remove_03() {
Graph g = emptyGraph();
Triple t1 = triple(s1, p1, o1);
g.add(t1);
g.remove(s1, any, any);
assertEquals(0, g.size());
returnGraph(g);
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class AbstractTestGraph2 method graph_add_04.
@Test
public void graph_add_04() {
Graph g = emptyGraph();
// Literals
Triple t1 = triple(s1, p1, lit1);
Triple t2 = triple(s1, p1, lit2);
g.add(t1);
g.add(t2);
assertEquals(2, g.size());
assertTrue(g.contains(t1));
assertTrue(g.contains(t2));
assertTrue(g.contains(s1, p1, lit1));
assertTrue(g.contains(s1, p1, lit2));
Node o = NodeFactoryExtra.parseNode("<ex:lex>");
assertFalse(g.contains(s1, p1, o));
returnGraph(g);
}
Aggregations