Class ColumnMap

java.lang.Object
org.apache.jena.tdb1.lib.ColumnMap

public class ColumnMap extends Object
General descriptor of a reordering (mapping) of columns in tuples to columns in indexes, for example, from triples to triple index order. Naming: map is convert to the reordered form, fetch is get back.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ColumnMap(String label, int... elements)
    Construct a column map - the elements are the mappings of a tuple originally in the order 0,1,2,...
    ColumnMap(String input, String output)
    Construct a column mapping that maps the input (one col, one char) to the output
    ColumnMap(String label, List<T> input, List<T> output)
     
    ColumnMap(String label, T[] input, T[] output)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    fetchSlot(int idx, org.apache.jena.atlas.lib.tuple.Tuple<T> tuple)
    Apply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPO
    <T> T
    fetchSlot(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
    int
    fetchSlotIdx(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 1->0
     
    int
    Length of mapping
    <T> org.apache.jena.atlas.lib.tuple.Tuple<T>
    map(org.apache.jena.atlas.lib.tuple.Tuple<T> src)
    Apply to an unmapped tuple to get a tuple with the column mapping applied
    Reorder the letters of a string by the same rules as this column map (forward, map direction)
    <T> T
    mapSlot(int idx, org.apache.jena.atlas.lib.tuple.Tuple<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
    <T> T
    mapSlot(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
    int
    mapSlotIdx(int idx)
    Get the index of the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS so 2->0
     
    <T> org.apache.jena.atlas.lib.tuple.Tuple<T>
    unmap(org.apache.jena.atlas.lib.tuple.Tuple<T> src)
    Apply to a mapped tuple to get a tuple with the column mapping reverse-applied
    Reorder the letters of a string by the same rules as this column map (backward, fetch direction)

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ColumnMap

      public ColumnMap(String input, String output)
      Construct a column mapping that maps the input (one col, one char) to the output
    • ColumnMap

      public ColumnMap(String label, List<T> input, List<T> output)
    • ColumnMap

      public ColumnMap(String label, T[] input, T[] output)
    • ColumnMap

      public ColumnMap(String label, int... elements)
      Construct a column map - the elements are the mappings of a tuple originally in the order 0,1,2,... so SPO->POS is 2,0,1 (SPO->POS so S->2, P->0, O->1) and not 1,2,0 (which is the extraction mapping). The label is just a label and is not interpreted.
  • Method Details

    • length

      public int length()
      Length of mapping
    • fetchSlot

      public <T> T fetchSlot(int idx, org.apache.jena.atlas.lib.tuple.Tuple<T> tuple)
      Apply to an unmapped tuple to get the i'th slot after mapping : SPO->POS : 0'th slot is P from SPO
    • fetchSlot

      public <T> T fetchSlot(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
    • mapSlot

      public <T> T mapSlot(int idx, org.apache.jena.atlas.lib.tuple.Tuple<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
    • mapSlot

      public <T> T mapSlot(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
    • mapSlotIdx

      public int mapSlotIdx(int idx)
      Get the index of the i'th slot as it appears after mapping : SPO->POS : 0'th slot is S from POS so 2->0
    • fetchSlotIdx

      public int fetchSlotIdx(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 1->0
    • map

      public <T> org.apache.jena.atlas.lib.tuple.Tuple<T> map(org.apache.jena.atlas.lib.tuple.Tuple<T> src)
      Apply to an unmapped tuple to get a tuple with the column mapping applied
    • unmap

      public <T> org.apache.jena.atlas.lib.tuple.Tuple<T> unmap(org.apache.jena.atlas.lib.tuple.Tuple<T> src)
      Apply to a mapped tuple to get a tuple with the column mapping reverse-applied
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLabel

      public String getLabel()
    • mapName

      public String mapName(String word)
      Reorder the letters of a string by the same rules as this column map (forward, map direction)
    • unmapName

      public String unmapName(String word)
      Reorder the letters of a string by the same rules as this column map (backward, fetch direction)