Package org.apache.jena.atlas.lib

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


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


        assertArrayEquals(expected, x) ;
    }

    @Test public void map1()
    {
        ColumnMap cmap = new ColumnMap("GSPO", "OSPG") ;
        Tuple<String> tuple = createTuple("G", "S", "P", "O") ;
        Tuple<String> mapped = cmap.map(tuple) ;
        Tuple<String> expected = createTuple("O", "S", "P", "G") ;
        assertEquals(expected, mapped) ;
        Tuple<String> unmapped = cmap.unmap(mapped) ;
        assertEquals(createTuple("G", "S", "P", "O"), unmapped) ;
    }
View Full Code Here

    @Test public void map2()
    {
        String[] x = { "G", "S", "P", "O" } ;
        String[] y = { "O", "S", "P", "G" } ;
       
        ColumnMap cmap = new ColumnMap("Test", x, y) ;
        Tuple<String> tuple = Tuple.create(x) ;
        Tuple<String> mapped = cmap.map(tuple) ;
       
        Tuple<String> expected = Tuple.create(y) ;
        assertEquals(expected, mapped) ;
        Tuple<String> unmapped = cmap.unmap(mapped) ;
        assertEquals(Tuple.create(x), unmapped) ;
    }
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

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

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

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

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

        assertArrayEquals(expected, x) ;
    }

    @Test public void map1()
    {
        ColumnMap cmap = new ColumnMap("GSPO", "OSPG") ;
        Tuple<String> tuple = Tuple.create("G", "S", "P", "O") ;
        Tuple<String> mapped = cmap.map(tuple) ;
        Tuple<String> expected = Tuple.create("O", "S", "P", "G") ;
        assertEquals(expected, mapped) ;
        Tuple<String> unmapped = cmap.unmap(mapped) ;
        assertEquals(Tuple.create("G", "S", "P", "O"), unmapped) ;
    }
View Full Code Here

    @Test public void map2()
    {
        String[] x = { "G", "S", "P", "O" } ;
        String[] y = { "O", "S", "P", "G" } ;
       
        ColumnMap cmap = new ColumnMap("Test", x, y) ;
        Tuple<String> tuple = Tuple.create(x) ;
        Tuple<String> mapped = cmap.map(tuple) ;
       
        Tuple<String> expected = Tuple.create(y) ;
        assertEquals(expected, mapped) ;
        Tuple<String> unmapped = cmap.unmap(mapped) ;
        assertEquals(Tuple.create(x), unmapped) ;
    }
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.