module ADIWG::Mdtranslator::Readers::Fgdc::Taxonomy
Public Class Methods
unpack(xTaxonomy, hResourceInfo, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb, line 20 def self.unpack(xTaxonomy, hResourceInfo, hResponseObj) # instance classes needed in script intMetadataClass = InternalMetadata.new hTaxonomy = intMetadataClass.newTaxonomy # taxonomy bio.1 (keywtax) - taxonomic keywords [] {keyword} (required) # -> resourceInfo.keywords axKeywords = xTaxonomy.xpath('./keywtax') unless axKeywords.empty? axKeywords.each do |xKeyword| Keyword.unpack(xKeyword, hResourceInfo, hResponseObj) end end if axKeywords.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy keywords are missing' end # taxonomy bio.2 (taxonsys) - taxonomic system xSystem = xTaxonomy.xpath('./taxonsys') unless xSystem.empty? TaxonSystem.unpack(xSystem, hTaxonomy, hResponseObj) end # taxonomy bio.3 (taxongen) - general taxonomic coverage # -> resourceInfo.taxonomy.generalScope general = xTaxonomy.xpath('./taxongen').text unless general.empty? hTaxonomy[:generalScope] = general end # taxonomy bio.4 (taxoncl) - taxonomic classification (required) # -> resourceInfo.taxonomy.taxonClass xTaxClass = xTaxonomy.xpath('./taxoncl') unless xTaxClass.empty? hTaxonClass = TaxonClass.unpack(xTaxClass, hResponseObj) unless hTaxonClass.nil? hTaxonomy[:taxonClasses] << hTaxonClass end end if xTaxClass.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy classification is missing' end return hTaxonomy end