adiwg-mdtranslator 2.19.0.pre.beta.26 → 2.19.0.pre.beta.28

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d88e487c8ce8e0beb2266436dec00d2d6f358a3318236a6253084801700eba4
4
- data.tar.gz: 1b183b2183c65ea0058d160ad21e4f88f9c81678f52658f4034498910a39326f
3
+ metadata.gz: c2b29afcfa119d88b586c681a8ff17a71bbe9ee920cfe3ea5811c6929024818d
4
+ data.tar.gz: b4eb9f1b0b86db2738dffd5362ed05a8ada2a7e6c7bbb5f6a201894b80260694
5
5
  SHA512:
6
- metadata.gz: 235d729ecc74b5b4e130e63bea84e259d4c1aad1c4f7d2e04d3e71d48ef3883b99993d6042a8709ec857978153abcd3445233f13f8abd4acd3f4cead790b9bbc
7
- data.tar.gz: e62dbef9e1e07a7d4ba558941b25b012d35e2c4df62e2a5ee30975dea13ce3be29b7e7a281bf7b7c938155693e27a8948e1dd5ed6fa59a93915b090ee38e4edd
6
+ metadata.gz: 8bbdb26949180a83c535c1b4794857f6e8b6858e57163a63674f5eb8541ce1e7d61355f136bb542563c96664cddd354de52958ae5a39b0ddf79c4d80d1799fa6
7
+ data.tar.gz: 74ea9e985ebd466c2ef8b8fa1feeadc1d97ca709f39f3ef4335bc0a5348b97f10106141b3f353475219f40c62fd8d8218a49c59ed2a9aaf9ba7505831d14434e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adiwg-mdtranslator (2.19.0.pre.beta.26)
4
+ adiwg-mdtranslator (2.19.0.pre.beta.28)
5
5
  adiwg-mdcodes (= 2.10.0)
6
6
  adiwg-mdjson_schemas (= 2.9.5)
7
7
  builder (~> 3.2)
@@ -103,35 +103,29 @@ module ADIWG
103
103
  unless xHorizontalAccuracy.empty?
104
104
  report = intMetadataClass.newDataQualityReport
105
105
  report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
106
- # data quality 2.4.1.1 (horizpar) - Horizontal Positional Accuracy Report
106
+ # Combine Horizontal Positional Accuracy Report and Explanation
107
+ descriptive_result_text = ''
107
108
  xHorizontalAccuracyReport = xHorizontalAccuracy.xpath('./horizpar')
108
109
  unless xHorizontalAccuracyReport.empty?
109
- descriptiveResult = intMetadataClass.newDescriptiveResult
110
- descriptiveResult[:name] = 'Horizontal Positional Accuracy Report'
111
- descriptiveResult[:statement] = xHorizontalAccuracyReport.text
112
- report[:descriptiveResult] << descriptiveResult
110
+ descriptive_result_text += xHorizontalAccuracyReport.text
113
111
  end
114
- # data quality 2.4.1.2 (qhorizpa) - Quantitative Horizontal Positional Accuracy Assessment
115
112
  xQuantitativeHorizontalAccuracy = xHorizontalAccuracy.xpath('./qhorizpa')
116
113
  unless xQuantitativeHorizontalAccuracy.empty?
117
- # data quality 2.4.1.2.1 (horizpav) - Horizontal Positional Accuracy Value
118
114
  xHorizontalAccuracyValue = xQuantitativeHorizontalAccuracy.xpath('horizpav')
119
115
  unless xHorizontalAccuracyValue.empty?
120
- quantitativeResult = intMetadataClass.newQuantitativeResult
121
- value = xHorizontalAccuracyValue.text
122
- quantitativeResult[:name] = 'Horizontal Positional Accuracy Value'
123
- quantitativeResult[:values] << value
124
- report[:quantitativeResult] << quantitativeResult
116
+ descriptive_result_text += " Value: #{xHorizontalAccuracyValue.text}"
125
117
  end
126
- # data quality 2.4.1.2.2 (horizpae) - Horizontal Positional Accuracy Explanation
127
118
  xHorizontalAccuracyExplanation = xQuantitativeHorizontalAccuracy.xpath('horizpae')
128
119
  unless xHorizontalAccuracyExplanation.empty?
129
- descriptiveResult = intMetadataClass.newDescriptiveResult
130
- descriptiveResult[:name] = 'Horizontal Positional Accuracy Explanation'
131
- descriptiveResult[:statement] = xHorizontalAccuracyExplanation.text
132
- report[:descriptiveResult] << descriptiveResult
120
+ descriptive_result_text += " Explanation: #{xHorizontalAccuracyExplanation.text}"
133
121
  end
134
122
  end
123
+ unless descriptive_result_text.empty?
124
+ descriptiveResult = intMetadataClass.newDescriptiveResult
125
+ descriptiveResult[:name] = 'Horizontal Positional Accuracy Report'
126
+ descriptiveResult[:statement] = descriptive_result_text
127
+ report[:descriptiveResult] << descriptiveResult
128
+ end
135
129
  hDataQuality[:report] << report
