adiwg-mdtranslator 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +20 -5
  4. data/Rakefile +2 -0
  5. data/adiwg-mdtranslator.gemspec +2 -1
  6. data/lib/adiwg/mdtranslator.rb +1 -0
  7. data/lib/adiwg/mdtranslator/internal/module_codelistFun.rb +26 -0
  8. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +3 -0
  9. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +1 -1
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +0 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +0 -1
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +2 -4
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +0 -1
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +0 -2
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +0 -2
  17. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +0 -1
  18. data/lib/adiwg/mdtranslator/version.rb +3 -2
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +0 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +0 -1
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +0 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +0 -1
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +1 -1
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +0 -1
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +0 -1
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +1 -3
  28. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_additionalDocument.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb +90 -0
  30. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_associatedResource.rb +84 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attribute.rb +107 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb +69 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_baseUnit.rb +38 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_boundingBox.rb +70 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_browseGraphic.rb +95 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_citation.rb +205 -0
  37. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_codelist.rb +50 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraint.rb +51 -0
  39. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraintCommon.rb +104 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_contact.rb +119 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_conventionalUnit.rb +64 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_coverageDescription.rb +84 -0
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataIdentification.rb +347 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_date.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_definitionUnit.rb +35 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_derivedUnit.rb +42 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dimension.rb +72 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distribution.rb +62 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distributor.rb +77 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_email.rb +44 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_extent.rb +85 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_feature.rb +71 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb +56 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureProperties.rb +64 -0
  55. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_format.rb +74 -0
  56. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_fraction.rb +46 -0
  57. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gcoDateTime.rb +45 -0
  58. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicElement.rb +77 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicExtent.rb +96 -0
  60. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometricObjects.rb +60 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometryCollection.rb +97 -0
  62. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +121 -0
  63. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +87 -0
  64. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gmlIdentifier.rb +32 -0
  65. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +71 -0
  66. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gridRepresentation.rb +36 -0
  67. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +95 -0
  68. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_imageDescription.rb +175 -0
  69. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +85 -0
  70. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_keyword.rb +78 -0
  71. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_legalConstraints.rb +87 -0
  72. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineString.rb +76 -0
  73. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +97 -0
  74. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_locale.rb +67 -0
  75. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_maintenance.rb +101 -0
  76. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdBand.rb +82 -0
  77. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +372 -0
  78. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_measure.rb +71 -0
  79. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_medium.rb +113 -0
  80. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_miBand.rb +90 -0
  81. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiLine.rb +84 -0
  82. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPoint.rb +84 -0
  83. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPolygon.rb +84 -0
  84. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +91 -0
  85. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb +79 -0
  86. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +106 -0
  87. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb +81 -0
  88. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb +77 -0
  89. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb +95 -0
  90. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +130 -0
  91. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb +94 -0
  92. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb +92 -0
  93. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb +71 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb +97 -0
  95. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_responsibility.rb +91 -0
  96. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +127 -0
  97. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scope.rb +75 -0
  98. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scopeDescription.rb +75 -0
  99. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_securityConstraints.rb +97 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_series.rb +63 -0
  101. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +125 -0
  102. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_spatialRepresentation.rb +61 -0
  103. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_temporalExtent.rb +53 -0
  104. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timeInstant.rb +80 -0
  105. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timePeriod.rb +113 -0
  106. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_transferOptions.rb +107 -0
  107. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_unitsOfMeasure.rb +258 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_usage.rb +134 -0
  109. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_useConstraints.rb +41 -0
  110. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +61 -0
  111. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_verticalExtent.rb +70 -0
  112. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer.rb +105 -0
  113. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +132 -0
  114. data/lib/adiwg/mdtranslator/writers/iso19115_1/readme.md +12 -0
  115. data/lib/adiwg/mdtranslator/writers/iso19115_1/version.rb +15 -0
  116. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +3 -2
  117. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +42 -39
  118. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +2 -2
  119. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +3 -1
  120. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +12 -7
  121. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +2 -3
  122. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  123. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +1 -1
  124. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +42 -35
  125. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +4 -10
  126. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +1 -1
  127. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +5 -0
  128. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +2 -2
  129. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +1 -1
  130. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +7 -7
  131. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +0 -1
  132. data/lib/adiwg/mdtranslator_cli.rb +2 -1
  133. metadata +93 -5
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +0 -55
@@ -0,0 +1,12 @@
1
+
2
+ ## iso19115_1
3
+
4
+ ### Writer for ISO 19115-1:2014 Geographic Metadata
5
+
6
+ The mdTranslator iso19115_1 writer implements approximately 95% of
7
+ the for ISO 19115-3:2014 standard. Efforts were made to include all
8
+ elements of the ISO standard that support general data descriptions
9
+ to ensure generation of health and robust project and data metadata
10
+ records. The sections of 19115-3 not supported by the mdTranslator
11
+ writer are the 'quantitative' section for data quality, portrayal
12
+ catalog reference, acquisition, and application schema information.
@@ -0,0 +1,15 @@
1
+ # iso19115-1 version history
2
+ # 1.0.0 Original
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Iso19115_1
8
+
9
+ # current version of ISO 19115-1 writer
10
+ VERSION = '1.0.0'
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -119,8 +119,9 @@ module ADIWG
119
119
  end
