adiwg-mdtranslator 2.10.0 → 2.12.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +23 -24
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +2 -1
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +2 -1
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +4 -2
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +13 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +38 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +2 -2
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +5 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +2 -1
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +17 -6
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +1 -2
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +24 -5
  16. data/lib/adiwg/mdtranslator/version.rb +8 -1
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_address.rb +10 -10
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +21 -16
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_browse.rb +8 -7
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +11 -11
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb +6 -4
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +14 -14
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataDomain.rb +18 -18
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +10 -7
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +5 -2
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_description.rb +10 -4
  27. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dictionary.rb +7 -9
  28. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_digitalForm.rb +7 -4
  29. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_distribution.rb +9 -5
  30. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityDetail.rb +15 -11
  31. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_entityOverview.rb +7 -4
  32. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_fgdc.rb +1 -1
  33. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geodeticReference.rb +7 -6
  34. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geographicResolution.rb +8 -7
  35. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +5 -4
  36. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicRange.rb +6 -5
  37. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +22 -18
  38. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_keyword.rb +32 -12
  39. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb +4 -2
  40. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_localSystem.rb +17 -6
  41. data/lib/adiwg/mdtranslator/writers/fgdc/classes/{class_mapProjection.rb → class_mapProjectionTags.rb} +33 -57
  42. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_metadataInfo.rb +9 -12
  43. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +7 -8
  44. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +16 -8
  45. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_offlineOption.rb +24 -19
  46. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_onlineOption.rb +7 -4
  47. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_orderProcess.rb +8 -5
  48. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_phone.rb +6 -3
  49. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarGrid.rb +146 -0
  50. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarInfo.rb +168 -0
  51. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarLocal.rb +42 -0
  52. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarMap.rb +294 -0
  53. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_planarReference.rb +47 -328
  54. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +6 -6
  55. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_publisher.rb +6 -4
  56. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_quality.rb +3 -2
  57. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_security.rb +5 -6
  58. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_series.rb +4 -4
  59. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +11 -14
  60. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +8 -8
  61. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +5 -2
  62. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialReference.rb +22 -7
  63. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_status.rb +8 -7
  64. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomy.rb +4 -2
  65. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyClassification.rb +5 -4
  66. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +17 -10
  67. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +11 -15
  68. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_timePeriod.rb +9 -7
  69. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +4 -2
  70. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_verticalDatum.rb +11 -17
  71. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb +53 -3
  72. data/lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer_messages_eng.yml +213 -0
  73. data/lib/adiwg/mdtranslator/writers/fgdc/version.rb +3 -2
  74. data/lib/adiwg/mdtranslator/writers/html/sections/html_allocation.rb +13 -1
  75. data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +11 -1
  76. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +10 -10
  77. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomyClass.rb +4 -4
  78. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_baseUnit.rb +27 -27
  79. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_citation.rb +5 -2
  80. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_codelist.rb +38 -38
  81. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_contact.rb +79 -79
  82. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_conventionalUnit.rb +49 -49
  83. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb +5 -2
  84. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionUnit.rb +24 -24
  85. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_derivedUnit.rb +36 -36
  86. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_domain.rb +28 -21
  87. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +12 -9
  88. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureAttribute.rb +9 -3
  89. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureType.rb +8 -3
  90. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_listedValue.rb +7 -4
  91. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_locale.rb +52 -49
  92. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_mdIdentifier.rb +4 -1
  93. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +15 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_onlineResource.rb +79 -76
  95. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_phone.rb +67 -67
  96. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_responsibleParty.rb +117 -108
  97. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb +246 -246
  98. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +44 -6
  99. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +40 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +6 -5
  101. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +13 -6
  102. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +1 -1
  103. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_allocation.rb +3 -0
  104. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_resourceInfo.rb +5 -4
  105. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_taxonomicClassification.rb +6 -4
  106. data/lib/adiwg/mdtranslator_cli.rb +18 -8
  107. metadata +14 -8
  108. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_mapCoordinateInfo.rb +0 -167
@@ -2,11 +2,11 @@
2
2
  # writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
6
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
7
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
8
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
5
9
  # Stan Smith 2014-12-03 original script
6
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
7
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
8
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
10
10
 
11
11
  require_relative 'class_baseUnit'
12
12
  require_relative 'class_conventionalUnit'
