use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class TestStats method statsForGraph.
private StatsResults statsForGraph(NodeId gid) {
Iterator<Tuple<NodeId>> iter = quads.find(gid, null, null, null);
StatsCollectorNodeId stats = new StatsCollectorNodeId(nt);
for (; iter.hasNext(); ) {
Tuple<NodeId> t = iter.next();
stats.record(t.get(0), t.get(1), t.get(2), t.get(3));
}
return stats.results();
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class TestStats method stats_02.
@Test
public void stats_02() {
NodeId gid = nt.getNodeIdForNode(NodeFactory.createURI("g1"));
StatsResults r = statsForGraph(gid);
assertEquals(1, r.getCount());
assertEquals(1, r.getPredicates().keySet().size());
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordFindNot_2.
@Test
public void TupleIndexRecordFindNot_2() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n5, n6);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertFalse(iter.hasNext());
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordSPO_3.
@Test
public void TupleIndexRecordSPO_3() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, null, n3);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertTrue(iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
}
use of org.apache.jena.tdb.store.NodeId in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordSPO_7.
@Test
public void TupleIndexRecordSPO_7() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
add(index, n1, n2, n4);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, NodeId.NodeIdAny, NodeId.NodeIdAny);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
Set<Tuple<NodeId>> x = Iter.toSet(iter);
assertEquals(2, x.size());
assertTrue(x.contains(TupleFactory.tuple(n1, n2, n3)));
assertTrue(x.contains(TupleFactory.tuple(n1, n2, n4)));
}
Aggregations