java.lang.Object
org.apache.jena.atlas.lib.tuple.TupleMap
General descriptor of a reordering (mapping) of slots in tuples
Naming: map is convert to the reordered form, unmap is get back.
map(tuple) is equivalent to create tuple(getSlotIdx(0) , getSlotIdx(1), ... getSlotIdx(n-1)) ;A
TupleMap holds twp maps: the "getTransform" and the "putTransform".
The "getTransform" is here to get the item from in the mapper Tuple.
In the case is SPO{@literal ->}POS this is
0{@literal <-}1, 1{@literal <-}2, 2{@literal <-}0
and the "putTransform" is where to place the items: 0{@literal ->}2, 1{@literal ->}0, 2{@literal ->}1.-
Method Summary
Modifier and TypeMethodDescriptionstatic TupleMapConstruct a mapping that maps the input (one col, one char) to the outputstatic TupleMapConstruct a mapping, with label, that maps the input (one col, one char) to the outputstatic <T> TupleMapConstruct a mapping that maps the input to the outputstatic <T> TupleMapConstruct a mapping that maps the input to the outputgetLabel()intgetSlotIdx(int idx) Get the index of the i'th slot as it appears from a mapping : for SPO->POS : 0'th slot is P so 0 returns 1 (the location in the tuple before mapping) The 0'th mapped slot istuple.get(tupleMap.getSlotIdx(0)).intlength()Length of mapping<T> Tuple<T>Apply to an unmapped tuple to get a tuple with the tuple mapping applied.<T> T[]map(T[] src, T[] dst) Apply to an unmapped tuple to get a tuple with the tuple mapping applied.intmapIdx(int idx) Get the index of the i'th slot as it appears from a mapping : for SPO->POS : 0'th slot is P so 0 returns 1 (the location in the tuple before mapping) Equivalent togetSlotIdx(int).
The 0'th mapped slot istuple.get(tupleMap.mapIdx(0)).
Mapping a tuple ismap(tuple) == create(tuple.mapIdx(0) , tuple.mapIdx(1), ... tuple.mapIdx(n-1))<T> TApply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPO<T> TmapSlot(int idx, T[] tuple) Apply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPOintputSlotIdx(int idx) Get the index of the i'th slot as it appears after unmapping : SPO->POS : 0'th slot is S from POS so 0 returns 2reverse()Return aTupleMapthat maps in the opposite directionbooleansameMapping(TupleMap other) Is this mapping the same (has the same effect) asother?toString()<T> Tuple<T>Apply to a mapped tuple to get a tuple with the tuple mapping reverse-applied.<T> T[]unmap(T[] src, T[] dst) Apply to a mapped tuple to get a tuple with the tuple mapping reverse-applied.intunmapIdx(int idx) Get the index of the i'th slot as it appears after unmapping : SPO->POS : 0'th slot is S from POS so 0 returns 2 Equivalent toputSlotIdx(int).
The 0'th unmapped slot istuple.get(tupleMap.unmapIdx(0)).
Unmapping a tuple isunmap(tuple) == create(tuple.unmapIdx(0) , tuple.unmapIdx(1), ... tuple.unmapIdx(n-1))<T> TApply to a mapped tuple to get the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS<T> TunmapSlot(int idx, T[] tuple) Apply to a mapped tuple to get the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS
-
Method Details
-
create
Construct a mapping that maps the input (one col, one char) to the output -
create
Construct a mapping, with label, that maps the input (one col, one char) to the output -
create
Construct a mapping that maps the input to the output -
create
Construct a mapping that maps the input to the output -
reverse
Return aTupleMapthat maps in the opposite directionthis.reverseMap().map is the same as this.unmap this.reverseMap().unmap is the same as this.map
-
length
public int length()Length of mapping -
getSlotIdx
public int getSlotIdx(int idx) Get the index of the i'th slot as it appears from a mapping : for SPO->POS : 0'th slot is P so 0 returns 1 (the location in the tuple before mapping) The 0'th mapped slot istuple.get(tupleMap.getSlotIdx(0)). -
putSlotIdx
public int putSlotIdx(int idx) Get the index of the i'th slot as it appears after unmapping : SPO->POS : 0'th slot is S from POS so 0 returns 2 -
mapIdx
public int mapIdx(int idx) Get the index of the i'th slot as it appears from a mapping : for SPO->POS : 0'th slot is P so 0 returns 1 (the location in the tuple before mapping) Equivalent togetSlotIdx(int).
The 0'th mapped slot istuple.get(tupleMap.mapIdx(0)).
Mapping a tuple ismap(tuple) == create(tuple.mapIdx(0) , tuple.mapIdx(1), ... tuple.mapIdx(n-1)) -
unmapIdx
public int unmapIdx(int idx) Get the index of the i'th slot as it appears after unmapping : SPO->POS : 0'th slot is S from POS so 0 returns 2 Equivalent toputSlotIdx(int).
The 0'th unmapped slot istuple.get(tupleMap.unmapIdx(0)).
Unmapping a tuple isunmap(tuple) == create(tuple.unmapIdx(0) , tuple.unmapIdx(1), ... tuple.unmapIdx(n-1)) -
map
Apply to an unmapped tuple to get a tuple with the tuple mapping applied. -
unmap
Apply to a mapped tuple to get a tuple with the tuple mapping reverse-applied. -
map
public <T> T[] map(T[] src, T[] dst) Apply to an unmapped tuple to get a tuple with the tuple mapping applied. Returns the destination array. -
unmap
public <T> T[] unmap(T[] src, T[] dst) Apply to a mapped tuple to get a tuple with the tuple mapping reverse-applied. Returns the destination array. -
mapSlot
Apply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPO -
unmapSlot
Apply to a mapped tuple to get the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS -
mapSlot
public <T> T mapSlot(int idx, T[] tuple) Apply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPO -
unmapSlot
public <T> T unmapSlot(int idx, T[] tuple) Apply to a mapped tuple to get the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS -
sameMapping
Is this mapping the same (has the same effect) asother? -
toString
-
getLabel
-