@@ -14,249 +14,249 @@ require_relative 'class_derivedUnit'
14
14
  require_relative 'class_definitionUnit'
15
15
 
16
16
  module ADIWG
17
- module Mdtranslator
18
- module Writers
19
- module Iso19110
20
-
21
- class UnitsOfMeasure
22
-
23
- def initialize(xml, responseObj)
24
- @xml = xml
25
- @hResponseObj = responseObj
26
- end
27
-
28
- def writeUnits(unit)
29
-
30
- # define empty containers here to save lines of code
31
- # for base units
32
- hBase = {}
33
- hBase[:identifier] = ''
34
- hBase[:codeSpace] = 'http://www.bipm.org/en/si/'
35
- hBase[:name] = ''
36
- hBase[:catalogSymbol] = ''
37
- hBase[:unitsSystem] = 'base unit'
38
-
39
- # for conventional units
40
- hConvent = {}
41
- hConvent[:identifier] = ''
42
- hConvent[:codeSpace] = 'http://www.bipm.org/en/si/'
43
- hConvent[:name] = ''
44
- hConvent[:catalogSymbol] = ''
45
- hConvent[:preferredUnit] = ''
46
- hConvent[:factor] = nil
47
- hConvent[:a] = nil
48
- hConvent[:b] = nil
49
- hConvent[:c] = nil
50
- hConvent[:d] = nil
51
-
52
- # for derived units
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19110
20
+
21
+ class UnitsOfMeasure
22
+
23
+ def initialize(xml, responseObj)
24
+ @xml = xml
25
+ @hResponseObj = responseObj
26
+ end
27
+
28
+ def writeUnits(unit)
29
+
30
+ # define empty containers here to save lines of code
31
+ # for base units
32
+ hBase = {}
33
+ hBase[:identifier] = ''
34
+ hBase[:codeSpace] = 'http://www.bipm.org/en/si/'
35
+ hBase[:name] = ''
36
+ hBase[:catalogSymbol] = ''
37
+ hBase[:unitsSystem] = 'base unit'
38
+
39
+ # for conventional units
40
+ hConvent = {}
41
+ hConvent[:identifier] = ''
42
+ hConvent[:codeSpace] = 'http://www.bipm.org/en/si/'
43
+ hConvent[:name] = ''
44
+ hConvent[:catalogSymbol] = ''
45
+ hConvent[:preferredUnit] = ''
46
+ hConvent[:factor] = nil
47
+ hConvent[:a] = nil
48
+ hConvent[:b] = nil
49
+ hConvent[:c] = nil
50
+ hConvent[:d] = nil
51
+
52
+ # for derived units
53
+ hDerived = {}
54
+ hDerived[:identifier] = ''
55
+ hDerived[:codeSpace] = ''
56
+ hDerived[:name] = ''
57
+ hDerived[:remarks] = ''
58
+ hDerived[:catalogSymbol] = ''
59
+ hDerived[:derivationUnitTerm] = nil
60
+
61
+ # find matching units of measure
62
+ case unit
63
+
64
+ # angular degrees
65
+ when 'deg', 'degree', 'degrees'
66
+ hBase[:identifier] = 'degree'
67
+ hBase[:codeSpace] = 'urn:ogc:def:uom:1.0'
68
+ hBase[:name] = 'degree of arc'
69
+ hBase[:catalogSymbol] = 'deg'
70
+ hBase[:unitsSystem] = 'http://www.opengis.net/def/uom/OGC/1.0/degree'
71
+
72
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
73
+ baseClass.writeXML(hBase)
74
+
75
+ when 'm', 'meter', 'meters', 'metre'
76
+ hBase[:identifier] = 'meter'
77
+ hBase[:name] = 'meter'
78
+ hBase[:catalogSymbol] = 'm'
79
+
80
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
81
+ baseClass.writeXML(hBase)
82
+
83
+ when 'kg', 'kilogram', 'kilograms'
84
+ hBase[:identifier] = 'kilogram'
85
+ hBase[:name] = 'kilogram'
86
+ hBase[:catalogSymbol] = 'kg'
87
+
88
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
89
+ baseClass.writeXML(hBase)
90
+
91
+ when 's', 'second', 'seconds'
92
+ hBase[:identifier] = 'second'
93
+ hBase[:name] = 'second'
94
+ hBase[:catalogSymbol] = 'd'
95
+
96
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
97
+ baseClass.writeXML(hBase)
98
+
99
+ when 'A', 'ampere', 'amperes'
100
+ hBase[:identifier] = 'ampere'
101
+ hBase[:name] = 'ampere'
102
+ hBase[:catalogSymbol] = 'A'
103
+
104
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
105
+ baseClass.writeXML(hBase)
106
+
107
+ when 'K', 'kelvin'
108
+ hBase[:identifier] = 'kelvin'
109
+ hBase[:name] = 'kelvin'
110
+ hBase[:catalogSymbol] = 'K'
111
+
112
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
113
+ baseClass.writeXML(hBase)
114
+
115
+ when 'mol', 'mole', 'moles'
116
+ hBase[:identifier] = 'mole'
117
+ hBase[:name] = 'mole'
118
+ hBase[:catalogSymbol] = 'mol'
119
+
120
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
121
+ baseClass.writeXML(hBase)
122
+
123
+ when 'cd', 'candela', 'candelas'
124
+ hBase[:identifier] = 'candela'
125
+ hBase[:name] = 'candela'
126
+ hBase[:catalogSymbol] = 'cd'
127
+
128
+ baseClass = BaseUnit.new(@xml, @hResponseObj)
129
+ baseClass.writeXML(hBase)
130
+
131
+ when 'ft', 'foot', 'feet'
132
+ hConvent[:identifier] = 'meter'
133
+ hConvent[:name] = 'foot'
134
+ hConvent[:catalogSymbol] = 'ft'
135
+ hConvent[:preferredUnit] = 'meter'
136
+ hConvent[:factor] = 3.280839
137
+
138
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
139
+ convClass.writeXML(hConvent)
140
+
141
+ when 'in', 'inch', 'inches'
142
+ hConvent[:identifier] = 'meter'
143
+ hConvent[:name] = 'inch'
144
+ hConvent[:catalogSymbol] = 'in'
145
+ hConvent[:preferredUnit] = 'meter'
146
+ hConvent[:factor] = 0.0254
147
+
148
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
149
+ convClass.writeXML(hConvent)
150
+
151
+ when 'mm', 'millimeter', 'millimeters'
152
+ hConvent[:identifier] = 'meter'
153
+ hConvent[:name] = 'millimeter'
154
+ hConvent[:catalogSymbol] = 'mm'
155
+ hConvent[:preferredUnit] = 'meter'
156
+ hConvent[:factor] = 0.001
157
+
158
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
159
+ convClass.writeXML(hConvent)
160
+
161
+ when 'micrometer', 'micrometers'
162
+ micro = "\u00b5"
163
+ s = micro.encode('utf-8')
164
+ s += 'm'
165
+ hConvent[:identifier] = 'meter'
166
+ hConvent[:name] = 'micrometer'
167
+ hConvent[:catalogSymbol] = s
168
+ hConvent[:preferredUnit] = 'meter'
169
+ hConvent[:factor] = 0.000001
170
+
171
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
172
+ convClass.writeXML(hConvent)
173
+
174
+ when 'nm', 'nanometer', 'nanometers'
175
+ hConvent[:identifier] = 'meter'
176
+ hConvent[:name] = 'nanometer'
177
+ hConvent[:catalogSymbol] = 'nm'
178
+ hConvent[:preferredUnit] = 'meter'
179
+ hConvent[:factor] = 0.000000001
180
+
181
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
182
+ convClass.writeXML(hConvent)
183
+
184
+ when 'degC', 'centigrade', 'degreesC', 'Celsius'
185
+ hConvent[:identifier] = 'kelvin'
186
+ hConvent[:name] = 'degree Celsius'
187
+ hConvent[:catalogSymbol] = 'degC'
188
+ hConvent[:preferredUnit] = 'kelvin'
189
+ hConvent[:a] = 273.16
190
+ hConvent[:b] = 1
191
+ hConvent[:c] = 1
192
+ hConvent[:d] = 0
193
+
194
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
195
+ convClass.writeXML(hConvent)
196
+
197
+ when 'degF', 'degreesF', 'Fahrenheit'
198
+ hConvent[:identifier] = 'kelvin'
199
+ hConvent[:name] = 'degree Fahrenheit'
200
+ hConvent[:catalogSymbol] = 'degF'
201
+ hConvent[:preferredUnit] = 'kelvin'
202
+ hConvent[:a] = 2298.44
203
+ hConvent[:b] = 5
204
+ hConvent[:c] = 9
205
+ hConvent[:d] = 0
206
+
207
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
208
+ convClass.writeXML(hConvent)
209
+
210
+ when 'mph', 'miles per hour'
211
+ hConvent[:identifier] = 'mi/h'
212
+ hConvent[:name] = 'miles per hour'
213
+ hConvent[:catalogSymbol] = 'mph'
214
+ hConvent[:preferredUnit] = 'm/s'
215
+ hConvent[:a] = 0
216
+ hConvent[:b] = 1609.344
217
+ hConvent[:c] = 0
218
+ hConvent[:d] = 3600.0
219
+
220
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
221
+ convClass.writeXML(hConvent)
222
+
223
+ when 'kph', 'kilometers per hour'
224
+ hConvent[:identifier] = 'k/h'
225
+ hConvent[:name] = 'kilometers per hour'
226
+ hConvent[:catalogSymbol] = 'kph'
227
+ hConvent[:preferredUnit] = 'm/s'
228
+ hConvent[:a] = 0
229
+ hConvent[:b] = 1000
230
+ hConvent[:c] = 0
231
+ hConvent[:d] = 3600
232
+
233
+ convClass = ConventionalUnit.new(@xml, @hResponseObj)
234
+ convClass.writeXML(hConvent)
235
+
236
+ when 'density'
53
237
  hDerived = {}
