adiwg-mdtranslator 2.18.0rc2 → 2.18.0rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/adiwg-mdtranslator.gemspec +1 -1
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +29 -17
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +3 -1
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +122 -7
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_conformanceResult.rb +49 -0
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageResult.rb +66 -0
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQuality.rb +69 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQualityReport.rb +109 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_descriptiveResult.rb +40 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_evaluationMethod.rb +80 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +11 -0
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_quantitativeResult.rb +47 -0
  14. data/lib/adiwg/mdtranslator/version.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +64 -4
  16. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +14 -0
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb +47 -0
  18. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataQuality.rb +64 -0
  19. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataQualityReport.rb +95 -0
  20. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +10 -10
  21. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +16 -0
  22. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +60 -11
  23. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQualityReport.rb +95 -0
  24. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +13 -1
  25. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_conformanceResult.rb +25 -0
  26. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dataQuality.rb +32 -0
  27. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dataQualityReport.rb +33 -0
  28. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_descriptiveResult.rb +23 -0
  29. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_evaluationMethod.rb +33 -0
  30. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb +2 -0
  31. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_qualityMeasure.rb +21 -0
  32. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_quantitativeResult.rb +24 -0
  33. metadata +22 -4
@@ -0,0 +1,80 @@
1
+ require_relative 'module_citation'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Readers
6
+ module MdJson
7
+
8
+ module EvaluationMethod
9
+ def self.unpack(hMethod, responseObj, inContext = nil)
10
+
11
+ intMetadataClass = InternalMetadata.new
12
+ intMethod = intMetadataClass.newEvaluationMethod
13
+
14
+ # type: nil,
15
+ if hMethod.has_key?('type')
16
+ intMethod[:type] = hMethod['type']
17
+ end
18
+
19
+ # dateTime: [],
20
+ if hMethod.has_key?('dateTime')
21
+ intMethod[:dateTime] = hMethod['dateTime']
22
+ end
23
+
24
+ # methodDescription: nil,
25
+ if hMethod.has_key?('methodDescription')
26
+ intMethod[:methodDescription] = hMethod['methodDescription']
27
+ end
28
+
29
+ # evaluationProcedure: {},
30
+ if hMethod.has_key?('evaluationProcedure')
31
+ intMethod[:evaluationProcedure] = Citation.unpack(hMethod['evaluationProcedure'], responseObj)
32
+ end
33
+
34
+ # referenceDocuments: [],
35
+ if hMethod.has_key?('referenceDocuments')
36
+
37
+ hMethod['referenceDocuments'].each do |item|
38
+ hReturn = Citation.unpack(item, responseObj)
39
+ unless hReturn.nil?
40
+ intMethod[:referenceDocuments] << hReturn
41
+ end
42
+ end
43
+
44
+ intMethod[:referenceDocuments] = hMethod['referenceDocuments']
45
+ end
46
+
47
+ # evaluationMethodType: nil,
48
+ if hMethod.has_key?('evaluationMethodType')
49
+ intMethod[:evaluationMethodType] = hMethod['evaluationMethodType']
50
+ end
51
+
52
+ # deductiveSource: nil,
53
+ if hMethod.has_key?('deductiveSource')
54
+ intMethod[:deductiveSource] = hMethod['deductiveSource']
55
+ end
56
+
57
+ # samplingScheme: nil,
58
+ if hMethod.has_key?('samplingScheme')
59
+ intMethod[:samplingScheme] = hMethod['samplingScheme']
60
+ end
61
+
62
+ # lotDescription: nil,
63
+ if hMethod.has_key?('lotDescription')
64
+ intMethod[:lotDescription] = hMethod['lotDescription']
65
+ end
66
+
67
+ # samplingRatio: nil
68
+ if hMethod.has_key?('samplingRatio')
69
+ intMethod[:samplingRatio] = hMethod['samplingRatio']
70
+ end
71
+
72
+ return intMethod
73
+
74
+ end
75
+ end
76
+
77
+ end
78
+ end
79
+ end
80
+ end
@@ -12,6 +12,7 @@ require_relative 'module_distribution'
12
12
  require_relative 'module_associatedResource'
13
13
  require_relative 'module_additionalDocumentation'
14
14
  require_relative 'module_funding'
15
+ require_relative 'module_dataQuality'
15
16
 
