adiwg-mdtranslator 2.18.4 → 2.19.0.pre.beta.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +14 -0
  3. data/Gemfile.lock +11 -9
  4. data/adiwg-mdtranslator.gemspec +3 -3
  5. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +29 -13
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dataQuality.rb +149 -0
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +10 -6
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +14 -11
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +26 -34
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +13 -1
  12. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +2 -2
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_conformanceResult.rb +1 -1
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageResult.rb +8 -7
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQuality.rb +4 -4
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQualityReport.rb +8 -16
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_evaluationMethod.rb +1 -1
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +8 -8
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_qualityMeasure.rb +34 -0
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_qualityResultFile.rb +72 -0
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb +2 -2
  22. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_contact.rb +13 -0
  23. data/lib/adiwg/mdtranslator/version.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/{class_quality.rb → class_dataQuality.rb} +14 -10
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +3 -3
  26. data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +5 -1
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb +39 -18
  28. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +385 -0
  29. data/lib/adiwg/mdtranslator/writers/html/sections/html_rangeElementDescription.rb +2 -2
  30. data/lib/adiwg/mdtranslator/writers/html/sections/html_resultFile.rb +60 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_dataQualityReport.rb +213 -39
  32. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb +1 -1
  33. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb +1 -19
  34. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_qualityResultFile.rb +55 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_rangeElementDescription.rb +14 -13
  36. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_sampleDimension.rb +6 -6
  37. data/lib/adiwg/mdtranslator/writers/iso19115_3/iso19115_3_writer.rb +2 -0
  38. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_allocation.rb +1 -1
  39. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coverageResult.rb +30 -0
  40. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dataQuality.rb +3 -1
  41. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dataQualityReport.rb +12 -10
  42. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_descriptiveResult.rb +3 -3
  43. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_funding.rb +2 -2
  44. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_legalConstraint.rb +1 -1
  45. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_metadata.rb +1 -1
  46. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_qualityMeasure.rb +4 -3
  47. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_qualityResultFile.rb +23 -0
  48. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_standaloneQualityReport.rb +31 -0
  49. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +10 -0
  50. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_additionalDocumentation.rb +1 -1
  51. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_algorithm.rb +1 -1
  52. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb +1 -1
  53. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_associatedResource.rb +2 -2
  54. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attribute.rb +2 -2
  55. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_attributeGroup.rb +1 -1
  56. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_body.rb +15 -31
  57. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb +5 -5
  58. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_classedData.rb +1 -1
  59. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_constraint.rb +5 -5
  60. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_contact.rb +37 -5
  61. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_coverageInfo.rb +3 -3
  62. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataDictionary.rb +5 -5
  63. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb +31 -12
  64. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb +385 -0
  65. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distribution.rb +1 -1
  66. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_distributor.rb +3 -3
  67. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domain.rb +3 -3
  68. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_domainItem.rb +1 -1
  69. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entity.rb +5 -5
  70. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_entityAttribute.rb +3 -3
  71. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_extent.rb +3 -3
  72. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_feature.rb +5 -5
  73. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureCollection.rb +4 -4
  74. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_featureProperties.rb +1 -1
  75. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_format.rb +1 -1
  76. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_funding.rb +1 -1
  77. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geodeticParameters.rb +2 -2
  78. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicElement.rb +4 -4
  79. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb +4 -14
  80. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geologicAge.rb +1 -1
  81. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryCollection.rb +4 -4
  82. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geometryObject.rb +2 -2
  83. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georectifiedRepresentation.rb +2 -2
  84. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_georeferenceableRepresentation.rb +3 -3
  85. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_graphic.rb +2 -2
  86. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_gridRepresentation.rb +2 -2
  87. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_identifier.rb +1 -1
  88. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_imageInfo.rb +1 -1
  89. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_keyword.rb +14 -16
  90. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb +10 -9
  91. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataRepository.rb +1 -1
  92. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processStep.rb +1 -1
  93. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_processing.rb +3 -3
  94. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_rangeElementDescription.rb +2 -2
  95. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb +17 -17
  96. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb +1 -1
  97. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resultFile.rb +60 -0
  98. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_scope.rb +12 -12
  99. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_source.rb +2 -2
  100. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb +1 -1
  101. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb +1 -3
  102. metadata +23 -13
  103. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +0 -181
  104. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_bodyScript.js +0 -317