54
- hDerived[:identifier] = ''
55
- hDerived[:codeSpace] = ''
56
- hDerived[:name] = ''
57
- hDerived[:remarks] = ''
58
- hDerived[:catalogSymbol] = ''
59
- hDerived[:derivationUnitTerm] = nil
60
-
61
- # find matching units of measure
62
- case unit
63
-
64
- # angular degrees
65
- when 'deg', 'degree', 'degrees'
66
- hBase[:identifier] = 'degree'
67
- hBase[:codeSpace] = 'urn:ogc:def:uom:1.0'
68
- hBase[:name] = 'degree of arc'
69
- hBase[:catalogSymbol] = 'deg'
70
- hBase[:unitsSystem] = 'http://www.opengis.net/def/uom/OGC/1.0/degree'
71
-
72
- baseClass = BaseUnit.new(@xml, @hResponseObj)
73
- baseClass.writeXML(hBase)
74
-
75
- when 'm', 'meter', 'meters', 'metre'
76
- hBase[:identifier] = 'meter'
77
- hBase[:name] = 'meter'
78
- hBase[:catalogSymbol] = 'm'
79
-
80
- baseClass = BaseUnit.new(@xml, @hResponseObj)
81
- baseClass.writeXML(hBase)
82
-
83
- when 'kg', 'kilogram', 'kilograms'
84
- hBase[:identifier] = 'kilogram'
85
- hBase[:name] = 'kilogram'
86
- hBase[:catalogSymbol] = 'kg'
87
-
88
- baseClass = BaseUnit.new(@xml, @hResponseObj)
89
- baseClass.writeXML(hBase)
90
-
91
- when 's', 'second', 'seconds'
92
- hBase[:identifier] = 'second'
93
- hBase[:name] = 'second'
94
- hBase[:catalogSymbol] = 'd'
95
-
96
- baseClass = BaseUnit.new(@xml, @hResponseObj)
97
- baseClass.writeXML(hBase)
98
-
99
- when 'A', 'ampere', 'amperes'
100
- hBase[:identifier] = 'ampere'
101
- hBase[:name] = 'ampere'
102
- hBase[:catalogSymbol] = 'A'
103
-
104
- baseClass = BaseUnit.new(@xml, @hResponseObj)
105
- baseClass.writeXML(hBase)
106
-
107
- when 'K', 'kelvin'
108
- hBase[:identifier] = 'kelvin'
109
- hBase[:name] = 'kelvin'
110
- hBase[:catalogSymbol] = 'K'
111
-
112
- baseClass = BaseUnit.new(@xml, @hResponseObj)
113
- baseClass.writeXML(hBase)
114
-
115
- when 'mol', 'mole', 'moles'
116
- hBase[:identifier] = 'mole'
117
- hBase[:name] = 'mole'
118
- hBase[:catalogSymbol] = 'mol'
119
-
120
- baseClass = BaseUnit.new(@xml, @hResponseObj)
121
- baseClass.writeXML(hBase)
122
-
123
- when 'cd', 'candela', 'candelas'
124
- hBase[:identifier] = 'candela'
125
- hBase[:name] = 'candela'
126
- hBase[:catalogSymbol] = 'cd'
127
-
128
- baseClass = BaseUnit.new(@xml, @hResponseObj)
129
- baseClass.writeXML(hBase)
130
-
131
- when 'ft', 'foot', 'feet'
132
- hConvent[:identifier] = 'meter'
133
- hConvent[:name] = 'foot'
134
- hConvent[:catalogSymbol] = 'ft'
135
- hConvent[:preferredUnit] = 'meter'
136
- hConvent[:factor] = 3.280839
137
-
138
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
139
- convClass.writeXML(hConvent)
140
-
141
- when 'in', 'inch', 'inches'
142
- hConvent[:identifier] = 'meter'
143
- hConvent[:name] = 'inch'
144
- hConvent[:catalogSymbol] = 'in'
145
- hConvent[:preferredUnit] = 'meter'
146
- hConvent[:factor] = 0.0254
147
-
148
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
149
- convClass.writeXML(hConvent)
150
-
151
- when 'mm', 'millimeter', 'millimeters'
152
- hConvent[:identifier] = 'meter'
153
- hConvent[:name] = 'millimeter'
154
- hConvent[:catalogSymbol] = 'mm'
155
- hConvent[:preferredUnit] = 'meter'
156
- hConvent[:factor] = 0.001
157
-
158
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
159
- convClass.writeXML(hConvent)
160
-
161
- when 'micrometer','micrometers'
162
- micro = "\u00b5"
163
- s = micro.encode('utf-8')
164
- s += 'm'
165
- hConvent[:identifier] = 'meter'
166
- hConvent[:name] = 'micrometer'
167
- hConvent[:catalogSymbol] = s
168
- hConvent[:preferredUnit] = 'meter'
169
- hConvent[:factor] = 0.000001
170
-
171
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
172
- convClass.writeXML(hConvent)
173
-
174
- when 'nm', 'nanometer', 'nanometers'
175
- hConvent[:identifier] = 'meter'
176
- hConvent[:name] = 'nanometer'
177
- hConvent[:catalogSymbol] = 'nm'
178
- hConvent[:preferredUnit] = 'meter'
179
- hConvent[:factor] = 0.000000001
180
-
181
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
182
- convClass.writeXML(hConvent)
183
-
184
- when 'degC', 'centigrade', 'degreesC', 'Celsius'
185
- hConvent[:identifier] = 'kelvin'
186
- hConvent[:name] = 'degree Celsius'
187
- hConvent[:catalogSymbol] = 'degC'
188
- hConvent[:preferredUnit] = 'kelvin'
189
- hConvent[:a] = 273.16
190
- hConvent[:b] = 1
191
- hConvent[:c] = 1
192
- hConvent[:d] = 0
193
-
194
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
195
- convClass.writeXML(hConvent)
196
-
197
- when 'degF', 'degreesF', 'Fahrenheit'
198
- hConvent[:identifier] = 'kelvin'
199
- hConvent[:name] = 'degree Fahrenheit'
200
- hConvent[:catalogSymbol] = 'degF'
201
- hConvent[:preferredUnit] = 'kelvin'
202
- hConvent[:a] = 2298.44
203
- hConvent[:b] = 5
204
- hConvent[:c] = 9
205
- hConvent[:d] = 0
206
-
207
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
208
- convClass.writeXML(hConvent)
209
-
210
- when 'mph', 'miles per hour'
211
- hConvent[:identifier] = 'mi/h'
212
- hConvent[:name] = 'miles per hour'
213
- hConvent[:catalogSymbol] = 'mph'
214
- hConvent[:preferredUnit] = 'm/s'
215
- hConvent[:a] = 0
216
- hConvent[:b] = 1609.344
217
- hConvent[:c] = 0
218
- hConvent[:d] = 3600.0
219
-
220
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
221
- convClass.writeXML(hConvent)
222
-
223
- when 'kph', 'kilometers per hour'
224
- hConvent[:identifier] = 'k/h'
225
- hConvent[:name] = 'kilometers per hour'
226
- hConvent[:catalogSymbol] = 'kph'
227
- hConvent[:preferredUnit] = 'm/s'
228
- hConvent[:a] = 0
229
- hConvent[:b] = 1000
230
- hConvent[:c] = 0
231
- hConvent[:d] = 3600
232
-
233
- convClass = ConventionalUnit.new(@xml, @hResponseObj)
234
- convClass.writeXML(hConvent)
235
-
236
- when 'density'
237
- hDerived = {}
238
- hDerived[:identifier] = 'kg/m^3'
239
- hDerived[:name] = 'kilograms per cubic meter'
240
- hDerived[:remarks] = 'volumetric mass density'
241
- hDerived[:catalogSymbol] = 'p'
242
- unitTerms = []
243
- unitTerms << {'uom' => 'kg', 'exponent' => '1'}
244
- unitTerms << {'uom' => 'm', 'exponent' => '-3'}
245
- hDerived[:derivationUnitTerm] = unitTerms
246
-
247
- dervClass = DerivedUnit.new(@xml, @hResponseObj)
248
- dervClass.writeXML(hDerived)
249
-
250
- else
251
- defnClass = UnitDefinition.new(@xml, @hResponseObj)
252
- defnClass.writeXML(unit)
253
-
254
- end
255
- end
256
-
257
- end
238
+ hDerived[:identifier] = 'kg/m^3'
239
+ hDerived[:name] = 'kilograms per cubic meter'
240
+ hDerived[:remarks] = 'volumetric mass density'
241
+ hDerived[:catalogSymbol] = 'p'
242
+ unitTerms = []
243
+ unitTerms << {'uom' => 'kg', 'exponent' => '1'}
244
+ unitTerms << {'uom' => 'm', 'exponent' => '-3'}
245
+ hDerived[:derivationUnitTerm] = unitTerms
246
+
247
+ dervClass = DerivedUnit.new(@xml, @hResponseObj)
248
+ dervClass.writeXML(hDerived)
249
+
250
+ else
251
+ defnClass = UnitDefinition.new(@xml, @hResponseObj)
252
+ defnClass.writeXML(unit)
253
+
254
+ end
255
+ end
258
256
 
