adiwg-mdtranslator 2.13.0 → 2.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +26 -14
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +1 -0
  4. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +56 -41
  5. data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +3 -1
  6. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +1 -0
  7. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +377 -0
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +6 -8
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +6 -6
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +6 -7
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +7 -11
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -13
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +10 -6
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +11 -21
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +18 -38
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +10 -8
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +22 -28
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +17 -18
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +5 -3
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +9 -15
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +6 -8
  22. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +8 -13
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +8 -12
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +6 -6
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +7 -11
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +6 -5
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +17 -8
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +12 -12
  29. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +9 -13
  30. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +6 -6
  31. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +14 -12
  32. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +20 -19
  33. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +8 -15
  34. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +7 -10
  35. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +12 -10
  36. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +8 -13
  37. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +10 -7
  38. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +8 -6
  39. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +8 -3
  40. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +11 -8
  41. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -10
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +10 -13
  43. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +11 -10
  44. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +8 -12
  45. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +8 -12
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +7 -12
  47. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +4 -2
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +13 -20
  49. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +12 -14
  50. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +8 -8
  51. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +6 -6
  52. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +12 -13
  53. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +10 -7
  54. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +9 -3
  55. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +8 -6
  56. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +6 -5
  57. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +6 -6
  58. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +10 -10
  59. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +7 -9
  60. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +12 -10
  61. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +59 -17
  62. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +9 -16
  63. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +10 -5
  64. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +6 -9
  65. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +16 -16
  66. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +8 -6
  67. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -12
  68. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +6 -6
  69. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +5 -3
  70. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +25 -28
  71. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +7 -7
  72. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +15 -12
  73. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +11 -10
  74. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +12 -11
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +10 -8
  76. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +29 -40
  77. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +6 -6
  78. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +5 -5
  79. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +12 -11
  80. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +6 -9
  81. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +11 -8
  82. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +6 -7
  83. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +6 -6
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +5 -3
  85. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -13
  86. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +10 -9
  87. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +14 -11
  88. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +14 -10
  89. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +8 -15
  90. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +5 -5
  91. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +7 -11
  92. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +12 -9
  93. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +12 -9
  94. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +9 -13
  95. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +22 -26
  96. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +13 -9
  97. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +7 -9
  98. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +6 -6
  99. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +12 -10
  100. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +10 -8
  101. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +12 -13
  102. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +10 -10
  103. data/lib/adiwg/mdtranslator/version.rb +8 -3
  104. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +78 -84
  105. data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibility.rb +3 -3
  106. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +23 -14
  107. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +2 -1
  108. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +10 -2
  109. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -0
  110. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
  111. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +1 -1
  112. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +5 -5
  113. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_medium.rb +1 -1
  114. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_party.rb +1 -5
  115. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_repository.rb +4 -2
  116. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +1 -0
  117. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +11 -11
  118. metadata +4 -3
@@ -2,8 +2,8 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2018-02-19 refactored error and warning messaging
6
- # Stan Smith 2016-10-21 original script
5
+ # Stan Smith 2018-06-27 refactored error and warning messaging
6
+ # Stan Smith 2016-10-21 original script
7
7
 
8
8
  require_relative 'module_responsibleParty'
9
9
 
@@ -16,9 +16,11 @@ module ADIWG
16
16
 
17
17
  def self.unpack(hVoucher, responseObj)
18
18
 
19
+ @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
20
+
19
21
  # return nil object if input is empty
20
22
  if hVoucher.empty?
21
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: voucher object is empty'
23
+ @MessagePath.issueWarning(940, responseObj)
22
24
  return nil
23
25
  end
24
26
 
@@ -26,30 +28,28 @@ module ADIWG
26
28
  intMetadataClass = InternalMetadata.new
27
29
  intVoucher = intMetadataClass.newTaxonVoucher
28
30
 
31
+ outContext = 'taxon voucher'
32
+
29
33
  # voucher - specimen (required)
30
34
  if hVoucher.has_key?('specimen')
31
35
  intVoucher[:specimen] = hVoucher['specimen']
32
36
  end
