Module: Dwca::Import

Defined in:
lib/dwca/import.rb

Defined Under Namespace

Classes: Manager, TwObjects

Constant Summary

RUNTIME =
{
  'http://purl.org/dc/terms/modified'           => nil, # bubble up? 
  'http://purl.org/dc/terms/language'           => nil, # one of  http://www.ietf.org/rfc/rfc4646.txt
  'http://rs.tdwg.org/dwc/terms/collectionCode' => nil, # default='Insect Collection' the name, acronym, coden, or initialism identifying the collection or data set from which the record was derived.
  'http://rs.tdwg.org/dwc/terms/datasetID'      => nil, # An identifier for the set of data. May be a global unique identifier or an identifier specific to a collection or institution. 
  'http://rs.tdwg.org/dwc/terms/datasetName'    => nil, # default='Illinois Natural History Survey'  The name identifying the data set from which the record was derived.
  'http://rs.tdwg.org/dwc/terms/basisOfRecord'  => nil, # default='Preserved Specimen'               The specific nature of the data record - a subtype of the dcterms:type. Recommended best practice is to use a controlled vocabulary such as the Darwin Core Type Vocabulary (http://rs.tdwg.org/dwc/terms/type-vocabulary/index.htm). 
}
DWC2TW =
{
  otu: {
    'http://rs.tdwg.org/dwc/terms/scientificName'           => {in: :name=, out: nil},
  },

  biological_association: {
    'http://rs.tdwg.org/dwc/terms/associatedTaxa' => {in: nil, out: nil}
  },

  taxon_name: {
    'http://rs.tdwg.org/dwc/terms/originalNameUsage' => {in: :name=, out: nil},
    'http://rs.tdwg.org/dwc/terms/taxonID'                  => {in: :dwc_parse_taxon_id, out: :id},
    'http://rs.tdwg.org/dwc/terms/kingdom'                  => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/phylum'                   => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/class'                    => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/order'                    => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/family'                   => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/genus'                    => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/subgenus'                 => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/specificEpithet'          => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/infraspecificEpithet'     => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/scientificNameAuthorship' => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/scientificName'           => {in: nil,                 out: nil},
    'http://rs.tdwg.org/dwc/terms/nomenclaturalCode'        => {in: nil,                 out: :iczn_code?}
  },

  collection_object: { 
    'http://rs.tdwg.org/dwc/terms/institutionID'     => {in: nil,     out: nil},             # Who owns it
    'http://rs.tdwg.org/dwc/terms/institutionCode'   => {in: nil,     out: nil},             # The name (or acronym) in use by the institution having custody of the object(s) or information referred to in the record. 
    'http://rs.tdwg.org/dwc/terms/individualCount'   => {in: :total=, out: :total},
  },

  collecting_event: {
    'http://rs.tdwg.org/dwc/terms/samplingProtocol'  => {in: :verbatim_method=,            out: :verbatim_method},
    'http://rs.tdwg.org/dwc/terms/eventDate'         => {in: nil,                          out: nil},  # out: date_range 
    'http://rs.tdwg.org/dwc/terms/habitat'           => {in: :macro_habitat=,              out: :habitat},
    'http://rs.tdwg.org/dwc/terms/locality'          => {in: :verbatim_locality=,          out: :verbatim_locality},
    'http://rs.tdwg.org/dwc/terms/verbatimElevation' => {in: nil,                          out: :elevation},
    'http://rs.tdwg.org/dwc/terms/country'           => {in: nil,                          out: :country},
    'http://rs.tdwg.org/dwc/terms/stateProvince'     => {in: nil,                          out: :state},
    'http://rs.tdwg.org/dwc/terms/county'            => {in: nil,                          out: :county},
    'http://rs.tdwg.org/dwc/terms/waterBody'         => {in: nil,                          out: :water_body}                                    
  },

  georeference: {  
    'http://rs.tdwg.org/dwc/terms/coordinateUncertaintyInMeters' => {in: nil, out: nil},
    'http://rs.tdwg.org/dwc/terms/decimalLatitude'               => {in: :verbatim_latitude, out: :verbatim_latitude},
    'http://rs.tdwg.org/dwc/terms/decimalLongitude'              => {in: :verbatim_longitude, out: :verbatim_longitude},
  },

  biocuration_classification: {
    'http://rs.tdwg.org/dwc/terms/lifeStage' => {in: :dwc_parse_life_stage, out: nil},
    'http://rs.tdwg.org/dwc/terms/sex'       => {in: :dwc_parse_sex,        out: :sex},
  },

  identifier: {
    'http://rs.tdwg.org/dwc/terms/catalogNumber' => {in: :identifier=, out: nil},
  },

  taxon_determination: {
    'http://rs.tdwg.org/dwc/terms/identifiedBy'   => {in: :dwc_parse_identifiedBy,   out: :identified_by},
    'http://rs.tdwg.org/dwc/terms/dateIdentified' => {in: :dwc_parse_dateIdentified, out: :date_identified}
  },

  type_specimen: {
    'http://rs.tdwg.org/dwc/terms/typeStatus' => {in: :type_type, out: :type_type}
  },
}

Class Method Summary (collapse)

Class Method Details

+ (Object) new_dwc(path_to_archive)



3
4
5
# File 'lib/dwca/import.rb', line 3

def self.new_dwc(path_to_archive)
  DarwinCore.new(path_to_archive)   
end

+ (Object) new_manager(darwin_core_archive)



84
85
86
87
88
89
90
91
# File 'lib/dwca/import.rb', line 84

def self.new_manager(darwin_core_archive)
  data, errors = darwin_core_archive.core.read
  Manger.new(
    data: data,
    errors: errors,
    core_fields: darwin_core_archive.core.fields 
  )
end