120
120
 
121
121
  # citation - cited responsible party [{CI_ResponsibleParty}]
122
- # contacts are grouped by role in the internal object
123
- # output a separate <gmd:contact> for each role:contact pairing
122
+ # responsibilities are grouped by role in the internal object
123
+ # to output in ISO ...
124
+ # create a separate record for each role-contact pair
124
125
  # check for duplicates and eliminate
125
126
  aRoleParty = []
126
127
  aRParties = hCitation[:responsibleParties]
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-03-22 replaced Enumeration class with method
5
6
  # Stan Smith 2018-10-26 refactor for mdJson schema 2.6.0
6
7
  # Stan Smith 2018-05-25 block non-ISO19115-2 topic categories
7
8
  # Stan Smith 2018-04-09 add error and warning messaging
@@ -31,9 +32,9 @@
31
32
  # Stan Smith 2013-08-26 original script
32
33
 
33
34
  require 'adiwg/mdtranslator/internal/internal_metadata_obj'
35
+ require 'adiwg/mdtranslator/internal/module_codelistFun'
34
36
  require_relative '../iso19115_2_writer'
35
37
  require_relative 'class_codelist'
36
- require_relative 'class_enumerationList'
37
38
  require_relative 'class_citation'
38
39
  require_relative 'class_responsibleParty'
39
40
  require_relative 'class_maintenance'
@@ -62,12 +63,11 @@ module ADIWG
62
63
  @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
63
64
  end
64
65
 
65
- def writeXML(hData, aAssocRes, aDistInfo)
66
+ def writeXML(hMetadata)
66
67
 
67
68
  # classes used
68
69
  intMetadataClass = InternalMetadata.new
69
70
  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
70
- enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
71
71
  citationClass = CI_Citation.new(@xml, @hResponseObj)
72
72
  rPartyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
73
73
  mInfoClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
@@ -83,11 +83,16 @@ module ADIWG
83
83
  resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
84
84
  extentClass = EX_Extent.new(@xml, @hResponseObj)
85
85
 
86
+ # create shortcuts to sections of internal object
87
+ hResource = hMetadata[:resourceInfo]
88
+ aAssocRes = hMetadata[:associatedResources]
89
+ aDistInfo = hMetadata[:distributorInfo]
90
+
86
91
  # data identification
87
92
  @xml.tag!('gmd:MD_DataIdentification') do
88
93
 
89
94
  # data identification - citation {CI_Citation} (required)
90
- hCitation = hData[:citation]
95
+ hCitation = hResource[:citation]
91
96
  unless hCitation.empty?
92
97
  @xml.tag!('gmd:citation') do
93
98
  citationClass.writeXML(hCitation, 'main resource')
@@ -98,7 +103,7 @@ module ADIWG
98
103
  end
99
104
 
100
105
  # data identification - abstract (required)
101
- s = hData[:abstract]
106
+ s = hResource[:abstract]
102
107
  unless s.nil?