16
17
  module ADIWG
17
18
  module Mdtranslator
@@ -117,6 +118,16 @@ module ADIWG
117
118
  end
118
119
  end
119
120
 
121
+ if hMetadata.has_key?('dataQuality')
122
+ aItems = hMetadata['dataQuality']
123
+ aItems.each do |item|
124
+ hReturn = DataQuality.unpack(item, responseObj)
125
+ unless hReturn.nil?
126
+ intMetadata[:dataQuality] << hReturn
127
+ end
128
+ end
129
+ end
130
+
120
131
  return intMetadata
121
132
 
122
133
  end
@@ -0,0 +1,47 @@
1
+ require_relative 'module_scope'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Readers
6
+ module MdJson
7
+
8
+ module QuantitativeResult
9
+ def self.unpack(hResult, responseObj, inContext = nil)
10
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
11
+
12
+ if hResult.empty?
13
+ @MessagePath.issueWarning(80, responseObj, inContext)
14
+ return nil
15
+ end
16
+
17
+ intMetadataClass = InternalMetadata.new
18
+ intResult = intMetadataClass.newQuantitativeResult
19
+
20
+ if hResult.has_key?('dateTime')
21
+ intResult[:dateTime] = hResult['dateTime']
22
+ end
23
+
24
+ if hResult.has_key?('scope')
25
+ intResult[:scope] = Scope.unpack(hResult['scope'], responseObj)
26
+ end
27
+
28
+ if hResult.has_key?('value')
29
+ intResult[:value] = hResult['value']
30
+ end
31
+
32
+ if hResult.has_key?('valueUnits')
33
+ intResult[:valueUnits] = hResult['valueUnits']
34
+ end
35
+
36
+ if hResult.has_key?('valueRecordType')
37
+ intResult[:valueRecordType] = hResult['valueRecordType']
38
+ end
39
+
40
+ return intResult
41
+ end
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.18.0rc2"
112
+ VERSION = "2.18.0rc4"
113
113
  end
114
114
  end
115
115
 
@@ -25,19 +25,79 @@ module ADIWG
25
25
  # classes used
26
26
  lineageClass = Lineage.new(@xml, @hResponseObj)
27
27
 
28
+ hDataQuality = intObj.dig(:metadata, :dataQuality, 0)
29
+
28
30
  # data quality 2.1 (attracc) - attribute accuracy (not implemented)
29
- if @hResponseObj[:writerShowTags]
31
+ attribute_completeness_report = hDataQuality[:report].find do |report|
32
+ report[:type] == 'DQ_NonQuantitativeAttributeCompleteness' &&
33
+ !report.dig(:descriptiveResult, 0, :statement).nil?
34
+ end
35
+
36
+ if attribute_completeness_report
37
+ @xml.tag!('attracc') do
38
+ @xml.tag!('attraccr', attribute_completeness_report[:descriptiveResult][0][:statement])
39
+ end
40
+ elsif @hResponseObj[:writerShowTags]
30
41
  @xml.tag!('attracc', 'Not Reported')
31
42
  end
32
43
 
33
44
  # data quality 2.2 (logic) - logical consistency (not implemented) (required)
34
- @xml.tag!('logic', 'Not Reported')
45
+ logic_report = hDataQuality[:report].find do |report|
46
+ report[:type] == 'DQ_ConceptualConsistency' &&
47
+ !report.dig(:qualityMeasure, :description).nil?
48
+ end
49
+
50
+ if logic = logic_report&.dig(:qualityMeasure, :decription)
51
+ @xml.tag!('logic', logic)
52
+ else
53
+ @xml.tag!('logic', 'Not Reported')
54
+ end
35
55
 
36
56
  # data quality 2.3 (complete) - completion report (not implemented) (required)
37
- @xml.tag!('complete', 'Not Reported')
57
+ completeness_report = hDataQuality[:report].find do |report|
58
+ report[:type] == 'DQ_CompletenessOmission' &&
59
+ !report.dig(:descriptiveResult, 0, :statement).nil?
60
+ end
61
+
62
+ if complete = completeness_report&.dig(:descriptiveResult, 0, :statement)
63
+ @xml.tag!('complete', complete)
64
+ else
65
+ @xml.tag!('complete', 'Not Reported')
66
+ end
38
67
 
39
68
  # data quality 2.4 (position) - positional accuracy (not implemented)
