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.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
  5. data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
  13. data/lib/adiwg/mdtranslator/version.rb +5 -1
  14. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
  16. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
  22. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
  23. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
  24. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
  25. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
  26. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
  27. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
  28. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
  29. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
  30. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
  31. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
  32. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
  33. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
  34. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
  35. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
  36. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
  37. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
  38. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
  39. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
  40. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
  41. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
  47. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
  48. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
  49. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
  50. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
  51. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
  52. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
  53. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
  54. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
  55. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
  56. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
  57. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
  58. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
  59. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
  60. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
  61. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
  62. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
  63. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
  64. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
  65. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
  66. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
  67. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
  68. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
  69. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
  70. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
  71. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
  72. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
  73. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
  74. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
  75. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
  76. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
  77. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
  78. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
  82. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
  83. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  84. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
  85. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
  86. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
  87. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
  88. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
  89. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
  90. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
  91. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
  92. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
  93. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
  94. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
  95. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
  96. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
  97. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
  98. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
  99. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
  100. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
  101. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
  102. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
  103. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
  104. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
  105. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
  106. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
  107. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
  109. data/lib/adiwg/mdtranslator_cli.rb +21 -4
  110. metadata +6 -5
@@ -2,76 +2,80 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-02 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-05-30 hBBox attributes changed for version 0.5.0
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
- module Mdtranslator
15
- module Writers
16
- module Iso19115_2
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19115_2
17
20
 
18
- class EX_GeographicBoundingBox
21
+ class EX_GeographicBoundingBox
19
22
 
20
- def initialize(xml, hResponseObj)
21
- @xml = xml
22
- @hResponseObj = hResponseObj
23
- end
23
+ def initialize(xml, hResponseObj)
24
+ @xml = xml
25
+ @hResponseObj = hResponseObj
26
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
27
+ end
24
28
 
25
- def writeXML(hBBox)
29
+ def writeXML(hBBox)
26
30
 
27
- # bounding box - west longitude (required)
28
- s = hBBox[:westLongitude]
29
- unless s.nil?
30
- @xml.tag!('gmd:westBoundLongitude') do
31
- @xml.tag!('gco:Decimal', s)
32
- end
33
- end
34
- if s.nil?
35
- @xml.tag!('gmd:westBoundLongitude', {'gco:nilReason' => 'missing'})
36
- end
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
- # bounding box - east longitude (required)
39
- s = hBBox[:eastLongitude]
40
- unless s.nil?
41
- @xml.tag!('gmd:eastBoundLongitude') do
42
- @xml.tag!('gco:Decimal', s)
43
- end
44
- end
45
- if s.nil?
46
- @xml.tag!('gmd:eastBoundLongitude', {'gco:nilReason' => 'missing'})
47
- end
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
- # bounding box - south latitude (required)
50
- s = hBBox[:southLatitude]
51
- unless s.nil?
52
- @xml.tag!('gmd:southBoundLatitude') do
53
- @xml.tag!('gco:Decimal', s)
54
- end
55
- end
56
- if s.nil?
57
- @xml.tag!('gmd:southBoundLatitude', {'gco:nilReason' => 'missing'})
58
- end
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
- # bounding box - north latitude (required)
61
- s = hBBox[:northLatitude]
62
- unless s.nil?
63
- @xml.tag!('gmd:northBoundLatitude') do
64
- @xml.tag!('gco:Decimal', s)
65
- end
66
- end
67
- if s.nil?
68
- @xml.tag!('gmd:northBoundLatitude', {'gco:nilReason' => 'missing'})
69
- end
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
- end # writeXML
72
- end # EX_GeographicBoundingBox class
75
+ end # writeXML
76
+ end # EX_GeographicBoundingBox class
73
77
 
74
- end
75
- end
76
- end
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
- # Stan Smith 2016-11-29 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-15 refactored to handle namespacing readers and writers
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
- module Mdtranslator
14
- module Writers
15
- module Iso19115_2
16
+ module Mdtranslator
17
+ module Writers
18
+ module Iso19115_2
16
19
 
17
- class MD_BrowseGraphic
20
+ class MD_BrowseGraphic
18
21
 
19
- def initialize(xml, hResponseObj)
20
- @xml = xml
21
- @hResponseObj = hResponseObj
22
- end
22
+ def initialize(xml, hResponseObj)
23
+ @xml = xml
24
+ @hResponseObj = hResponseObj
25
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
26
+ end
23
27
 
24
- def writeXML(hGraphic)
28
+ def writeXML(hGraphic, inContext = nil)
25
29
 