33
37
  if intVoucher[:specimen].nil? || intVoucher[:specimen] == ''
34
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: voucher specimen is missing'
35
- responseObj[:readerExecutionPass] = false
36
- return nil
38
+ @MessagePath.issueError(941, responseObj)
37
39
  end
38
40
 
39
41
  # voucher - repository (required)
40
42
  if hVoucher.has_key?('repository')
41
43
  hObject = hVoucher['repository']
42
44
  unless hObject.empty?
43
- hReturn = ResponsibleParty.unpack(hObject, responseObj)
45
+ hReturn = ResponsibleParty.unpack(hObject, responseObj, outContext)
44
46
  unless hReturn.nil?
45
47
  intVoucher[:repository] = hReturn
46
48
  end
47
49
  end
48
50
  end
49
51
  if intVoucher[:repository].empty?
50
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: voucher repository is missing'
51
- responseObj[:readerExecutionPass] = false
52
- return nil
52
+ @MessagePath.issueError(942, responseObj)
53
53
  end
54
54
 
55
55
  return intVoucher
@@ -1,13 +1,18 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.13.1 2018-07-02 fix bug in ISO 19110 writer when dictionary empty
5
+ # 2.13.1 2018-06-12 change default time stamps from 'local' to UTC
6
+ # 2.13.1 2018-06-11 fix bug #179 remove 0 time value from date string when time not present
7
+ # 2.13.1 2018-06-08 refactor mdJson test to use mdJson generation helpers
8
+ # 2.13.1 2018-05-25 filter ISO 19115-3 topic categories from ISO 19115-2 writer
4
9
  # 2.13.0 2018-05-08 add contact name in addition to ID in outContext messaging
5
10
  # 2.13.0 2018-05-30 changed local schema reference in ISO writer tests to remote
6
- # 2.13.0 2018-05-03 refactor ISO19115-2 test mdJson to use mdJson generation helpers
11
+ # 2.13.0 2018-05-03 refactor ISO19115-2 tests to use mdJson generation helpers
7
12
  # 2.13.0 2018-04-09 refactored messaging for ISO19115-2
8
13
  # 2.12.0 2018-04-07 add 'fgdc' option to reader and writer enum list
9
14
  # 2.12.0 2018-04-06 rename taxonomicRank to taxonomicLevel
10
- # 2.12.0 2018-04-06 rename latinName to taxonomicNamel
15
+ # 2.12.0 2018-04-06 rename latinName to taxonomicName
11
16
  # 2.12.0 2018-04-06 changed resourceInfo taxonomy from object to array
12
17
  # 2.12.0 2018-04-05 refactored messaging for ISO19110
13
18
  # 2.11.0 2018-03-28 add 'responsibleParties' to budget allocation
@@ -82,7 +87,7 @@
82
87
  module ADIWG
83
88
  module Mdtranslator
84
89
  # current mdtranslator version
85
- VERSION = "2.13.0"
90
+ VERSION = "2.13.1"
86
91
  end
87
92
  end
88
93
 
@@ -23,16 +23,14 @@ module ADIWG
23
23
  def writeXML(hResourceInfo)
24
24
 
25
25
  # spatial organization 3.1 (indspref) - Indirect Spatial Reference
26
- # <- hResourceInfo.spatialReferenceSystems.systemIdentifier.identifier = 'indirect' (first)
26
+ # <- hResourceInfo.spatialReferenceSystems.systemIdentifier (first)
27
27
  haveIndirect = false
28
28
  hResourceInfo[:spatialReferenceSystems].each do |hSystem|
29
29
  unless hSystem[:systemIdentifier].empty?
30
- if hSystem[:systemIdentifier][:identifier] == 'indirect'
31
- unless hSystem[:systemIdentifier][:description].empty?
32
- @xml.tag!('indspref', hSystem[:systemIdentifier][:description])
33
- haveIndirect = true
34
- break
35
- end
30
+ unless hSystem[:systemIdentifier][:description].empty?
31
+ @xml.tag!('indspref', hSystem[:systemIdentifier][:description])
32
+ haveIndirect = true
33
+ break
36
34
  end
