Module: ADIWG::Mdtranslator::Readers::Fgdc::EntityAttribute

Defined in:
lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb

Class Method Summary collapse

Class Method Details

.unpack(xEntity, title, hResponseObj) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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