adiwg-mdtranslator 2.19.0.pre.beta.27 → 2.19.0.pre.beta.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/adiwg/mdtranslator/version.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_enumerationList.rb +52 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extension.rb +208 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb +24 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2b29afcfa119d88b586c681a8ff17a71bbe9ee920cfe3ea5811c6929024818d
|
4
|
+
data.tar.gz: b4eb9f1b0b86db2738dffd5362ed05a8ada2a7e6c7bbb5f6a201894b80260694
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbdb26949180a83c535c1b4794857f6e8b6858e57163a63674f5eb8541ce1e7d61355f136bb542563c96664cddd354de52958ae5a39b0ddf79c4d80d1799fa6
|
7
|
+
data.tar.gz: 74ea9e985ebd466c2ef8b8fa1feeadc1d97ca709f39f3ef4335bc0a5348b97f10106141b3f353475219f40c62fd8d8218a49c59ed2a9aaf9ba7505831d14434e
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
# ISO <<CodeLists>> Enumerations
|
2
|
+
# 19115-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2016-12-12 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
9
|
+
# Stan Smith 2015-06-12 refactored to use mdCodes gem for codelist contents
|
10
|
+
# Stan Smith 2014-12-15 replaced NOAA CT_CodelistCatalogue with mdTranslator CT_CodelistCatalogue
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-10-15 allow non-ISO codesNames to be rendered
|
13
|
+
# Stan Smith 2013-08-09 original script
|
14
|
+
|
15
|
+
require 'adiwg-mdcodes'
|
16
|
+
|
17
|
+
module ADIWG
|
18
|
+
module Mdtranslator
|
19
|
+
module Writers
|
20
|
+
module Iso19115_3
|
21
|
+
|
22
|
+
class MD_EnumerationList
|
23
|
+
|
24
|
+
def initialize(xml, responseObj)
|
25
|
+
@xml = xml
|
26
|
+
@hResponseObj = responseObj
|
27
|
+
end
|
28
|
+
|
29
|
+
def writeXML(codeList, codeName)
|
30
|
+
|
31
|
+
# get requested codelist from the adiwg-mdcodes gem
|
32
|
+
mdCodelist = ADIWG::Mdcodes.getCodelistDetail(codeList)
|
33
|
+
|
34
|
+
sourceName = mdCodelist['sourceName']
|
35
|
+
codelist = mdCodelist['codelist']
|
36
|
+
|
37
|
+
# search the codelist for a matching codeName
|
38
|
+
# only valid enumeration values can be written in ISO
|
39
|
+
codelist.each do |code|
|
40
|
+
if code['codeName'] == codeName
|
41
|
+
@xml.tag!('gmd:' + "#{sourceName}", codeName)
|
42
|
+
break
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end # writeXML
|
47
|
+
end # MD_EnumerationList class
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
# ISO <<Class>> MD_MetadataExtensionInformation
|
2
|
+
# 19115-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-03-22 replaced Enumeration class with method
|
6
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
7
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
8
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
13
|
+
# Stan Smith 2013-11-22 original script.
|
14
|
+
|
15
|
+
require 'adiwg/mdtranslator/internal/module_codelistFun'
|
16
|
+
require_relative '../iso19115_3_writer'
|
17
|
+
require_relative 'class_codelist'
|
18
|
+
require_relative 'class_enumerationList'
|
19
|
+
require_relative 'class_onlineResource'
|
20
|
+
|
21
|
+
module ADIWG
|
22
|
+
module Mdtranslator
|
23
|
+
module Writers
|
24
|
+
module Iso19115_3
|
25
|
+
|
26
|
+
class MD_MetadataExtensionInformation
|
27
|
+
|
28
|
+
def initialize(xml, hResponseObj)
|
29
|
+
@xml = xml
|
30
|
+
@hResponseObj = hResponseObj
|
31
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_3
|
32
|
+
end
|
33
|
+
|
34
|
+
def writeXML(hExtension)
|
35
|
+
|
36
|
+
# classes used
|
37
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
38
|
+
olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
|
39
|
+
|
40
|
+
outContext = 'extension information'
|
41
|
+
outContext = 'extension name ' + hExtension[:name] unless hExtension[:name].nil?
|
42
|
+
|
43
|
+
@xml.tag!('gmd:MD_MetadataExtensionInformation') do
|
44
|
+
|
45
|
+
# metadata extension - online resource {CI_OnLineResource}
|
46
|
+
hOLResource = hExtension[:onLineResource]
|
47
|
+
unless hOLResource.empty?
|
48
|
+
@xml.tag!('gmd:extensionOnLineResource') do
|
49
|
+
olResClass.writeXML(hOLResource, outContext)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
if hOLResource.empty? && @hResponseObj[:writerShowTags]
|
53
|
+
@xml.tag!('gmd:extensionOnLineResource')
|
54
|
+
end
|
55
|
+
|
56
|
+
# metadata extension = extended element information
|
57
|
+
@xml.tag!('gmd:extendedElementInformation') do
|
58
|
+
@xml.tag!('gmd:MD_ExtendedElementInformation') do
|
59
|
+
|
60
|
+
# extended element info - name (required)
|
61
|
+
s = hExtension[:name]
|
62
|
+
unless s.nil?
|
63
|
+
@xml.tag!('gmd:name') do
|
64
|
+
@xml.tag!('gco:CharacterString', s)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
if s.nil?
|
68
|
+
@NameSpace.issueWarning(100, 'gmd:name')
|
69
|
+
end
|
70
|
+
|
71
|
+
# extended element info - short name
|
72
|
+
s = hExtension[:shortName]
|
73
|
+
unless s.nil?
|
74
|
+
@xml.tag!('gmd:shortName') do
|
75
|
+
@xml.tag!('gco:CharacterString', s)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
79
|
+
@xml.tag!('gmd:shortName')
|
80
|
+
end
|
81
|
+
|
82
|
+
# extended element info - definition (required)
|
83
|
+
s = hExtension[:definition]
|
84
|
+
unless s.nil?
|
85
|
+
@xml.tag!('gmd:definition') do
|
86
|
+
@xml.tag!('gco:CharacterString', s)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
if s.nil?
|
90
|
+
@NameSpace.issueWarning(101, 'gmd:definition', outContext)
|
91
|
+
end
|
92
|
+
|
93
|
+
# extended element info - obligation {MD_ObligationCode}
|
94
|
+
obligation = hExtension[:obligation]
|
95
|
+
unless obligation.nil?
|
96
|
+
if CodelistFun.validateItem('iso_obligation', obligation)
|
97
|
+
@xml.tag!('gmd:obligation') do
|
98
|
+
@xml.tag!('gmd:MD_ObligationCode', obligation)
|
99
|
+
end
|
100
|
+
else
|
101
|
+
@NameSpace.issueWarning(380, 'gmd:obligation', "#{obligation}")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
if obligation.nil? && @hResponseObj[:writerShowTags]
|
105
|
+
@xml.tag!('gmd:obligation')
|
106
|
+
end
|
107
|
+
|
108
|
+
# extended element info - data type (required)
|
109
|
+
s = hExtension[:dataType]
|
110
|
+
unless s.nil?
|
111
|
+
@xml.tag!('gmd:dataType') do
|
112
|
+
codelistClass.writeXML('gmd', 'iso_entityClass', s)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
if s.nil?
|
116
|
+
@NameSpace.issueWarning(102, 'gmd:dataType', outContext)
|
117
|
+
end
|
118
|
+
|
119
|
+
# extended element info - maximum occurrence
|
120
|
+
s = hExtension[:maxOccurrence]
|
121
|
+
unless s.nil?
|
122
|
+
@xml.tag!('gmd:maximumOccurrence') do
|
123
|
+
@xml.tag!('gco:CharacterString', s)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
127
|
+
@xml.tag!('gmd:maximumOccurrence')
|
128
|
+
end
|
129
|
+
|
130
|
+
# extended element info - parent entity [] (required)
|
131
|
+
aParents = hExtension[:parentEntities]
|
132
|
+
aParents.each do |parent|
|
133
|
+
@xml.tag!('gmd:parentEntity') do
|
134
|
+
@xml.tag!('gco:CharacterString', parent)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
if aParents.empty?
|
138
|
+
@NameSpace.issueWarning(103, 'gmd:parentEntity', outContext)
|
139
|
+
end
|
140
|
+
|
141
|
+
# extended element info - rule
|
142
|
+
s = hExtension[:rule]
|
143
|
+
unless s.nil?
|
144
|
+
@xml.tag!('gmd:rule') do
|
145
|
+
@xml.tag!('gco:CharacterString', s)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
if s.nil?
|
149
|
+
@NameSpace.issueWarning(104, 'gmd:rule', outContext)
|
150
|
+
end
|
151
|
+
|
152
|
+
# extended element info - rationale []
|
153
|
+
aRations = hExtension[:rationales]
|
154
|
+
aRations.each do |ration|
|
155
|
+
@xml.tag!('gmd:rationale') do
|
156
|
+
@xml.tag!('gco:CharacterString', ration)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
if aRations.empty? && @hResponseObj[:writerShowTags]
|
160
|
+
@xml.tag!('gmd:rationale')
|
161
|
+
end
|
162
|
+
|
163
|
+
# extended element info - source [] (required)
|
164
|
+
# only allowing 1 for now
|
165
|
+
role = hExtension[:sourceRole]
|
166
|
+
unless role.nil?
|
167
|
+
@xml.tag!('gmd:source') do
|
168
|
+
@xml.tag!('gmd:CI_ResponsibleParty') do
|
169
|
+
orgName = hExtension[:sourceOrganization]
|
170
|
+
unless orgName.nil?
|
171
|
+
@xml.tag!('gmd:organisationName') do
|
172
|
+
@xml.tag!('gco:CharacterString', orgName)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
uri = hExtension[:sourceURI]
|
176
|
+
unless uri.nil?
|
177
|
+
@xml.tag!('gmd:contactInfo') do
|
178
|
+
@xml.tag!('gmd:CI_Contact') do
|
179
|
+
@xml.tag!('gmd:onlineResource') do
|
180
|
+
@xml.tag!('gmd:CI_OnlineResource') do
|
181
|
+
@xml.tag!('gmd:linkage') do
|
182
|
+
@xml.tag!('gmd:URL', uri)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
@xml.tag!('gmd:role') do
|
190
|
+
codelistClass.writeXML('gmd', 'iso_role', role)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
if role.nil?
|
196
|
+
@NameSpace.issueWarning(105, 'gmd:source', outContext)
|
197
|
+
end
|
198
|
+
|
199
|
+
end # gmd:MD_ExtendedElementInformation tag
|
200
|
+
end # gmd:extendedElementInformation
|
201
|
+
end # gmd:MD_MetadataExtensionInformation
|
202
|
+
end # writeXML
|
203
|
+
end # MD_MetadataExtensionInformation class
|
204
|
+
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
@@ -26,6 +26,7 @@ require_relative 'class_maintenance'
|
|
26
26
|
require_relative 'class_spatialRepresentation'
|
27
27
|
require_relative 'class_referenceSystem'
|
28
28
|
require_relative 'class_featureCatalog'
|
29
|
+
require_relative 'class_extension'
|
29
30
|
|
30
31
|
module ADIWG
|
31
32
|
module Mdtranslator
|
@@ -62,6 +63,7 @@ module ADIWG
|
|
62
63
|
representationClass = SpatialRepresentation.new(@xml, @hResponseObj)
|
63
64
|
referenceSystemClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
|
64
65
|
mdCatalogClass = MD_FeatureCatalogue.new(@xml, @hResponseObj)
|
66
|
+
extensionClass = MD_MetadataExtensionInformation.new(@xml, @hResponseObj)
|
65
67
|
|
66
68
|
# create shortcuts to sections of internal object
|
67
69
|
hMetadata = intObj[:metadata]
|
@@ -291,6 +293,28 @@ module ADIWG
|
|
291
293
|
@xml.tag!('mdb:referenceSystemInfo')
|
292
294
|
end
|
293
295
|
|
296
|
+
# metadata information - metadata extension info
|
297
|
+
# add biological profile to all metadata records
|
298
|
+
intBio = intMetadataClass.newMetadataExtension
|
299
|
+
intBio[:name] = 'Taxonomy System'
|
300
|
+
intBio[:shortName] = 'TaxonSys'
|
301
|
+
intBio[:definition] = 'Documentation of taxonomic sources, procedures, and treatments'
|
302
|
+
intBio[:obligation] = 'optional'
|
303
|
+
intBio[:dataType] = 'class'
|
304
|
+
intBio[:maxOccurrence] = '1'
|
305
|
+
intBio[:parentEntities] << 'MD_Identification'
|
306
|
+
intBio[:rule] = 'New Metadata section as a class to MD_Identification'
|
307
|
+
intBio[:rationales] << 'The set of data elements contained within this class element ' +
|
308
|
+
'represents an attempt to provide better documentation of ' +
|
309
|
+
'taxonomic sources, procedures, and treatments.'
|
310
|
+
intBio[:sourceOrganization] = 'National Biological Information Infrastructure'
|
311
|
+
intBio[:sourceURI] = 'https://www2.usgs.gov/core_science_systems/Access/p1111-1.html'
|
312
|
+
intBio[:sourceRole] = 'author'
|
313
|
+
|
314
|
+
@xml.tag!('gmd:metadataExtensionInfo') do
|
315
|
+
extensionClass.writeXML(intBio)
|
316
|
+
end
|
317
|
+
|
294
318
|
# ###################### Begin Data Identification #####################
|
295
319
|
|
296
320
|
# metadata information - data identification info - required
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adiwg-mdtranslator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.19.0.pre.beta.
|
4
|
+
version: 2.19.0.pre.beta.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Smith
|
@@ -789,6 +789,8 @@ files:
|
|
789
789
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distribution.rb
|
790
790
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distributor.rb
|
791
791
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_email.rb
|
792
|
+
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_enumerationList.rb
|
793
|
+
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extension.rb
|
792
794
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extent.rb
|
793
795
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_feature.rb
|
794
796
|
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_featureCatalog.rb
|