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
@@ -3,8 +3,10 @@
3
3
  # to define the domain of an attribute
4
4
 
5
5
  # History:
6
+ # Stan Smith 2018-04-04 refactored error and warning messaging
6
7
  # Stan Smith 2017-11-02 original script
7
8
 
9
+ require_relative '../iso19110_writer'
8
10
  require_relative 'class_listedValue'
9
11
  require_relative 'class_definitionReference'
10
12
 
@@ -18,20 +20,23 @@ module ADIWG
18
20
  def initialize(xml, responseObj)
19
21
  @xml = xml
20
22
  @hResponseObj = responseObj
23
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
21
24
  end
22
25
 
23
- def writeXML(hDomain)
26
+ def writeXML(hDomain, inContext)
24
27
 
25
28
  # classes used
26
29
  listClass = FC_ListedValue.new(@xml, @hResponseObj)
27
30
  defRefClass = FC_DefinitionReference.new(@xml, @hResponseObj)
28
31
 
32
+ outContext = hDomain[:domainCode]
33
+
29
34
  # if have domainItems treat as enumerated list
30
35
  aItems = hDomain[:domainItems]
31
36
  unless aItems.empty?
32
37
  aItems.each do |hItem|
33
38
  @xml.tag!('gfc:listedValue') do
34
- listClass.writeXML(hItem)
39
+ listClass.writeXML(hItem, outContext)
35
40
  end
36
41
  end
37
42
  return
@@ -45,7 +50,7 @@ module ADIWG
45
50
 
46
51
  # label
47
52
  if hDomain[:domainName].nil?
48
- @xml.tag!('gfc:label', {'gco:nilReason' => 'missing'})
53
+ @NameSpace.issueWarning(100, 'gfc:label')
49
54
  else
50
55
  @xml.tag!('gfc:label') do
51
56
  @xml.tag!('gco:CharacterString', hDomain[:domainName])
@@ -73,28 +78,30 @@ module ADIWG
73
78
  end
74
79
 
75
80
  # if have definition only treat as unrepresentable domain
76
- @xml.tag!('gfc:listedValue') do
77
- @xml.tag!('gfc:FC_ListedValue') do
78
-
79
- # label
80
- if hDomain[:domainName].nil?
81
- @xml.tag!('gfc:label', {'gco:nilReason' => 'missing'})
82
- else
83
- @xml.tag!('gfc:label') do
84
- @xml.tag!('gco:CharacterString', hDomain[:domainName])
81
+ unless hDomain[:domainDescription].nil?
82
+ @xml.tag!('gfc:listedValue') do
83
+ @xml.tag!('gfc:FC_ListedValue') do
84
+
85
+ # label
86
+ if hDomain[:domainName].nil?
87
+ @NameSpace.issueWarning(101, 'gfc:label')
88
+ else
89
+ @xml.tag!('gfc:label') do
90
+ @xml.tag!('gco:CharacterString', hDomain[:domainName])
91
+ end
85
92
  end
86
- end
87
93
 
88
- # definition
89
- unless hDomain[:domainDescription].nil?
90
- @xml.tag!('gfc:definition') do
91
- @xml.tag!('gco:CharacterString', hDomain[:domainDescription])
94
+ # definition
95
+ unless hDomain[:domainDescription].nil?
96
+ @xml.tag!('gfc:definition') do
97
+ @xml.tag!('gco:CharacterString', hDomain[:domainDescription])
98
+ end
99
+ end
100
+ if hDomain[:domainDescription].empty? && @hResponseObj[:writerShowTags]
101
+ @xml.tag!('gfc:definition')
92
102
  end
93
- end
94
- if hDomain[:domainDescription].empty? && @hResponseObj[:writerShowTags]
95
- @xml.tag!('gfc:definition')
96
- end
97
103
 
104
+ end
98
105
  end
99
106
  end
100
107
 
@@ -2,6 +2,7 @@
2
2
  # writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-03 refactored error and warning messaging
5
6
  # Stan Smith 2017-01-20 refactored for mdJson/mdTranslator 2.0
6
7
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
7
8
  # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
