Module: ADIWG::Mdtranslator::Readers::Fgdc::EntityOverview

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

Class Method Summary collapse

Class Method Details

.unpack(xOverview, hResponseObj) ⇒ Object



18
19
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
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb', line 18

def self.unpack(xOverview, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hEntity = intMetadataClass.newEntity
   hEntity[:entityId] = UUIDTools::UUID.random_create.to_s
   hEntity[:entityName] = 'Entity Overview'
   hEntity[:entityCode] = 'overview'

   # entity attribute 5.2.1 (eaover) - entity attribute overview (required)
   # -> dataDictionary.entities.entityDefinition
   definition = xOverview.xpath('./eaover').text
   unless definition.empty?
      hEntity[:entityDefinition] = definition
   end
   if definition.empty?
      hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: entityAttribute overview definition is missing'
   end

   # entity attribute 5.2.2 (eadetcit) - entity attribute detail citation []
   # -> dataDictionary.entities.entityReference.title
   axReference = xOverview.xpath('./eadetcit')
   axReference.each do |xReference|
      reference = xReference.text
      unless reference.empty?
         hCitation = intMetadataClass.newCitation
         hCitation[:title] = reference
         hEntity[:entityReferences] << hCitation
      end
   end

   return hEntity

end