37
35
  end
38
36
  end
@@ -42,7 +40,7 @@ module ADIWG
42
40
 
43
41
  # spatial organization 3.2 (direct) - Direct Spatial Reference Method
44
42
  # <- resourceInfo.spatialRepresentationTypes
45
- # take first that match ['point' | 'vector' | 'grid']
43
+ # take first to match ['point' | 'vector' | 'grid']
46
44
  direct = nil
47
45
  hResourceInfo[:spatialRepresentationTypes].each do |type|
48
46
  direct = 'Point' if type == 'point'
@@ -59,22 +57,47 @@ module ADIWG
59
57
 
60
58
  # spatial organization 3.3 (ptvctinf) - point and vector object information
61
59
  # <- resourceInfo.spatialRepresentations.vectorRepresentation (first)
62
- if direct == 'Point' || direct == 'Vector'
63
- hResourceInfo[:spatialRepresentations].each do |hSpaceRep|
64
- unless hSpaceRep[:vectorRepresentation].empty?
65
- hVectorRep = hSpaceRep[:vectorRepresentation]
66
- unless hVectorRep.empty?
67
- @xml.tag!('ptvctinf') do
68
- if hVectorRep[:topologyLevel].nil?
69
-
70
- # spatial organization point and vector object 3.3.1 (sdtsterm) - SDTS term []
60
+ hResourceInfo[:spatialRepresentations].each do |hSpaceRep|
61
+ unless hSpaceRep[:vectorRepresentation].empty?
62
+ hVectorRep = hSpaceRep[:vectorRepresentation]
63
+ unless hVectorRep.empty?
64
+ @xml.tag!('ptvctinf') do
65
+ if hVectorRep[:topologyLevel].nil?
66
+
67
+ # spatial organization point and vector object 3.3.1 (sdtsterm) - SDTS term []
68
+ hVectorRep[:vectorObject].each do |hVecObj|
69
+ @xml.tag!('sdtsterm') do
70
+
71
+ # spatial organization point and vector object 3.3.1.1 (sdtstype) - SDTS object type (requied)
72
+ @xml.tag!('sdtstype', hVecObj[:objectType])
73
+
74
+ # spatial organization point and vector object 3.3.1.2 (ptvctcnt) - SDTS count
75
+ unless hVecObj[:objectCount].nil?
76
+ @xml.tag!('ptvctcnt', hVecObj[:objectCount])
77
+ end
78
+ if hVecObj[:objectCount].nil?
79
+ @xml.tag!('ptvctcnt')
80
+ end
81
+
82
+ end
83
+ end
84
+
85
+ else
86
+
87
+ # point and vector object 3.3.2 (vpfterm) - VPF terms description
88
+ @xml.tag!('vpfterm') do
89
+
90
+ # VPF term 3.3.2.1 (vpflevel) - VPF topology level
91
+ @xml.tag!('vpflevel', hVectorRep[:topologyLevel])
92
+
93
+ # VPF term 3.3.2.2 (vpfinfo) - VPF point and vector object information []
71
94
  hVectorRep[:vectorObject].each do |hVecObj|
72
- @xml.tag!('sdtsterm') do
95
+ @xml.tag!('vpfinfo') do
73
96
 
74
- # spatial organization point and vector object 3.3.1.1 (sdtstype) - SDTS object type (requied)
75
- @xml.tag!('sdtstype', hVecObj[:objectType])
97
+ # spatial organization point and vector object 3.3.2.2.1 (vpftype) - VPF object type (requied)
98
+ @xml.tag!('vpftype', hVecObj[:objectType])
76
99
 
77
- # spatial organization point and vector object 3.3.1.2 (ptvctcnt) - SDTS count
100
+ # spatial organization point and vector object 3.3.2.2.2 (ptvctcnt) - VPF object type
78
101
  unless hVecObj[:objectCount].nil?
79
102
  @xml.tag!('ptvctcnt', hVecObj[:objectCount])
80
103
  end
@@ -85,89 +108,60 @@ module ADIWG
85
108
  end
86
109
  end