136
130
  end
137
131
  # data quality 2.4.2 (vertacc) - Vertical Positional Accuracy
@@ -139,35 +133,29 @@ module ADIWG
139
133
  unless xVerticalAccuracy.empty?
140
134
  report = intMetadataClass.newDataQualityReport
141
135
  report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
142
- # data quality 2.4.2.1 (vertaccr) - Vertical Positional Accuracy Report
136
+ # Combine Vertical Positional Accuracy Report and Explanation
137
+ descriptive_result_text = ''
143
138
  xVerticalAccuracyReport = xVerticalAccuracy.xpath('./vertaccr')
144
139
  unless xVerticalAccuracyReport.empty?
145
- descriptiveResult = intMetadataClass.newDescriptiveResult
146
- descriptiveResult[:name] = 'Vertical Positional Accuracy Report'
147
- descriptiveResult[:statement] = xVerticalAccuracyReport.text
148
- report[:descriptiveResult] << descriptiveResult
140
+ descriptive_result_text += xVerticalAccuracyReport.text
149
141
  end
150
- # data quality 2.4.2.2 (qvertpa) - Quantitative Vertical Positional Accuracy Assessment
151
142
  xVerticalAccuracyAssessment = xVerticalAccuracy.xpath('./qvertpa')
152
143
  unless xVerticalAccuracyAssessment.empty?
153
- # data quality 2.4.2.2.1 (vertaccv) - Vertical Positional Accuracy Value
154
144
  xVerticalAccuracyValue = xVerticalAccuracyAssessment.xpath('vertaccv')
155
145
  unless xVerticalAccuracyValue.empty?
156
- quantitativeResult = intMetadataClass.newQuantitativeResult
157
- value = xVerticalAccuracyValue.text
158
- quantitativeResult[:name] = 'Vertical Positional Accuracy Value'
159
- quantitativeResult[:values] << value
160
- report[:quantitativeResult] << quantitativeResult
146
+ descriptive_result_text += " Value: #{xVerticalAccuracyValue.text}"
161
147
  end
162
- # data quality 2.4.2.2.2 (vertacce) - Vertical Positional Accuracy Explanation
163
148
  xVerticalAccuracyExplanation = xVerticalAccuracyAssessment.xpath('vertacce')
164
149
  unless xVerticalAccuracyExplanation.empty?
165
- descriptiveResult = intMetadataClass.newDescriptiveResult
166
- descriptiveResult[:name] = 'Vertical Positional Accuracy Explanation'
167
- descriptiveResult[:statement] = xVerticalAccuracyExplanation.text
168
- report[:descriptiveResult] << descriptiveResult
150
+ descriptive_result_text += " Explanation: #{xVerticalAccuracyExplanation.text}"
169
151
  end
170
152
  end
153
+ unless descriptive_result_text.empty?
154
+ descriptiveResult = intMetadataClass.newDescriptiveResult
155
+ descriptiveResult[:name] = 'Vertical Positional Accuracy Report'
156
+ descriptiveResult[:statement] = descriptive_result_text
157
+ report[:descriptiveResult] << descriptiveResult
158
+ end
171
159
  hDataQuality[:report] << report
172
160
  end
173
161
  end
@@ -192,4 +180,4 @@ module ADIWG
192
180
  end
193
181
  end
194
182
  end
195
- end
183
+ end
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.19.0-beta.26"
112
+ VERSION = "2.19.0-beta.28"
113
113
  end
114
114
  end
115
115
 
@@ -8,289 +8,142 @@
8
8
  require_relative 'class_lineage'
9
9
 
10
10
  module ADIWG
