Sha256: 6fdbf31c5d9d78d86f78172971b7e68d91972cf7f0737faba32eacdba41b0ffc

Contents?: true

Size: 1.7 KB

Versions: 5

Compression:

Stored size: 1.7 KB

Contents

# Reader - fgdc to internal data structure
# unpack fgdc entity and attribute overview

# History:
#  Stan Smith 2017-09-06 original script

require 'uuidtools'
require 'nokogiri'
require 'adiwg/mdtranslator/internal/internal_metadata_obj'

module ADIWG
   module Mdtranslator
      module Readers
         module Fgdc

            module EntityOverview

               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[:entityCode] = 'overview'

                  # entity attribute 5.2.1 (eaover) - entity attribute overview
                  # -> dataDictionary.entities.entityDefinition
                  definition = xOverview.xpath('./eaover').text
                  unless definition.empty?
                     hEntity[:entityDefinition] = definition
                  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

            end

         end
      end
   end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb