use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordSPO_1.
@Test
public void TupleIndexRecordSPO_1() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n2, n3);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
assertTrue(iter.hasNext());
iter.next();
assertFalse(iter.hasNext());
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class AbstractTestTupleIndex method TupleIndexRecordSPO_5.
@Test
public void TupleIndexRecordSPO_5() {
TupleIndex index = createIndex("SPO");
add(index, n1, n2, n3);
add(index, n1, n2, n4);
Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n2, n3);
Iterator<Tuple<NodeId>> iter = index.find(tuple2);
Set<Tuple<NodeId>> x = Iter.toSet(iter);
assertEquals(1, x.size());
assertTrue(x.contains(TupleFactory.tuple(n1, n2, n3)));
assertFalse(x.contains(TupleFactory.tuple(n1, n2, n4)));
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class SetupTDB method makeTupleIndex.
public static TupleIndex makeTupleIndex(Location location, String primary, String indexOrder, String indexName, int keyLength) {
FileSet fs = new FileSet(location, indexName);
int readCacheSize = params.getBlockReadCacheSize();
int writeCacheSize = params.getBlockWriteCacheSize();
// Value part is null (zero length)
RangeIndex rIndex = SetupIndex.makeRangeIndex(location, indexName, params.getBlockSize(), keyLength, 0, readCacheSize, writeCacheSize);
TupleIndex tupleIndex = new TupleIndexRecord(primary.length(), new ColumnMap(primary, indexOrder), indexOrder, rIndex.getRecordFactory(), rIndex);
return tupleIndex;
}
Aggregations