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);
}
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);
}
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);
}
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));
}
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;
}
Aggregations