module ADIWG::Mdtranslator::Readers::Fgdc::CodeSet
Public Class Methods
unpack(axDomains, code, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb, line 18 def self.unpack(axDomains, code, hResponseObj) # instance classes needed in script intMetadataClass = InternalMetadata.new aDomains = [] axCodeSets = axDomains.xpath('./codesetd') unless axCodeSets.empty? axCodeSets.each do |xCodeSet| hDomain = intMetadataClass.newDictionaryDomain hDomain[:domainId] = UUIDTools::UUID.random_create.to_s hDomain[:domainCode] = code hDomain[:domainDescription] = 'FGDC codeSet domain' # entity attribute 5.1.2.4.3.1 (codesetn) - codeset name (required) # -> dataDictionary.domains.commonName name = xCodeSet.xpath('./codesetn').text unless name.empty? hDomain[:domainName] = name end if name.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: codeset domain name is missing' end # entity attribute 5.1.2.4.3.2 (codesets) - codeset source name (required) # -> dataDictionary.domains.domainReference.title hCitation = intMetadataClass.newCitation title = xCodeSet.xpath('./codesets').text unless title.empty? hCitation[:title] = title hDomain[:domainReference] = hCitation end if title.empty? hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: codeset domain source is missing' end aDomains << hDomain end end return aDomains end