103
108
  @xml.tag!('gmd:abstract') do
104
109
  @xml.tag!('gco:CharacterString', s)
@@ -109,7 +114,7 @@ module ADIWG
109
114
  end
110
115
 
111
116
  # data identification - purpose
112
- s = hData[:purpose]
117
+ s = hResource[:purpose]
113
118
  unless s.nil?
114
119
  @xml.tag!('gmd:purpose') do
115
120
  @xml.tag!('gco:CharacterString', s)
@@ -121,16 +126,16 @@ module ADIWG
121
126
 
122
127
  # data identification - time period {timePeriod}
123
128
  # package as a temporal extent
124
- unless hData[:timePeriod].empty?
129
+ unless hResource[:timePeriod].empty?
125
130
  hExtent = intMetadataClass.newExtent
126
131
  hTempExtent = intMetadataClass.newTemporalExtent
127
- hTempExtent[:timePeriod] = hData[:timePeriod]
132
+ hTempExtent[:timePeriod] = hResource[:timePeriod]
128
133
  hExtent[:temporalExtents] << hTempExtent
129
- hData[:extents] << hExtent
134
+ hResource[:extents] << hExtent
130
135
  end
131
136
 
132
137
  # data identification - credit []
133
- aCredits = hData[:credits]
138
+ aCredits = hResource[:credits]
134
139
  aCredits.each do |credit|
135
140
  @xml.tag!('gmd:credit') do
136
141
  @xml.tag!('gco:CharacterString', credit)
@@ -141,7 +146,7 @@ module ADIWG
141
146
  end
142
147
 
143
148
  # data identification - status []
144
- aStatus = hData[:status]
149
+ aStatus = hResource[:status]
145
150
  aStatus.each do |code|
146
151
  @xml.tag!('gmd:status') do
147
152
  codelistClass.writeXML('gmd', 'iso_progress', code)
@@ -152,13 +157,13 @@ module ADIWG
152
157
  end
153
158
 
154
159
  # data identification - point of contact
155
- aRParties = hData[:pointOfContacts]
160
+ aRParties = hResource[:pointOfContacts]
156
161
  aRParties.each do |hRParty|
157
162
  role = hRParty[:roleName]
158
163
  aParties = hRParty[:parties]
159
164
  aParties.each do |hParty|
160
165
  @xml.tag!('gmd:pointOfContact') do
161
- rPartyClass.writeXML(role, hParty, 'main resource point of contact')
166
+ rPartyClass.writeXML(role, hParty, 'resource point of contact')
162
167
  end
163
168
  end
164
169
  end
@@ -167,7 +172,7 @@ module ADIWG
167
172
  end
168
173
 
169
174
  # data identification - resource maintenance []
170
- aMaint = hData[:resourceMaintenance]
175
+ aMaint = hResource[:resourceMaintenance]
171
176
  aMaint.each do |hMaint|
172
177
  @xml.tag!('gmd:resourceMaintenance') do
173
178
  mInfoClass.writeXML(hMaint, 'main resource')
@@ -178,7 +183,7 @@ module ADIWG
178
183
  end
179
184
 
180
185
  # data identification - graphic overview []
181
- aGraphics = hData[:graphicOverviews]
186
+ aGraphics = hResource[:graphicOverviews]
182
187
  aGraphics.each do |hGraphic|
183
188
  @xml.tag!('gmd:graphicOverview') do
184
189
  bGraphicClass.writeXML(hGraphic, 'main resource')
@@ -189,7 +194,7 @@ module ADIWG
189
194
  end
190
195
 
191
196
  # data identification - resource format []
192
- aFormats = hData[:resourceFormats]
197
+ aFormats = hResource[:resourceFormats]
193
198
  aFormats.each do |hResFormat|
194
199
  @xml.tag!('gmd:resourceFormat') do
195
200
  rFormatClass.writeXML(hResFormat)
@@ -200,7 +205,7 @@ module ADIWG
200
205
  end
201
206
 
202
207
  # data identification - descriptive keywords []
203
- aKeywords = hData[:keywords]
208
+ aKeywords = hResource[:keywords]
204
209
  aKeywords.each do |hKeyword|
