Package org.apache.jena.atlas.lib

Examples of org.apache.jena.atlas.lib.ColumnMap


        // This should work but requires properties.
        //return SetupTDB.makeTupleIndex(location, properties, indexName, primary, indexOrder, dftKeyLength)
        // Migrate to TDB proper.
        // Value part is null (zero length)
        RangeIndex rIndex = openBPT(location, indexName, readCacheSize, writeCacheSize, dftKeyLength, dftValueLength) ;
        TupleIndex tupleIndex = new TupleIndexRecord(primary.length(), new ColumnMap(primary, indexOrder), indexOrder, rIndex.getRecordFactory(), rIndex) ;
        return tupleIndex ;
    }
View Full Code Here


    {
        RecordFactory rf = new RecordFactory(8,4) ;
        Record r = rf.create() ;
        Bytes.setLong(0x123456789ABCDEF0L, r.getKey()) ;
        Bytes.setInt(0x22334455, r.getValue()) ;
        ColumnMap cMap = new ColumnMap("XYAB", "BYXA") ;
        Record r2 = copyRecord(rf, r, cMap) ;
        System.out.println(r) ;
        System.out.println(r2) ;
    }
View Full Code Here

    protected TupleIndex makeTupleIndex(Location location, String name, String primary, String indexOrder)
    {
        // Commonly,  name == indexOrder.
        // FileSet
        FileSet fs = new FileSet(location, name) ;
        ColumnMap colMap = new ColumnMap(primary, indexOrder) ;
        return tupleIndexBuilder.buildTupleIndex(fs, colMap, indexOrder) ;
    }
View Full Code Here

    private static TupleIndex createTupleIndex(IndexBuilder indexBuilder, RecordFactory recordFactory, Location location, String primary, String desc)
    {
        // Map name of index to name of file.
        FileSet fileset = new FileSet(location, desc) ;
        RangeIndex rIdx1 = indexBuilder.newRangeIndex(fileset, recordFactory) ;
        TupleIndex tupleIndex = new TupleIndexRecord(desc.length(), new ColumnMap(primary, desc), desc, recordFactory, rIdx1) ;
        return tupleIndex ;
    }
View Full Code Here

public class TestColumnMap extends BaseTest
{
    @Test public void remap1()
    {
        ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ;   // S->2 etc
       
        Integer[] array = {0,1,2 } ;
        assertEquals(Integer.valueOf(2), x.mapSlot(0, array) ) ;  
        assertEquals(Integer.valueOf(0), x.mapSlot(1, array) ) ;
        assertEquals(Integer.valueOf(1), x.mapSlot(2, array) ) ;
    }
View Full Code Here

        assertEquals(Integer.valueOf(1), x.mapSlot(2, array) ) ;
    }
   
    @Test public void remap2()
    {
        ColumnMap x = new ColumnMap("SPO->POS", 2,0,1) ;
        Integer[] array = { 0,1,2 } ;
        assertEquals(Integer.valueOf(1), x.fetchSlot(0, array)) ;   // The index 1 comes from position 0.
        assertEquals(Integer.valueOf(2), x.fetchSlot(1, array)) ;
        assertEquals(Integer.valueOf(0), x.fetchSlot(2, array)) ;
    }
View Full Code Here

    protected TupleIndex makeTupleIndex(Location location, String name, String primary, String indexOrder)
    {
        // Commonly,  name == indexOrder.
        // FileSet
        FileSet fs = new FileSet(location, name) ;
        ColumnMap colMap = new ColumnMap(primary, indexOrder) ;
        return tupleIndexBuilder.buildTupleIndex(fs, colMap, indexOrder) ;
    }
View Full Code Here

   
    @Override
    protected TupleIndexRecord create(String description)
    {
        RangeIndex rIdx = IndexBuilder.mem().newRangeIndex(FileSet.mem(), factory) ;
        ColumnMap cmap = new ColumnMap("SPO", description) ;
        TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ;
        return index ;
    }
View Full Code Here

    static NodeId n6 = new NodeId(0x6666666666666666L) ;
   
    static TupleIndexRecord create(String description)
    {
        RangeIndex rIdx = IndexBuilder.mem().newRangeIndex(FileSet.mem(), factory) ;
        ColumnMap cmap = new ColumnMap("SPO", description) ;
        TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx) ;
        return index ;
    }
View Full Code Here

        assertEquals(Integer.valueOf(0), x.fetchSlot(2, array)) ;
    }

    @Test public void remap3()
    {
        ColumnMap x = new ColumnMap("POS", 2,0,1) ;
        Tuple<String> tuple = createTuple("S", "P", "O") ;
        Tuple<String> mapped = x.map(tuple) ;
        Tuple<String> expected = createTuple("P", "O", "S") ;
        assertEquals(expected, mapped) ;
    }
View Full Code Here

TOP

Related Classes of org.apache.jena.atlas.lib.ColumnMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.