40
- if @hResponseObj[:writerShowTags]
69
+
70
+
71
+ horizontal_positional_accuracy_report = hDataQuality[:report].find do |report|
72
+ report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' &&
73
+ report.dig(:qualityMeasure, :name) == 'Horizontal Positional Accuracy Report'
74
+ end
75
+
76
+ horizpar = horizontal_positional_accuracy_report&.dig(:evaluationMethod, :methodDescription)
77
+
78
+
79
+ vertical_positional_accuracy_report = hDataQuality[:report].find do |report|
80
+ report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' &&
81
+ report.dig(:qualityMeasure, :name) == 'Vertical Positional Accuracy Report'
82
+ end
83
+
84
+ vertaccr = vertical_positional_accuracy_report&.dig(:evaluationMethod, :methodDescription)
85
+
86
+ if horizpar || vertaccr
87
+ @xml.tag!('posacc') do
88
+ if horizpar
89
+ @xml.tag!('horizpa') do
90
+ @xml.tag!('horizpar', horizpar)
91
+ end
92
+ end
93
+
94
+ if vertaccr
95
+ @xml.tag!('vertacc') do
96
+ @xml.tag!('vertaccr', vertaccr)
97
+ end
98
+ end
99
+ end
100
+ elsif @hResponseObj[:writerShowTags]
41
101
  @xml.tag!('position', 'Not Reported')
42
102
  end
43
103
 
@@ -12,6 +12,7 @@
12
12
  require_relative 'html_contact'
13
13
  require_relative 'html_metadataInfo'
14
14
  require_relative 'html_resourceInfo'
15
+ require_relative 'html_dataQuality'
15
16
  require_relative 'html_lineage'
16
17
  require_relative 'html_distribution'
17
18
  require_relative 'html_associatedResource'
@@ -38,6 +39,7 @@ module ADIWG
38
39
  metaInfoClass = Html_MetadataInfo.new(@html)
39
40
  contactClass = Html_Contact.new(@html)
40
41
  resourceClass = Html_ResourceInfo.new(@html)
42
+ dataQualityClass = Html_DataQuality.new(@html)
41
43
  lineageClass = Html_Lineage.new(@html)
42
44
  distributionClass = Html_Distribution.new(@html)
43
45
  associatedClass = Html_AssociatedResource.new(@html)
@@ -51,6 +53,7 @@ module ADIWG
51
53
  aContacts = intObj[:contacts]
52
54
  hMetaInfo = intObj[:metadata][:metadataInfo]
53
55
  hResourceInfo = intObj[:metadata][:resourceInfo]
56
+ aDataQuality = intObj[:metadata][:dataQuality]
54
57
  aLineage = intObj[:metadata][:lineageInfo]
55
58
  aDistribution = intObj[:metadata][:distributorInfo]
56
59
  aAssociated = intObj[:metadata][:associatedResources]
@@ -161,6 +164,17 @@ module ADIWG
161
164
  end
162
165
  end
163
166
 
167
+ unless aDataQuality.nil? || aDataQuality.empty?
168
+ @html.details do
169
+ @html.summary('Data Quality', {'id' => 'body-dataQuality', 'class' => 'h2'})
170
+ aDataQuality.each do |hDataQuality|
171
+ @html.section(:class => 'block') do
172
+ dataQualityClass.writeHtml(hDataQuality)
173
+ end
174
+ end
175
+ end
176
+ end
177
+
164
178
  # lineage section
165
179
  unless aLineage.empty?
166
180
  @html.details do