@@ -10,6 +11,7 @@
10
11
  # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
11
12
  # Stan Smith 2013-12-01 original script
12
13
 
14
+ require_relative '../iso19110_writer'
13
15
  require_relative 'class_locale'
14
16
  require_relative 'class_responsibleParty'
15
17
  require_relative 'class_featureType'
@@ -24,6 +26,7 @@ module ADIWG
24
26
  def initialize(xml, responseObj)
25
27
  @xml = xml
26
28
  @hResponseObj = responseObj
29
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
27
30
  end
28
31
 
29
32
  def writeXML(intObj)
@@ -85,7 +88,7 @@ module ADIWG
85
88
  end
86
89
  end
87
90
  if name.nil?
88
- @xml.tag!('gmx:name', {'gco:nilReason' => 'missing'})
91
+ @NameSpace.issueWarning(40, 'gmx:name')
89
92
  end
90
93
 
91
94
  # feature catalogue - scope (required) []
@@ -95,8 +98,8 @@ module ADIWG
95
98
  @xml.tag!('gco:CharacterString', scope)
96
99
  end
97
100
  end
98
- if aScopes.empty? && @hResponseObj[:writerShowTags]
99
- @xml.tag!('gmx:scope', {'gco:nilReason' => 'missing'})
101
+ if aScopes.empty?
102
+ @NameSpace.issueWarning(41, 'gmx:scope')
100
103
  end
101
104
 
102
105
  # feature catalogue - field of application []
@@ -117,7 +120,7 @@ module ADIWG
117
120
  end
118
121
  end
119
122
  if version.nil?
120
- @xml.tag!('gmx:versionNumber', {'gco:nilReason' => 'missing'})
123
+ @NameSpace.issueWarning(42, 'gmx:versionNumber')
121
124
  end
122
125
 
123
126
  # feature catalogue - version date (required)
@@ -135,7 +138,7 @@ module ADIWG
135
138
  end
136
139
  end
137
140
  if sDate.nil?
138
- @xml.tag!('gmx:versionDate', {'gco:nilReason' => 'missing'})
141
+ @NameSpace.issueWarning(43, 'gmx:versionDate')
139
142
  end
140
143
 
141
144
  # feature catalogue - locale []
@@ -163,8 +166,8 @@ module ADIWG
163
166
  end
164
167
  end
165
168
  end
166
- if hParty.empty? && @hResponseObj[:writerShowTags]
167
- @xml.tag!('gfc:producer')
169
+ if hParty.empty?
170
+ @NameSpace.issueWarning(44, 'gfc:producer')
168
171
  end
169
172
 
170
173
  # feature catalogue - functional language
@@ -178,7 +181,7 @@ module ADIWG
178
181
  @xml.tag!('gfc:functionalLanguage')
179
182
  end
180
183
 
181
- # feature catalogue - feature type (required)
184
+ # feature catalogue - feature type [] (required)
182
185
  # use feature type to represent date entities
183
186
  unless aEntities.empty?
184
187
  aEntities.each do |hEntity|
@@ -188,7 +191,7 @@ module ADIWG
188
191
  end
189
192
  end
190
193
  if aEntities.empty?
191
- @xml.tag!('gfc:featureType', {'gco:nilReason' => 'missing'})
194
+ @NameSpace.issueWarning(45, 'gfc:featureType')
192
195
  end
193
196
 
194
197
  return metadata
@@ -3,6 +3,7 @@
3
3
  # create attributes for entities
4
4
 
5
5
  # History:
6
+ # Stan Smith 2018-04-03 refactored error and warning messaging
6
7
  # Stan Smith 2017-11-02 split out domain from attribute
7
8
  # Stan Smith 2017-02-02 refactored for mdTranslator/mdJson 2.0
8
9
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
@@ -11,6 +12,7 @@
11
12
  # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
13
  # Stan Smith 2014-12-02 original script
13
14
 
15
+ require_relative '../iso19110_writer'
14
16
  require_relative 'class_multiplicity'
15
17
  require_relative 'class_unitsOfMeasure'
16
18
  require_relative 'class_definitionReference'
