adiwg-mdtranslator 2.12.0 → 2.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
- data/lib/adiwg/mdtranslator/version.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
- data/lib/adiwg/mdtranslator_cli.rb +21 -4
- metadata +6 -5
@@ -2,97 +2,100 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
6
|
+
# Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
|
7
|
+
# Stan Smith 2015-09-21 added format from distributorTransferOptions
|
8
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
9
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
10
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
|
12
13
|
# Stan Smith 2013-09-25 original script
|
13
14
|
|
15
|
+
require_relative '../iso19115_2_writer'
|
14
16
|
require_relative 'class_responsibleParty'
|
15
17
|
require_relative 'class_orderProcess'
|
16
18
|
require_relative 'class_format'
|
17
19
|
require_relative 'class_transferOptions'
|
18
20
|
|
19
21
|
module ADIWG
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
module Mdtranslator
|
23
|
+
module Writers
|
24
|
+
module Iso19115_2
|
23
25
|
|
24
|
-
|
26
|
+
class MD_Distributor
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def initialize(xml, hResponseObj)
|
29
|
+
@xml = xml
|
30
|
+
@hResponseObj = hResponseObj
|
31
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
32
|
+
end
|
30
33
|
|
31
|
-
|
34
|
+
def writeXML(hDistributor)
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
# classes used
|
37
|
+
partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
|
38
|
+
orderClass = MD_StandardOrderProcess.new(@xml, @hResponseObj)
|
39
|
+
formatClass = MD_Format.new(@xml, @hResponseObj)
|
40
|
+
transferClass = MD_DigitalTransferOptions.new(@xml, @hResponseObj)
|
38
41
|
|
39
|
-
|
42
|
+
@xml.tag!('gmd:MD_Distributor') do
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
# distributor - contact (required) {CI_ResponsibleParty}
|
45
|
+
role = 'distributor'
|
46
|
+
hParty = hDistributor[:contact][:parties][0]
|
47
|
+
unless hParty.nil?
|
48
|
+
@xml.tag!('gmd:distributorContact') do
|
49
|
+
partyClass.writeXML(role, hParty, 'distributor')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
if hParty.nil?
|
53
|
+
@NameSpace.issueWarning(90, 'gmd:distributorContact')
|
54
|
+
end
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
# distributor - order process [{MD_StandardOrderProcess}]
|
57
|
+
aDistOrderProc = hDistributor[:orderProcess]
|
58
|
+
aDistOrderProc.each do |hOrder|
|
59
|
+
@xml.tag!('gmd:distributionOrderProcess') do
|
60
|
+
orderClass.writeXML(hOrder)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
if aDistOrderProc.empty? && @hResponseObj[:writerShowTags]
|
64
|
+
@xml.tag!('gmd:distributionOrderProcess')
|
65
|
+
end
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
# distributor - format [{MD_Format}]
|
68
|
+
format = false
|
69
|
+
aOptions = hDistributor[:transferOptions]
|
70
|
+
aOptions.each do |hOption|
|
71
|
+
aFormats = hOption[:distributionFormats]
|
72
|
+
aFormats.each do |hFormat|
|
73
|
+
format = true
|
74
|
+
@xml.tag!('gmd:distributorFormat') do
|
75
|
+
formatClass.writeXML(hFormat)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if !format && @hResponseObj[:writerShowTags]
|
80
|
+
@xml.tag!('gmd:distributorFormat')
|
81
|
+
end
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
# distributor - transfer options [{MD_DigitalTransferOptions}]
|
84
|
+
aOptions = hDistributor[:transferOptions]
|
85
|
+
aOptions.each do |hOption|
|
86
|
+
@xml.tag!('gmd:distributorTransferOptions') do
|
87
|
+
transferClass.writeXML(hOption)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
if aOptions.empty? && @hResponseObj[:writerShowTags]
|
91
|
+
@xml.tag!('gmd:distributorTransferOptions')
|
92
|
+
end
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
+
end # gmd:MD_Distributor tag
|
95
|
+
end # writeXML
|
96
|
+
end # MD_Distributor class
|
94
97
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
98
101
|
end
|
@@ -2,51 +2,51 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
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
13
|
# Stan Smith 2013-08-09 original script
|
14
14
|
|
15
15
|
require 'adiwg-mdcodes'
|
16
16
|
|
17
17
|
module ADIWG
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
module Mdtranslator
|
19
|
+
module Writers
|
20
|
+
module Iso19115_2
|
21
21
|
|
22
|
-
|
22
|
+
class MD_EnumerationList
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def initialize(xml, responseObj)
|
25
|
+
@xml = xml
|
26
|
+
@hResponseObj = responseObj
|
27
|
+
end
|
28
28
|
|
29
|
-
|
29
|
+
def writeXML(codeList, codeName)
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
# get requested codelist from the adiwg-mdcodes gem
|
32
|
+
mdCodelist = ADIWG::Mdcodes.getCodelistDetail(codeList)
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
sourceName = mdCodelist['sourceName']
|
35
|
+
codelist = mdCodelist['codelist']
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
45
|
|
46
|
-
|
47
|
-
|
46
|
+
end # writeXML
|
47
|
+
end # MD_EnumerationList class
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
52
|
end
|
@@ -2,198 +2,202 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
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 (hResponseObj)
|
9
|
+
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
10
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
11
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
5
12
|
# Stan Smith 2013-11-22 original script.
|
6
|
-
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
7
|
-
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
8
|
-
# Stan Smith 2015-06-11 change all codelists to use 'class_codelist' method
|
9
|
-
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
-
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
11
|
-
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
12
13
|
|
14
|
+
require_relative '../iso19115_2_writer'
|
13
15
|
require_relative 'class_codelist'
|
14
16
|
require_relative 'class_enumerationList'
|
15
17
|
require_relative 'class_onlineResource'
|
16
|
-
require_relative 'class_responsibleParty'
|
17
18
|
|
18
19
|
module ADIWG
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
end
|
180
|
-
@xml.tag!('gmd:role') do
|
181
|
-
codelistClass.writeXML('gmd', 'iso_role', role)
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19115_2
|
23
|
+
|
24
|
+
class MD_MetadataExtensionInformation
|
25
|
+
|
26
|
+
def initialize(xml, hResponseObj)
|
27
|
+
@xml = xml
|
28
|
+
@hResponseObj = hResponseObj
|
29
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
30
|
+
end
|
31
|
+
|
32
|
+
def writeXML(hExtension)
|
33
|
+
|
34
|
+
# classes used
|
35
|
+
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
36
|
+
enumerationClass = MD_EnumerationList.new(@xml, @hResponseObj)
|
37
|
+
olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
|
38
|
+
|
39
|
+
outContext = 'extension information'
|
40
|
+
outContext = 'extension name ' + hExtension[:name] unless hExtension[:name].nil?
|
41
|
+
|
42
|
+
@xml.tag!('gmd:MD_MetadataExtensionInformation') do
|
43
|
+
|
44
|
+
# metadata extension - online resource {CI_OnLineResource}
|
45
|
+
hOLResource = hExtension[:onLineResource]
|
46
|
+
unless hOLResource.empty?
|
47
|
+
@xml.tag!('gmd:extensionOnLineResource') do
|
48
|
+
olResClass.writeXML(hOLResource, outContext)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
if hOLResource.empty? && @hResponseObj[:writerShowTags]
|
52
|
+
@xml.tag!('gmd:extensionOnLineResource')
|
53
|
+
end
|
54
|
+
|
55
|
+
# metadata extension = extended element information
|
56
|
+
@xml.tag!('gmd:extendedElementInformation') do
|
57
|
+
@xml.tag!('gmd:MD_ExtendedElementInformation') do
|
58
|
+
|
59
|
+
# extended element info - name (required)
|
60
|
+
s = hExtension[:name]
|
61
|
+
unless s.nil?
|
62
|
+
@xml.tag!('gmd:name') do
|
63
|
+
@xml.tag!('gco:CharacterString', s)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
if s.nil?
|
67
|
+
@NameSpace.issueWarning(100, 'gmd:name')
|
68
|
+
end
|
69
|
+
|
70
|
+
# extended element info - short name
|
71
|
+
s = hExtension[:shortName]
|
72
|
+
unless s.nil?
|
73
|
+
@xml.tag!('gmd:shortName') do
|
74
|
+
@xml.tag!('gco:CharacterString', s)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
78
|
+
@xml.tag!('gmd:shortName')
|
79
|
+
end
|
80
|
+
|
81
|
+
# extended element info - definition (required)
|
82
|
+
s = hExtension[:definition]
|
83
|
+
unless s.nil?
|
84
|
+
@xml.tag!('gmd:definition') do
|
85
|
+
@xml.tag!('gco:CharacterString', s)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
if s.nil?
|
89
|
+
@NameSpace.issueWarning(101, 'gmd:definition', outContext)
|
90
|
+
end
|
91
|
+
|
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)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
100
|
+
@xml.tag!('gmd:obligation')
|
101
|
+
end
|
102
|
+
|
103
|
+
# extended element info - data type (required)
|
104
|
+
s = hExtension[:dataType]
|
105
|
+
unless s.nil?
|
106
|
+
@xml.tag!('gmd:dataType') do
|
107
|
+
codelistClass.writeXML('gmd', 'iso_entityClass', s)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if s.nil?
|
111
|
+
@NameSpace.issueWarning(102, 'gmd:dataType', outContext)
|
112
|
+
end
|
113
|
+
|
114
|
+
# extended element info - maximum occurrence
|
115
|
+
s = hExtension[:maxOccurrence]
|
116
|
+
unless s.nil?
|
117
|
+
@xml.tag!('gmd:maximumOccurrence') do
|
118
|
+
@xml.tag!('gco:CharacterString', s)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
122
|
+
@xml.tag!('gmd:maximumOccurrence')
|
123
|
+
end
|
124
|
+
|
125
|
+
# extended element info - parent entity [] (required)
|
126
|
+
aParents = hExtension[:parentEntities]
|
127
|
+
aParents.each do |parent|
|
128
|
+
@xml.tag!('gmd:parentEntity') do
|
129
|
+
@xml.tag!('gco:CharacterString', parent)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
if aParents.empty?
|
133
|
+
@NameSpace.issueWarning(103, 'gmd:parentEntity', outContext)
|
134
|
+
end
|
135
|
+
|
136
|
+
# extended element info - rule
|
137
|
+
s = hExtension[:rule]
|
138
|
+
unless s.nil?
|
139
|
+
@xml.tag!('gmd:rule') do
|
140
|
+
@xml.tag!('gco:CharacterString', s)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
if s.nil?
|
144
|
+
@NameSpace.issueWarning(104, 'gmd:rule', outContext)
|
145
|
+
end
|
146
|
+
|
147
|
+
# extended element info - rationale []
|
148
|
+
aRations = hExtension[:rationales]
|
149
|
+
aRations.each do |ration|
|
150
|
+
@xml.tag!('gmd:rationale') do
|
151
|
+
@xml.tag!('gco:CharacterString', ration)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
if aRations.empty? && @hResponseObj[:writerShowTags]
|
155
|
+
@xml.tag!('gmd:rationale')
|
156
|
+
end
|
157
|
+
|
158
|
+
# extended element info - source [] (required)
|
159
|
+
# only allowing 1 for now
|
160
|
+
role = hExtension[:sourceRole]
|
161
|
+
unless role.nil?
|
162
|
+
@xml.tag!('gmd:source') do
|
163
|
+
@xml.tag!('gmd:CI_ResponsibleParty') do
|
164
|
+
orgName = hExtension[:sourceOrganization]
|
165
|
+
unless orgName.nil?
|
166
|
+
@xml.tag!('gmd:organisationName') do
|
167
|
+
@xml.tag!('gco:CharacterString', orgName)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
uri = hExtension[:sourceURI]
|
171
|
+
unless uri.nil?
|
172
|
+
@xml.tag!('gmd:contactInfo') do
|
173
|
+
@xml.tag!('gmd:CI_Contact') do
|
174
|
+
@xml.tag!('gmd:onlineResource') do
|
175
|
+
@xml.tag!('gmd:CI_OnlineResource') do
|
176
|
+
@xml.tag!('gmd:linkage') do
|
177
|
+
@xml.tag!('gmd:URL', uri)
|
178
|
+
end
|
182
179
|
end
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
@xml.tag!('gmd:role') do
|
185
|
+
codelistClass.writeXML('gmd', 'iso_role', role)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
if role.nil?
|
191
|
+
@NameSpace.issueWarning(105, 'gmd:source', outContext)
|
192
|
+
end
|
193
|
+
|
194
|
+
end # gmd:MD_ExtendedElementInformation tag
|
195
|
+
end # gmd:extendedElementInformation
|
196
|
+
end # gmd:MD_MetadataExtensionInformation
|
197
|
+
end # writeXML
|
198
|
+
end # MD_MetadataExtensionInformation class
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
199
203
|
end
|