26
- @xml.tag!('gmd:MD_BrowseGraphic') do
30
+ @xml.tag!('gmd:MD_BrowseGraphic') do
27
31
 
28
- # browse graphic - file name (required)
29
- s = hGraphic[:graphicName]
30
- unless s.nil?
31
- @xml.tag!('gmd:fileName') do
32
- @xml.tag!('gco:CharacterString', s)
33
- end
34
- end
35
- if s.nil?
36
- @xml.tag!('gmd:fileName', {'gco:nilReason' => 'missing'})
37
- end
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
- # browse graphic - file description
40
- s = hGraphic[:graphicDescription]
41
- unless s.nil?
42
- @xml.tag!('gmd:fileDescription') do
43
- @xml.tag!('gco:CharacterString', s)
44
- end
45
- end
46
- if s.nil? && @hResponseObj[:writerShowTags]
47
- @xml.tag!('gmd:fileDescription')
48
- end
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
- # browse graphic - file type
51
- s = hGraphic[:graphicType]
52
- unless s.nil?
53
- @xml.tag!('gmd:fileType') do
54
- @xml.tag!('gco:CharacterString', s)
55
- end
56
- end
57
- if s.nil? && @hResponseObj[:writerShowTags]
58
- @xml.tag!('gmd:fileType')
59
- end
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
- end # MD_BrowseGraphic tag
62
- end # writeXML
63
- end # MD_BrowseGraphic class
65
+ end # MD_BrowseGraphic tag
66
+ end # writeXML
67
+ end # MD_BrowseGraphic class
64
68
 
65
- end
66
- end
67
- end
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
- @xml.tag!('gmd:title', {'gco:nilReason' => 'missing'})
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
- @xml.tag!('gmd:date', {'gco:nilReason' => 'missing'})
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
- # do not process ISBN and ISSN as MD_identifier(s)
95
- # ... these are written separately in ISO 19115-x
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
- if issn == '' && isbn == ''
108
- @xml.tag!('gmd:identifier') do
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
- @xml.tag!('gmd:citedResponsibleParty') do
126
- rPartyClass.writeXML(role, hParty)
127
- end
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 aRParties.empty? && @hResponseObj[:writerShowTags]
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
- # 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
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
- 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
- @xml.tag!('gmd:CI_Contact') do
39
-
40
- # contact - phones [] (pass all phones)
41
- aPhones = hContact[:phones]
42
- unless aPhones.empty?
43
- @xml.tag!('gmd:phone') do
44
- phoneClass.writeXML(aPhones)
45
- end
46
- end
47
- if aPhones.empty? && @hResponseObj[:writerShowTags]
48
- @xml.tag!('gmd:phone')
49
- end
50
-
51
- # contact - address [0]
52
- hAddress = hContact[:addresses][0]
53
- aEmail = hContact[:eMailList]
54
- unless hAddress.nil? && aEmail.empty?
55
- @xml.tag!('gmd:address') do
56
- addClass.writeXML(hAddress, aEmail)
57
- end
58
- end
59
- if hAddress.nil? && hContact[:eMailList].empty? && @hResponseObj[:writerShowTags]
60
- @xml.tag!('gmd:address')
61
- end
62
-
63
- # contact - online resource [0]
64
- hOlResource = hContact[:onlineResources][0]
65
- unless hOlResource.nil?
66
- @xml.tag!('gmd:onlineResource') do
67
- resourceClass.writeXML(hOlResource)
68
- end
69
- end
70
- if hOlResource.nil? && @hResponseObj[:writerShowTags]
71
- @xml.tag!('gmd:onlineResource')
72
- end
73
-
74
- # contact - hours of service [0]
75
- s = hContact[:hoursOfService][0]
76
- unless s.nil?
77
- @xml.tag!('gmd:hoursOfService') do
78
- @xml.tag!('gco:CharacterString', s)
79
- end
80
- end
81
- if s.nil? && @hResponseObj[:writerShowTags]
82
- @xml.tag!('gmd:hoursOfService')
83
- end
84
-
85
- # contact - contact instructions
86
- s = hContact[:contactInstructions]
87
- unless s.nil?
88
- @xml.tag!('gmd:contactInstructions') do
89
- @xml.tag!('gco:CharacterString', hContact[:contactInstructions])
90
- end
91
- end
92
- if s.nil? && @hResponseObj[:writerShowTags]
93
- @xml.tag!('gmd:contactInstructions')
94
- end
95
-
96
- end # CI_Contact tag
97
- end # write XML
98
- end # CI_Contact class
99
-
100
- end
101
- end
102
- end
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