Documentation ¶
Overview ¶
Package taxonomy implements a basic taxonomy to be used with GBIF occurrence data.
Index ¶
- func Canon(name string) string
- type ErrAmbiguous
- type Rank
- type Taxon
- type Taxonomy
- func (tx *Taxonomy) Accepted(id int64) Taxon
- func (tx *Taxonomy) AcceptedAndRanked(id int64) Taxon
- func (tx *Taxonomy) AddFromGBIF(id int64, maxRank Rank) error
- func (tx *Taxonomy) AddNameFromGBIF(name string, maxRank Rank) error
- func (tx *Taxonomy) AddSpecies(sp *gbif.Species)
- func (tx *Taxonomy) ByName(name string) []int64
- func (tx *Taxonomy) IDs() []int64
- func (tx *Taxonomy) MinRank() Rank
- func (tx *Taxonomy) Rank(id int64) Rank
- func (tx *Taxonomy) Stage()
- func (tx *Taxonomy) Taxon(id int64) Taxon
- func (tx *Taxonomy) Write(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrAmbiguous ¶
An ErrAmbiguous is the error produced when searching for a name that has multiple possible resolutions in GBIF.
func (*ErrAmbiguous) Error ¶
func (e *ErrAmbiguous) Error() string
func (*ErrAmbiguous) Unwrap ¶
func (e *ErrAmbiguous) Unwrap() error
type Rank ¶
type Rank uint
Rank is a linnean rank. Ranks are arranged in a way that an inclusive rank in the taxonomy is always smaller than more exclusive ranks. Then it is possible to use the form:
if rank < taxonomy.Genus { // do something }
Valid taxonomic ranks.
type Taxon ¶
type Taxon struct { Name string // taxon name Author string // author of the name ID int64 // ID of the taxon Rank Rank // taxon rank Status string // taxon status Parent int64 // ID of the parent taxon }
A Taxon stores the taxon information.
type Taxonomy ¶
type Taxonomy struct {
// contains filtered or unexported fields
}
A Taxonomy stores taxon IDs
func (*Taxonomy) AcceptedAndRanked ¶
AcceptedAndRanked return the accepted and ranked taxon from a given ID.
func (*Taxonomy) AddFromGBIF ¶
AddFromGBIF add a taxon from a GBIF ID, as well as all the parents up to the given rank.
Taxa will be added in a temporal space. To formally add the taxa to the taxonomy use the Stage method.
It requires an internet connection.
func (*Taxonomy) AddNameFromGBIF ¶
AddNameFromGBIF search for a taxon name in GBIF as well as all the parents up to the given rank.
If multiple taxons with the indicated name were found it will look for a single accepted name. If there are multiple accepted names, or all the names are synonyms, then it will return an ErrAmbiguous error.
Taxa will be added in a temporal space. To formally add the taxa to the taxonomy use the Stage method.
It requires an internet connection.
func (*Taxonomy) AddSpecies ¶
AddSpecies add a GBIF Species type from an external source.
func (*Taxonomy) Stage ¶
func (tx *Taxonomy) Stage()
Stage add the taxa in the temporal space to the taxonomy,