@Test public void find2() { TripleTable table = createTripleTableMem() ; add(table, n1, n2, n3) ; add(table, n1, n2, n4) ; contains(table, n1, n2, n3) ; contains(table, n1, n2, n4) ; }
private static void contains(TripleTable table, Node s, Node p, Node o) { Iterator<Triple> iter = table.find(s, p, o) ; assertNotNull(iter) ; assertTrue(iter.hasNext()) ; assertEquals(new Triple(s, p, o), iter.next()) ; assertFalse(iter.hasNext()) ; }
@Test public void createTripleTable1() { TripleTable table = createTripleTableMem() ; notMatch(table, n1, n2, n3) ; }
private static void match(TripleTable table, Node s, Node p, Node o) { Iterator<Triple> iter = table.find(s, p, o) ; assertNotNull(iter) ; assertTrue(iter.hasNext()) ; }
private static void notMatch(TripleTable table, Node s, Node p, Node o) { Iterator<Triple> iter = table.find(s, p, o) ; assertNotNull(iter) ; assertFalse(iter.hasNext()) ; }
@Test public void add1() { TripleTable table = createTripleTableMem() ; table.add(new Triple(n1,n2,n3)) ; }
@Test public void find1() { TripleTable table = createTripleTableMem() ; add(table, n1, n2, n3) ; contains(table, n1, n2, n3) ; notMatch(table, n1, n2, n4) ; }