205
210
  @xml.tag!('gmd:descriptiveKeywords') do
206
211
  keywordClass.writeXML(hKeyword)
@@ -211,7 +216,7 @@ module ADIWG
211
216
  end
212
217
 
213
218
  # data identification - resource specific usage []
214
- aUses = hData[:resourceUsages]
219
+ aUses = hResource[:resourceUsages]
215
220
  aUses.each do |hResUse|
216
221
  @xml.tag!('gmd:resourceSpecificUsage') do
217
222
  useClass.writeXML(hResUse)
@@ -223,7 +228,7 @@ module ADIWG
223
228
 
224
229
  # data identification - resource constraints {}
225
230
  haveCon = false
226
- aCons = hData[:constraints]
231
+ aCons = hResource[:constraints]
227
232
  aCons.each do |hCon|
228
233
  @xml.tag!('gmd:resourceConstraints') do
229
234
  type = hCon[:type]
@@ -271,24 +276,24 @@ module ADIWG
271
276
  end
272
277
 
273
278
  # data identification - taxonomy (first)
274
- unless hData[:taxonomy].empty?
275
- hTaxonomy = hData[:taxonomy][0]
279
+ unless hResource[:taxonomy].empty?
280
+ hTaxonomy = hResource[:taxonomy][0]
276
281
  unless hTaxonomy.empty?
277
282
  @xml.tag!('gmd:taxonomy') do
278
283
  taxClass.writeXML(hTaxonomy)
279
284
  end
280
285
  end
281
- if hData[:taxonomy].length > 1
286
+ if hResource[:taxonomy].length > 1
282
287
  @NameSpace.issueNotice(53, 'main resource')
283
288
  @NameSpace.issueNotice(54, 'main resource')
284
289
  end
285
290
  end
286
- if hData[:taxonomy].empty? && @hResponseObj[:writerShowTags]
291
+ if hResource[:taxonomy].empty? && @hResponseObj[:writerShowTags]
287
292
  @xml.tag!('gmd:taxonomy')
288
293
  end
289
294
 
290
295
  # data identification - spatial representation type []
291
- aSpatialType = hData[:spatialRepresentationTypes]
296
+ aSpatialType = hResource[:spatialRepresentationTypes]
292
297
  aSpatialType.each do |spType|
293
298
  @xml.tag!('gmd:spatialRepresentationType') do
294
299
  codelistClass.writeXML('gmd', 'iso_spatialRepresentation', spType)
@@ -299,7 +304,7 @@ module ADIWG
299
304
  end
300
305
 
301
306
  # data identification - spatial resolution []
302
- aSpatialRes = hData[:spatialResolutions]
307
+ aSpatialRes = hResource[:spatialResolutions]
303
308
  aSpatialRes.each do |hSpRes|
304
309
  @xml.tag!('gmd:spatialResolution') do
305
310
  resolutionClass.writeXML(hSpRes)
@@ -310,8 +315,8 @@ module ADIWG
310
315
  end
311
316
 
312
317
  # data identification - language [] (required)
313
- aLocale = hData[:otherResourceLocales]
314
- aLocale.insert(0, hData[:defaultResourceLocale])
318
+ aLocale = hResource[:otherResourceLocales]
319
+ aLocale.insert(0, hResource[:defaultResourceLocale])
315
320
  aLocale.each do |hLocale|
316
321
  s = hLocale[:languageCode]
317
322
  unless hLocale[:countryCode].nil?
@@ -344,10 +349,10 @@ module ADIWG
344
349
  end
345
350
  end
346
351
 
347
- # data identification - topic category []
348
- # <- hData.keywords where keywordType='isoTopicCategory'
352
+ # data identification - topic category [] {MD_TopicCategoryCode}
353
+ # get from hData.keywords where keywordType='isoTopicCategory'
349
354
  aTopics = []
350
- aKeywords = hData[:keywords]
355
+ aKeywords = hResource[:keywords]
351
356
  aKeywords.each do |hKeyword|
352
357
  if hKeyword[:keywordType] == 'isoTopicCategory'
353
358
  hKeyword[:keywords].each do |hKeyObj|