87
110
 
88
- else
89
-
90
- # point and vector object 3.3.2 (vpfterm) - VPF terms description
91
- @xml.tag!('vpfterm') do
92
-
93
- # VPF term 3.3.2.1 (vpflevel) - VPF topology level
94
- @xml.tag!('vpflevel', hVectorRep[:topologyLevel])
95
-
96
- # VPF term 3.3.2.2 (vpfinfo) - VPF point and vector object information []
97
- hVectorRep[:vectorObject].each do |hVecObj|
98
- @xml.tag!('vpfinfo') do
99
-
100
- # spatial organization point and vector object 3.3.2.2.1 (vpftype) - VPF object type (requied)
101
- @xml.tag!('vpftype', hVecObj[:objectType])
102
-
103
- # spatial organization point and vector object 3.3.2.2.2 (ptvctcnt) - VPF object type
104
- unless hVecObj[:objectCount].nil?
105
- @xml.tag!('ptvctcnt', hVecObj[:objectCount])
106
- end
107
- if hVecObj[:objectCount].nil?
108
- @xml.tag!('ptvctcnt')
109
- end
110
-
111
- end
112
- end
113
-
114
- end
115
-
116
111
  end
112
+
117
113
  end
118
- break
119
114
  end
120
-
115
+ break
121
116
  end
117
+
122
118
  end
123
119
  end
124
120
 
125
121
  # spatial organization 3.4 (rastinfo) - point and vector object information
126
122
  # <- resourceInfo.spatialRepresentations.gridRepresentation (first)
127
- if direct == 'Raster'
128
- hResourceInfo[:spatialRepresentations].each do |hSpaceRep|
129
- if hSpaceRep[:gridRepresentation]
130
- hGridRep = hSpaceRep[:gridRepresentation]
131
- @xml.tag!('rastinfo') do
132
-
133
- # spatial organization raster 3.4.1 (rasttype) - raster type (required)
134
- unless hGridRep[:cellGeometry].empty?
135
- @xml.tag!('rasttype', hGridRep[:cellGeometry])
136
- end
137
- if hGridRep[:cellGeometry].empty?
138
- @NameSpace.issueWarning(380, 'rasttype')
139
- end
123
+ hResourceInfo[:spatialRepresentations].each do |hSpaceRep|
124
+ unless hSpaceRep[:gridRepresentation].empty?
125
+ hGridRep = hSpaceRep[:gridRepresentation]
126
+ @xml.tag!('rastinfo') do
127
+
128
+ # spatial organization raster 3.4.1 (rasttype) - raster type (required)
129
+ unless hGridRep[:cellGeometry].empty?
130
+ @xml.tag!('rasttype', hGridRep[:cellGeometry])
131
+ end
132
+ if hGridRep[:cellGeometry].empty?
133
+ @NameSpace.issueWarning(380, 'rasttype')
134
+ end
140
135
 
141
- # spatial organization raster 3.4.2 (rowcount) - row count
142
- hGridRep[:dimension].each do |hDimension|
143
- if hDimension[:dimensionType] == 'row'
144
- unless hDimension[:dimensionSize].nil?
145
- @xml.tag!('rowcount', hDimension[:dimensionSize])
146
- end
136
+ # spatial organization raster 3.4.2 (rowcount) - row count
137
+ hGridRep[:dimension].each do |hDimension|
138
+ if hDimension[:dimensionType] == 'row'
139
+ unless hDimension[:dimensionSize].nil?
140
+ @xml.tag!('rowcount', hDimension[:dimensionSize])
147
141
  end
148
142
  end
143
+ end
149
144
 
150
- # spatial organization raster 3.4.2 (colcount) - column count
151
- hGridRep[:dimension].each do |hDimension|
152
- if hDimension[:dimensionType] == 'column'
153
- unless hDimension[:dimensionSize].nil?
154
- @xml.tag!('colcount', hDimension[:dimensionSize])
155
- end
145
+ # spatial organization raster 3.4.2 (colcount) - column count
146
+ hGridRep[:dimension].each do |hDimension|
147
+ if hDimension[:dimensionType] == 'column'
148
+ unless hDimension[:dimensionSize].nil?
149
+ @xml.tag!('colcount', hDimension[:dimensionSize])
156
150
  end
