Search in sources :

Example 11 with TupleMap

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

the class TDB2StorageBuilder method makeTupleIndex.

private TupleIndex makeTupleIndex(String primary, String index, String name) {
    TupleMap cmap = TupleMap.create(primary, index);
    RecordFactory rf = new RecordFactory(SystemTDB.SizeOfNodeId * cmap.length(), 0);
    RangeIndex rIdx = makeRangeIndex(rf, index);
    TupleIndex tIdx = new TupleIndexRecord(primary.length(), cmap, index, rf, rIdx);
    return tIdx;
}
Also used : RecordFactory(org.apache.jena.dboe.base.record.RecordFactory) TupleIndexRecord(org.apache.jena.tdb2.store.tupletable.TupleIndexRecord) RangeIndex(org.apache.jena.dboe.index.RangeIndex) TupleIndex(org.apache.jena.tdb2.store.tupletable.TupleIndex) TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap)

Example 12 with TupleMap

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

the class TestTupleMap method map_same_2.

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

Example 13 with TupleMap

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

the class TestTupleMap method compile_2.

@Test
public void compile_2() {
    TupleMap map = TupleMap.create("SPOG", "GOPS");
    Integer[] expected = { 3, 2, 1, 0 };
    assertEquals(Arrays.asList(expected), map.transformPut());
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

Example 14 with TupleMap

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

the class TestTupleMap method map_reverse_1.

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

Example 15 with TupleMap

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

the class TestTupleMap method map_reverse_2.

@Test
public void map_reverse_2() {
    TupleMap x1 = TupleMap.create("SPO", "POS");
    TupleMap x2 = TupleMap.create("POS", "SPO");
    Tuple<String> tuple = TupleFactory.tuple("X", "Y", "Z");
    Tuple<String> tuple1 = x1.map(tuple);
    Tuple<String> tuple2 = x2.unmap(tuple);
    assertEquals(tuple1, tuple2);
}
Also used : TupleMap(org.apache.jena.atlas.lib.tuple.TupleMap) Test(org.junit.Test)

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