@@ -356,15 +361,13 @@ module ADIWG
356
361
  end
357
362
  end
358
363
  # only allow valid ISO 19115-2 topic categories to be written
359
- aAcceptable = %w(farming biota boundaries climatologyMeteorologyAtmosphere economy
360
- elevation environment geoscientificInformation health imageryBaseMapsEarthCover
361
- intelligenceMilitary inlandWaters location oceans planningCadastre society
362
- structure transportation utilitiesCommunication)
363
364
  aTopics.each do |topic|
364
- if aAcceptable.include?(topic)
365
+ if CodelistFun.validateItem('iso_topicCategory', topic)
365
366
  @xml.tag!('gmd:topicCategory') do
366
- enumerationClass.writeXML('iso_topicCategory', topic)
367
+ @xml.tag!('gmd:MD_TopicCategoryCode', topic)
367
368
  end
369
+ else
370
+ @NameSpace.issueWarning(380, 'gmd:topicCategory', "#{topic}")
368
371
  end
369
372
  end
370
373
  if aTopics.empty? && @hResponseObj[:writerShowTags]
@@ -372,7 +375,7 @@ module ADIWG
372
375
  end
373
376
 
374
377
  # data identification - environment description
375
- s = hData[:environmentDescription]
378
+ s = hResource[:environmentDescription]
376
379
  unless s.nil?
377
380
  @xml.tag!('gmd:environmentDescription') do
378
381
  @xml.tag!('gco:CharacterString', s)
@@ -383,7 +386,7 @@ module ADIWG
383
386
  end
384
387
 
385
388
  # data identification - extent []
386
- aExtents = hData[:extents]
389
+ aExtents = hResource[:extents]
387
390
  aExtents.each do |hExtent|
388
391
  @xml.tag!('gmd:extent') do
389
392
  extentClass.writeXML(hExtent)
@@ -394,7 +397,7 @@ module ADIWG
394
397
  end
395
398
 
396
399
  # data identification - supplemental info
397
- s = hData[:supplementalInfo]
400
+ s = hResource[:supplementalInfo]
398
401
  unless s.nil?
399
402
  @xml.tag!('gmd:supplementalInformation') do
400
403
  @xml.tag!('gco:CharacterString', s)
@@ -36,7 +36,7 @@ module ADIWG
36
36
  scopeClass = DQ_Scope.new(@xml, @hResponseObj)
37
37
  lineClass = LI_Lineage.new(@xml, @hResponseObj)
38
38
 
39
- outContext = 'data quality'
39
+ outContext = 'data quality - lineage'
40
40
 
41
41
  @xml.tag!('gmd:DQ_DataQuality') do
42
42
 
@@ -48,7 +48,7 @@ module ADIWG
48
48
  end
49
49
  end
50
50
  if hScope.empty?
51
- @NameSpace.issueWarning(60, 'gmd:scope')
51
+ @NameSpace.issueWarning(60, 'gmd:scope', outContext)
52
52
  end
53
53
 
54
54
  # date quality - report (moved to ISO 19157)
@@ -39,6 +39,8 @@ module ADIWG
39
39
  formatClass = MD_Format.new(@xml, @hResponseObj)
40
40
  transferClass = MD_DigitalTransferOptions.new(@xml, @hResponseObj)
41
41
 
42
+ outContext = 'distributor'
43
+
42
44
  @xml.tag!('gmd:MD_Distributor') do
43
45
 
44
46
  # distributor - contact (required) {CI_ResponsibleParty}
@@ -72,7 +74,7 @@ module ADIWG
72
74
  aFormats.each do |hFormat|
73
75
  format = true
74
76
  @xml.tag!('gmd:distributorFormat') do
75
- formatClass.writeXML(hFormat)
77
+ formatClass.writeXML(hFormat, outContext + ' format')
76
78
  end
77
79
  end
78
80
  end
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-03-22 replaced Enumeration class with method
5
6
  # Stan Smith 2018-04-09 add error and warning messaging
6
7
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
8
  # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
@@ -11,6 +12,7 @@
11
12
  # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
12
13
  # Stan Smith 2013-11-22 original script.
