Search in sources :

Example 6 with BPlusTreeParams

use of org.apache.jena.tdb.index.bplustree.BPlusTreeParams in project jena by apache.

the class DatasetBuilderStd method createBPTree.

/**
 * Knowing all the parameters, create a B+Tree
 */
private RangeIndex createBPTree(FileSet fileset, int order, BlockMgrBuilder blockMgrBuilderNodes, BlockMgrBuilder blockMgrBuilderRecords, RecordFactory factory, IndexParams indexParams) {
    // ---- Checking
    {
        int blockSize = indexParams.getBlockSize();
        if (blockSize < 0)
            throw new IllegalArgumentException("Negative blocksize: " + blockSize);
        if (blockSize < 0 && order < 0)
            throw new IllegalArgumentException("Neither blocksize nor order specified");
        if (blockSize >= 0 && order < 0)
            order = BPlusTreeParams.calcOrder(blockSize, factory.recordLength());
        if (blockSize >= 0 && order >= 0) {
            int order2 = BPlusTreeParams.calcOrder(blockSize, factory.recordLength());
            if (order != order2)
                throw new IllegalArgumentException("Wrong order (" + order + "), calculated = " + order2);
        }
    }
    BPlusTreeParams params = new BPlusTreeParams(order, factory);
    BlockMgr blkMgrNodes = blockMgrBuilderNodes.buildBlockMgr(fileset, Names.bptExtTree, indexParams);
    BlockMgr blkMgrRecords = blockMgrBuilderRecords.buildBlockMgr(fileset, Names.bptExtRecords, indexParams);
    return BPlusTree.create(params, blkMgrNodes, blkMgrRecords);
}
Also used : BPlusTreeParams(org.apache.jena.tdb.index.bplustree.BPlusTreeParams) BlockMgr(org.apache.jena.tdb.base.block.BlockMgr)

Aggregations

BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)6 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)6 FileSet (org.apache.jena.tdb.base.file.FileSet)4 Record (org.apache.jena.tdb.base.record.Record)4 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)4 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)4 InputStream (java.io.InputStream)2 AtlasException (org.apache.jena.atlas.AtlasException)2 Location (org.apache.jena.tdb.base.file.Location)2 RangeIndex (org.apache.jena.tdb.index.RangeIndex)2 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)2