Search in sources :

Example 6 with TupleMap

use of org.apache.jena.atlas.lib.tuple.TupleMap in project jena by apache.

the class TestTupleMap method map_slot_2.

@Test
public void map_slot_2() {
    TupleMap tmap = TupleMap.create("SPO", "POS");
    Tuple<String> tuple = TupleFactory.tuple("S", "P", "O");
    Tuple<String> tuple1 = TupleFactory.tuple(tuple.get(tmap.mapIdx(0)), tuple.get(tmap.mapIdx(1)), tuple.get(tmap.mapIdx(2)));
    Tuple<String> tuple2 = tmap.map(tuple);
    assertEquals(tuple2, tuple1);
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

Example 7 with TupleMap

use of org.apache.jena.atlas.lib.tuple.TupleMap in project jena by apache.

the class TestTupleMap method map_tuple_1.

// Check coverage
@Test
public void map_tuple_1() {
    TupleMap tmap = TupleMap.create("SPO", "POS");
    Tuple<String> tuple = TupleFactory.tuple("S", "P", "O");
    Tuple<String> tuple2 = tmap.map(tuple);
    assertEquals(tuple2.get(0), "P");
    assertEquals(tuple2.get(1), "O");
    assertEquals(tuple2.get(2), "S");
    Tuple<String> tuple3 = tmap.unmap(tuple2);
    assertEquals(tuple, tuple3);
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

Example 8 with TupleMap

use of org.apache.jena.atlas.lib.tuple.TupleMap in project jena by apache.

the class TestTupleMap method map_slot_3.

@Test
public void map_slot_3() {
    TupleMap tmap = TupleMap.create("POS", "SPO");
    Tuple<String> tuple = TupleFactory.tuple("P", "O", "S");
    Tuple<String> tuple1 = TupleFactory.tuple(tuple.get(tmap.unmapIdx(0)), tuple.get(tmap.unmapIdx(1)), tuple.get(tmap.unmapIdx(2)));
    Tuple<String> tuple2 = tmap.unmap(tuple);
    assertEquals(tuple2, tuple1);
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

Example 9 with TupleMap

use of org.apache.jena.atlas.lib.tuple.TupleMap in project jena by apache.

the class TestTupleMap method map_same_1.

@Test
public void map_same_1() {
    TupleMap x1 = TupleMap.create("SPO", "POS");
    TupleMap x2 = TupleMap.create("SPO", "POS");
    assertTrue(x1.sameMapping(x1));
    assertTrue(x1.sameMapping(x2));
    assertTrue(x2.sameMapping(x1));
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

Example 10 with TupleMap

use of org.apache.jena.atlas.lib.tuple.TupleMap in project jena by apache.

the class TestTupleIndexRecord method create.

@Override
protected TupleIndexRecord create(String description) {
    IndexParams indexParams = StoreParams.getDftStoreParams();
    RangeIndex rIdx = BuildTestLib.buildRangeIndex(FileSet.mem(), factory, indexParams);
    TupleMap tmap = TupleMap.create("SPO", description);
    TupleIndexRecord index = new TupleIndexRecord(3, tmap, description, factory, rIdx);
    return index;
}
Also used : IndexParams(org.apache.jena.dboe.index.IndexParams) RangeIndex(org.apache.jena.dboe.index.RangeIndex) TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap)

Aggregations

TupleMap (org.apache.jena.atlas.lib.tuple.TupleMap)20 Test (org.junit.Test)16 RangeIndex (org.apache.jena.dboe.index.RangeIndex)3 RecordFactory (org.apache.jena.dboe.base.record.RecordFactory)2 IndexParams (org.apache.jena.dboe.index.IndexParams)2 TupleIndex (org.apache.jena.tdb2.store.tupletable.TupleIndex)2 BlockMgr (org.apache.jena.dboe.base.block.BlockMgr)1 BufferChannel (org.apache.jena.dboe.base.file.BufferChannel)1 FileSet (org.apache.jena.dboe.base.file.FileSet)1 Location (org.apache.jena.dboe.base.file.Location)1 Record (org.apache.jena.dboe.base.record.Record)1 BPlusTree (org.apache.jena.dboe.trans.bplustree.BPlusTree)1 BPlusTreeParams (org.apache.jena.dboe.trans.bplustree.BPlusTreeParams)1 ProgressIterator (org.apache.jena.system.progress.ProgressIterator)1 ProgressMonitor (org.apache.jena.system.progress.ProgressMonitor)1 TDBException (org.apache.jena.tdb2.TDBException)1 DatasetGraphTDB (org.apache.jena.tdb2.store.DatasetGraphTDB)1 TupleIndexRecord (org.apache.jena.tdb2.store.tupletable.TupleIndexRecord)1