module ADIWG::Mdtranslator::Readers::Fgdc::TaxonSystem
Public Class Methods
unpack(xSystem, hTaxonomy, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb, line 20 def self.unpack(xSystem, hTaxonomy, hResponseObj) # instance classes needed in script intMetadataClass = InternalMetadata.new # taxonomy bio.2.1 (classsys) - taxonomic classification authority [] (required) # -> resourceInfo.taxonomy.taxonSystem axTaxClass = xSystem.xpath('./classsys') unless axTaxClass.empty? axTaxClass.each do |xTaxClass| hTaxonSystem = intMetadataClass.newTaxonSystem # taxonomy bio.2.1.1 (classcit) - taxonomic classification citation {citation} (required) # -> resourceInfo.taxonomy.taxonSystem.citation xCitation = xTaxClass.xpath('./classcit') unless xCitation.empty? hCitation = Citation.unpack(xCitation, hResponseObj) unless hCitation.nil? hTaxonSystem[:citation] = hCitation end end if xCitation.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy classification system citation missing' end # taxonomy bio.2.1.2 (classmod) - taxonomic classification modifications # -> resourceInfo.taxonomy.taxonSystem.modifications modifications = xTaxClass.xpath('./classmod').text unless modifications.empty? hTaxonSystem[:modifications] = modifications end hTaxonomy[:taxonSystem] << hTaxonSystem end end if axTaxClass.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy classification system is missing' end # taxonomy bio.2.2 (idref) - taxonomic identification reference [] {identifier} # -> resourceInfo.taxonomy.idReferences.authority axTaxRef = xSystem.xpath('./idref') unless axTaxRef.empty? axTaxRef.each do |xTaxRef| hCitation = Citation.unpack(xTaxRef, hResponseObj) unless hCitation.nil? hTaxonomy[:idReferences] << hCitation end end end # taxonomy bio.2.3 (ider) - taxonomic identifier [] {contact} # -> resourceInfo.taxonomy.observers.responsibility axObserver = xSystem.xpath('./ider') unless axObserver.empty? axObserver.each do |xObserver| hResponsibility = Contact.unpack(xObserver, hResponseObj) unless hResponsibility.nil? hResponsibility[:roleName] = 'observer' hTaxonomy[:observers] << hResponsibility end end end # taxonomy bio.2.4 (taxonpro) - taxonomic procedures (required) # -> resourceInfo.taxonomy.idProcedure procedures = xSystem.xpath('./taxonpro').text unless procedures.empty? hTaxonomy[:idProcedure] = procedures end if procedures.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy classification procedures are missing' end # taxonomy bio.2.5 (taxoncom) - taxonomic completeness # -> resourceInfo.taxonomy.idCompleteness completeness = xSystem.xpath('./taxoncom').text unless completeness.empty? hTaxonomy[:idCompleteness] = completeness end # taxonomy bio.2.6 (vouchers) - vouchers [] # -> resourceInfo.taxonomy.vouchers axVoucher = xSystem.xpath('./vouchers') unless axVoucher.empty? axVoucher.each do |xVoucher| hVoucher = intMetadataClass.newTaxonVoucher # taxonomy bio.2.6.1 (specimen) - specimen (required) # -> resourceInfo.taxonomy.vouchers.specimen specimen = xVoucher.xpath('./specimen').text unless specimen.empty? hVoucher[:specimen] = specimen end if procedures.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy voucher specimen is missing' end # taxonomy bio.2.6.2 (reposit) - repository {contact} (required) # -> resourceInfo.taxonomy.vouchers.repository xRepository = xVoucher.xpath('./reposit') unless xRepository.empty? hResponsibility = Contact.unpack(xRepository, hResponseObj) unless hResponsibility.nil? hResponsibility[:roleName] = 'custodian' hVoucher[:repository] = hResponsibility end end if xRepository.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO taxonomy voucher repository is missing' end hTaxonomy[:vouchers] << hVoucher end end return hTaxonomy end