259
257
  end
260
- end
261
- end
258
+
259
+ end
260
+ end
261
+ end
262
262
  end
@@ -30,20 +30,27 @@ module ADIWG
30
30
  return nil
31
31
  end
32
32
 
33
- # make contacts and domains available to the instance
33
+ # make objects available to the instance
34
+ @intObj = intObj
34
35
  @contacts = intObj[:contacts]
36
+ @hResponseObj = responseObj
35
37
  dictionary = intObj[:dataDictionaries][whichDict]
36
38
  @domains = dictionary[:domains]
37
39
 
40
+ # load error message array
41
+ file = File.join(File.dirname(__FILE__), 'iso19110_writer_messages_eng') + '.yml'
42
+ hMessageList = YAML.load_file(file)
43
+ @aMessagesList = hMessageList['messageList']
44
+
38
45
  # set the format of the output file based on the writer specified
39
46
  responseObj[:writerOutputFormat] = 'xml'
40
47
  responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Iso19110::VERSION
41
48
 
42
49
  # create new XML document
43
- xml = Builder::XmlMarkup.new(indent: 3)
50
+ @xml = Builder::XmlMarkup.new(indent: 3)
44
51
 
45
52
  # start writing the ISO 19110 XML record
46
- metadataWriter = FC_FeatureCatalogue.new(xml, responseObj)
53
+ metadataWriter = FC_FeatureCatalogue.new(@xml, responseObj)
47
54
  metadata = metadataWriter.writeXML(intObj)