@@ -26,6 +28,7 @@ module ADIWG
26
28
  def initialize(xml, responseObj)
27
29
  @xml = xml
28
30
  @hResponseObj = responseObj
31
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
29
32
  end
30
33
 
31
34
  def writeXML(hAttribute)
@@ -38,6 +41,8 @@ module ADIWG
38
41
 
39
42
  @xml.tag!('gfc:FC_FeatureAttribute') do
40
43
 
44
+ outContext = hAttribute[:attributeCode]
45
+
41
46
  # feature attribute - member name (required)
42
47
  # used for attribute common name
43
48
  s = hAttribute[:attributeName]
@@ -47,7 +52,7 @@ module ADIWG
47
52
  end
48
53
  end
49
54
  if s.nil?
50
- @xml.tag!('gfc:memberName', {'gco:nilReason' => 'missing'})
55
+ @NameSpace.issueWarning(50, 'gfc:memberName', outContext)
51
56
  end
52
57
 
53
58
  # feature attribute - definition
@@ -63,6 +68,7 @@ module ADIWG
63
68
  end
64
69
 
65
70
  # feature attribute - cardinality (required)
71
+ # no test required, values come from Boolean values
66
72
  @xml.tag!('gfc:cardinality') do
67
73
  multiClass.writeXML(hAttribute)
68
74
  end
@@ -100,7 +106,7 @@ module ADIWG
100
106
  @xml.tag!('gfc:valueMeasurementUnit')
101
107
  end
102
108
 
103
- # feature attribute - value type (datatype)
109
+ # feature attribute - value type {datatype}
104
110
  s = hAttribute[:dataType]
105
111
  unless s.nil?
106
112
  @xml.tag!('gfc:valueType') do
@@ -121,7 +127,7 @@ module ADIWG
121
127
  # find domain in domain array
122
128
  hDomain = ADIWG::Mdtranslator::Writers::Iso19110.getDomain(domainID)
123
129
  unless hDomain.empty?
124
- domainClass.writeXML(hDomain)
130
+ domainClass.writeXML(hDomain, outContext)
125
131
  end
126
132
  end
127
133
 
@@ -2,6 +2,7 @@
2
2
  # writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-03 refactored error and warning messaging
5
6
  # Stan Smith 2017-11-02 add entity reference
6
7
  # Stan Smith 2017-02-03 refactored for mdJson/mdTranslator 2.0
7
8
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
@@ -11,6 +12,7 @@
11
12
  # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
13
  # Stan Smith 2014-12-02 original script
13
14
 
15
+ require_relative '../iso19110_writer'
14
16
  require_relative 'class_featureConstraint'
15
17
  require_relative 'class_featureAttribute'
16
18
  require_relative 'class_definitionReference'
@@ -25,6 +27,7 @@ module ADIWG
25
27
  def initialize(xml, responseObj)
26
28
  @xml = xml
27
29
  @hResponseObj = responseObj
30
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
28
31
  end
29
32
 
30
33
  def writeXML(hEntity)
@@ -45,6 +48,8 @@ module ADIWG
45
48
 
46
49
  @xml.tag!('gfc:FC_FeatureType', {'id' => entityId}) do
47
50
 
51
+ outContext = hEntity[:entityCode]
52
+
48
53
  # feature type - type name (required)
49
54
  # used for entity common name
50
55
  s = hEntity[:entityName]
@@ -54,7 +59,7 @@ module ADIWG
54
59
  end
55
60
  end
56
61
  if s.nil?
57
- @xml.tag!('gfc:typeName', {'gco:nilReason' => 'missing'})
62
+ @NameSpace.issueWarning(60, 'gfc:typeName', outContext)
58
63
  end
59
64
 
60
65
  # feature type - definition
@@ -96,8 +101,8 @@ module ADIWG
96
101
 
97
102
  # feature type - feature catalogue (required)
98
103
  # 'role that links this feature type to the feature catalogue that contains it'
99
- # confusing, allows definition of another feature catalogue here
100
- # just set to nilReason = 'inapplicable' (as recommended by NOAA)
104
+ # confusing?, allows definition of another feature catalogue here
105
+ # just set nilReason = 'inapplicable' (as recommended by NOAA)
101
106
  @xml.tag!('gfc:featureCatalogue', {'gco:nilReason' => 'inapplicable'})