11
- module Mdtranslator
12
- module Writers
13
- module Fgdc
14
-
15
- class DataQuality
16
-
17
- def initialize(xml, hResponseObj)
18
- @xml = xml
19
- @hResponseObj = hResponseObj
20
- @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
- end
22
-
23
- def writeXML(intObj)
24
-
25
- # classes used
26
- lineageClass = Lineage.new(@xml, @hResponseObj)
27
-
28
- hDataQuality = intObj.dig(:metadata, :dataQuality, 0)
29
-
30
- if hDataQuality && hDataQuality[:report]
31
- # data quality 2.1 (attracc) - Attribute Accuracy
32
- attribute_accuracy_report = hDataQuality[:report].find do |report|
33
- report[:type] == 'DQ_NonQuantitativeAttributeCorrectness' &&
34
- !report.dig(:descriptiveResult, 0, :statement).nil?
35
- end
36
- thematic_classification_report = hDataQuality[:report].find do |report|
37
- report[:type] == 'DQ_ThematicClassificationCorrectness'
38
- end
39
- attribute_accuracy_report_text = ''
40
- if attribute_accuracy_report
41
- attribute_accuracy_report_text = attribute_accuracy_report[:descriptiveResult][0][:statement]
42
- end
43
- if thematic_classification_report
44
- if attribute_accuracy_report_text != ''
45
- attribute_accuracy_report_text = attribute_accuracy_report_text + ' ' + thematic_classification_report[:descriptiveResult][0][:statement]
46
- else
47
- attribute_accuracy_report_text = thematic_classification_report[:descriptiveResult][0][:statement]
48
- end
49
- end
50
- quantitative_attribute_accuracy = hDataQuality[:report].find do |report|
51
- report[:type] == 'DQ_QuantitativeAttributeAccuracy'
52
- end
53
- attribute_accuracy_value = quantitative_attribute_accuracy.dig(:quantitativeResult, 0, :values, 0) if quantitative_attribute_accuracy
54
- attribute_evaluation_method = quantitative_attribute_accuracy.dig(:evaluationMethod, :methodDescription) if quantitative_attribute_accuracy
55
- if attribute_accuracy_report_text != '' || attribute_accuracy_value || attribute_evaluation_method
56
- # data quality 2.1 (attracc) - Attribute Accuracy
57
- @xml.tag!('attracc') do
58
- if attribute_accuracy_report_text != ''
59
- # data quality 2.1.1 (attraccr) - Attribute Accuracy Report
60
- @xml.tag!('attraccr', attribute_accuracy_report_text)
61
- end
62
- if attribute_accuracy_value || attribute_evaluation_method
63
- # data quality 2.1.2 (qattracc) - Quantitative Attribute Accuracy Assessment
64
- @xml.tag!('qattracc') do
65
- if attribute_accuracy_value
66
- # data quality 2.1.2.1 (attraccv) - Attribute Accuracy Value
67
- @xml.tag!('attraccv', attribute_accuracy_value)
68
- end
69
- if attribute_evaluation_method
70
- # data quality 2.1.2.2 (attracce) - Attribute Accuracy Explanation
71
- @xml.tag!('attracce', attribute_evaluation_method)
72
- end
73
- end
74
- end
75
- end
76
- elsif @hResponseObj[:writerShowTags]
77
- @xml.tag!('attracc', 'Not Reported')
78
- end
79
-
80
- # data quality 2.2 (logic) - logical consistency (required)
81
- logic_report = hDataQuality[:report].find do |report|
82
- report[:type] == 'DQ_ConceptualConsistency' &&
83
- !report.dig(:descriptiveResult, 0, :statement).nil?
84
- end
85
- domain_report = hDataQuality[:report].find do |report|
86
- report[:type] == 'DQ_DomainConsistency' &&
87
- !report.dig(:descriptiveResult, 0, :statement).nil?
88
- end
89
- format_report = hDataQuality[:report].find do |report|
90
- report[:type] == 'DQ_FormatConsistency' &&
91
- !report.dig(:descriptiveResult, 0, :statement).nil?
92
- end
93
- topological_report = hDataQuality[:report].find do |report|
94
- report[:type] == 'DQ_TopologicalConsistency' &&
95
- !report.dig(:descriptiveResult, 0, :statement).nil?
96
- end
97
- logic = ''
98
- if logic_report
99
- logic = logic_report[:descriptiveResult][0][:statement]
100
- end
101
- if domain_report
102
- if logic != ''
103
- logic = logic + ' ' + domain_report[:descriptiveResult][0][:statement]
104
- else
105
- logic = domain_report[:descriptiveResult][0][:statement]
106
- end
107
- end
108
- if format_report
109
- if logic != ''
110
- logic = logic + ' ' + format_report[:descriptiveResult][0][:statement]
111
- else
112
- logic = format_report[:descriptiveResult][0][:statement]
113
- end
114
- end
115
- if topological_report
116
- if logic != ''
117
- logic = logic + ' ' + topological_report[:descriptiveResult][0][:statement]
118
- else
119
- logic = topological_report[:descriptiveResult][0][:statement]
120
- end
121
- end
122
- if logic != ''
123
- @xml.tag!('logic', logic)
124
- else
125
- @xml.tag!('logic', 'Not Reported')
126
- end
127
-
128
- # data quality 2.3 (complete) - completion report (required)
129
- omission_report = hDataQuality[:report].find do |report|
130
- report[:type] == 'DQ_CompletenessOmission' &&
131
- !report.dig(:descriptiveResult, 0, :statement).nil?
132
- end
133
- omission = omission_report&.dig(:descriptiveResult, 0, :statement)
134
- commission_report = hDataQuality[:report].find do |report|
135
- report[:type] == 'DQ_CompletenessCommission' &&
136
- !report.dig(:descriptiveResult, 0, :statement).nil?
137
- end
138
- commission = commission_report&.dig(:descriptiveResult, 0, :statement)
139
- complete = ''
140
- if omission
141
- complete = omission
142
- end
143
- if commission
144
- if complete != ''
145
- complete = complete + ' ' + commission
146
- else
147
- complete = commission
148
- end
149
- end
150
- if complete != ''
151
- @xml.tag!('complete', complete)
152
- else
153
- @xml.tag!('complete', 'Not Reported')
154
- end
155
-
156
- # data quality 2.4 (posacc) - Positional Accuracy
157
- # data quality 2.4.1 (horizpa) - Horizontal Positional Accuracy
158
- reports = hDataQuality[:report].select do |report|
159
- [
160
- 'DQ_AbsoluteExternalPositionalAccuracy',
161
- 'DQ_RelativeInternalPositionalAccuracy',
162
- 'DQ_GriddedDataPositionalAccuracy'
163
- ].include?(report[:type]) &&
164
- report.dig(:descriptiveResult, 0, :name) == 'Horizontal Positional Accuracy Report' &&
165
- !report.dig(:descriptiveResult, 0, :statement).nil?
166
- end
167
-
168
- horizpar = ''
169
- horizpav = ''
170
- horizpae = ''
171
-
172
- reports.each do |report|
173
- if report[:descriptiveResult]
174
- report[:descriptiveResult].each do |result|
175
- if result[:name] == 'Horizontal Positional Accuracy Report'
176
- horizpar = horizpar.empty? ? result[:statement] : "#{horizpar} #{result[:statement]}"
177
- elsif result[:name] == 'Horizontal Positional Accuracy Explanation'
178
- horizpae = horizpae.empty? ? result[:statement] : "#{horizpae} #{result[:statement]}"
179
- end
180
- end
181
- end
182
- if report[:quantitativeResult]
183
- report[:quantitativeResult].each do |result|
184
- if result[:name] == 'Horizontal Positional Accuracy Value' && horizpav.empty?
185
- horizpav = result[:values][0]
186
- end
187
- end
188
- end
189
- end
190
-
191
- # data quality 2.4.2 (vertacc) - Vertical Positional Accuracy
192
- reports = hDataQuality[:report].select do |report|
193
- [
194
- 'DQ_AbsoluteExternalPositionalAccuracy',
195
- 'DQ_RelativeInternalPositionalAccuracy',
196
- 'DQ_GriddedDataPositionalAccuracy'
197
- ].include?(report[:type]) &&
198
- report.dig(:descriptiveResult, 0, :name) == 'Vertical Positional Accuracy Report' &&
199
- !report.dig(:descriptiveResult, 0, :statement).nil?
200
- end
201
-
202
- vertaccr = ''
203
- vertaccv = ''
204
- vertacce = ''
205
-
206
- reports.each do |report|
207
- if report[:descriptiveResult]
208
- report[:descriptiveResult].each do |result|
209
- if result[:name] == 'Vertical Positional Accuracy Report'
210
- vertaccr = vertaccr.empty? ? result[:statement] : "#{vertaccr} #{result[:statement]}"
211
- elsif result[:name] == 'Vertical Positional Accuracy Explanation'
212
- vertacce = vertacce.empty? ? result[:statement] : "#{vertacce} #{result[:statement]}"
213
- end
214
- end
215
- end
216
- if report[:quantitativeResult]
217
- report[:quantitativeResult].each do |result|
218
- if result[:name] == 'Vertical Positional Accuracy Value' && vertaccv.empty?
219
- vertaccv = result[:values][0]
220
- end
221
- end
222
- end
223
- end
224
-
225
- if !horizpar.empty? || !vertaccr.empty?
226
- # Data quality 2.4 (posacc) - Positional Accuracy
227
- @xml.tag!('posacc') do
228
- if !horizpar.empty?
229
- # Data quality 2.4.1 (horizpa) - Horizontal Positional Accuracy
230
- @xml.tag!('horizpa') do
231
- # Data quality 2.4.1.1 (horizpar) - Horizontal Positional Accuracy Report
232
- @xml.tag!('horizpar', horizpar)
233
- if horizpav != '' || !horizpae.empty?
234
- # Data quality 2.4.1.2 (qhorizpa) - Quantitative Horizontal Positional Accuracy
235
- @xml.tag!('qhorizpa') do
236
- if horizpav != ''
237
- # Data quality 2.4.1.2.1 (horizpav) - Horizontal Positional Accuracy Value
238
- @xml.tag!('horizpav', horizpav)
239
- end
240
- if !horizpae.empty?
241
- # Data quality 2.4.1.2.2 (horizpae) - Horizontal Positional Accuracy Explanation
242
- @xml.tag!('horizpae', horizpae)
243
- end
244
- end
245
- end
246
- end
247
- end
248
-
249
- if !vertaccr.empty?
250
- # Data quality 2.4.2 (vertacc) - Vertical Positional Accuracy
251
- @xml.tag!('vertacc') do
252
- # Data quality 2.4.2.1 (vertaccr) - Vertical Positional Accuracy Report
253
- @xml.tag!('vertaccr', vertaccr)
254
- if vertaccv != '' || !vertacce.empty?
255
- # Data quality 2.4.2.2 (qvertpa) - Quantitative Vertical Positional Accuracy
256
- @xml.tag!('qvertpa') do
257
- if vertaccv != ''
258
- # Data quality 2.4.2.2.1 (vertaccv) - Vertical Positional Accuracy Value
259
- @xml.tag!('vertaccv', vertaccv)
260
- end
261
- if !vertacce.empty?
262
- # Data quality 2.4.2.2.2 (vertacce) - Vertical Positional Accuracy Explanation
263
- @xml.tag!('vertacce', vertacce)
264
- end
265
- end
266
- end
267
- end
268
- end
269
- end
270
- elsif @hResponseObj[:writerShowTags]
271
- @xml.tag!('position', 'Not Reported')
272
- end
11
+ module Mdtranslator
12
+ module Writers
13
+ module Fgdc
14
+
15
+ class DataQuality
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
+ end
22
+
23
+ def writeXML(intObj)
24
+
25
+ # classes used
26
+ lineageClass = Lineage.new(@xml, @hResponseObj)
27
+
28
+ hDataQuality = intObj.dig(:metadata, :dataQuality, 0)
29
+
30
+ if hDataQuality && hDataQuality[:report]
31
+ # data quality 2.1 (attracc) - Attribute Accuracy
32
+ attribute_accuracy_report_text = hDataQuality[:report].select do |report|
33
+ [
34
+ 'DQ_NonQuantitativeAttributeCorrectness',
35
+ 'DQ_ThematicClassificationCorrectness'
36
+ ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
37
+ end.map { |report| report.dig(:descriptiveResult, 0, :statement) }.compact.join(' ')
38
+
39
+ quantitative_attribute_accuracy = hDataQuality[:report].find { |report| report[:type] == 'DQ_QuantitativeAttributeAccuracy' }
40
+ attribute_accuracy_value = quantitative_attribute_accuracy.dig(:quantitativeResult, 0, :values, 0) if quantitative_attribute_accuracy
41
+ attribute_evaluation_method = quantitative_attribute_accuracy.dig(:evaluationMethod, :methodDescription) if quantitative_attribute_accuracy
42
+
43
+ if attribute_accuracy_report_text != '' || attribute_accuracy_value || attribute_evaluation_method
44
+ @xml.tag!('attracc') do
45
+ @xml.tag!('attraccr', attribute_accuracy_report_text) unless attribute_accuracy_report_text.empty?
46
+ if attribute_accuracy_value || attribute_evaluation_method
47
+ @xml.tag!('qattracc') do
48
+ @xml.tag!('attraccv', attribute_accuracy_value) if attribute_accuracy_value
49
+ @xml.tag!('attracce', attribute_evaluation_method) if attribute_evaluation_method
50
+ end
273
51
  end
274
-
275
- # data quality 2.5 (lineage) - lineage (required)
276
- unless intObj[:metadata][:lineageInfo].empty?
277
- @xml.tag!('lineage') do
278
- lineageClass.writeXML(intObj[:metadata][:lineageInfo])
279
- end
280
- end
281
- if intObj[:metadata][:lineageInfo].empty?
282
- @NameSpace.issueWarning(350, nil, 'data quality section')
52
+ end
53
+ elsif @hResponseObj[:writerShowTags]
54
+ @xml.tag!('attracc', 'Not Reported')
55
+ end
56
+
57
+ # data quality 2.2 (logic) - logical consistency (required)
58
+ logic_reports = hDataQuality[:report].select do |report|
59
+ [
60
+ 'DQ_ConceptualConsistency',
61
+ 'DQ_DomainConsistency',
62
+ 'DQ_FormatConsistency',
63
+ 'DQ_TopologicalConsistency'
64
+ ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
65
+ end
66
+
67
+ logic = logic_reports.map { |report| report.dig(:descriptiveResult, 0, :statement) }.compact.join(' ')
68
+
69
+ if logic != ''
70
+ @xml.tag!('logic', logic)
71
+ else
72
+ @xml.tag!('logic', 'Not Reported')
73
+ end
74
+
75
+ # data quality 2.3 (complete) - completion report (required)
76
+ omission = hDataQuality[:report].find { |report| report[:type] == 'DQ_CompletenessOmission' }&.dig(:descriptiveResult, 0, :statement)
77
+ commission = hDataQuality[:report].find { |report| report[:type] == 'DQ_CompletenessCommission' }&.dig(:descriptiveResult, 0, :statement)
78
+ complete = [omission, commission].compact.join(' ')
79
+ if complete != ''
80
+ @xml.tag!('complete', complete)
81
+ else
82
+ @xml.tag!('complete', 'Not Reported')
83
+ end
84
+
85
+ # data quality 2.4 (posacc) - Positional Accuracy
86
+ reports = hDataQuality[:report].select do |report|
87
+ [
88
+ 'DQ_AbsoluteExternalPositionalAccuracy',
89
+ 'DQ_RelativeInternalPositionalAccuracy',
90
+ 'DQ_GriddedDataPositionalAccuracy'
91
+ ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
92
+ end
93
+
94
+ horizpar = ''
95
+ vertaccr = ''
96
+
97
+ reports.each do |report|
98
+ descriptive_result = report.dig(:descriptiveResult, 0)
99
+ next unless descriptive_result
100
+
101
+ if descriptive_result[:name] == 'Vertical Positional Accuracy Report'
102
+ vertaccr = descriptive_result[:statement]
103
+ else
104
+ horizpar = descriptive_result[:statement]
105
+ end
106
+ end
107
+
108
+ if !horizpar.empty? || !vertaccr.empty?
109
+ @xml.tag!('posacc') do
110
+ if !horizpar.empty?
111
+ @xml.tag!('horizpa') do
112
+ @xml.tag!('horizpar', horizpar)
113
+ end
283
114
  end
284
115
 
285
- # data quality 2.6 (cloud) - cloud cover (not implemented)
286
- if @hResponseObj[:writerShowTags]
287
- @xml.tag!('cloud', 'Not Reported')
116
+ if !vertaccr.empty?
117
+ @xml.tag!('vertacc') do
118
+ @xml.tag!('vertaccr', vertaccr)
119
+ end
288
120
  end
121
+ end
122
+ elsif @hResponseObj[:writerShowTags]
123
+ @xml.tag!('position', 'Not Reported')
124
+ end
125
+
126
+ # data quality 2.5 (lineage) - lineage (required)
127
+ unless intObj[:metadata][:lineageInfo].empty?
128
+ @xml.tag!('lineage') do
129
+ lineageClass.writeXML(intObj[:metadata][:lineageInfo])
130
+ end
131
+ end
132
+ if intObj[:metadata][:lineageInfo].empty?
133
+ @NameSpace.issueWarning(350, nil, 'data quality section')
134
+ end
135
+
136
+ # data quality 2.6 (cloud) - cloud cover (not implemented)
137
+ if @hResponseObj[:writerShowTags]
138
+ @xml.tag!('cloud', 'Not Reported')
139
+ end
140
+
141
+ end # writeXML
142
+ end # DataQuality
143
+
144
+ end # Quality
289
145
 
290
- end # writeXML
291
- end # Quality
292
-
293
- end
294
146
  end
295
- end
296
- end
147
+ end
148
+ end
149
+ end
@@ -127,7 +127,7 @@ module ADIWG
127
127
 
128
128
  # altitude bounding (altmax) - maximum altitude (required)
129
129
  unless hBBox[:maximumAltitude].nil?
130
- @xml.tag!('altmax', hBBox[:minimumAltitude])
130
+ @xml.tag!('altmax', hBBox[:maximumAltitude])
131
131
  end
132
132
  if hBBox[:maximumAltitude].nil?
133
133
  @NameSpace.issueWarning(372, 'altmax')
@@ -0,0 +1,52 @@
1
+ # ISO <<CodeLists>> Enumerations
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2016-12-12 refactored for mdTranslator/mdJson 2.0
6
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
8
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
+ # Stan Smith 2015-06-12 refactored to use mdCodes gem for codelist contents
10
+ # Stan Smith 2014-12-15 replaced NOAA CT_CodelistCatalogue with mdTranslator CT_CodelistCatalogue
11
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
+ # Stan Smith 2014-10-15 allow non-ISO codesNames to be rendered
13
+ # Stan Smith 2013-08-09 original script
14
+
15
+ require 'adiwg-mdcodes'
16
+
17
+ module ADIWG
18
+ module Mdtranslator
19
+ module Writers
20
+ module Iso19115_3
21
+
22
+ class MD_EnumerationList
23
+
24
+ def initialize(xml, responseObj)
25
+ @xml = xml
26
+ @hResponseObj = responseObj
27
+ end
28
+
29
+ def writeXML(codeList, codeName)
30
+
31
+ # get requested codelist from the adiwg-mdcodes gem
32
+ mdCodelist = ADIWG::Mdcodes.getCodelistDetail(codeList)
33
+
34
+ sourceName = mdCodelist['sourceName']
35
+ codelist = mdCodelist['codelist']
36
+
37
+ # search the codelist for a matching codeName
38
+ # only valid enumeration values can be written in ISO
39
+ codelist.each do |code|
40
+ if code['codeName'] == codeName
41
+ @xml.tag!('gmd:' + "#{sourceName}", codeName)
42
+ break
43
+ end
44
+ end
45
+
46
+ end # writeXML
47
+ end # MD_EnumerationList class
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,208 @@
1
+ # ISO <<Class>> MD_MetadataExtensionInformation
2
+ # 19115-2 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-22 replaced Enumeration class with method
6
+ # Stan Smith 2018-04-09 add error and warning messaging
7
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
10
+ # Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
11
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
13
+ # Stan Smith 2013-11-22 original script.
14
+
15
+ require 'adiwg/mdtranslator/internal/module_codelistFun'
16
+ require_relative '../iso19115_3_writer'
17
+ require_relative 'class_codelist'
18
+ require_relative 'class_enumerationList'
19
+ require_relative 'class_onlineResource'
20
+
21
+ module ADIWG
22
+ module Mdtranslator
23
+ module Writers
24
+ module Iso19115_3
25
+
26
+ class MD_MetadataExtensionInformation
27
+
28
+ def initialize(xml, hResponseObj)
29
+ @xml = xml
30
+ @hResponseObj = hResponseObj
31
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_3
32
+ end
33
+
34
+ def writeXML(hExtension)
35
+
36
+ # classes used
37
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
38
+ olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
39
+
40
+ outContext = 'extension information'
41
+ outContext = 'extension name ' + hExtension[:name] unless hExtension[:name].nil?
42
+
43
+ @xml.tag!('gmd:MD_MetadataExtensionInformation') do
44
+
45
+ # metadata extension - online resource {CI_OnLineResource}
46
+ hOLResource = hExtension[:onLineResource]
47
+ unless hOLResource.empty?
48
+ @xml.tag!('gmd:extensionOnLineResource') do
49
+ olResClass.writeXML(hOLResource, outContext)
50
+ end
51
+ end
52
+ if hOLResource.empty? && @hResponseObj[:writerShowTags]
53
+ @xml.tag!('gmd:extensionOnLineResource')
54
+ end
55
+
56
+ # metadata extension = extended element information
57
+ @xml.tag!('gmd:extendedElementInformation') do
58
+ @xml.tag!('gmd:MD_ExtendedElementInformation') do
59
+
60
+ # extended element info - name (required)
61
+ s = hExtension[:name]
62
+ unless s.nil?
63
+ @xml.tag!('gmd:name') do
64
+ @xml.tag!('gco:CharacterString', s)
65
+ end
66
+ end
67
+ if s.nil?
68
+ @NameSpace.issueWarning(100, 'gmd:name')
69
+ end
70
+
71
+ # extended element info - short name
72
+ s = hExtension[:shortName]
73
+ unless s.nil?
74
+ @xml.tag!('gmd:shortName') do
75
+ @xml.tag!('gco:CharacterString', s)
76
+ end
77
+ end
78
+ if s.nil? && @hResponseObj[:writerShowTags]
79
+ @xml.tag!('gmd:shortName')
80
+ end
81
+
82
+ # extended element info - definition (required)
83
+ s = hExtension[:definition]
84
+ unless s.nil?
85
+ @xml.tag!('gmd:definition') do
86
+ @xml.tag!('gco:CharacterString', s)
87
+ end
88
+ end
89
+ if s.nil?
90
+ @NameSpace.issueWarning(101, 'gmd:definition', outContext)
91
+ end
92
+
93
+ # extended element info - obligation {MD_ObligationCode}
94
+ obligation = hExtension[:obligation]
95
+ unless obligation.nil?
96
+ if CodelistFun.validateItem('iso_obligation', obligation)
97
+ @xml.tag!('gmd:obligation') do
98
+ @xml.tag!('gmd:MD_ObligationCode', obligation)
99
+ end
100
+ else
101
+ @NameSpace.issueWarning(380, 'gmd:obligation', "#{obligation}")
102
+ end
103
+ end
104
+ if obligation.nil? && @hResponseObj[:writerShowTags]
105
+ @xml.tag!('gmd:obligation')
106
+ end
107
+
108
+ # extended element info - data type (required)
109
+ s = hExtension[:dataType]
110
+ unless s.nil?
111
+ @xml.tag!('gmd:dataType') do
112
+ codelistClass.writeXML('gmd', 'iso_entityClass', s)
113
+ end
114
+ end
115
+ if s.nil?
116
+ @NameSpace.issueWarning(102, 'gmd:dataType', outContext)
117
+ end
118
+
119
+ # extended element info - maximum occurrence
120
+ s = hExtension[:maxOccurrence]
121
+ unless s.nil?
122
+ @xml.tag!('gmd:maximumOccurrence') do
123
+ @xml.tag!('gco:CharacterString', s)
124
+ end
125
+ end
126
+ if s.nil? && @hResponseObj[:writerShowTags]
127
+ @xml.tag!('gmd:maximumOccurrence')
128
+ end
129
+
130
+ # extended element info - parent entity [] (required)
131
+ aParents = hExtension[:parentEntities]
132
+ aParents.each do |parent|
133
+ @xml.tag!('gmd:parentEntity') do
134
+ @xml.tag!('gco:CharacterString', parent)
135
+ end
136
+ end
137
+ if aParents.empty?
138
+ @NameSpace.issueWarning(103, 'gmd:parentEntity', outContext)
139
+ end
140
+
141
+ # extended element info - rule
142
+ s = hExtension[:rule]
143
+ unless s.nil?
144
+ @xml.tag!('gmd:rule') do
145
+ @xml.tag!('gco:CharacterString', s)
146
+ end
147
+ end
148
+ if s.nil?
149
+ @NameSpace.issueWarning(104, 'gmd:rule', outContext)
150
+ end
151
+
152
+ # extended element info - rationale []
153
+ aRations = hExtension[:rationales]
154
+ aRations.each do |ration|
155
+ @xml.tag!('gmd:rationale') do
156
+ @xml.tag!('gco:CharacterString', ration)
157
+ end
158
+ end
159
+ if aRations.empty? && @hResponseObj[:writerShowTags]
160
+ @xml.tag!('gmd:rationale')
161
+ end
162
+
163
+ # extended element info - source [] (required)
164
+ # only allowing 1 for now
165
+ role = hExtension[:sourceRole]
166
+ unless role.nil?
167
+ @xml.tag!('gmd:source') do
168
+ @xml.tag!('gmd:CI_ResponsibleParty') do
169
+ orgName = hExtension[:sourceOrganization]
170
+ unless orgName.nil?
171
+ @xml.tag!('gmd:organisationName') do
172
+ @xml.tag!('gco:CharacterString', orgName)
173
+ end
174
+ end
175
+ uri = hExtension[:sourceURI]
176
+ unless uri.nil?
177
+ @xml.tag!('gmd:contactInfo') do
178
+ @xml.tag!('gmd:CI_Contact') do
179
+ @xml.tag!('gmd:onlineResource') do
180
+ @xml.tag!('gmd:CI_OnlineResource') do
181
+ @xml.tag!('gmd:linkage') do
182
+ @xml.tag!('gmd:URL', uri)
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
188
+ end
189
+ @xml.tag!('gmd:role') do
190
+ codelistClass.writeXML('gmd', 'iso_role', role)
191
+ end
192
+ end
193
+ end
194
+ end
195
+ if role.nil?
196
+ @NameSpace.issueWarning(105, 'gmd:source', outContext)
197
+ end
198
+
199
+ end # gmd:MD_ExtendedElementInformation tag
200
+ end # gmd:extendedElementInformation
201
+ end # gmd:MD_MetadataExtensionInformation
202
+ end # writeXML
203
+ end # MD_MetadataExtensionInformation class
204
+
205
+ end
206
+ end
207
+ end
208
+ end
@@ -26,6 +26,7 @@ require_relative 'class_maintenance'
26
26
  require_relative 'class_spatialRepresentation'
27
27
  require_relative 'class_referenceSystem'
28
28
  require_relative 'class_featureCatalog'
29
+ require_relative 'class_extension'
29
30
 
30
31
  module ADIWG
31
32
  module Mdtranslator
@@ -62,6 +63,7 @@ module ADIWG
62
63
  representationClass = SpatialRepresentation.new(@xml, @hResponseObj)
63
64
  referenceSystemClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
64
65
  mdCatalogClass = MD_FeatureCatalogue.new(@xml, @hResponseObj)
66
+ extensionClass = MD_MetadataExtensionInformation.new(@xml, @hResponseObj)
65
67
 
66
68
  # create shortcuts to sections of internal object
67
69
  hMetadata = intObj[:metadata]
@@ -291,6 +293,28 @@ module ADIWG
291
293
  @xml.tag!('mdb:referenceSystemInfo')
292
294
  end
293
295
 
296
+ # metadata information - metadata extension info
297
+ # add biological profile to all metadata records
298
+ intBio = intMetadataClass.newMetadataExtension
299
+ intBio[:name] = 'Taxonomy System'
300
+ intBio[:shortName] = 'TaxonSys'
301
+ intBio[:definition] = 'Documentation of taxonomic sources, procedures, and treatments'
302
+ intBio[:obligation] = 'optional'
303
+ intBio[:dataType] = 'class'
304
+ intBio[:maxOccurrence] = '1'
305
+ intBio[:parentEntities] << 'MD_Identification'
306
+ intBio[:rule] = 'New Metadata section as a class to MD_Identification'
307
+ intBio[:rationales] << 'The set of data elements contained within this class element ' +
308
+ 'represents an attempt to provide better documentation of ' +
309
+ 'taxonomic sources, procedures, and treatments.'
310
+ intBio[:sourceOrganization] = 'National Biological Information Infrastructure'
311
+ intBio[:sourceURI] = 'https://www2.usgs.gov/core_science_systems/Access/p1111-1.html'
312
+ intBio[:sourceRole] = 'author'
313
+
314
+ @xml.tag!('gmd:metadataExtensionInfo') do
315
+ extensionClass.writeXML(intBio)
316
+ end
317
+
294
318
  # ###################### Begin Data Identification #####################
295
319
 
296
320
  # metadata information - data identification info - required
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adiwg-mdtranslator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0.pre.beta.26
4
+ version: 2.19.0.pre.beta.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-20 00:00:00.000000000 Z
12
+ date: 2024-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -789,6 +789,8 @@ files:
789
789
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distribution.rb
790
790
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distributor.rb
791
791
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_email.rb
792
+ - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_enumerationList.rb
793
+ - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extension.rb
792
794
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extent.rb
793
795
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_feature.rb
794
796
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_featureCatalog.rb