13
14
 
15
+ require 'adiwg/mdtranslator/internal/module_codelistFun'
14
16
  require_relative '../iso19115_2_writer'
15
17
  require_relative 'class_codelist'
16
18
  require_relative 'class_enumerationList'
@@ -33,7 +35,6 @@ module ADIWG
33
35
 
34
36
  # classes used
35
37
  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
36
- enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
37
38
  olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
38
39
 
39
40
  outContext = 'extension information'
@@ -89,14 +90,18 @@ module ADIWG
89
90
  @NameSpace.issueWarning(101, 'gmd:definition', outContext)
90
91
  end
91
92
 
92
- # extended element info - obligation
93
- s = hExtension[:obligation]
94
- unless s.nil?
95
- @xml.tag!('gmd:obligation') do
96
- enumerationClass.writeXML('iso_obligation', s)
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}")
97
102
  end
98
103
  end
99
- if s.nil? && @hResponseObj[:writerShowTags]
104
+ if obligation.nil? && @hResponseObj[:writerShowTags]
100
105
  @xml.tag!('gmd:obligation')
101
106
  end
102
107
 
@@ -95,7 +95,6 @@ module ADIWG
95
95
  hMetadata = intObj[:metadata]
96
96
  hMetaInfo = hMetadata[:metadataInfo]
97
97
  hResInfo = hMetadata[:resourceInfo]
98
- aAssocRes = hMetadata[:associatedResources]
99
98
  aDistInfo = hMetadata[:distributorInfo]
100
99
  version = @hResponseObj[:translatorVersion]
101
100
 
@@ -211,7 +210,7 @@ module ADIWG
211
210
 
212
211
  # metadata information - metadata standard name (default)
213
212
  @xml.tag!('gmd:metadataStandardName') do
214
- @xml.tag!('gco:CharacterString', 'ISO 19115-2')
213
+ @xml.tag!('gco:CharacterString', 'ISO 19139')
215
214
  end
216
215
 
217
216
  # metadata information - metadata standard version (default)
@@ -298,7 +297,7 @@ module ADIWG
298
297
  # metadata information - identification info - required
299
298
  unless hResInfo.empty?
300
299
  @xml.tag!('gmd:identificationInfo') do
301
- dataIdClass.writeXML(hResInfo, aAssocRes, aDistInfo)
300
+ dataIdClass.writeXML(hMetadata)
302
301
  end
303
302
  end
304
303
  if hResInfo.empty?
@@ -1,6 +1,6 @@
1
1
  # ISO <<Class>> MD_ReferenceSystem
2
2
  # writer
3
- # 19115-2 output for ISO 19115-2 XML
3
+ # 19115-2 output for XML
4
4
 
5
5
  # History:
6
6
  # Stan Smith 2018-10-17 refactor to support schema 2.6.0 changes to projection
@@ -40,7 +40,7 @@ module ADIWG
40
40
  end
41
41
 
42
42
  # spatial resolution - distance (only if type='distance')
43
- unless hResolution[:measure].nil?
43
+ unless hResolution[:measure].empty?
44
44
  hMeasure = hResolution[:measure]
45
45
  unless hMeasure.empty?
46
46
  if hMeasure[:type] == 'distance'
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2019-03-14 added test for empty parameters
5
6
  # Stan Smith 2018-04-10 add error and warning messaging
6
7
  # Stan Smith 2016-11-17 refactored for mdTranslator/mdJson 2.0
7
8
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
@@ -39,80 +40,86 @@ module ADIWG
39
40
  outContext = 'responsible party'
40
41
  outContext = inContext + ' responsible party' unless inContext.nil?
41
42
 
42
- contactId = hParty[:contactId]
43
- hContact = ADIWG::Mdtranslator::Writers::Iso19115_2.getContact(contactId)
43
+ hContact = ADIWG::Mdtranslator::Writers::Iso19115_2.getContact(hParty[:contactId])
44
+
44
45
  unless hContact.empty?
45
- isOrg = hContact[:isOrganization]
46
46
  @xml.tag!('gmd:CI_ResponsibleParty') do
47
47
 
