module ADIWG::Mdtranslator::Readers::Fgdc::Lineage

Public Class Methods

unpack(xLineage, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb, line 21
def self.unpack(xLineage, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hLineage = intMetadataClass.newLineage

   # data quality 2.5 (lineage) - lineage
   unless xLineage.empty?

      # lineage bio (method) - methodology [] (required)
      axMethods = xLineage.xpath('./method')
      unless axMethods.empty?
         Method.unpack(hLineage, axMethods, hResponseObj)
      end
      if axMethods.empty?
         hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: BIO lineage methodology section is missing'
      end

      # lineage 2.5.1 (srcinfo) - source information []
      axSource = xLineage.xpath('./srcinfo')
      unless axSource.empty?
         axSource.each do |xSource|
            hSource = Source.unpack(xSource, hResponseObj)
            hLineage[:dataSources] << hSource
         end
      end

      # lineage 2.5.2 (procstep) - process step [] (required)
      axProcess = xLineage.xpath('./procstep')
      unless axProcess.empty?
         axProcess.each do |xProcess|
            hProcess = Process.unpack(xProcess, hLineage, hResponseObj)
            hLineage[:processSteps] << hProcess
         end
      end
      if axProcess.empty?
         hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: lineage process step section is missing'
      end

      return hLineage

   end

   return nil

end