157
151
  end
152
+ end
158
153
 
159
- # spatial organization raster 3.4.2 (vrtcount) - depth count
160
- hGridRep[:dimension].each do |hDimension|
161
- if hDimension[:dimensionType] == 'vertical'
162
- unless hDimension[:dimensionSize].nil?
163
- @xml.tag!('vrtcount', hDimension[:dimensionSize])
164
- end
154
+ # spatial organization raster 3.4.2 (vrtcount) - depth count
155
+ hGridRep[:dimension].each do |hDimension|
156
+ if hDimension[:dimensionType] == 'vertical'
157
+ unless hDimension[:dimensionSize].nil?
158
+ @xml.tag!('vrtcount', hDimension[:dimensionSize])
165
159
  end
166
160
  end
167
-
168
161
  end
169
- break
162
+
170
163
  end
164
+ break
171
165
  end
172
166
  end
173
167
 
@@ -43,10 +43,10 @@ module ADIWG
43
43
  end
44
44
 
45
45
  if hContact[:isOrganization]
46
- hParty[:organizationMembers].each do |hMember|
47
- hMemberContact = Html_Document.getContact(hMember[:contactId])
46
+ hParty[:organizationMembers].each do |memberId|
47
+ hMemberContact = Html_Document.getContact(memberId)
48
48
  @html.em('has Member: ')
49
- @html.a(hMemberContact[:name], 'href' => '#CID_'+hMember[:contactId])
49
+ @html.a(hMemberContact[:name], 'href' => '#CID_'+ memberId)
50
50
  @html.br
51
51
  end
52
52
  else
@@ -1,7 +1,7 @@
1
1
  # Writer - internal data structure to ISO 19110:2003
2
2
 
3
3
  # History:
4
- # Stan Smith 2018-03-30 add error/warning/notice message methods
4
+ # Stan Smith 2018-07-02 fix bug with handling of empty or missing dictionary
5
5
  # Stan Smith 2017-05-26 allow choice of which dictionary to translate
6
6
  # ... fix bug when no dictionary is provided in mdJson
7
7
  # Stan Smith 2017-01-20 refactor for mdJson/mdTranslator 2.0
@@ -21,28 +21,29 @@ module ADIWG
21
21
  module Writers
22
22
  module Iso19110
23
23
 
24
- def self.startWriter(intObj, hResponseObj, whichDict: 0)
24
+ def self.startWriter(intObj, hResponseObj, whichDict = 0)
25
25
 
26
- # Iso19110 can only output one dictionary at a time
27
- # test if requested dictionary is in input file
28
- if intObj[:dataDictionaries][whichDict].nil?
29
- responseObj[:writerMessages] << 'Dictionary is missing'
30
- responseObj[:writerPass] = false
31
- return nil
32
- end
26
+ # load error message array
27
+ file = File.join(File.dirname(__FILE__), 'iso19110_writer_messages_eng') + '.yml'
28
+ hMessageList = YAML.load_file(file)
29
+ @aMessagesList = hMessageList['messageList']
33
30
 
34
31
  # make objects available to the instance
35
32
  @intObj = intObj
36
33
  @contacts = intObj[:contacts]
37
34
  @hResponseObj = hResponseObj
35
+
36
+ if intObj[:dataDictionaries].empty?
37
+ issueError(110)
38
+ return nil
39
+ end
40
+ if intObj[:dataDictionaries].length > 1
41
+ issueNotice(111)
42
+ end
43
+
38
44
  dictionary = intObj[:dataDictionaries][whichDict]
39
45
  @domains = dictionary[:domains]
40
46
 
41
- # load error message array
42
- file = File.join(File.dirname(__FILE__), 'iso19110_writer_messages_eng') + '.yml'
43
- hMessageList = YAML.load_file(file)
44
- @aMessagesList = hMessageList['messageList']
45
-
46
47
  # set the format of the output file based on the writer specified