48
55
 
49
56
  return metadata
@@ -52,26 +59,57 @@ module ADIWG
52
59
 
53
60
  # find contact in contact array and return the contact hash
54
61
  def self.getContact(contactId)
55
-
56
62
  @contacts.each do |contact|
57
63
  if contact[:contactId] == contactId
58
64
  return contact
59
65
  end
60
66
  end
61
67
  return {}
62
-
63
68
  end
64
69
 
65
70
  # find domain in domain array and return the domain hash
66
71
  def self.getDomain(domainId)
67
-
68
72
  @domains.each do |domain|
69
73
  if domain[:domainId] == domainId
70
74
  return domain
71
75
  end
72
76
  end
73
77
  return {}
78
+ end
79
+
80
+ def self.findMessage(messageId)
81
+ @aMessagesList.each do |hMessage|
82
+ if hMessage['id'] == messageId
83
+ return hMessage['message']
84
+ end
85
+ end
86
+ return nil
87
+ end
74
88
 
89
+ def self.issueError(messageId, context = nil)
90
+ message = findMessage(messageId)
91
+ unless message.nil?
92
+ message += ': CONTEXT is ' + context unless context.nil?
93
+ @hResponseObj[:writerMessages] << 'ERROR: ISO-19110 writer: ' + message
94
+ @hResponseObj[:writerPass] = false
95
+ end
96
+ end
97
+
98
+ def self.issueWarning(messageId, tag = nil, context = nil)
99
+ message = findMessage(messageId)
100
+ unless message.nil?
101
+ message += ': CONTEXT is ' + context unless context.nil?
102
+ if @hResponseObj[:writerForceValid]
103
+ if tag.nil?
104
+ issueError(messageId, context)
105
+ else
106
+ @xml.tag!(tag, {'gco:nilReason' => 'missing'})
107
+ @hResponseObj[:writerMessages] << 'WARNING: ISO-19110 writer: ' + message
108
+ end
109
+ else
110
+ @hResponseObj[:writerMessages] << 'WARNING: ISO-19110 writer: ' + message
111
+ end
112
+ end
75
113
  end