@@ -0,0 +1,47 @@
1
+ require_relative 'html_citation'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Html
7
+ class Html_DataQuality
8
+ def initialize(html)
9
+ @html = html
10
+ end
11
+
12
+ def writeHtml(hDataQuality)
13
+ citationClass = Html_Citation.new(@html)
14
+
15
+ unless hDataQuality[:standaloneQualityReport].nil? ||
16
+ ( hDataQuality[:standaloneQualityReport][:abstract].nil? &&
17
+ hDataQuality[:standaloneQualityReport][:reportReference].nil? )
18
+ report = hDataQuality[:standaloneQualityReport]
19
+
20
+ @html.section(class: 'block') do
21
+ @html.details do
22
+ @html.summary('Standalone Quality Report', {'class' => 'h5'})
23
+ unless report[:abstract].nil?
24
+ @html.section(class: 'block') do
25
+ @html.em('Abstract:')
26
+ @html.text!(report[:abstract])
27
+ end
28
+ end
29
+
30
+ unless report[:reportReference].nil?
31
+ @html.details do
32
+ @html.summary('Report Reference', {'class' => 'h5'})
33
+ @html.section(class: 'block') do
34
+ citationClass.writeHtml(report[:reportReference])
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,64 @@
1
+ require_relative 'class_dataQualityReport'
2
+ require_relative 'class_citation'
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Iso19115_1
8
+
9
+ class DQ_DataQuality
10
+ def initialize(xml, hResponseObj)
11
+ @xml = xml
12
+ @hResponseObj = hResponseObj
13
+ end
14
+
15
+ def writeXML(hDataQuality)
16
+
17
+ reportClass = DataQualityReport.new(@xml, @hResponseObj)
18
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
19
+
20
+ @xml.tag!('mdq:DQ_DataQuality') do
21
+
22
+ @xml.tag!('mdq:scope') do
23
+ @xml.tag!('mcc:MD_Scope') do
24
+ @xml.tag!('mcc:level') do
25
+ @xml.tag!('mcc:MD_ScopeCode', codeList: "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode", codeListValue: "series")
26
+ end
27
+ end
28
+ end
29
+
30
+ unless hDataQuality[:standaloneQualityReport].nil? || hDataQuality[:standaloneQualityReport].empty?
31
+
32
+ @xml.tag!('mdq:standaloneQualityReport') do
33
+ @xml.tag!('mdq:DQ_StandaloneQualityReportInformation') do
34
+ # reportReference
35
+
36
+ @xml.tag!('mdq:reportReference') do
37
+ citationClass.writeXML(hDataQuality[:standaloneQualityReport][:reportReference])
38
+ end
39
+
40
+
41
+ # abstract
42
+ @xml.tag!('mdq:abstract') do
43
+ @xml.tag!('gco:CharacterString', hDataQuality[:standaloneQualityReport][:abstract])
44
+ end
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ # reports
51
+ hDataQuality[:report].each do |hReport|
52
+ unless hReport.nil? || hReport.empty?
53
+ reportClass.writeXML(hReport)
54
+ end
55
+
56
+ end
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,95 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Iso19115_1
5
+
6
+ class DataQualityReport
7
+ def initialize(xml, hResponseObj)
8
+ @xml = xml
9
+ @hResponseObj = hResponseObj
10
+ end
11
+
12
+ def writeXML(hReport)
13
+ # require 'pry'; binding.pry
14
+
15
+ @xml.tag!('mdq:report') do
16
+ @xml.tag!("mdq:#{hReport[:type]}") do
17
+
18
+ # conformanceResult []
19
+
20
+ # coverageResult []
21
+
22
+ # descriptiveResult []
23
+ unless hReport[:descriptiveResult].nil? || hReport[:descriptiveResult].empty?
24
+ hReport[:descriptiveResult].each do |descriptiveResult|
25
+ @xml.tag!('mdq:result') do
26
+ @xml.tag!('mdq:DQ_DescriptiveResult') do
27
+ unless descriptiveResult[:statement].nil? || descriptiveResult[:statement].empty?
28
+ @xml.tag!('mdq:statement') do
29
+ @xml.tag!('gco:CharacterString', descriptiveResult[:statement])
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ # evaluationMethod {}
38
+ evaluationMethod = hReport[:evaluationMethod]
39
+ unless evaluationMethod.nil? || evaluationMethod.empty?
40
+ @xml.tag!('mdq:evaluationMethod') do
41
+ @xml.tag!('mdq:DQ_EvaluationMethod') do
42
+ @xml.tag!('mdq:evaluationMethodDescription') do
43
+ @xml.tag!('gco:CharacterString', evaluationMethod[:methodDescription])
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ # qualityMeasure {}
50
+ qualityMeasure = hReport[:qualityMeasure]
51
+ unless qualityMeasure.nil? || qualityMeasure.empty?
52
+ @xml.tag!('mdq:measure') do
53
+ @xml.tag!('mdq:DQ_MeasureReference') do
54
+ unless qualityMeasure[:name].nil?
55
+ qualityMeasure[:name].each do |value|
56
+ @xml.tag!('mdq:nameOfMeasure') do
57
+ @xml.tag!('gco:CharacterString', value)
58
+ end
59
+ end
60
+ end
61
+
62
+ unless qualityMeasure[:description].nil?
63
+ @xml.tag!('mdq:measureDescription') do
64
+ @xml.tag!('gco:CharacterString', qualityMeasure[:description])
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+
72
+ # quantitativeResult []
73
+ unless hReport[:quantitativeResult].nil? || hReport[:quantitativeResult].empty?
74
+ hReport[:quantitativeResult].each do |quantitativeResult|
75
+ @xml.tag!('mdq:result') do
76
+ @xml.tag!('mdq:DQ_QuantitativeResult') do
77
+ quantitativeResult[:value].each do |value|
78
+ @xml.tag!('mdq:value') do
79
+ @xml.tag!('gco:Record', value)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -62,16 +62,6 @@ module ADIWG
62
62
  @xml.tag!('cit:contactInfo')