@@ -1,3 +1,14 @@
1
+ require_relative '../iso19115_3_writer'
2
+ require_relative 'class_format'
3
+ require_relative 'class_qualityResultFile'
4
+ require_relative 'class_date'
5
+ require_relative 'class_scope'
6
+ require_relative 'class_spatialRepresentation'
7
+ require_relative 'class_coverageDescription'
8
+ require_relative 'class_codelist'
9
+ require_relative 'class_identifier'
10
+ require_relative 'class_citation'
11
+
1
12
  module ADIWG
2
13
  module Mdtranslator
3
14
  module Writers
@@ -12,83 +23,246 @@ module ADIWG
12
23
  def writeXML(hReport)
13
24
  # require 'pry'; binding.pry
14
25
 
26
+ formatClass = MD_Format.new(@xml, @hResponseObj)
27
+ qualityResultFileClass = QualityResultFile.new(@xml, @hResponseObj)
28
+ dateClass = CI_Date.new(@xml, @hResponseObj)
29
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
30
+ spatialRepresentationClass = SpatialRepresentation.new(@xml, @hResponseObj)
31
+ coverageDescriptionClass = MD_CoverageDescription.new(@xml, @hResponseObj)
32
+ codeListClass = MD_Codelist.new(@xml, @hResponseObj)
33
+ identifierClass = MD_Identifier.new(@xml, @hResponseObj)
34
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
35
+
15
36
  @xml.tag!('mdq:report') do
16
37
  @xml.tag!("mdq:#{hReport[:type]}") do
17
38
 
18
- # conformanceResult []
19
-
20
- # coverageResult []
39
+ # standaloneQualityReportDetails
40
+ unless hReport[:standaloneQualityReportDetails].nil?
41
+ @xml.tag!('mdq:standaloneQualityReportDetails') do
42
+ @xml.tag!('gco:CharacterString', hReport[:standaloneQualityReportDetails])
43
+ end
44
+ end
21
45
 
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])
46
+ # qualityMeasure {}
47
+ qualityMeasure = hReport[:qualityMeasure]
48
+ unless qualityMeasure.empty?
49
+ @xml.tag!('mdq:measure') do
50
+ @xml.tag!('mdq:DQ_MeasureReference') do
51
+ unless qualityMeasure[:identifier].empty?
52
+ @xml.tag!('mdq:measureIdentification') do
53
+ identifierClass.writeXML(qualityMeasure[:identifier])
54
+ end
55
+ end
56
+ unless qualityMeasure[:nameOfMeasure].nil?
57
+ qualityMeasure[:nameOfMeasure].each do |value|
58
+ @xml.tag!('mdq:nameOfMeasure') do
59
+ @xml.tag!('gco:CharacterString', value)
30
60
  end
31
61
  end
32
62
  end
63
+ unless qualityMeasure[:description].nil?
64
+ @xml.tag!('mdq:measureDescription') do
65
+ @xml.tag!('gco:CharacterString', qualityMeasure[:description])
66
+ end
67
+ end
33
68
  end
34
69
  end
35
- end
70
+ end # qualityMeasure
36
71
 
37
72
  # evaluationMethod {}
38
73
  evaluationMethod = hReport[:evaluationMethod]
39
- unless evaluationMethod.nil? || evaluationMethod.empty?
74
+ unless evaluationMethod.empty?
40
75
  @xml.tag!('mdq:evaluationMethod') do
41
76
  @xml.tag!('mdq:DQ_EvaluationMethod') do