48
+ name = hContact[:name]
49
+ position = hContact[:positionName]
50
+
48
51
  # responsible party
49
- if isOrg
52
+ if hContact[:isOrganization]
50
53
 
51
- # organization name
52
- s = hContact[:name]
53
- unless s.nil?
54
+ # responsible party - organization name
55
+ unless name.nil?
54
56
  @xml.tag!('gmd:organisationName') do
55
- @xml.tag!('gco:CharacterString', s)
57
+ @xml.tag!('gco:CharacterString', name)
56
58
  end
57
59
  end
58
- if s.nil? && @hResponseObj[:writerShowTags]
60
+ if name.nil? && @hResponseObj[:writerShowTags]
59
61
  @xml.tag!('gmd:organisationName')
60
62
  end
61
63
 
62
64
  else
63
65
 
64
- # individual name
65
- s = hContact[:name]
66
- unless s.nil?
66
+ # responsible party - individual name
67
+ unless name.nil?
67
68
  @xml.tag!('gmd:individualName') do
68
- @xml.tag!('gco:CharacterString', s)
69
+ @xml.tag!('gco:CharacterString', name)
69
70
  end
70
71
  end
71
- if s.nil? && @hResponseObj[:writerShowTags]
72
+ if name.nil? && @hResponseObj[:writerShowTags]
72
73
  @xml.tag!('gmd:individualName')
73
74
  end
74
75
 
75
- # position name
76
- s = hContact[:positionName]
77
- unless s.nil?
76
+ # responsible party - position name
77
+ unless position.nil?
78
78
  @xml.tag!('gmd:positionName') do
79
- @xml.tag!('gco:CharacterString', s)
79
+ @xml.tag!('gco:CharacterString', position)
80
80
  end
81
81
  end
82
- if s.nil? && @hResponseObj[:writerShowTags]
82
+ if position.nil? && @hResponseObj[:writerShowTags]
83
83
  @xml.tag!('gmd:positionName')
84
84
  end
85
85
 
86
86
  end
87
87
 
88
88
  # responsible party - contact info
89
- if !hContact[:phones].empty? ||
90
- !hContact[:addresses].empty? ||
91
- !hContact[:eMailList].empty? ||
92
- !hContact[:onlineResources].empty? ||
93
- !hContact[:hoursOfService].empty? ||
94
- !hContact[:contactInstructions].nil?
95
-
89
+ haveInfo = false
90
+ unless hContact[:phones].empty? &&
91
+ hContact[:addresses].empty? &&
92
+ hContact[:eMailList].empty? &&
93
+ hContact[:onlineResources].empty? &&
94
+ hContact[:hoursOfService].empty? &&
95
+ hContact[:contactInstructions].nil?
96
+ haveInfo = true
97
+ end
98
+ if haveInfo
96
99
  @xml.tag!('gmd:contactInfo') do
97
100
  contactClass.writeXML(hContact)
98
101
  end
99
- elsif @hResponseObj[:writerShowTags]
102
+ end
103
+ if !haveInfo && @hResponseObj[:writerShowTags]
100
104
  @xml.tag!('gmd:contactInfo')
101
105
  end
102
106
 
103
107
  # responsible party - role (required)
104
- s = role
105
- unless s.nil?
106
- @xml.tag! 'gmd:role' do
107
- codelistClass.writeXML('gmd', 'iso_role', s)
108
+ unless role.nil?
109
+ @xml.tag!('gmd:role') do
110
+ codelistClass.writeXML('gmd', 'iso_role', role)
108
111
  end
109
112
  end
110
- if s.nil?
111
- @NameSpace.issueWarning(270, 'gmd:role', inContext)
113
+ if role.nil?
114
+ @NameSpace.issueWarning(270, 'gmd:role', outContext)
112
115
  end
113
116
 
114
- end # CI_ResponsibleParty tag
115
- end # valid contact returned
117
+ end
118
+ end
119
+ if hContact.empty? && @hResponseObj[:writerShowTags]
120
+ @xml.tag!('gmd:CI_ResponsibleParty')
121
+ end
122
+
116
123
  end # write XML
117
124
  end # CI_ResponsibleParty class
118
125