47
48
  hResponseObj[:writerOutputFormat] = 'xml'
48
49
  hResponseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Iso19110::VERSION
@@ -113,6 +114,14 @@ module ADIWG
113
114
  end
114
115
  end
115
116
 
117
+ def self.issueNotice(messageId, context = nil)
118
+ message = findMessage(messageId)
119
+ unless message.nil?
120
+ message += ': CONTEXT is ' + context unless context.nil?
121
+ @hResponseObj[:writerMessages] << 'NOTICE: ISO-19110 writer: ' + message
122
+ end
123
+ end
124
+
116
125
  end
117
126
  end
118
127
  end
@@ -37,4 +37,5 @@ messageList:
37
37
  - {id: 100, message: "codeset domain name is missing"}
38
38
  - {id: 101, message: "unrepresented domain name is missing"}
39
39
 
40
- - {id: 110, message: " is missing"}
40
+ - {id: 110, message: "data dictionary is empty"}
41
+ - {id: 111, message: "multiple data dictionaries found, using first"}
@@ -2,6 +2,7 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-05-25 block non-ISO19115-2 topic categories
5
6
  # Stan Smith 2018-04-09 add error and warning messaging
6
7
  # Stan Smith 2018-04-06 changed taxonomy to an array
7
8
  # Stan Smith 2018-01-05 deprecated topicCategory[]
@@ -353,9 +354,16 @@ module ADIWG
353
354
  end
354
355
  end
355
356
  end
357
+ # only allow valid ISO 19115-2 topic categories to be written
358
+ aAcceptable = %w(farming biota boundaries climatologyMeteorologyAtmosphere economy
359
+ elevation environment geoscientificInformation health imageryBaseMapsEarthCover
360
+ intelligenceMilitary inlandWaters location oceans planningCadastre society
361
+ structure transportation utilitiesCommunication)
356
362
  aTopics.each do |topic|
357
- @xml.tag!('gmd:topicCategory') do
358
- enumerationClass.writeXML('iso_topicCategory', topic)
363
+ if aAcceptable.include?(topic)
364
+ @xml.tag!('gmd:topicCategory') do
365
+ enumerationClass.writeXML('iso_topicCategory', topic)
366
+ end
359
367
  end
360
368
  end
361
369
  if aTopics.empty? && @hResponseObj[:writerShowTags]
@@ -18,6 +18,7 @@ module ADIWG
18
18
  Jbuilder.new do |json|
19
19
  json.date(AdiwgDateTimeFun.stringDateTimeFromDateObject(hDate))
20
20
  json.dateType hDate[:dateType]
21
+ json.description hDate[:description]
21
22
  end
22
23
 
23
24
  end # build
@@ -24,9 +24,9 @@ module ADIWG
24
24
  def self.build(hDictionary)
25
25
 
26
26
  Jbuilder.new do |json|
27
+ json.citation Citation.build(hDictionary[:citation]) unless hDictionary[:citation].empty?
27
28
  json.description hDictionary[:description]
28
29
  json.subject hDictionary[:subjects] unless hDictionary[:subjects].empty?
29
- json.citation Citation.build(hDictionary[:citation]) unless hDictionary[:citation].empty?
30
30
  json.recommendedUse hDictionary[:recommendedUses] unless hDictionary[:recommendedUses].empty?
31
31
  json.locale @Namespace.json_map(hDictionary[:locales], Locale)
32
32
  json.responsibleParty ResponsibleParty.build(hDictionary[:responsibleParty])
@@ -23,7 +23,7 @@ module ADIWG
23
23
  json.containsData hGeographic[:containsData]
24
24
  json.identifier Identifier.build(hGeographic[:identifier]) unless hGeographic[:identifier].empty?
25
25
  json.boundingBox BoundingBox.build(hGeographic[:boundingBox]) unless hGeographic[:boundingBox].empty?
26
- json.geographicElement hGeographic[:nativeGeoJson]
26
+ json.geographicElement hGeographic[:nativeGeoJson] unless hGeographic[:nativeGeoJson].empty?
27
27
  end
28
28
 
29
29
  end # build