42
- @xml.tag!('mdq:evaluationMethodDescription') do
43
- @xml.tag!('gco:CharacterString', evaluationMethod[:methodDescription])
77
+ unless evaluationMethod[:dateTime].empty?
78
+ evaluationMethod[:dateTime].each do |dateTime|
79
+ dateTimeValue = DateTime.parse(dateTime).strftime('%Y-%m-%dT%H:%M:%S')
80
+ @xml.tag!('mdq:dateTime') do
81
+ @xml.tag!('gco:DateTime', dateTimeValue)
82
+ end
83
+ end
84
+ end
85
+ unless evaluationMethod[:methodDescription].nil?
86
+ @xml.tag!('mdq:evaluationMethodDescription') do
87
+ @xml.tag!('gco:CharacterString', evaluationMethod[:methodDescription])
88
+ end
89
+ end
90
+ unless evaluationMethod[:evaluationProcedure].empty?
91
+ @xml.tag!('mdq:evaluationProcedure') do
92
+ citationClass.writeXML(evaluationMethod[:evaluationProcedure])
93
+ end
44
94
  end
95
+ unless evaluationMethod[:referenceDocuments].empty?
96
+ evaluationMethod[:referenceDocuments].each do |citation|
97
+ @xml.tag!('mdq:referenceDoc') do
98
+ citationClass.writeXML(citation)
99
+ end
100
+ end
101
+ end
102
+ # TODO the following will not work until the iso_evaluationMethodType codelist is added to mdCodes
103
+ # unless evaluationMethod[:evaluationMethodType].nil?
104
+ # @xml.tag!('mdq:evaluationMethodType') do
105
+ # codeListClass.writeXML('mcc', 'iso_evaluationMethodType', evaluationMethod[:evaluationMethodType])
106
+ # end
107
+ # end
45
108
  end
46
109
  end
47
- end
110
+ end # evaluationMethod
48
111
 
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)
112
+ # conformanceResult []
113
+ unless hReport[:conformanceResult].empty?
114
+ hReport[:conformanceResult].each do |conformanceResult|
115
+ @xml.tag!('mdq:result') do
116
+ @xml.tag!('mdq:DQ_ConformanceResult') do
117
+ unless conformanceResult[:dateTime].nil?
118
+ dateTimeValue = DateTime.parse(conformanceResult[:dateTime]).strftime('%Y-%m-%dT%H:%M:%S')
119
+ @xml.tag!('mdq:dateTime') do
120
+ @xml.tag!('gco:DateTime', dateTimeValue)
121
+ end
122
+ end
123
+ unless conformanceResult[:scope].empty?
124
+ @xml.tag!('mdq:resultScope') do
125
+ scopeClass.writeXML(conformanceResult[:scope])
126
+ end
127
+ end
128
+ unless conformanceResult[:specification].empty?
129
+ @xml.tag!('mdq:specification') do
130
+ citationClass.writeXML(conformanceResult[:specification])
131
+ end
132
+ end
133
+ unless conformanceResult[:explanation].nil?
134
+ @xml.tag!('mdq:explanation') do
135
+ @xml.tag!('gco:CharacterString', conformanceResult[:explanation])
136
+ end
137
+ end
138
+ unless conformanceResult[:pass].nil?
139
+ @xml.tag!('mdq:pass') do
140
+ @xml.tag!('gco:Boolean', conformanceResult[:pass])
58
141
  end
59
142
  end
60
143
  end
144
+ end
145
+ end
146
+ end # conformanceResult
61
147
 
62
- unless qualityMeasure[:description].nil?
63
- @xml.tag!('mdq:measureDescription') do
64
- @xml.tag!('gco:CharacterString', qualityMeasure[:description])
148
+ # descriptiveResult []
149
+ unless hReport[:descriptiveResult].empty?
150
+ hReport[:descriptiveResult].each do |descriptiveResult|
151
+ @xml.tag!('mdq:result') do
152
+ @xml.tag!('mdq:DQ_DescriptiveResult') do
153
+ unless descriptiveResult[:dateTime].nil?
154
+ dateTimeValue = DateTime.parse(descriptiveResult[:dateTime]).strftime('%Y-%m-%dT%H:%M:%S')
155
+ @xml.tag!('mdq:dateTime') do
156
+ @xml.tag!('gco:DateTime', dateTimeValue)
157
+ end
158
+ end
159
+ unless descriptiveResult[:scope].empty?
160
+ @xml.tag!('mdq:resultScope') do
161
+ scopeClass.writeXML(descriptiveResult[:scope])
162
+ end
163
+ end
164
+ unless descriptiveResult[:statement].nil?
165
+ @xml.tag!('mdq:statement') do
166
+ @xml.tag!('gco:CharacterString', descriptiveResult[:statement])
167
+ end
65
168
  end
