Class ClassificationUtils

java.lang.Object
org.gbif.api.util.ClassificationUtils

public class ClassificationUtils extends Object
  • Method Details

    • getHigherClassification

      Concatenates all higher Linnean taxa into a single dwc:higherClassification string, skipping null values.
      Parameters:
      lc - the LinneanClassification to join into the higher classification string
      Returns:
      the concatenated dwc:higherClassification string
    • getHigherRank

      @Nullable public static String getHigherRank(LinneanClassification lc, Rank rank)
      Gets a higher taxon property by passing the rank of it. Only Linnean ranks are supported.
      Parameters:
      lc - the LinneanClassification holding the taxon property to be retrieved
      rank - the higher linnean rank to retrieve
      Returns:
      the name of the higher taxon or null if rank doesnt exist
    • setHigherRank

      public static void setHigherRank(LinneanClassification lc, Rank rank, String name)
      Sets a higher taxon property by passing the rank of it.
      Parameters:
      lc - the LinneanClassification on which to set the new property
      rank - the higher linnean rank to set
      name - the higher ranks name
    • getHigherClassificationMap

      An ordered map with entries for all higher Linnean ranks down to species which are not null. The map starts with the highest rank, e.g. the kingdom and maps the name usage key to its canonical name.
      Parameters:
      lc - the object that implements both LinneanClassification and LinneanClassificationKeys from which to build the map
      Returns:
      map of higher ranks
    • getHigherClassificationMap

      @NotNull public static <T extends LinneanClassification & LinneanClassificationKeys> @NotNull LinkedHashMap<Integer,String> getHigherClassificationMap(T lc, int key, Integer parentKey, String parent)
      An ordered map with entries for all higher Linnean ranks down to the actual direct parent of this usage. The map starts with the highest rank, e.g. the kingdom and maps the name usage key to its canonical name. The name usage itself is never included, even though a higher rank might point to the usage itself.
      Parameters:
      lc - the object that implements both LinneanClassification and LinneanClassificationKeys from which to build the map
      Returns:
      map of higher ranks
    • getHigherRankKey

      @Nullable public static Integer getHigherRankKey(LinneanClassificationKeys lck, Rank rank)
      Gets a higher taxon key by passing the rank of it. Only Linnean ranks are supported.
      Parameters:
      lck - the classification that holds the taxon key
      rank - the higher linnean rank to retrieve
      Returns:
      the key of the higher taxon or null if rank doesnt exist
    • setHigherRankKey

      public static void setHigherRankKey(LinneanClassificationKeys lck, Rank rank, Integer usageKey)
      Sets a higher taxon property by passing the rank of it.
      Parameters:
      lck - the classification on which to set the taxon property
      rank - the higher rank to set
      usageKey - key of the higher ranks usage
    • setHigherRank

      public static <T extends LinneanClassification & LinneanClassificationKeys> void setHigherRank(T lc, Rank rank, String name, Integer usageKey)
      Sets a higher taxon property by passing the rank of it.
      Parameters:
      lc - the object that implements both LinneanClassification and LinneanClassificationKeys on which to set the taxon property
      rank - the higher linnean rank to set
      name - the higher ranks name
      usageKey - key of the higher ranks usage
    • hasContent

      public static boolean hasContent(LinneanClassification lc)
      Returns:
      true if at least one higher rank of the classification is given, i.e. not null or empty
    • copyLinneanClassificationKeys

      Copies all linnean classification based higher taxon keys from one instance to another.
    • copyLinneanClassification

      Copies all linnean classification based higher taxon names from one instance to another.