Search in sources :

Example 6 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_ins_0_0.

@Test
public void tree_ins_0_0() {
    // Empty tree
    int[] keys = {};
    RangeIndex rIndex = makeRangeIndex(2);
    testInsert(rIndex, keys);
    assertTrue(rIndex.isEmpty());
    assertNull(rIndex.minKey());
    assertNull(rIndex.maxKey());
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Example 7 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_ins_2_01.

@Test
public void tree_ins_2_01() {
    int[] keys = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    RangeIndex rIndex = makeRangeIndex(2);
    testInsert(rIndex, keys);
    assertEquals(0, r(rIndex.minKey()));
    assertEquals(9, r(rIndex.maxKey()));
}
Also used : RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Example 8 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class LoaderOps method idxBTree.

/**
 * Get the BPlusTree index for a {@Link TupleIndex}
 */
public static BPlusTree idxBTree(TupleIndex idx) {
    TupleIndexRecord idxr = (TupleIndexRecord) idx;
    RangeIndex rIndex = idxr.getRangeIndex();
    BPlusTree bpt = (BPlusTree) rIndex;
    return bpt;
}
Also used : TupleIndexRecord(org.apache.jena.tdb2.store.tupletable.TupleIndexRecord) RangeIndex(org.apache.jena.dboe.index.RangeIndex) BPlusTree(org.apache.jena.dboe.trans.bplustree.BPlusTree)

Example 9 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class TestTupleIndexRecord method create.

@Override
protected TupleIndexRecord create(String description) {
    IndexParams indexParams = StoreParams.getDftStoreParams();
    RangeIndex rIdx = BuildTestLib.buildRangeIndex(FileSet.mem(), factory, indexParams);
    TupleMap tmap = TupleMap.create("SPO", description);
    TupleIndexRecord index = new TupleIndexRecord(3, tmap, description, factory, rIdx);
    return index;
}
Also used : IndexParams(org.apache.jena.dboe.index.IndexParams) RangeIndex(org.apache.jena.dboe.index.RangeIndex) TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap)

Example 10 with RangeIndex

use of org.apache.jena.dboe.index.RangeIndex in project jena by apache.

the class AbstractTestRangeIndex method tree_iter_0_01.

// Root
@Test
public void tree_iter_0_01() {
    int[] keys = { 1, 2, 3, 4, 5 };
    RangeIndex rIndex = makeRangeIndex(5);
    add(rIndex, keys);
    Iterator<Record> iter = rIndex.iterator(r(2), r(4));
    while (iter.hasNext()) iter.next();
    List<Integer> x = toIntList(rIndex.iterator(r(2), r(4)));
    List<Integer> expected = toIntList(2, 3);
    assertEquals(expected, x);
}
Also used : RecordLib.intToRecord(org.apache.jena.dboe.test.RecordLib.intToRecord) Record(org.apache.jena.dboe.base.record.Record) RangeIndex(org.apache.jena.dboe.index.RangeIndex) Test(org.junit.Test) IndexTestLib.randTest(org.apache.jena.dboe.index.test.IndexTestLib.randTest)

Aggregations

RangeIndex (org.apache.jena.dboe.index.RangeIndex)45 IndexTestLib.randTest (org.apache.jena.dboe.index.test.IndexTestLib.randTest)37 Test (org.junit.Test)37 TupleMap (org.apache.jena.atlas.lib.tuple.TupleMap)3 Record (org.apache.jena.dboe.base.record.Record)2 RecordFactory (org.apache.jena.dboe.base.record.RecordFactory)2 IndexParams (org.apache.jena.dboe.index.IndexParams)2 RecordLib.intToRecord (org.apache.jena.dboe.test.RecordLib.intToRecord)2 TupleIndexRecord (org.apache.jena.tdb2.store.tupletable.TupleIndexRecord)2 Index (org.apache.jena.dboe.index.Index)1 BPlusTree (org.apache.jena.dboe.trans.bplustree.BPlusTree)1 TupleIndex (org.apache.jena.tdb2.store.tupletable.TupleIndex)1