66
169
  end
67
170
  end
68
171
  end
69
- end
70
-
172
+ end # descriptiveResult
71
173
 
72
174
  # quantitativeResult []
73
- unless hReport[:quantitativeResult].nil? || hReport[:quantitativeResult].empty?
175
+ unless hReport[:quantitativeResult].empty?
74
176
  hReport[:quantitativeResult].each do |quantitativeResult|
75
177
  @xml.tag!('mdq:result') do
76
178
  @xml.tag!('mdq:DQ_QuantitativeResult') do
77
- quantitativeResult[:value].each do |value|
78
- @xml.tag!('mdq:value') do
79
- @xml.tag!('gco:Record', value)
179
+ unless quantitativeResult[:dateTime].nil?
180
+ dateTimeValue = DateTime.parse(quantitativeResult[:dateTime]).strftime('%Y-%m-%dT%H:%M:%S')
181
+ @xml.tag!('mdq:dateTime') do
182
+ @xml.tag!('gco:DateTime', dateTimeValue)
183
+ end
184
+ end
185
+ unless quantitativeResult[:scope].empty?
186
+ @xml.tag!('mdq:resultScope') do
187
+ scopeClass.writeXML(quantitativeResult[:scope])
188
+ end
189
+ end
190
+ unless quantitativeResult[:values].empty?
191
+ quantitativeResult[:values].each do |value|
192
+ @xml.tag!('mdq:value') do
193
+ @xml.tag!('gco:Record', value)
194
+ end
195
+ end
196
+ end
197
+ unless quantitativeResult[:valueUnits].nil?
198
+ @xml.tag!('mdq:valueUnit') do
199
+ @xml.tag!('gml:UnitDefinition') do
200
+ @xml.tag!('gml:identifier', {'codeSpace' => 'units'}, quantitativeResult[:valueUnits])
201
+ end
202
+ end
203
+ end
204
+ unless quantitativeResult[:valueRecordType].nil?
205
+ @xml.tag!('mdq:valueType') do
206
+ @xml.tag!('gco:RecordType', quantitativeResult[:valueRecordType])
80
207
  end
81
208
  end
82
209
  end
83
210
  end
84
211
  end
85
- end
212
+ end # quantitativeResult
86
213
 
87
- end
88
- end
89
- end
214
+ # coverageResult []
215
+ unless hReport[:coverageResult].empty?
216
+ hReport[:coverageResult].each do |coverageResult|
217
+ @xml.tag!('mdq:result') do
218
+ @xml.tag!('mdq:QE_CoverageResult') do
219
+ unless coverageResult[:dateTime].nil?
220
+ dateTimeValue = DateTime.parse(coverageResult[:dateTime]).strftime('%Y-%m-%dT%H:%M:%S')
221
+ @xml.tag!('mdq:dateTime') do
222
+ @xml.tag!('gco:DateTime', dateTimeValue)
223
+ end
224
+ end
225
+ unless coverageResult[:scope].empty?
226
+ @xml.tag!('mdq:resultScope') do
227
+ scopeClass.writeXML(coverageResult[:scope])
228
+ end
229
+ end
230
+ unless coverageResult[:spatialRepresentationType].nil?
231
+ @xml.tag!('mdq:spatialRepresentationType') do
232
+ codeListClass.writeXML('mcc', 'iso_spatialRepresentation', coverageResult[:spatialRepresentationType])
233
+ end
234
+ end
235
+ unless coverageResult[:resultFile].empty?
236
+ @xml.tag!('mdq:resultFile') do
237
+ qualityResultFileClass.writeXML(coverageResult[:resultFile])
238
+ end
239
+ end
240
+ unless coverageResult[:spatialRepresentation].empty?
241
+ @xml.tag!('mdq:resultSpatialRepresentation') do
242
+ spatialRepresentationClass.writeXML(coverageResult[:spatialRepresentation])
243
+ end
244
+ end
245
+ unless coverageResult[:resultContentDescription].empty?
246
+ @xml.tag!('mdq:resultContentDescription') do
247
+ coverageDescriptionClass.writeXML(coverageResult[:resultContentDescription])
248
+ end
249
+ end
250
+ unless coverageResult[:resourceFormat].empty?
251
+ @xml.tag!('mdq:resultFormat') do
252
+ formatClass.writeXML(coverageResult[:resourceFormat])
253
+ end
254
+ end
255
+ end
256
+ end
257
+ end
258
+ end # coverageResult
259
+
260
+ end # mdq:<type>
261
+ end # mdq:report
262
+
263
+ end # writeXML
90
264
 