63
63
  end
64
64
 
65
- # individual - position
66
- unless hContact[:positionName].nil?
67
- @xml.tag!('cit:positionName') do
68
- @xml.tag!('gco:CharacterString', hContact[:positionName])
69
- end
70
- end
71
- if hContact[:positionName].nil? && @hResponseObj[:writerShowTags]
72
- @xml.tag!('cit:positionName')
73
- end
74
-
75
65
  # individual - party identifier
76
66
  if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0
77
67
  hContact[:externalIdentifier].each do |identifier|
@@ -91,6 +81,16 @@ module ADIWG
91
81
  end
92
82
  end
93
83
  end
84
+
85
+ # individual - position
86
+ unless hContact[:positionName].nil?
87
+ @xml.tag!('cit:positionName') do
88
+ @xml.tag!('gco:CharacterString', hContact[:positionName])
89
+ end
90
+ end
91
+ if hContact[:positionName].nil? && @hResponseObj[:writerShowTags]
92
+ @xml.tag!('cit:positionName')
93
+ end
94
94
 
95
95
  end
96
96
  end
@@ -18,6 +18,7 @@ require_relative 'class_onlineResource'
18
18
  require_relative 'class_coverageDescription'
19
19
  require_relative 'class_imageDescription'
20
20
  require_relative 'class_distribution'
21
+ require_relative 'class_dataQuality'
21
22
  require_relative 'class_lineage'
22
23
  require_relative 'class_constraint'
23
24
  require_relative 'class_dataIdentification'
@@ -54,6 +55,7 @@ module ADIWG
54
55
  coverageClass = MD_CoverageDescription.new(@xml, @hResponseObj)
55
56
  imageClass = MD_ImageDescription.new(@xml, @hResponseObj)
56
57
  distributionClass = MD_Distribution.new(@xml, @hResponseObj)
58
+ dataQualityClass = DQ_DataQuality.new(@xml, @hResponseObj)
57
59
  lineageClass = LI_Lineage.new(@xml, @hResponseObj)
58
60
  constraintClass = Constraint.new(@xml, @hResponseObj)
59
61
  maintenanceClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
@@ -66,6 +68,7 @@ module ADIWG
66
68
  hMetaInfo = hMetadata[:metadataInfo]
67
69
  hResInfo = hMetadata[:resourceInfo]
68
70
  aDistributions = hMetadata[:distributorInfo]
71
+ aDataQuality = hMetadata[:dataQuality]
69
72
  aLineage = hMetadata[:lineageInfo]
70
73
  aDictionaries = intObj[:dataDictionaries]
71
74
  version = @hResponseObj[:translatorVersion]
@@ -342,6 +345,19 @@ module ADIWG
342
345
  @xml.tag!('mdb:distributionInfo')
343
346
  end
344
347
 
348
+ # metadata information - data quality [] { DQ_DataQuality}
349
+ aDataQuality.each do |hDataQuality|
350
+ unless hDataQuality.empty?
351
+ @xml.tag!('mdb:dataQualityInfo') do
352
+ dataQualityClass.writeXML(hDataQuality)
353
+ end
354
+ end
355
+ end
356
+ if aDataQuality.empty? && @hResponseObj[:writeShowTags]
357
+ @xml.tag('mdb:dataQualityInfo')
358
+ end
359
+
360
+
345
361
  # metadata information - resource lineage [] {LI_Lineage}