102
107
 
103
108
  # feature type - constrained by
@@ -2,9 +2,8 @@
2
2
  # writer output in XML
3
3
  # to define the domain of an attribute
4
4
 
5
- require_relative 'class_definitionReference'
6
-
7
5
  # History:
6
+ # Stan Smith 2018-04-03 refactored error and warning messaging
8
7
  # Stan Smith 2018-01-25 add support for domain itemReference
9
8
  # Stan Smith 2017-02-03 refactored for mdJson/mdTranslator 2.0
10
9
  # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
@@ -13,6 +12,9 @@ require_relative 'class_definitionReference'
13
12
  # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
14
13
  # Stan Smith 2014-12-02 original script
15
14
 
15
+ require_relative '../iso19110_writer'
16
+ require_relative 'class_definitionReference'
17
+
16
18
  module ADIWG
17
19
  module Mdtranslator
18
20
  module Writers
@@ -23,9 +25,10 @@ module ADIWG
23
25
  def initialize(xml, responseObj)
24
26
  @xml = xml
25
27
  @hResponseObj = responseObj
28
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
26
29
  end
27
30
 
28
- def writeXML(hItem)
31
+ def writeXML(hItem, inContext)
29
32
 
30
33
  # classes used
31
34
  defRefClass = FC_DefinitionReference.new(@xml, @hResponseObj)
@@ -41,7 +44,7 @@ module ADIWG
41
44
  end
42
45
  end
43
46
  if s.nil?
44
- @xml.tag!('gfc:label', {'gco:nilReason' => 'missing'})
47
+ @NameSpace.issueWarning(70, 'gfc:label', inContext)
45
48
  end
46
49
 
47
50
  # listed value - code
@@ -2,68 +2,71 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-21 refactored for mdTranslator/mdJson 2.0
5
+ # Stan Smith 2018-04-03 refactored error and warning messaging
6
+ # Stan Smith 2016-11-21 refactored for mdTranslator/mdJson 2.0
6
7
  # Stan Smith 2015-07-28 original script.
7
8
 
9
+ require_relative '../iso19110_writer'
8
10
  require_relative 'class_codelist'
9
11
 
10
12
  module ADIWG
11
- module Mdtranslator
12
- module Writers
13
- module Iso19110
13
+ module Mdtranslator
14
+ module Writers
15
+ module Iso19110
14
16
 
15
- class PT_Locale
17
+ class PT_Locale
16
18
 
17
- def initialize(xml, hResponseObj)
18
- @xml = xml
19
- @hResponseObj = hResponseObj
20
- end
19
+ def initialize(xml, hResponseObj)
20
+ @xml = xml
21
+ @hResponseObj = hResponseObj
22
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
23
+ end
21
24
 
22
- def writeXML(hLocale)
25
+ def writeXML(hLocale)
23
26
 
24
- # classes used
25
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
+ # classes used
28
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
29
 
27
- @xml.tag!('gmd:PT_Locale') do
30
+ @xml.tag!('gmd:PT_Locale') do
28
31
 
29
- # locale - language (required)
30
- s = hLocale[:languageCode]
31
- unless s.nil?
32
- @xml.tag!('gmd:languageCode') do
33
- codelistClass.writeXML('gmd', 'iso_language', s)
34
- end
35
- end
36
- if s.nil?
37
- @xml.tag!('gmd:languageCode', {'gco:nilReason' => 'missing'})
38
- end
32
+ # locale - language (required)
33
+ s = hLocale[:languageCode]
34
+ unless s.nil?
35
+ @xml.tag!('gmd:languageCode') do
36
+ codelistClass.writeXML('gmd', 'iso_language', s)
37
+ end
38
+ end
39
+ if s.nil?
40
+ @NameSpace.issueWarning(80, 'gmd:languageCode')
41
+ end
39
42
 
