Search in sources :

Example 1 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class TestRecordBuffer method recBufferIterate05.

@Test
public void recBufferIterate05() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator(intToRecord(1), null);
    same(iter, 2, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 2 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class TestRecordBuffer method recBufferIterate02.

@Test
public void recBufferIterate02() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator();
    same(iter, 2, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 3 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class TestRecordBuffer method recBufferIterate04.

@Test
public void recBufferIterate04() {
    RecordBuffer rb = make(3, 5);
    Iterator<Record> iter = rb.iterator(intToRecord(3), null);
    same(iter, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 4 with Record

use of org.apache.jena.tdb.base.record.Record in project jena by apache.

the class TestRecordBuffer method recBufferIterate10.

@Test
public void recBufferIterate10() {
    RecordBuffer rb = make(5, 5);
    Iterator<Record> iter = rb.iterator(intToRecord(4), intToRecord(8));
    same(iter, 4, 6);
}
Also used : Record(org.apache.jena.tdb.base.record.Record) RecordLib.intToRecord(org.apache.jena.tdb.base.record.RecordLib.intToRecord) RecordBuffer(org.apache.jena.tdb.base.buffer.RecordBuffer) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 5 with Record

use of org.apache.jena.tdb.base.record.Record 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 {
        System.err.printf("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();
}
Also used : BPlusTreeParams(org.apache.jena.tdb.index.bplustree.BPlusTreeParams) RecordFactory(org.apache.jena.tdb.base.record.RecordFactory) FileSet(org.apache.jena.tdb.base.file.FileSet) BlockMgr(org.apache.jena.tdb.base.block.BlockMgr) Record(org.apache.jena.tdb.base.record.Record) RangeIndex(org.apache.jena.tdb.index.RangeIndex) BPlusTree(org.apache.jena.tdb.index.bplustree.BPlusTree)

Aggregations

Record (org.apache.jena.tdb.base.record.Record)95 Test (org.junit.Test)20 RecordLib.intToRecord (org.apache.jena.tdb.base.record.RecordLib.intToRecord)15 RecordBuffer (org.apache.jena.tdb.base.buffer.RecordBuffer)14 BaseTest (org.apache.jena.atlas.junit.BaseTest)10 RangeIndex (org.apache.jena.tdb.index.RangeIndex)8 BlockMgr (org.apache.jena.tdb.base.block.BlockMgr)6 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)6 NoSuchElementException (java.util.NoSuchElementException)5 FileSet (org.apache.jena.tdb.base.file.FileSet)5 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)5 NodeId (org.apache.jena.tdb.store.NodeId)5 Pair (org.apache.jena.atlas.lib.Pair)4 Location (org.apache.jena.tdb.base.file.Location)4 BPlusTreeParams (org.apache.jena.tdb.index.bplustree.BPlusTreeParams)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 StorageException (org.apache.jena.tdb.base.StorageException)3 RecordBufferPage (org.apache.jena.tdb.base.recordbuffer.RecordBufferPage)3 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)3 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)3