91
- end
265
+ end # DataQualityReport class
92
266
  end
93
267
  end
94
268
  end
@@ -85,7 +85,7 @@ module ADIWG
85
85
  # schema locations
86
86
  # set to 'remoteSchema' before publishing
87
87
  localSchema = 'C:\Users\StanSmith\Projects\ISO\19115\-3\mdt\1.0\mdt.xsd'
88
- remoteSchema = 'http://standards.iso.org/iso/19115/-3/mdt/2.0/mdt.xsd'
88
+ remoteSchema = 'https://schemas.isotc211.org/19115/-3/mdt/2.0/mdt.xsd'
89
89
 
90
90
  # MD_Metadata
91
91
  @xml.tag!('mdb:MD_Metadata',
@@ -113,25 +113,7 @@ module ADIWG
113
113
  @xml.tag!('cit:individual')
114
114
  end
115
115
 
116
- # organization - party identifier
117
- if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0
118
- hContact[:externalIdentifier].each do |identifier|
119
- @xml.tag!('cit:partyIdentifier') do
120
- identifierClass.writeXML(identifier);
121
- end
122
- end
123
- else
124
- if hContact[:contactId] &&
125
- hContact[:contactId].is_a?(Hash)
126
- @xml.tag!('cit:partyIdentifier') do
127
- identifierClass.writeXML(hContact[:contactId]);
128
- end
129
- elsif hContact[:contactId].is_a?(String)
130
- @xml.tag!('cit:partyIdentifier') do
131
- identifierClass.writeXML({ identifier: hContact[:contactId] })
132
- end
133
- end
134
- end
116
+
135
117
 
136
118
  end
137
119
  if hContact.empty?
@@ -0,0 +1,55 @@
1
+ require_relative '../iso19115_3_writer'
2
+ require_relative 'class_format'
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Iso19115_3
8
+
9
+ class QualityResultFile
10
+
11
+ def initialize(xml, hResponseObj)
12
+ @xml = xml
13
+ @hResponseObj = hResponseObj
14
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_3
15
+ end
16
+
17
+ def writeXML(hResultFile, inContext = nil)
18
+
19
+ # classes used
20
+ formatClass = MD_Format.new(@xml, @hResponseObj)
21
+
22
+ @xml.tag!('mdq:QualityResultFile') do
23
+
24
+ unless hResultFile[:fileName].nil?
25
+ @xml.tag!('mdq:fileName') do
26
+ @xml.tag!('gcx:FileName', hResultFile[:fileName])
27
+ end
28
+ end
29
+
30
+ unless hResultFile[:fileType].nil?
31
+ @xml.tag!('mdq:fileType') do
32
+ @xml.tag!('gcx:MimeFileType', {:type => hResultFile[:fileType]})
33
+ end
34
+ end
35
+
36
+ unless hResultFile[:fileDescription].nil?
37
+ @xml.tag!('mdq:fileDescription') do
38
+ @xml.tag!('gco:CharacterString', hResultFile[:fileDescription])
39
+ end
40
+ end
41
+
42
+ unless hResultFile[:fileFormat].empty?
43
+ @xml.tag!('mdq:fileFormat') do
44
+ formatClass.writeXML(hResultFile[:fileFormat], inContext)
45
+ end
46
+ end
47
+
48
+ end
49
+ end # writeXML
50
+ end
51
+
52
+ end
53
+ end
54
+ end
55
+ end
@@ -17,23 +17,24 @@ module ADIWG
17
17
  end
18
18
 
19
19
  def writeXML(hAttribute, inContext = nil)
20
-
21
- unless hAttribute[:name].nil?
22
- @xml.tag!('mrc:name') do
23
- @xml.tag!('gco:CharacterString', hAttribute[:name])
20
+ @xml.tag!('mrc:MI_RangeElementDescription') do
21
+ unless hAttribute[:name].nil?
22
+ @xml.tag!('mrc:name') do
23
+ @xml.tag!('gco:CharacterString', hAttribute[:name])
24
+ end
24
25
  end
25
- end
26
26
 
27
- unless hAttribute[:definition].nil?
28
- @xml.tag!('mrc:definition') do
29
- @xml.tag!('gco:CharacterString', hAttribute[:definition])
27
+ unless hAttribute[:definition].nil?
28
+ @xml.tag!('mrc:definition') do
29
+ @xml.tag!('gco:CharacterString', hAttribute[:definition])
30
+ end
30
31
  end
31
- end
32
32
 
33
- hAttribute[:rangeElements].each do |hRangeElement|
34
- @xml.tag!('mrc:rangeElement') do
35
- @xml.tag!('gco:Record') do
36
- @xml.tag!('gco:CharacterString', hRangeElement)
33
+ hAttribute[:rangeElement].each do |hRangeElement|
34
+ @xml.tag!('mrc:rangeElement') do
35
+ @xml.tag!('gco:Record') do
36
+ @xml.tag!('gco:CharacterString', hRangeElement)
37
+ end
37
38
  end
38
39
  end
39
40
  end
@@ -67,12 +67,6 @@ module ADIWG
67
67
  @xml.tag!('mrc:scaleFactor')
68
68
  end
69
69
 
70
- hAttribute[:rangeElementDescription].each do |red|
71
- @xml.tag!('mrc:rangeElementDescription') do
72
- rangeElementDescription.writeXML(red, inContext)
73
- end
74
- end
75
-
76
70
  # sample dimension - offset {real}
77
71
  unless hAttribute[:offset].nil?
78
72
  @xml.tag!('mrc:offset') do
@@ -126,6 +120,12 @@ module ADIWG
126
120
  @xml.tag!('mrc:bitsPerValue')
127
121
  end
128
122
 
123
+ hAttribute[:rangeElementDescription].each do |red|
124
+ @xml.tag!('mrc:rangeElementDescription') do
125
+ rangeElementDescription.writeXML(red, inContext)
126
+ end
127
+ end
128
+
129
129
  end # writeXML
130
130
  end # MD_SampleDescription
131
131
 
@@ -20,6 +20,8 @@ module ADIWG
20
20
 
21
21
  def self.startWriter(intObj, hResponseObj)
22
22
 
23
+ hResponseObj[:writerMissingIdCount] = '000'
24
+
23
25
  # make contact available to the instance
24
26
  @contacts = intObj[:contacts]
25
27
  @hResponseObj = hResponseObj
@@ -28,8 +28,8 @@ module ADIWG
28
28
  json.recipientId hAllocation[:recipientId]
29
29
  json.responsibleParty @Namespace.json_map(hAllocation[:responsibleParties], ResponsibleParty)
30
30
  json.matching hAllocation[:matching]
31
- json.onlineResource @Namespace.json_map(hAllocation[:onlineResources], OnlineResource)
32
31
  json.comment hAllocation[:comment]
32
+ json.onlineResource @Namespace.json_map(hAllocation[:onlineResources], OnlineResource)
33
33
  end
34
34
 
35
35
  end # build
@@ -0,0 +1,30 @@
1
+ require 'jbuilder'
2
+ require_relative 'mdJson_scope'
3
+ require_relative 'mdJson_spatialRepresentation'
4
+ require_relative 'mdJson_format'
5
+ require_relative 'mdJson_qualityResultFile'
6
+ require_relative 'mdJson_coverageDescription'
7
+
8
+ module ADIWG
9
+ module Mdtranslator
10
+ module Writers
11
+ module MdJson
12
+
13
+ module CoverageResult
14
+ def self.build(hCoverageResult)
15
+ Jbuilder.new do |json|
16
+ json.dateTime hCoverageResult[:dateTime]
17
+ json.scope Scope.build(hCoverageResult[:scope]) unless hCoverageResult[:scope].empty?
18
+ json.spatialRepresentationType hCoverageResult[:spatialRepresentationType]
19
+ json.spatialRepresentation SpatialRepresentation.build(hCoverageResult[:spatialRepresentation]) unless hCoverageResult[:spatialRepresentation].empty?
20
+ json.resultContentDescription CoverageDescription.build(hCoverageResult[:resultContentDescription]) unless hCoverageResult[:resultContentDescription].empty?
21
+ json.resourceFormat Format.build(hCoverageResult[:resourceFormat]) unless hCoverageResult[:resourceFormat].empty?
22
+ json.resultFile QualityResultFile.build(hCoverageResult[:resultFile]) unless hCoverageResult[:resultFile].empty?
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -3,6 +3,8 @@
3
3
  require 'jbuilder'
4
4
  require_relative 'mdJson_scope'
5
5
  require_relative 'mdJson_dataQualityReport'
6
+ require_relative 'mdJson_citation'
7
+ require_relative 'mdJson_standaloneQualityReport'
6
8
 
7
9
  module ADIWG
8
10
  module Mdtranslator
@@ -17,7 +19,7 @@ module ADIWG
17
19
  Jbuilder.new do |json|
18
20
  json.scope Scope.build(hDataQuality[:scope])
19
21
  json.systemIdentifier hDataQuality[:systemIdentifier]
20
- json.standaloneQualityReport hDataQuality[:standaloneQualityReport]
22
+ json.standaloneQualityReport StandaloneQualityReport.build(hDataQuality[:standaloneReport]) unless hDataQuality[:standaloneReport].nil?
21
23
  json.report @Namespace.json_map(hDataQuality[:report], DataQualityReport)
22
24
  end
23
25
 
@@ -1,9 +1,10 @@
1
1
  require 'jbuilder'
2
- require_relative 'mdJson_conformanceResult'
3
- require_relative 'mdJson_descriptiveResult'
4
2
  require_relative 'mdJson_qualityMeasure'
5
- require_relative 'mdJson_quantitativeResult'
6
3
  require_relative 'mdJson_evaluationMethod'
4
+ require_relative 'mdJson_quantitativeResult'
5
+ require_relative 'mdJson_descriptiveResult'
6
+ require_relative 'mdJson_conformanceResult'
7
+ require_relative 'mdJson_coverageResult'
7
8
 
8
9
  module ADIWG
9
10
  module Mdtranslator
@@ -16,13 +17,14 @@ module ADIWG
16
17
 
17
18
  def self.build(hReport)
18
19
  Jbuilder.new do |json|
19
- json.type hReport[:type]
20
- json.conformanceResult @Namespace.json_map(hReport[:conformanceResult], ConformanceResult) unless hReport[:conformanceResult].nil? || hReport[:conformanceResult].empty?
21
- json.descriptiveResult @Namespace.json_map(hReport[:descriptiveResult], DescriptiveResult) unless hReport[:descriptiveResult].nil? || hReport[:descriptiveResult].empty?
22
- json.evaluationMethod EvaluationMethod.build(hReport[:evaluationMethod]) unless hReport[:evaluationMethod].nil?
23
- json.qualityMeasure QualityMeasure.build(hReport[:qualityMeasure]) unless hReport[:qualityMeasure].nil?
24
- json.quantitativeResult @Namespace.json_map(hReport[:quantitativeResult], QuantitativeResult) unless hReport[:quantitativeResult].nil? || hReport[:quantitativeResult].empty?
25
-
20
+ json.type hReport[:type] unless hReport[:type].nil?
21
+ json.standaloneQualityReportDetails hReport[:standaloneQualityReportDetails] unless hReport[:standaloneQualityReportDetails].nil?
22
+ json.qualityMeasure QualityMeasure.build(hReport[:qualityMeasure]) unless hReport[:qualityMeasure].empty?
23
+ json.evaluationMethod EvaluationMethod.build(hReport[:evaluationMethod]) unless hReport[:evaluationMethod].empty?
24
+ json.quantitativeResult @Namespace.json_map(hReport[:quantitativeResult], QuantitativeResult) unless hReport[:quantitativeResult].empty?
25
+ json.descriptiveResult @Namespace.json_map(hReport[:descriptiveResult], DescriptiveResult) unless hReport[:descriptiveResult].empty?
26
+ json.conformanceResult @Namespace.json_map(hReport[:conformanceResult], ConformanceResult) unless hReport[:conformanceResult].empty?
27
+ json.coverageResult @Namespace.json_map(hReport[:coverageResult], CoverageResult) unless hReport[:coverageResult].empty?
26
28
  end
27
29
  end
28
30
 
@@ -9,9 +9,9 @@ module ADIWG
9
9
  module DescriptiveResult
10
10
  def self.build(hResult)
11
11
  Jbuilder.new do |json|
12
- json.dateTime hResult[:dateTime]
13
- json.scope Scope.build(hResult[:scope]) unless hResult[:scope].nil?
14
- json.statement hResult[:statement]
12
+ json.dateTime hResult[:dateTime] unless hResult[:dateTime].nil?
13
+ json.scope Scope.build(hResult[:scope]) unless hResult[:scope].empty?
14
+ json.statement hResult[:statement] unless hResult[:statement].nil?
15
15
  end
16
16
  end
17
17
 
@@ -20,9 +20,9 @@ module ADIWG
20
20
  def self.build(hFunding)
21
21
 
22
22
  Jbuilder.new do |json|
23
- json.description hFunding[:description]
24
- json.timePeriod TimePeriod.build(hFunding[:timePeriod]) unless hFunding[:timePeriod].empty?
25
23
  json.allocation @Namespace.json_map(hFunding[:allocations], Allocation)
24
+ json.timePeriod TimePeriod.build(hFunding[:timePeriod]) unless hFunding[:timePeriod].empty?
25
+ json.description hFunding[:description]
26
26
  end
27
27
 
28
28
  end # build
@@ -15,8 +15,8 @@ module ADIWG
15
15
  def self.build(hLegal)
16
16
 
17
17
  Jbuilder.new do |json|
18
- json.useConstraint hLegal[:useCodes] unless hLegal[:useCodes].empty?
19
18
  json.accessConstraint hLegal[:accessCodes] unless hLegal[:accessCodes].empty?
19
+ json.useConstraint hLegal[:useCodes] unless hLegal[:useCodes].empty?
20
20
  json.otherConstraint hLegal[:otherCons] unless hLegal[:otherCons].empty?
21
21
  end
22
22
 
@@ -28,12 +28,12 @@ module ADIWG
28
28
  Jbuilder.new do |json|
29
29
  json.metadataInfo MetadataInfo.build(hMetadata[:metadataInfo])
30
30
  json.resourceInfo ResourceInfo.build(hMetadata[:resourceInfo])
31
+ json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality)
31
32
  json.resourceLineage @Namespace.json_map(hMetadata[:lineageInfo], LineageInfo)
