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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +20 -5
- data/Rakefile +2 -0
- data/adiwg-mdtranslator.gemspec +2 -1
- data/lib/adiwg/mdtranslator.rb +1 -0
- data/lib/adiwg/mdtranslator/internal/module_codelistFun.rb +26 -0
- data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +3 -0
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +0 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +0 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +2 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +0 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +0 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +0 -2
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +0 -1
- data/lib/adiwg/mdtranslator/version.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +1 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_additionalDocument.rb +48 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb +90 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_associatedResource.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attribute.rb +107 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb +69 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_baseUnit.rb +38 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_boundingBox.rb +70 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_browseGraphic.rb +95 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_citation.rb +205 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_codelist.rb +50 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraint.rb +51 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraintCommon.rb +104 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_contact.rb +119 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_conventionalUnit.rb +64 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_coverageDescription.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataIdentification.rb +347 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_date.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_definitionUnit.rb +35 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_derivedUnit.rb +42 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dimension.rb +72 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distribution.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distributor.rb +77 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_email.rb +44 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_extent.rb +85 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_feature.rb +71 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb +56 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureProperties.rb +64 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_format.rb +74 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_fraction.rb +46 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gcoDateTime.rb +45 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicElement.rb +77 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicExtent.rb +96 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometricObjects.rb +60 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometryCollection.rb +97 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +121 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +87 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gmlIdentifier.rb +32 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +71 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gridRepresentation.rb +36 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +95 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_imageDescription.rb +175 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +85 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_keyword.rb +78 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_legalConstraints.rb +87 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineString.rb +76 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +97 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_locale.rb +67 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_maintenance.rb +101 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdBand.rb +82 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +372 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_measure.rb +71 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_medium.rb +113 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_miBand.rb +90 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiLine.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPoint.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPolygon.rb +84 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +91 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb +79 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +106 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb +81 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb +77 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb +95 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +130 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb +94 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb +92 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb +71 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb +97 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_responsibility.rb +91 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +127 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scope.rb +75 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scopeDescription.rb +75 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_securityConstraints.rb +97 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_series.rb +63 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +125 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_spatialRepresentation.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_temporalExtent.rb +53 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timeInstant.rb +80 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timePeriod.rb +113 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_transferOptions.rb +107 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_unitsOfMeasure.rb +258 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_usage.rb +134 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_useConstraints.rb +41 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_verticalExtent.rb +70 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer.rb +105 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +132 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/readme.md +12 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/version.rb +15 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +42 -39
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +12 -7
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +2 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +42 -35
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +4 -10
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +5 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +2 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +0 -1
- data/lib/adiwg/mdtranslator_cli.rb +2 -1
- metadata +93 -5
- 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.
|
@@ -119,8 +119,9 @@ module ADIWG
|
|
119
119
|
end
|
120
120
|
|
121
121
|
# citation - cited responsible party [{CI_ResponsibleParty}]
|
122
|
-
#
|
123
|
-
# output
|
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(
|
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 =
|
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 =
|
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 =
|
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
|
129
|
+
unless hResource[:timePeriod].empty?
|
125
130
|
hExtent = intMetadataClass.newExtent
|
126
131
|
hTempExtent = intMetadataClass.newTemporalExtent
|
127
|
-
hTempExtent[:timePeriod] =
|
132
|
+
hTempExtent[:timePeriod] = hResource[:timePeriod]
|
128
133
|
hExtent[:temporalExtents] << hTempExtent
|
129
|
-
|
134
|
+
hResource[:extents] << hExtent
|
130
135
|
end
|
131
136
|
|
132
137
|
# data identification - credit []
|
133
|
-
aCredits =
|
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 =
|
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 =
|
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, '
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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
|
275
|
-
hTaxonomy =
|
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
|
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
|
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 =
|
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 =
|
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 =
|
314
|
-
aLocale.insert(0,
|
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
|
-
#
|
352
|
+
# data identification - topic category [] {MD_TopicCategoryCode}
|
353
|
+
# get from hData.keywords where keywordType='isoTopicCategory'
|
349
354
|
aTopics = []
|
350
|
-
aKeywords =
|
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
|
365
|
+
if CodelistFun.validateItem('iso_topicCategory', topic)
|
365
366
|
@xml.tag!('gmd:topicCategory') do
|
366
|
-
|
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 =
|
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 =
|
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 =
|
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
|
-
|
94
|
-
unless
|
95
|
-
|
96
|
-
|
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
|
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
|
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(
|
300
|
+
dataIdClass.writeXML(hMetadata)
|
302
301
|
end
|
303
302
|
end
|
304
303
|
if hResInfo.empty?
|
@@ -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
|
-
|
43
|
-
|
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
|
52
|
+
if hContact[:isOrganization]
|
50
53
|
|
51
|
-
# organization name
|
52
|
-
|
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',
|
57
|
+
@xml.tag!('gco:CharacterString', name)
|
56
58
|
end
|
57
59
|
end
|
58
|
-
if
|
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
|
-
|
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',
|
69
|
+
@xml.tag!('gco:CharacterString', name)
|
69
70
|
end
|
70
71
|
end
|
71
|
-
if
|
72
|
+
if name.nil? && @hResponseObj[:writerShowTags]
|
72
73
|
@xml.tag!('gmd:individualName')
|
73
74
|
end
|
74
75
|
|
75
|
-
# position name
|
76
|
-
|
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',
|
79
|
+
@xml.tag!('gco:CharacterString', position)
|
80
80
|
end
|
81
81
|
end
|
82
|
-
if
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
-
|
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
|
-
|
105
|
-
|
106
|
-
|
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
|
111
|
-
@NameSpace.issueWarning(270, 'gmd:role',
|
113
|
+
if role.nil?
|
114
|
+
@NameSpace.issueWarning(270, 'gmd:role', outContext)
|
112
115
|
end
|
113
116
|
|
114
|
-
end
|
115
|
-
end
|
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
|
|