Module: ADIWG::Mdtranslator::Readers::Fgdc::Lineage

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

Class Method Summary collapse

Class Method Details

.unpack(xLineage, hResponseObj) ⇒ Object



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
61
62
63
64
65
66
# 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