76
114
 
77
115
  end
@@ -0,0 +1,40 @@
1
+ # Writer - messages for ISO 19110:2005
2
+
3
+ # History:
4
+ # Stan Smith 2018-03-30 original script
5
+
6
+ messageList:
7
+ - {id: 1, message: "citation title is missing"}
8
+ - {id: 2, message: "citation date is missing"}
9
+
10
+ - {id: 10, message: "online resource uri is missing"}
11
+
12
+ - {id: 20, message: "responsible party role is missing"}
13
+ - {id: 21, message: "responsible party organization name is missing"}
14
+ - {id: 22, message: "responsible party individual name is missing"}
15
+
16
+ - {id: 30, message: "date is missing or invalid"}
17
+ - {id: 31, message: "date type is missing"}
18
+
19
+ - {id: 40, message: "feature catalogue name is missing"}
20
+ - {id: 41, message: "feature catalogue scope is missing"}
21
+ - {id: 42, message: "feature catalogue version number is missing"}
22
+ - {id: 43, message: "feature catalogue version date is missing"}
23
+ - {id: 44, message: "feature catalogue producer (responsible party) is missing"}
24
+ - {id: 45, message: "feature catalogue feature type is missing"}
25
+
26
+ - {id: 50, message: "attribute common name is missing"}
27
+
28
+ - {id: 60, message: "entity common name is missing"}
29
+
30
+ - {id: 70, message: "domain item name is missing"}
31
+
32
+ - {id: 80, message: "locale language code is missing"}
33
+ - {id: 81, message: "locale character encoding method is missing"}
34
+
35
+ - {id: 90, message: "identifier code (identifier) is missing"}
36
+
37
+ - {id: 100, message: "codeset domain name is missing"}
38
+ - {id: 101, message: "unrepresented domain name is missing"}
39
+
40
+ - {id: 110, message: " is missing"}
@@ -1,15 +1,16 @@
1
1
  # History
2
- # Stan Smith 2018-02-14 refactored cardinality
3
- # Stan Smith 2018-02-14 refactored constraints
4
- # Stan Smith 2017-03-10 refactored for mdJson/mdTranslator 2.0
5
- # Josh Bradley
2
+ # 1.2.0 Stan Smith 2018-04-05 refactored messaging system
3
+ # 1.1.1 Stan Smith 2018-02-14 refactored cardinality
4
+ # 1.1.0 Stan Smith 2018-02-14 refactored constraints
5
+ # 1.0.0 Stan Smith 2017-03-10 refactored for mdJson/mdTranslator 2.0
6
+ # 0.1.0 Josh Bradley
6
7
 
7
8
  module ADIWG
8
9
  module Mdtranslator
9
10
  module Writers
10
11
  module Iso19110
11
12
 
12
- VERSION = '1.1.1'
13
+ VERSION = '1.2.0'
13
14
 
14
15
  end
15
16
  end