adiwg-mdtranslator 2.19.0.pre.beta.27 → 2.19.0.pre.beta.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ca06d30e3f61cd83863f943c9dc420c5c197b8d8a88798ae4f5561c982e55c4
4
- data.tar.gz: bfcb85d3757590769d3df99e6896ec73789922930c407bcd2dbd8b610201041a
3
+ metadata.gz: c46eec2a287472b918b6fd3bf6adab38b374f1f34bae1eaeea82171ccdea6865
4
+ data.tar.gz: 36a0c56320659c2fc054b7f52c275b70a0882f64058202e2e46e058c81d20961
5
5
  SHA512:
6
- metadata.gz: dec2917effa8c4483f209737acca05b55991676b0aeebbcb8222cc038588734de121aad6c3b4774c792099e5bc79922a831d0c682cef779a3deafc15d79d494d
7
- data.tar.gz: 723f2b5077b7cfe9749fa0dbc44cb1ee2bdb185efee2589b1ab10026002e7108d6b115d95baf0adcb8ce90e933a2d915dd069e7694684601d61fe19375923eaa
6
+ metadata.gz: 40f0d779700fe4240cbd8ceb510b5b9982b303359a0c16dfe73fa925d494db9027bf5e952061082e4f7ed36f1ceecbbb31da1675684ffddbed6745b9f77e2adb
7
+ data.tar.gz: 43634f675e34eea2b56b09106919e62390f9997cc121906ad6d45c8e8b5f3966595845d3a7a024ab1abd732156524da42162e987257ea840e43d0d55ae331c24
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adiwg-mdtranslator (2.19.0.pre.beta.27)
4
+ adiwg-mdtranslator (2.19.0.pre.beta.29)
5
5
  adiwg-mdcodes (= 2.10.0)
6
6
  adiwg-mdjson_schemas (= 2.9.5)
7
7
  builder (~> 3.2)
@@ -109,7 +109,7 @@
109
109
  module ADIWG
110
110
  module Mdtranslator
111
111
  # current mdtranslator version
112
- VERSION = "2.19.0-beta.27"
112
+ VERSION = "2.19.0-beta.29"
113
113
  end
114
114
  end
115
115
 
@@ -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,31 @@ module ADIWG
291
293
  @xml.tag!('mdb:referenceSystemInfo')
292
294
  end
293
295
 
296
+ taxonomyArray = hResInfo[:taxonomy]
297
+ unless taxonomyArray.empty?
298
+ # metadata information - metadata extension info
299
+ # add biological profile to all metadata records
300
+ intBio = intMetadataClass.newMetadataExtension
301
+ intBio[:name] = 'Taxonomy System'
302
+ intBio[:shortName] = 'TaxonSys'
303
+ intBio[:definition] = 'Documentation of taxonomic sources, procedures, and treatments'
304
+ intBio[:obligation] = 'optional'
305
+ intBio[:dataType] = 'class'
306
+ intBio[:maxOccurrence] = '1'
307
+ intBio[:parentEntities] << 'MD_Identification'
308
+ intBio[:rule] = 'New Metadata section as a class to MD_Identification'
309
+ intBio[:rationales] << 'The set of data elements contained within this class element ' +
310
+ 'represents an attempt to provide better documentation of ' +
311
+ 'taxonomic sources, procedures, and treatments.'
312
+ intBio[:sourceOrganization] = 'National Biological Information Infrastructure'
313
+ intBio[:sourceURI] = 'https://www2.usgs.gov/core_science_systems/Access/p1111-1.html'
314
+ intBio[:sourceRole] = 'author'
315
+
316
+ @xml.tag!('gmd:metadataExtensionInfo') do
317
+ extensionClass.writeXML(intBio)
318
+ end
319
+ end
320
+
294
321
  # ###################### Begin Data Identification #####################
295
322
 
296
323
  # 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.27
4
+ version: 2.19.0.pre.beta.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-25 00:00:00.000000000 Z
12
+ date: 2024-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -789,6 +789,8 @@ files:
789
789
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distribution.rb
790
790
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_distributor.rb
791
791
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_email.rb
792
+ - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_enumerationList.rb
793
+ - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extension.rb
792
794
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extent.rb
793
795
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_feature.rb
794
796
  - lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_featureCatalog.rb