use of org.apache.jena.tdb.index.RangeIndex in project jena by apache.
the class ProcRewriteIndex method exec.
public static void exec(Location srcLoc, Location dstLoc, String indexName) {
FileSet destination = new FileSet(dstLoc, indexName);
int readCacheSize = 0;
int writeCacheSize = -1;
int dftKeyLength;
int dftValueLength;
if (indexName.length() == 3) {
dftKeyLength = SystemTDB.LenIndexTripleRecord;
dftValueLength = 0;
} else if (indexName.length() == 4) {
dftKeyLength = SystemTDB.LenIndexQuadRecord;
dftValueLength = 0;
} else {
FmtLog.error(ProcRewriteIndex.class, "Can't determine record size for %s\n", indexName);
return;
}
RecordFactory recordFactory = null;
BPlusTreeParams bptParams = null;
BlockMgr blkMgrNodes;
BlockMgr blkMgrRecords;
int blockSize = SystemTDB.BlockSize;
RangeIndex rangeIndex = SetupIndex.makeRangeIndex(srcLoc, indexName, blockSize, dftKeyLength, dftValueLength, readCacheSize, writeCacheSize);
BPlusTree bpt = (BPlusTree) rangeIndex;
bptParams = bpt.getParams();
recordFactory = bpt.getRecordFactory();
int blockSizeNodes = blockSize;
int blockSizeRecords = blockSize;
blkMgrNodes = BlockMgrFactory.create(destination, Names.bptExtTree, blockSizeNodes, readCacheSize, writeCacheSize);
blkMgrRecords = BlockMgrFactory.create(destination, Names.bptExtRecords, blockSizeRecords, readCacheSize, writeCacheSize);
Iterator<Record> iterator = bpt.iterator();
// // Fakery.
// blkMgrNodes = BlockMgrFactory.create(destination, Names.bptExt1, blockSize, readCacheSize, writeCacheSize) ;
// blkMgrRecords = BlockMgrFactory.create(destination, Names.bptExt2, blockSize, readCacheSize, writeCacheSize) ;
// recordFactory = new RecordFactory(dftKeyLength, dftValueLength) ;
// bptParams = new BPlusTreeParams(3, recordFactory) ;
// List<Record> data = TestBPlusTreeRewriter.createData(10, recordFactory) ;
// iterator = data.iterator() ;
// System.out.println("Rewrite: "+srcLoc+" "+indexName+" --> "+destination) ;
BPlusTree bpt2 = BPlusTreeRewriter.packIntoBPlusTree(iterator, bptParams, recordFactory, blkMgrNodes, blkMgrRecords);
if (bpt2 == null)
return;
//
// Iterator<Record> iter = bpt2.iterator() ;
// for ( ; iter.hasNext() ; )
// {
// Record r = iter.next() ;
// System.out.println(r) ;
// }
bpt2.close();
}
use of org.apache.jena.tdb.index.RangeIndex in project jena by apache.
the class DebugTDB method dumpNodeIndex.
// public static RangeIndex makeRangeIndex(Location location, String indexName,
// int dftKeyLength, int dftValueLength,
// int readCacheSize,int writeCacheSize)
public static void dumpNodeIndex(String dir) {
Location location = Location.create(dir);
Index nodeToId = SetupTDB.makeIndex(location, Names.indexNode2Id, SystemTDB.BlockSize, SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId, -1, -1);
for (Record aNodeToId : nodeToId) {
System.out.println(aNodeToId);
}
}
use of org.apache.jena.tdb.index.RangeIndex in project jena by apache.
the class IndexTestLib method buildIndex.
// ---------- Utilities
// public static RangeIndex buildRangeIndex(RangeIndexMaker maker, int[] keys)
// {
// RangeIndex index = maker.make() ;
// IndexTestLib.add(index, keys) ;
// return index ;
// }
public static Index buildIndex(IndexMaker maker, int[] keys) {
Index index = maker.makeIndex();
IndexTestLib.add(index, keys);
return index;
}
use of org.apache.jena.tdb.index.RangeIndex in project jena by apache.
the class TestTupleIndexRecord method createIndex.
@Override
protected TupleIndexRecord createIndex(String description) {
IndexParams indexParams = StoreParams.getDftStoreParams();
RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams);
ColumnMap cmap = new ColumnMap("SPO", description);
TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx);
return index;
}
use of org.apache.jena.tdb.index.RangeIndex in project jena by apache.
the class TestTupleIndexRecordDirect method create.
static TupleIndexRecord create(String description) {
IndexParams indexParams = StoreParams.getDftStoreParams();
RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams);
ColumnMap cmap = new ColumnMap("SPO", description);
TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx);
return index;
}
Aggregations