346
362
  aLineage.each do |hLineage|
347
363
  @xml.tag!('mdb:resourceLineage') do
@@ -16,6 +16,8 @@
16
16
  require_relative '../iso19115_2_writer'
17
17
  require_relative 'class_scope'
18
18
  require_relative 'class_lineage'
19
+ require_relative 'class_dataQualityReport'
20
+ require_relative 'class_citation'
19
21
 
20
22
  module ADIWG
21
23
  module Mdtranslator
@@ -30,32 +32,79 @@ module ADIWG
30
32
  @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
31
33
  end
32
34
 
33
- def writeXML(hLineage)
35
+ def writeXML(hLineage, options = {})
36
+
37
+ hDataQuality = {}
38
+ dataQualityNamespace = 'gmd'
39
+ if options[:dataQualityType] == 'mdb'
40
+ hDataQuality = hLineage
41
+ dataQualityNamespace = 'mdq'
42
+ end
34
43
 
35
44
  # classes used
36
45
  scopeClass = DQ_Scope.new(@xml, @hResponseObj)
37
46
  lineClass = LI_Lineage.new(@xml, @hResponseObj)
47
+ reportClass = DataQualityReport.new(@xml, @hResponseObj)
48
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
38
49
 
39
- outContext = 'data quality - lineage'
50
+ outContext = 'data quality'
40
51
 
41
- @xml.tag!('gmd:DQ_DataQuality') do
52
+ @xml.tag!("#{dataQualityNamespace}:DQ_DataQuality") do
42
53
 
43
54
  # data quality - scope {DQ_Scope} (required)
44
- hScope = hLineage[:resourceScope]
45
- unless hScope.empty?
46
- @xml.tag!('gmd:scope') do
47
- scopeClass.writeXML(hScope, outContext)
55
+ if options[:dataQualityType] == 'mdb'
56
+ @xml.tag!('mdq:scope') do
57
+ @xml.tag!('mcc:MD_Scope') do
58
+ @xml.tag!('mcc:level') do
59
+ @xml.tag!('mcc:MD_ScopeCode', codeList: "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_ScopeCode", codeListValue: "series")
60
+ end
61
+ end
62
+ end
63
+ else
64
+ hScope = hLineage[:resourceScope]
65
+ unless hScope.nil? || hScope.empty?
66
+ @xml.tag!('gmd:scope') do
67
+ scopeClass.writeXML(hScope, outContext)
68
+ end
69
+ end
70
+ if hScope.nil? || hScope.empty?
71
+ @NameSpace.issueWarning(60, 'gmd:scope', outContext)
48
72
  end
49
73
  end
50
- if hScope.empty?
51
- @NameSpace.issueWarning(60, 'gmd:scope', outContext)
74
+
75
+
76
+ unless hDataQuality[:standaloneQualityReport].nil? || hDataQuality[:standaloneQualityReport].empty?
77
+
78
+ @xml.tag!('mdq:standaloneQualityReport') do
79
+ @xml.tag!('mdq:DQ_StandaloneQualityReportInformation') do
80
+ # reportReference
81
+ @xml.tag!('mdq:reportReference') do
82
+ citationClass.writeXML(hDataQuality[:standaloneQualityReport][:reportReference])
83
+ end
84
+
85
+ # abstract
86
+ @xml.tag!('mdq:abstract') do
87
+ @xml.tag!('gco:CharacterString', hDataQuality[:standaloneQualityReport][:abstract])
88
+ end
89
+ end
90
+ end
91
+
52
92
  end
53
93
 
54
94
  # date quality - report (moved to ISO 19157)
95
+ unless hDataQuality[:report].nil?
96
+ hDataQuality[:report].each do |hReport|
97
+ unless hReport.nil? || hReport.empty?
98
+ reportClass.writeXML(hReport)
99
+ end
100
+ end
101
+ end
55
102
 
56
103
  # data quality - lineage
57
- @xml.tag!('gmd:lineage') do
58
- lineClass.writeXML(hLineage)
104
+ unless options[:dataQualityType] == 'mdb'
105
+ @xml.tag!('gmd:lineage') do
106
+ lineClass.writeXML(hLineage)
107
+ end
59
108
  end
60
109
 
61
110
  end # gmd:DQ_DataQuality tag