Class: ADIWG::Mdtranslator::Writers::Iso19115_2::DQ_DataQuality

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, responseObj) ⇒ DQ_DataQuality

Returns a new instance of DQ_DataQuality.



29
30
31
32
33
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb', line 29

def initialize(xml, responseObj)
   @xml = xml
   @hResponseObj = responseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Instance Method Details

#writeXML(hLineage, options = {}) ⇒ Object



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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb', line 35

def writeXML(hLineage, options = {})

   hDataQuality = {}
   dataQualityNamespace = 'gmd'
   if options[:dataQualityType] == 'mdb'
      hDataQuality = hLineage
      dataQualityNamespace = 'mdq'
   end

   # classes used
   scopeClass = DQ_Scope.new(@xml, @hResponseObj)
   lineClass = LI_Lineage.new(@xml, @hResponseObj)
   reportClass = DataQualityReport.new(@xml, @hResponseObj)
   citationClass = CI_Citation.new(@xml, @hResponseObj)

   outContext = 'data quality'

   @xml.tag!("#{dataQualityNamespace}:DQ_DataQuality") do

      # data quality - scope {DQ_Scope} (required)
      if options[:dataQualityType] == 'mdb'
         @xml.tag!('mdq:scope') do
            @xml.tag!('mcc:MD_Scope') do
               @xml.tag!('mcc:level') do
                  @xml.tag!('mcc:MD_ScopeCode', codeList: "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode", codeListValue: "series")
               end
            end
         end
      else
         hScope = hLineage[:resourceScope]
         unless hScope.nil? || hScope.empty?
            @xml.tag!('gmd:scope') do
               scopeClass.writeXML(hScope, outContext)
            end
         end
         if hScope.nil? || hScope.empty?
            @NameSpace.issueWarning(60, 'gmd:scope', outContext)
         end
      end


      unless hDataQuality[:standaloneQualityReport].nil? || hDataQuality[:standaloneQualityReport].empty?

         @xml.tag!('mdq:standaloneQualityReport') do
            @xml.tag!('mdq:DQ_StandaloneQualityReportInformation') do
               # reportReference
               unless hDataQuality[:standaloneQualityReport][:reportReference].nil? || hDataQuality[:standaloneQualityReport][:reportReference].empty?
                  @xml.tag!('mdq:reportReference') do
                     citationClass.writeXML(hDataQuality[:standaloneQualityReport][:reportReference])
                  end
               end

               unless hDataQuality[:standaloneQualityReport][:abstract].nil? || hDataQuality[:standaloneQualityReport][:abstract].empty?
                  # abstract
                  @xml.tag!('mdq:abstract') do
                     @xml.tag!('gco:CharacterString', hDataQuality[:standaloneQualityReport][:abstract])
                  end
               end
            end
         end

      end

      # date quality - report (moved to ISO 19157)
      unless hDataQuality[:report].nil?
         hDataQuality[:report].each do |hReport|
            unless hReport.nil? || hReport.empty?
               reportClass.writeXML(hReport)
            end
         end
      end

      # data quality - lineage
      unless options[:dataQualityType] == 'mdb'
         @xml.tag!('gmd:lineage') do
            lineClass.writeXML(hLineage)
         end
      end

   end # gmd:DQ_DataQuality tag
end