40
- # locale - country
41
- s = hLocale[:countryCode]
42
- unless s.nil?
43
- @xml.tag!('gmd:country') do
44
- codelistClass.writeXML('gmd', 'iso_countries', s)
45
- end
46
- end
47
- if s.nil? && @hResponseObj[:writerShowTags]
48
- @xml.tag!('gmd:country')
49
- end
43
+ # locale - country
44
+ s = hLocale[:countryCode]
45
+ unless s.nil?
46
+ @xml.tag!('gmd:country') do
47
+ codelistClass.writeXML('gmd', 'iso_countries', s)
48
+ end
49
+ end
50
+ if s.nil? && @hResponseObj[:writerShowTags]
51
+ @xml.tag!('gmd:country')
52
+ end
50
53
 
51
- # locale - character encoding (required)
52
- s = hLocale[:characterEncoding]
53
- unless s.nil?
54
- @xml.tag!('gmd:characterEncoding') do
55
- codelistClass.writeXML('gmd', 'iso_characterSet', s)
56
- end
57
- end
58
- if s.nil?
59
- @xml.tag!('gmd:characterEncoding', {'gco:nilReason' => 'missing'})
60
- end
54
+ # locale - character encoding (required)
55
+ s = hLocale[:characterEncoding]
56
+ unless s.nil?
57
+ @xml.tag!('gmd:characterEncoding') do
58
+ codelistClass.writeXML('gmd', 'iso_characterSet', s)
59
+ end
60
+ end
61
+ if s.nil?
62
+ @NameSpace.issueWarning(81, 'gmd:characterEncoding')
63
+ end
61
64
 
62
- end # gmd:PT_Locale
63
- end # writeXML
64
- end # gmd:PT_Locale class
65
+ end # gmd:PT_Locale
66
+ end # writeXML
67
+ end # gmd:PT_Locale class
65
68
 
66
- end
67
- end
68
- end
69
+ end
70
+ end
71
+ end
69
72
  end
@@ -2,8 +2,10 @@
2
2
  # 19115-2 output for ISO 19115-2 XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-04-03 refactored error and warning messaging
5
6
  # Stan Smith 2017-11-02 original script
6
7
 
8
+ require_relative '../iso19110_writer'
7
9
  require_relative 'class_citation'
8
10
 
9
11
  module ADIWG
@@ -16,6 +18,7 @@ module ADIWG
16
18
  def initialize(xml, hResponseObj)
17
19
  @xml = xml
18
20
  @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19110
19
22
  end
20
23
 
21
24
  def writeXML(hIdentifier)
@@ -39,7 +42,7 @@ module ADIWG
39
42
  # identifier - code (required)
40
43
  s = hIdentifier[:identifier]
41
44
  if s.nil?
42
- @xml.tag!('gmd:code', {'gco:nilReason' => 'missing'})
45
+ @NameSpace.issueWarning(90, 'gmd:code')
43
46
  else
44
47
  @xml.tag!('gmd:code') do
45
48
  @xml.tag!('gco:CharacterString', s)
@@ -37,8 +37,23 @@ module ADIWG
37
37
  def writeXML(hAttribute)
38
38
 
39
39
  # xml for iso classes Multiplicity and MultiplicityRange
40
+ # in 19110 cardinality is expressed as multiplicity, a min/max range
41
+ # Multiplicity is not defined in the documentation, only inferred from the XSD
42
+ # max cardinality -----------------
40
43
  # ISO 19110-2 rule
41
44
  # ... "If this is an attribute or operation, the default cardinality is 1"
45
+ # there is no hint if this refers to min or max of the range, I chose max
46
+ # I assume this means the attribute can occur only once in the entity
47
+ # I set the internal object mustBeUnique = true as default
48
+ # I assume false would describe something like a repeating tag in an XML file
49
+ # min cardinality -----------------
50
+ # mdJson allows setting flag to allow nulls as attribute values
51
+ # I set this into minimum cardinality
52
+ # issue ---------------------------
53
+ # min cardinality refers to the attribute values
54
+ # max cardinality refers to the attribute instantiation
55
+ # perhaps one of these should not be carried in ISO19110
56
+
42
57
  minCard = 1
43
58
  maxCard = 9
44
59
  if hAttribute[:allowNull]