adiwg-mdtranslator 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +20 -5
  4. data/Rakefile +2 -0
  5. data/adiwg-mdtranslator.gemspec +2 -1
  6. data/lib/adiwg/mdtranslator.rb +1 -0
  7. data/lib/adiwg/mdtranslator/internal/module_codelistFun.rb +26 -0
  8. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +3 -0
  9. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +1 -1
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +0 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +0 -1
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +2 -4
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +0 -1
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +0 -2
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +0 -2
  17. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +0 -1
  18. data/lib/adiwg/mdtranslator/version.rb +3 -2
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +0 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +0 -1
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +0 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +0 -1
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +1 -1
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +0 -1
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +0 -1
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +1 -3
  28. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_additionalDocument.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb +90 -0
  30. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_associatedResource.rb +84 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attribute.rb +107 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb +69 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_baseUnit.rb +38 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_boundingBox.rb +70 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_browseGraphic.rb +95 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_citation.rb +205 -0
  37. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_codelist.rb +50 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraint.rb +51 -0
  39. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraintCommon.rb +104 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_contact.rb +119 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_conventionalUnit.rb +64 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_coverageDescription.rb +84 -0
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataIdentification.rb +347 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_date.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_definitionUnit.rb +35 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_derivedUnit.rb +42 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dimension.rb +72 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distribution.rb +62 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distributor.rb +77 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_email.rb +44 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_extent.rb +85 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_feature.rb +71 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb +56 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureProperties.rb +64 -0
  55. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_format.rb +74 -0
  56. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_fraction.rb +46 -0
  57. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gcoDateTime.rb +45 -0
  58. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicElement.rb +77 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicExtent.rb +96 -0
  60. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometricObjects.rb +60 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometryCollection.rb +97 -0
  62. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +121 -0
  63. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +87 -0
  64. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gmlIdentifier.rb +32 -0
  65. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +71 -0
  66. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gridRepresentation.rb +36 -0
  67. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +95 -0
  68. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_imageDescription.rb +175 -0
  69. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +85 -0
  70. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_keyword.rb +78 -0
  71. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_legalConstraints.rb +87 -0
  72. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineString.rb +76 -0
  73. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +97 -0
  74. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_locale.rb +67 -0
  75. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_maintenance.rb +101 -0
  76. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdBand.rb +82 -0
  77. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +372 -0
  78. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_measure.rb +71 -0
  79. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_medium.rb +113 -0
  80. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_miBand.rb +90 -0
  81. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiLine.rb +84 -0
  82. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPoint.rb +84 -0
  83. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPolygon.rb +84 -0
  84. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +91 -0
  85. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb +79 -0
  86. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +106 -0
  87. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb +81 -0
  88. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb +77 -0
  89. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb +95 -0
  90. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +130 -0
  91. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb +94 -0
  92. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb +92 -0
  93. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb +71 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb +97 -0
  95. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_responsibility.rb +91 -0
  96. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +127 -0
  97. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scope.rb +75 -0
  98. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scopeDescription.rb +75 -0
  99. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_securityConstraints.rb +97 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_series.rb +63 -0
  101. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +125 -0
  102. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_spatialRepresentation.rb +61 -0
  103. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_temporalExtent.rb +53 -0
  104. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timeInstant.rb +80 -0
  105. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timePeriod.rb +113 -0
  106. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_transferOptions.rb +107 -0
  107. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_unitsOfMeasure.rb +258 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_usage.rb +134 -0
  109. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_useConstraints.rb +41 -0
  110. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +61 -0
  111. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_verticalExtent.rb +70 -0
  112. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer.rb +105 -0
  113. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +132 -0
  114. data/lib/adiwg/mdtranslator/writers/iso19115_1/readme.md +12 -0
  115. data/lib/adiwg/mdtranslator/writers/iso19115_1/version.rb +15 -0
  116. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +3 -2
  117. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +42 -39
  118. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +2 -2
  119. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +3 -1
  120. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +12 -7
  121. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +2 -3
  122. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  123. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +1 -1
  124. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +42 -35
  125. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +4 -10
  126. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +1 -1
  127. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +5 -0
  128. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +2 -2
  129. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +1 -1
  130. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +7 -7
  131. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +0 -1
  132. data/lib/adiwg/mdtranslator_cli.rb +2 -1
  133. metadata +93 -5
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +0 -55
@@ -0,0 +1,64 @@
1
+ # ISO <<Class>> ConventionalUnit
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-08 copied from 19115_2 writer
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class ConventionalUnit
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hConv)
20
+
21
+ # create and identity for the unit
22
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
23
+ unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
24
+
25
+ @xml.tag!('gml:ConventionalUnit', {'gml:id' => unitID}) do
26
+ @xml.tag!('gml:identifier', {'codeSpace' => hConv[:codeSpace]}, hConv[:identifier])
27
+ @xml.tag!('gml:name', hConv[:name])
28
+ @xml.tag!('gml:catalogSymbol', hConv[:catalogSymbol])
29
+ @xml.tag!('gml:conversionToPreferredUnit', {'uom' => hConv[:preferredUnit]}) do
30
+
31
+ # two methods of conversion are available
32
+ # factor and formula
33
+ if !hConv[:factor].nil?
34
+ # factor:
35
+ # y = factor * x
36
+ # y is in preferred units
37
+ # x is in provided units
38
+ # factor is conversion to preferred units
39
+ @xml.tag!('gml:factor', hConv[:factor])
40
+ else
41
+ # formula:
42
+ # y = (a + bx) / (c + dx)
43
+ # y is in preferred units
44
+ # x is in provided units
45
+ # a,b,c,d are constants to convert to preferred units
46
+ @xml.tag!('gml:formula') do
47
+ @xml.tag!('gml:a', hConv[:a])
48
+ @xml.tag!('gml:b', hConv[:b])
49
+ @xml.tag!('gml:c', hConv[:c])
50
+ @xml.tag!('gml:d', hConv[:d])
51
+ end
52
+ end
53
+
54
+ end
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,84 @@
1
+ # ISO <<abstract class>> coverage description
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-05 original script.
6
+
7
+ require_relative 'class_identifier'
8
+ require_relative 'class_attributeGroup'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_CoverageDescription
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
21
+ end
22
+
23
+ def writeXML(hCoverage)
24
+
25
+ # classes used
26
+ identifierClass = MD_Identifier.new(@xml, @hResponseObj)
27
+ groupClass = MD_AttributeGroup.new(@xml, @hResponseObj)
28
+
29
+ outContext = 'content coverage description'
30
+
31
+ unless hCoverage.empty?
32
+ @xml.tag!('mrc:MD_CoverageDescription') do
33
+
34
+ # coverage description - attribute description (required)
35
+ # combine coverageName and coverageDescription
36
+ attDesc = ''
37
+ unless hCoverage[:coverageName].nil?
38
+ attDesc += hCoverage[:coverageName] + '; '
39
+ end
40
+ unless hCoverage[:coverageDescription].nil?
41
+ attDesc += hCoverage[:coverageDescription]
42
+ end
43
+ unless attDesc == ''
44
+ @xml.tag!('mrc:attributeDescription') do
45
+ @xml.tag!('gco:RecordType', attDesc)
46
+ end
47
+ end
48
+ if attDesc == ''
49
+ @NameSpace.issueWarning(40, 'gmd:attributeDescription', outContext)
50
+ end
51
+
52
+ # coverage description - processing level code {MD_Identifier}
53
+ unless hCoverage[:processingLevelCode].empty?
54
+ @xml.tag!('mrc:processingLevelCode') do
55
+ identifierClass.writeXML(hCoverage[:processingLevelCode], outContext+' processing level')
56
+ end
57
+ if hCoverage[:processingLevelCode].empty? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('mrc:processingLevelCode')
59
+ end
60
+ end
61
+
62
+ # coverage description - attribute group [] {MD_AttributeGroup}
63
+ aGroups = hCoverage[:attributeGroups]
64
+ aGroups.each do |hGroup|
65
+ unless hGroup.empty?
66
+ @xml.tag!('mrc:attributeGroup') do
67
+ groupClass.writeXML(hGroup, outContext)
68
+ end
69
+ end
70
+ end
71
+ if aGroups.empty? && @hResponseObj[:writerShowTags]
72
+ @xml.tag!('mrc:attributeGroup')
73
+ end
74
+
75
+ end
76
+
77
+ end # MI_CoverageDescription tag
78
+ end # writeXML
79
+ end # ContentInformation class
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,347 @@
1
+ # ISO <<Class>> MD_DataIdentification
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-21 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
8
+ require 'adiwg/mdtranslator/internal/module_codelistFun'
9
+ require_relative '../iso19115_1_writer'
10
+ require_relative 'class_codelist'
11
+ require_relative 'class_citation'
12
+ require_relative 'class_responsibility'
13
+ require_relative 'class_resolution'
14
+ require_relative 'class_extent'
15
+ require_relative 'class_constraint'
16
+ require_relative 'class_maintenance'
17
+ require_relative 'class_browseGraphic'
18
+ require_relative 'class_format'
19
+ require_relative 'class_keyword'
20
+ require_relative 'class_usage'
21
+ require_relative 'class_additionalDocument'
22
+ require_relative 'class_associatedResource'
23
+ require_relative 'class_locale'
24
+
25
+ module ADIWG
26
+ module Mdtranslator
27
+ module Writers
28
+ module Iso19115_1
29
+
30
+ class MD_DataIdentification
31
+
32
+ def initialize(xml, hResponseObj)
33
+ @xml = xml
34
+ @hResponseObj = hResponseObj
35
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
36
+ end
37
+
38
+ def writeXML(hMetadata)
39
+
40
+ # classes used
41
+ intMetadataClass = InternalMetadata.new
42
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
43
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
44
+ responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
45
+ resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
46
+ extentClass = EX_Extent.new(@xml, @hResponseObj)
47
+ documentClass = AdditionalDocument.new(@xml, @hResponseObj)
48
+ maintClass = MD_MaintenanceInformation.new(@xml, @hResponseObj)
49
+ graphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
50
+ formatClass = MD_Format.new(@xml, @hResponseObj)
51
+ keywordClass = MD_Keywords.new(@xml, @hResponseObj)
52
+ useClass = MD_Usage.new(@xml, @hResponseObj)
53
+ constraintClass = Constraint.new(@xml, @hResponseObj)
54
+ associatedClass = MD_AssociatedResource.new(@xml, @hResponseObj)
55
+ localeClass = PT_Locale.new(@xml, @hResponseObj)
56
+ # resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
57
+
58
+ # create shortcuts to sections of internal object
59
+ hResource = hMetadata[:resourceInfo]
60
+ aAssocRes = hMetadata[:associatedResources]
61
+
62
+ # data identification
63
+ @xml.tag!('mri:MD_DataIdentification') do
64
+
65
+ # data identification - citation {CI_Citation} (required)
66
+ hCitation = hResource[:citation]
67
+ unless hCitation.empty?
68
+ @xml.tag!('mri:citation') do
69
+ citationClass.writeXML(hCitation, 'main resource')
70
+ end
71
+ end
72
+ if hCitation.empty?
73
+ @NameSpace.issueWarning(50, 'mri:citation')
74
+ end
75
+
76
+ # data identification - abstract (required)
77
+ unless hResource[:abstract].nil?
78
+ @xml.tag!('mri:abstract') do
79
+ @xml.tag!('gco:CharacterString', hResource[:abstract])
80
+ end
81
+ end
82
+ if hResource[:abstract].nil?
83
+ @NameSpace.issueWarning(51, 'mri:abstract')
84
+ end
85
+
86
+ # data identification - purpose
87
+ unless hResource[:purpose].nil?
88
+ @xml.tag!('mri:purpose') do
89
+ @xml.tag!('gco:CharacterString', hResource[:purpose])
90
+ end
91
+ end
92
+ if hResource[:purpose].nil? && @hResponseObj[:writerShowTags]
93
+ @xml.tag!('mri:purpose')
94
+ end
95
+
96
+ # data identification - credit []
97
+ aCredits = hResource[:credits]
98
+ aCredits.each do |credit|
99
+ @xml.tag!('mri:credit') do
100
+ @xml.tag!('gco:CharacterString', credit)
101
+ end
102
+ end
103
+ if aCredits.empty? && @hResponseObj[:writerShowTags]
104
+ @xml.tag!('mri:credit')
105
+ end
106
+
107
+ # data identification - status [] {MD_ProgressCode}
108
+ aStatus = hResource[:status]
109
+ aStatus.each do |code|
110
+ @xml.tag!('mri:status') do
111
+ codelistClass.writeXML('mcc', 'iso_progress', code)
112
+ end
113
+ end
114
+ if aStatus.empty? && @hResponseObj[:writerShowTags]
115
+ @xml.tag!('mri:status')
116
+ end
117
+
118
+ # data identification - point of contact [] {CI_Responsibility}
119
+ aContacts = hResource[:pointOfContacts]
120
+ aContacts.each do |hContact|
121
+ unless hContact.empty?
122
+ @xml.tag!('mri:pointOfContact') do
123
+ responsibilityClass.writeXML(hContact, 'metadata information')
124
+ end
125
+ end
126
+ end
127
+ if aContacts.empty? && @hResponseObj[:writerShowTags]
128
+ @NameSpace.issueWarning(52, 'mri:pointOfContact')
129
+ end
130
+
131
+ # data identification - spatial representation type [] {MD_SpatialRepresentationTypeCode}
132
+ aSpatialTypes = hResource[:spatialRepresentationTypes]
133
+ aSpatialTypes.each do |code|
134
+ @xml.tag!('mri:spatialRepresentationType') do
135
+ codelistClass.writeXML('mcc', 'iso_spatialRepresentation', code)
136
+ end
137
+ end
138
+ if aSpatialTypes.empty? && @hResponseObj[:writerShowTags]
139
+ @xml.tag!('mri:spatialRepresentationType')
140
+ end
141
+
142
+ # data identification - spatial resolution [] {MD_Resolution}
143
+ aSpatialRes = hResource[:spatialResolutions]
144
+ aSpatialRes.each do |hResolution|
145
+ @xml.tag!('mri:spatialResolution') do
146
+ resolutionClass.writeXML(hResolution, 'resource information')
147
+ end
148
+ end
149
+ if aSpatialRes.empty? && @hResponseObj[:writerShowTags]
150
+ @xml.tag!('mri:spatialResolution')
151
+ end
152
+
153
+ # data identification - temporal resolution [] {TM_PeriodDuration}
154
+ aTemporalRes = hResource[:temporalResolutions]
155
+ aTemporalRes.each do |hResolution|
156
+ @xml.tag!('mri:temporalResolution') do
157
+ duration = AdiwgDateTimeFun.writeDuration(hResolution)
158
+ @xml.tag!('gco:TM_PeriodDuration', duration)
159
+ end
160
+ end
161
+ if aTemporalRes.empty? && @hResponseObj[:writerShowTags]
162
+ @xml.tag!('mri:temporalResolution')
163
+ end
164
+
165
+ # data identification - topic category [] {MD_TopicCategoryCode}
166
+ # get from hData.keywords where keywordType='isoTopicCategory'
167
+ aTopics = []
168
+ aKeywords = hResource[:keywords]
169
+ aKeywords.each do |hKeyword|
170
+ if hKeyword[:keywordType] == 'isoTopicCategory'
171
+ hKeyword[:keywords].each do |hKeyObj|
172
+ aTopics << hKeyObj[:keyword]
173
+ end
174
+ end
175
+ end
176
+ # only allow valid ISO 19115-1 topic categories to be written
177
+ aTopics.each do |topic|
178
+ if CodelistFun.validateItem('iso_topicCategory', topic)
179
+ @xml.tag!('mri:topicCategory') do
180
+ @xml.tag!('mri:MD_TopicCategoryCode', topic)
181
+ end
182
+ else
183
+ @NameSpace.issueWarning(400, 'mri:topicCategory', "#{topic}")
184
+ end
185
+ end
186
+ if aTopics.empty? && @hResponseObj[:writerShowTags]
187
+ @xml.tag!('mri:topicCategory')
188
+ end
189
+
190
+ # package mdJson time period {timePeriod} as a temporal extent
191
+ unless hResource[:timePeriod].empty?
192
+ hExtent = intMetadataClass.newExtent
193
+ hTempExtent = intMetadataClass.newTemporalExtent
194
+ hTempExtent[:timePeriod] = hResource[:timePeriod]
195
+ hExtent[:temporalExtents] << hTempExtent
196
+ hResource[:extents] << hExtent
197
+ end
198
+
199
+ # data identification - extent [] {EX_Extent}
200
+ aExtents = hResource[:extents]
201
+ aExtents.each do |hExtent|
202
+ @xml.tag!('mri:extent') do
203
+ extentClass.writeXML(hExtent)
204
+ end
205
+ end
206
+ if aExtents.empty? && @hResponseObj[:writerShowTags]
207
+ @xml.tag!('mri:extent')
208
+ end
209
+
210
+ # data identification - additional documentation [] {AdditionalDocument}
211
+ aDocuments = hMetadata[:additionalDocuments]
212
+ aDocuments.each do |hDoc|
213
+ unless hDoc.empty?
214
+ documentClass.writeXML(hDoc)
215
+ end
216
+ end
217
+ if aDocuments.empty? && @hResponseObj[:writerShowTags]
218
+ @xml.tag!('mri:additionalDocumentation')
219
+ end
220
+
221
+ # data identification - processing level {MD_Identifier} - not implemented
222
+
223
+ # data identification - resource maintenance [] {MD_MaintenanceInformation}
224
+ aMaint = hResource[:resourceMaintenance]
225
+ aMaint.each do |hMaint|
226
+ @xml.tag!('mri:resourceMaintenance') do
227
+ maintClass.writeXML(hMaint, 'resource information')
228
+ end
229
+ end
230
+ if aMaint.empty? && @hResponseObj[:writerShowTags]
231
+ @xml.tag!('mri:resourceMaintenance')
232
+ end
233
+
234
+ # data identification - graphic overview []
235
+ aGraphics = hResource[:graphicOverviews]
236
+ aGraphics.each do |hGraphic|
237
+ @xml.tag!('mri:graphicOverview') do
238
+ graphicClass.writeXML(hGraphic, 'resource information')
239
+ end
240
+ end
241
+ if aGraphics.empty? && @hResponseObj[:writerShowTags]
242
+ @xml.tag!('mri:graphicOverview')
243
+ end
244
+
245
+ # data identification - resource format [] {MD_Format}
246
+ aFormats = hResource[:resourceFormats]
247
+ aFormats.each do |hFormat|
248
+ @xml.tag!('mri:resourceFormat') do
249
+ formatClass.writeXML(hFormat)
250
+ end
251
+ end
252
+ if aFormats.empty? && @hResponseObj[:writerShowTags]
253
+ @xml.tag!('mri:resourceFormat')
254
+ end
255
+
256
+ # data identification - descriptive keywords [] {MD_Keywords}
257
+ aKeywords = hResource[:keywords]
258
+ aKeywords.each do |hKeyword|
259
+ @xml.tag!('mri:descriptiveKeywords') do
260
+ keywordClass.writeXML(hKeyword)
261
+ end
262
+ end
263
+ if aKeywords.empty? && @hResponseObj[:writerShowTags]
264
+ @xml.tag!('mir:descriptiveKeywords')
265
+ end
266
+
267
+ # data identification - resource specific usage [] {MD_Usage}
268
+ aUses = hResource[:resourceUsages]
269
+ aUses.each do |hResUse|
270
+ @xml.tag!('mri:resourceSpecificUsage') do
271
+ useClass.writeXML(hResUse)
272
+ end
273
+ end
274
+ if aUses.empty? && @hResponseObj[:writerShowTags]
275
+ @xml.tag!('mri:resourceSpecificUsage')
276
+ end
277
+
278
+ # data identification - resource constraints [] {MD_Constraints}
279
+ aConstraint = hResource[:constraints]
280
+ aConstraint.each do |hCon|
281
+ @xml.tag!('mri:resourceConstraints') do
282
+ constraintClass.writeXML(hCon, 'resource information')
283
+ end
284
+ end
285
+ if aConstraint.empty? && @hResponseObj[:writerShowTags]
286
+ @xml.tag!('mri:resourceConstraints')
287
+ end
288
+
289
+ # data identification - associated resource [] {MD_AssociatedResource}
290
+ aAssocRes.each do |hAssocRes|
291
+ @xml.tag!('mri:associatedResource') do
292
+ associatedClass.writeXML(hAssocRes, 'resource information')
293
+ end
294
+ end
295
+ if aAssocRes.empty? && @hResponseObj[:writerShowTags]
296
+ @xml.tag!('mri:associatedResource')
297
+ end
298
+
299
+ # data identification - default locale {PT_Locale}
300
+ unless hResource[:defaultResourceLocale].empty?
301
+ @xml.tag!('mri:defaultLocale') do
302
+ localeClass.writeXML(hResource[:defaultResourceLocale], 'resource information default')
303
+ end
304
+ end
305
+ if hResource[:defaultResourceLocale].empty? && @hResponseObj[:writerShowTags]
306
+ @xml.tag!('mri:defaultLocale')
307
+ end
308
+
309
+ # data identification - other locales [] {PT_Locale}
310
+ aLocales = hResource[:otherResourceLocales]
311
+ aLocales.each do |hLocale|
312
+ @xml.tag!('mri:otherLocale') do
313
+ localeClass.writeXML(hLocale, 'resource information other')
314
+ end
315
+ end
316
+ if aLocales.empty? && @hResponseObj[:writerShowTags]
317
+ @xml.tag!('mri:otherLocale')
318
+ end
319
+
320
+ # data identification - environment description
321
+ unless hResource[:environmentDescription].nil?
322
+ @xml.tag!('mri:environmentDescription') do
323
+ @xml.tag!('gco:CharacterString', hResource[:environmentDescription])
324
+ end
325
+ end
326
+ if hResource[:environmentDescription].nil? && @hResponseObj[:writerShowTags]
327
+ @xml.tag!('mri:environmentDescription')
328
+ end
329
+
330
+ # data identification - supplemental info
331
+ unless hResource[:supplementalInfo].nil?
332
+ @xml.tag!('mri:supplementalInformation') do
333
+ @xml.tag!('gco:CharacterString', hResource[:supplementalInfo])
334
+ end
335
+ end
336
+ if hResource[:supplementalInfo].nil? && @hResponseObj[:writerShowTags]
337
+ @xml.tag!('mri:supplementalInformation')
338
+ end
339
+
340
+ end # mri:MD_DataIdentification tag
341
+ end # writeXML
342
+ end # MD_DataIdentification class
343
+
344
+ end
345
+ end
346
+ end
347
+ end