module ADIWG::Mdtranslator::Readers::Fgdc::EntityAttribute

Public Class Methods

unpack(xEntity, title, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb, line 20
def self.unpack(xEntity, title, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hDictionary = intMetadataClass.newDataDictionary
   hCitation = intMetadataClass.newCitation
   hDictionary[:citation] = hCitation

   # add dictionary title
   hCitation[:title] = 'Data Dictionary for: ' + title

   # entity attribute 5.1 (detailed) - entity attribute detailed description
   axDetail = xEntity.xpath('./detailed')
   unless axDetail.empty?
      axDetail.each do |xDetail|
         hEntity = Entity.unpack(xDetail, hDictionary, hResponseObj)
         unless hEntity.nil?
            hDictionary[:entities] << hEntity
         end
      end
   end

   # entity attribute 5.2 (overview) - entity attribute summary  description
   axOverview = xEntity.xpath('./overview')
   unless axOverview.empty?
      axOverview.each do |xOverview|
         hEntity = EntityOverview.unpack(xOverview, hResponseObj)
         unless hEntity.nil?
            hDictionary[:entities] << hEntity
         end
      end
   end

   # error messages
   if axDetail.empty? && axOverview.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: entityAttribute description is missing'
   end

   return hDictionary

end