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,76 +2,80 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
6
|
+
# Stan Smith 2016-12-02 refactored for mdTranslator/mdJson 2.0
|
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 2014-12-12 refactored to handle namespacing readers and writers
|
11
|
+
# Stan Smith 2014-05-30 hBBox attributes changed for version 0.5.0
|
11
12
|
# Stan Smith 2013-11-01 original script
|
12
13
|
|
14
|
+
require_relative '../iso19115_2_writer'
|
15
|
+
|
13
16
|
module ADIWG
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
module Mdtranslator
|
18
|
+
module Writers
|
19
|
+
module Iso19115_2
|
17
20
|
|
18
|
-
|
21
|
+
class EX_GeographicBoundingBox
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
def initialize(xml, hResponseObj)
|
24
|
+
@xml = xml
|
25
|
+
@hResponseObj = hResponseObj
|
26
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
27
|
+
end
|
24
28
|
|
25
|
-
|
29
|
+
def writeXML(hBBox)
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
# bounding box - west longitude (required)
|
32
|
+
s = hBBox[:westLongitude]
|
33
|
+
unless s.nil?
|
34
|
+
@xml.tag!('gmd:westBoundLongitude') do
|
35
|
+
@xml.tag!('gco:Decimal', s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if s.nil?
|
39
|
+
@NameSpace.issueError(10)
|
40
|
+
end
|
37
41
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
# bounding box - east longitude (required)
|
43
|
+
s = hBBox[:eastLongitude]
|
44
|
+
unless s.nil?
|
45
|
+
@xml.tag!('gmd:eastBoundLongitude') do
|
46
|
+
@xml.tag!('gco:Decimal', s)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if s.nil?
|
50
|
+
@NameSpace.issueError(11)
|
51
|
+
end
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
# bounding box - south latitude (required)
|
54
|
+
s = hBBox[:southLatitude]
|
55
|
+
unless s.nil?
|
56
|
+
@xml.tag!('gmd:southBoundLatitude') do
|
57
|
+
@xml.tag!('gco:Decimal', s)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
if s.nil?
|
61
|
+
@NameSpace.issueError(12)
|
62
|
+
end
|
59
63
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
64
|
+
# bounding box - north latitude (required)
|
65
|
+
s = hBBox[:northLatitude]
|
66
|
+
unless s.nil?
|
67
|
+
@xml.tag!('gmd:northBoundLatitude') do
|
68
|
+
@xml.tag!('gco:Decimal', s)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
if s.nil?
|
72
|
+
@NameSpace.issueError(13)
|
73
|
+
end
|
70
74
|
|
71
|
-
|
72
|
-
|
75
|
+
end # writeXML
|
76
|
+
end # EX_GeographicBoundingBox class
|
73
77
|
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
77
81
|
end
|
@@ -2,67 +2,71 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
6
|
+
# Stan Smith 2016-11-29 refactored for mdTranslator/mdJson 2.0
|
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 2014-12-15 refactored to handle namespacing readers and writers
|
10
11
|
# Stan Smith 2013-10-17 original script
|
11
12
|
|
13
|
+
require_relative '../iso19115_2_writer'
|
14
|
+
|
12
15
|
module ADIWG
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
module Mdtranslator
|
17
|
+
module Writers
|
18
|
+
module Iso19115_2
|
16
19
|
|
17
|
-
|
20
|
+
class MD_BrowseGraphic
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
def initialize(xml, hResponseObj)
|
23
|
+
@xml = xml
|
24
|
+
@hResponseObj = hResponseObj
|
25
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
26
|
+
end
|
23
27
|
|
24
|
-
|
28
|
+
def writeXML(hGraphic, inContext = nil)
|
25
29
|
|
26
|
-
|
30
|
+
@xml.tag!('gmd:MD_BrowseGraphic') do
|
27
31
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
# browse graphic - file name (required)
|
33
|
+
s = hGraphic[:graphicName]
|
34
|
+
unless s.nil?
|
35
|
+
@xml.tag!('gmd:fileName') do
|
36
|
+
@xml.tag!('gco:CharacterString', s)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if s.nil?
|
40
|
+
@NameSpace.issueWarning(20, 'gmd:fileName', inContext)
|
41
|
+
end
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
# browse graphic - file description
|
44
|
+
s = hGraphic[:graphicDescription]
|
45
|
+
unless s.nil?
|
46
|
+
@xml.tag!('gmd:fileDescription') do
|
47
|
+
@xml.tag!('gco:CharacterString', s)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
51
|
+
@xml.tag!('gmd:fileDescription')
|
52
|
+
end
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
# browse graphic - file type
|
55
|
+
s = hGraphic[:graphicType]
|
56
|
+
unless s.nil?
|
57
|
+
@xml.tag!('gmd:fileType') do
|
58
|
+
@xml.tag!('gco:CharacterString', s)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
62
|
+
@xml.tag!('gmd:fileType')
|
63
|
+
end
|
60
64
|
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
end # MD_BrowseGraphic tag
|
66
|
+
end # writeXML
|
67
|
+
end # MD_BrowseGraphic class
|
64
68
|
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
68
72
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-04-09 add error and warning messaging
|
5
6
|
# Stan Smith 2016-11-29 refactored for mdTranslator/mdJson 2.0
|
6
7
|
# Stan Smith 2015-08-28 added alternate title
|
7
8
|
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
@@ -18,6 +19,7 @@
|
|
18
19
|
# Stan Smith 2013-12-30 added ISBN, ISSN
|
19
20
|
# Stan Smith 2013-08-26 original script
|
20
21
|
|
22
|
+
require_relative '../iso19115_2_writer'
|
21
23
|
require_relative 'class_codelist'
|
22
24
|
require_relative 'class_responsibleParty'
|
23
25
|
require_relative 'class_date'
|
@@ -34,9 +36,10 @@ module ADIWG
|
|
34
36
|
def initialize(xml, hResponseObj)
|
35
37
|
@xml = xml
|
36
38
|
@hResponseObj = hResponseObj
|
39
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
37
40
|
end
|
38
41
|
|
39
|
-
def writeXML(hCitation)
|
42
|
+
def writeXML(hCitation, inContext = nil)
|
40
43
|
|
41
44
|
# classes used
|
42
45
|
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
|
@@ -45,12 +48,15 @@ module ADIWG
|
|
45
48
|
idClass = MD_Identifier.new(@xml, @hResponseObj)
|
46
49
|
seriesClass = CI_Series.new(@xml, @hResponseObj)
|
47
50
|
|
51
|
+
outContext = 'citation'
|
52
|
+
outContext = inContext + ' citation' unless inContext.nil?
|
53
|
+
|
48
54
|
@xml.tag!('gmd:CI_Citation') do
|
49
55
|
|
50
56
|
# citation - title (required)
|
51
57
|
s = hCitation[:title]
|
52
58
|
if s.nil?
|
53
|
-
@
|
59
|
+
@NameSpace.issueWarning(30, 'gmd:title', inContext)
|
54
60
|
else
|
55
61
|
@xml.tag!('gmd:title') do
|
56
62
|
@xml.tag!('gco:CharacterString', s)
|
@@ -72,11 +78,11 @@ module ADIWG
|
|
72
78
|
aDate = hCitation[:dates]
|
73
79
|
aDate.each do |hDate|
|
74
80
|
@xml.tag!('gmd:date') do
|
75
|
-
dateClass.writeXML(hDate)
|
81
|
+
dateClass.writeXML(hDate, outContext)
|
76
82
|
end
|
77
83
|
end
|
78
84
|
if aDate.empty?
|
79
|
-
@
|
85
|
+
@NameSpace.issueWarning(31, 'gmd:date', outContext)
|
80
86
|
end
|
81
87
|
|
82
88
|
# citation - edition
|
@@ -91,8 +97,8 @@ module ADIWG
|
|
91
97
|
end
|
92
98
|
|
93
99
|
# citation - resource identifier []
|
94
|
-
#
|
95
|
-
# ...
|
100
|
+
# process ISBN and ISSN as MD_identifier(s)
|
101
|
+
# ... then also write separately in ISBN or ISSN tag
|
96
102
|
isbn = ''
|
97
103
|
issn = ''
|
98
104
|
aIds = hCitation[:identifiers]
|
@@ -104,10 +110,8 @@ module ADIWG
|
|
104
110
|
issn = hIdentifier[:identifier]
|
105
111
|
end
|
106
112
|
end
|
107
|
-
|
108
|
-
|
109
|
-
idClass.writeXML(hIdentifier)
|
110
|
-
end
|
113
|
+
@xml.tag!('gmd:identifier') do
|
114
|
+
idClass.writeXML(hIdentifier, outContext)
|
111
115
|
end
|
112
116
|
end
|
113
117
|
if aIds.empty? && @hResponseObj[:writerShowTags]
|
@@ -117,17 +121,23 @@ module ADIWG
|
|
117
121
|
# citation - cited responsible party [{CI_ResponsibleParty}]
|
118
122
|
# contacts are grouped by role in the internal object
|
119
123
|
# output a separate <gmd:contact> for each role:contact pairing
|
124
|
+
# check for duplicates and eliminate
|
125
|
+
aRoleParty = []
|
120
126
|
aRParties = hCitation[:responsibleParties]
|
121
127
|
aRParties.each do |hRParty|
|
122
128
|
role = hRParty[:roleName]
|
123
129
|
aParties = hRParty[:parties]
|
124
130
|
aParties.each do |hParty|
|
125
|
-
|
126
|
-
|
127
|
-
|
131
|
+
aRoleParty << {role: role, hParty: hParty}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
aRoleParty.uniq!
|
135
|
+
aRoleParty.each do |hRoleParty|
|
136
|
+
@xml.tag!('gmd:citedResponsibleParty') do
|
137
|
+
rPartyClass.writeXML(hRoleParty[:role], hRoleParty[:hParty], outContext)
|
128
138
|
end
|
129
139
|
end
|
130
|
-
if
|
140
|
+
if aRoleParty.empty? && @hResponseObj[:writerShowTags]
|
131
141
|
@xml.tag!('gmd:citedResponsibleParty')
|
132
142
|
end
|
133
143
|
|
@@ -2,14 +2,14 @@
|
|
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-11-17 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 (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
11
|
+
# Stan Smith 2014-05-16 added method to return contact from array
|
12
|
+
# Stan Smith 2014-05-14 modified for JSON schema version 0.4.0
|
13
13
|
# Stan Smith 2013-08-12 original script
|
14
14
|
|
15
15
|
require_relative 'class_phone'
|
@@ -17,87 +17,92 @@ require_relative 'class_address'
|
|
17
17
|
require_relative 'class_onlineResource'
|
18
18
|
|
19
19
|
module ADIWG
|
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
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19115_2
|
23
|
+
|
24
|
+
class CI_Contact
|
25
|
+
|
26
|
+
def initialize(xml, hResponseObj)
|
27
|
+
@xml = xml
|
28
|
+
@hResponseObj = hResponseObj
|
29
|
+
end
|
30
|
+
|
31
|
+
def writeXML(hContact)
|
32
|
+
|
33
|
+
# classes used
|
34
|
+
phoneClass = CI_Telephone.new(@xml, @hResponseObj)
|
35
|
+
addClass = CI_Address.new(@xml, @hResponseObj)
|
36
|
+
resourceClass = CI_OnlineResource.new(@xml, @hResponseObj)
|
37
|
+
|
38
|
+
# outContext
|
39
|
+
outContext = 'contact information'
|
40
|
+
outContext += ' ' + hContact[:name] unless hContact[:name].nil?
|
41
|
+
outContext += ' (' + hContact[:contactId] + ')' unless hContact[:contactId].nil?
|
42
|
+
|
43
|
+
@xml.tag!('gmd:CI_Contact') do
|
44
|
+
|
45
|
+
# contact - phones [] (pass all phones)
|
46
|
+
aPhones = hContact[:phones]
|
47
|
+
unless aPhones.empty?
|
48
|
+
@xml.tag!('gmd:phone') do
|
49
|
+
phoneClass.writeXML(aPhones)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
if aPhones.empty? && @hResponseObj[:writerShowTags]
|
53
|
+
@xml.tag!('gmd:phone')
|
54
|
+
end
|
55
|
+
|
56
|
+
# contact - address [0]
|
57
|
+
hAddress = hContact[:addresses][0]
|
58
|
+
aEmail = hContact[:eMailList]
|
59
|
+
unless hAddress.nil? && aEmail.empty?
|
60
|
+
@xml.tag!('gmd:address') do
|
61
|
+
addClass.writeXML(hAddress, aEmail)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if hAddress.nil? && hContact[:eMailList].empty? && @hResponseObj[:writerShowTags]
|
65
|
+
@xml.tag!('gmd:address')
|
66
|
+
end
|
67
|
+
|
68
|
+
# contact - online resource [0]
|
69
|
+
hOlResource = hContact[:onlineResources][0]
|
70
|
+
unless hOlResource.nil?
|
71
|
+
@xml.tag!('gmd:onlineResource') do
|
72
|
+
resourceClass.writeXML(hOlResource, outContext)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
if hOlResource.nil? && @hResponseObj[:writerShowTags]
|
76
|
+
@xml.tag!('gmd:onlineResource')
|
77
|
+
end
|
78
|
+
|
79
|
+
# contact - hours of service [0]
|
80
|
+
s = hContact[:hoursOfService][0]
|
81
|
+
unless s.nil?
|
82
|
+
@xml.tag!('gmd:hoursOfService') do
|
83
|
+
@xml.tag!('gco:CharacterString', s)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
87
|
+
@xml.tag!('gmd:hoursOfService')
|
88
|
+
end
|
89
|
+
|
90
|
+
# contact - contact instructions
|
91
|
+
s = hContact[:contactInstructions]
|
92
|
+
unless s.nil?
|
93
|
+
@xml.tag!('gmd:contactInstructions') do
|
94
|
+
@xml.tag!('gco:CharacterString', hContact[:contactInstructions])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
98
|
+
@xml.tag!('gmd:contactInstructions')
|
99
|
+
end
|
100
|
+
|
101
|
+
end # CI_Contact tag
|
102
|
+
end # write XML
|
103
|
+
end # CI_Contact class
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
103
108
|
end
|