32
33
  json.resourceDistribution @Namespace.json_map(hMetadata[:distributorInfo], Distribution)
33
34
  json.associatedResource @Namespace.json_map(hMetadata[:associatedResources], AssociatedResource)
34
35
  json.additionalDocumentation @Namespace.json_map(hMetadata[:additionalDocuments], AdditionalDocument)
35
36
  json.funding @Namespace.json_map(hMetadata[:funding], Funding)
36
- json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality)
37
37
  end
38
38
 
39
39
  end # build
@@ -1,4 +1,5 @@
1
1
  require 'jbuilder'
2
+ require_relative 'mdJson_identifier'
2
3
 
3
4
  module ADIWG
4
5
  module Mdtranslator
@@ -8,9 +9,9 @@ module ADIWG
8
9
  module QualityMeasure
9
10
  def self.build(hQualityMeasure)
10
11
  Jbuilder.new do |json|
11
- json.identifier hQualityMeasure[:identifier]
12
- json.name hQualityMeasure[:name]
13
- json.description hQualityMeasure[:description]
12
+ json.identifier Identifier.build(hQualityMeasure[:identifier]) unless hQualityMeasure[:identifier].empty?
13
+ json.name hQualityMeasure[:nameOfMeasure] unless hQualityMeasure[:nameOfMeasure].empty?
14
+ json.description hQualityMeasure[:description] unless hQualityMeasure[:description].nil?
14
15
  end
15
16
  end
16
17
  end