adiwg-mdtranslator 2.9.2 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -2
  3. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
  4. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
  5. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
  7. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
  9. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
  14. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
  15. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
  16. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
  17. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
  18. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
  19. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
  20. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
  21. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
  22. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
  23. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
  24. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
  25. data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
  26. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
  27. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
  28. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
  29. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
  30. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
  31. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
  32. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
  33. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
  34. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
  35. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
  36. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
  37. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
  38. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
  39. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
  40. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
  41. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
  42. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
  43. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
  44. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
  45. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
  46. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
  47. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
  48. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
  49. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
  50. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
  51. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
  52. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
  53. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
  54. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
  55. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
  56. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
  57. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
  58. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
  59. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
  60. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
  61. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
  62. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
  63. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
  64. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
  65. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
  66. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
  67. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
  68. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
  69. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
  70. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
  71. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
  72. data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
  73. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
  74. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
  75. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
  76. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
  77. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
  78. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
  79. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
  80. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
  81. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
  82. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
  83. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
  84. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
  85. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
  86. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
  87. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
  88. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
  89. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
  90. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
  91. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
  92. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
  93. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
  94. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
  95. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
  96. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
  97. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
  98. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
  99. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
  100. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
  101. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
  102. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
  103. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
  104. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
  105. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
  106. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
  107. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
  108. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
  109. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
  110. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
  111. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
  112. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
  113. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
  114. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
  115. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
  116. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
  117. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
  118. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
  119. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
  120. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
  121. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
  122. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
  123. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
  124. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
  125. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
  126. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
  127. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
  128. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
  129. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
  130. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
  131. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
  132. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
  133. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
  135. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
  136. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
  137. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
  138. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
  139. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
  140. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
  141. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
  142. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
  143. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
  144. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
  145. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
  146. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
  147. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
  148. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
  149. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
  150. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
  151. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
  152. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
  153. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
  154. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
  155. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
  156. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
  157. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
  158. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
  159. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
  160. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
  161. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
  162. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
  163. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
  164. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
  165. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
  166. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
  167. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
  168. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
  169. data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
  170. data/lib/adiwg/mdtranslator/version.rb +9 -1
  171. data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
  172. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
  173. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
  174. data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
  175. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
  176. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
  177. data/lib/adiwg/mdtranslator.rb +177 -165
  178. data/lib/adiwg/mdtranslator_cli.rb +8 -3
  179. metadata +2 -2
@@ -2,77 +2,76 @@
2
2
  # Reader - ADIwg JSON V1 to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-06 refactored for mdJson 2.0
6
- # Stan Smith 2014-12-15 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 remove global namespace constants
9
- # Stan Smith 2015-07-24 added error reporting of missing items
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-06 refactored for mdJson 2.0
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
10
+ # Stan Smith 2015-07-24 added error reporting of missing items
10
11
  # Stan Smith 2013-12-01 original script
11
12
 
12
13
  module ADIWG
13
- module Mdtranslator
14
- module Readers
15
- module MdJson
14
+ module Mdtranslator
15
+ module Readers
16
+ module MdJson
16
17
 
17
- module EntityForeignKey
18
+ module EntityForeignKey
18
19
 
19
- def self.unpack(hFKey, responseObj)
20
+ def self.unpack(hFKey, responseObj)
20
21
 
21
- # return nil object if input is empty
22
- if hFKey.empty?
23
- responseObj[:readerExecutionMessages] << 'Foreign Key object is empty'
24
- responseObj[:readerExecutionPass] = false
25
- return nil
26
- end
22
+ # return nil object if input is empty
23
+ if hFKey.empty?
24
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data entity foreign key object is empty'
25
+ return nil
26
+ end
27
27
 
28
- # instance classes needed in script
29
- intMetadataClass = InternalMetadata.new
30
- intFKey = intMetadataClass.newEntityForeignKey
28
+ # instance classes needed in script
29
+ intMetadataClass = InternalMetadata.new
30
+ intFKey = intMetadataClass.newEntityForeignKey
31
31
 
32
- # entity foreign key - local attribute code name [] (required)
33
- # return nil if no local attribute is provided
34
- if hFKey.has_key?('localAttributeCodeName')
35
- intFKey[:fkLocalAttributes] = hFKey['localAttributeCodeName']
36
- else
37
- intFKey[:fkLocalAttributes] = []
38
- end
39
- if intFKey[:fkLocalAttributes].empty?
40
- responseObj[:readerExecutionMessages] << 'Data Dictionary foreign key local attribute code name is missing'
41
- responseObj[:readerExecutionPass] = false
42
- return nil
43
- end
32
+ # entity foreign key - local attribute code name [] (required)
33
+ # return nil if no local attribute is provided
34
+ if hFKey.has_key?('localAttributeCodeName')
35
+ intFKey[:fkLocalAttributes] = hFKey['localAttributeCodeName']
36
+ end
37
+ if intFKey[:fkLocalAttributes].empty?
38
+ responseObj[:readerExecutionMessages] <<
39
+ 'ERROR: mdJson reader: data entity foreign key local attribute code name is missing'
40
+ responseObj[:readerExecutionPass] = false
41
+ return nil
42
+ end
44
43
 
45
- # entity foreign key - referenced entity code name (required)
46
- # return nil if no referenced entity is provided
47
- if hFKey.has_key?('referencedEntityCodeName')
48
- intFKey[:fkReferencedEntity] = hFKey['referencedEntityCodeName']
49
- end
50
- if intFKey[:fkReferencedEntity].nil? || intFKey[:fkReferencedEntity] == ''
51
- responseObj[:readerExecutionMessages] << 'Data Dictionary foreign key referenced entity name is missing'
52
- responseObj[:readerExecutionPass] = false
53
- return nil
54
- end
44
+ # entity foreign key - referenced entity code name (required)
45
+ # return nil if no referenced entity is provided
46
+ if hFKey.has_key?('referencedEntityCodeName')
47
+ intFKey[:fkReferencedEntity] = hFKey['referencedEntityCodeName']
48
+ end
49
+ if intFKey[:fkReferencedEntity].nil? || intFKey[:fkReferencedEntity] == ''
50
+ responseObj[:readerExecutionMessages] <<
51
+ 'ERROR: mdJson reader: data entity foreign key referenced entity name is missing'
52
+ responseObj[:readerExecutionPass] = false
53
+ return nil
54
+ end
55
55
 
56
- # entity foreign key - referenced attribute code name [] (required)
57
- # return nil if no referenced attribute is provided
58
- if hFKey.has_key?('referencedAttributeCodeName')
59
- intFKey[:fkReferencedAttributes] = hFKey['referencedAttributeCodeName']
60
- else
61
- intFKey[:fkReferencedAttributes] = []
62
- end
63
- if intFKey[:fkReferencedAttributes].empty?
64
- responseObj[:readerExecutionMessages] << 'Data Dictionary foreign key referenced attribute name is missing'
65
- responseObj[:readerExecutionPass] = false
66
- return nil
67
- end
56
+ # entity foreign key - referenced attribute code name [] (required)
57
+ # return nil if no referenced attribute is provided
58
+ if hFKey.has_key?('referencedAttributeCodeName')
59
+ intFKey[:fkReferencedAttributes] = hFKey['referencedAttributeCodeName']
60
+ end
61
+ if intFKey[:fkReferencedAttributes].empty?
62
+ responseObj[:readerExecutionMessages] <<
63
+ 'ERROR: mdJson reader: data entity foreign key referenced attribute name is missing'
64
+ responseObj[:readerExecutionPass] = false
65
+ return nil
66
+ end
68
67
 
69
- return intFKey
68
+ return intFKey
70
69
 
71
- end
72
-
73
- end
70
+ end
74
71
 
75
72
  end
76
- end
77
- end
73
+
74
+ end
75
+ end
76
+ end
78
77
  end
@@ -2,71 +2,70 @@
2
2
  # Reader - ADIwg JSON V1 to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-07 refactored for mdJson 2.0
6
- # Stan Smith 2015-07-24 added error reporting of missing items
7
- # Stan Smith 2015-07-14 refactored to remove global namespace constants
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-07 refactored for mdJson 2.0
7
+ # Stan Smith 2015-07-24 added error reporting of missing items
8
+ # Stan Smith 2015-07-14 refactored to remove global namespace constants
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
10
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
10
11
  # Stan Smith 2013-12-01 original script
11
12
 
12
13
  module ADIWG
13
- module Mdtranslator
14
- module Readers
15
- module MdJson
14
+ module Mdtranslator
15
+ module Readers
16
+ module MdJson
16
17
 
17
- module EntityIndex
18
+ module EntityIndex
18
19
 
19
- def self.unpack(hIndex, responseObj)
20
+ def self.unpack(hIndex, responseObj)
20
21
 
21
- # return nil object if input is empty
22
- if hIndex.empty?
23
- responseObj[:readerExecutionMessages] << 'Entity Index object is empty'
24
- responseObj[:readerExecutionPass] = false
25
- return nil
26
- end
22
+ # return nil object if input is empty
23
+ if hIndex.empty?
24
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity index object is empty'
25
+ return nil
26
+ end
27
27
 
28
- # instance classes needed in script
29
- intMetadataClass = InternalMetadata.new
30
- intIndex = intMetadataClass.newEntityIndex
28
+ # instance classes needed in script
29
+ intMetadataClass = InternalMetadata.new
30
+ intIndex = intMetadataClass.newEntityIndex
31
31
 
32
- # entity index - code name (required)
33
- # return nil if no entity index is provided
34
- if hIndex.has_key?('codeName')
35
- intIndex[:indexCode] = hIndex['codeName']
36
- end
37
- if intIndex[:indexCode].nil? || intIndex[:indexCode] == ''
38
- responseObj[:readerExecutionMessages] << 'Data Dictionary entity index name is missing'
39
- responseObj[:readerExecutionPass] = false
40
- return nil
41
- end
32
+ # entity index - code name (required)
33
+ # return nil if no entity index is provided
34
+ if hIndex.has_key?('codeName')
35
+ intIndex[:indexCode] = hIndex['codeName']
36
+ end
37
+ if intIndex[:indexCode].nil? || intIndex[:indexCode] == ''
38
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity index code name is missing'
39
+ responseObj[:readerExecutionPass] = false
40
+ return nil
41
+ end
42
42
 
43
- # entity index - allow duplicates (required)
44
- if hIndex.has_key?('allowDuplicates')
45
- if hIndex['allowDuplicates'] === true
46
- intIndex[:duplicate] = true
47
- end
48
- end
43
+ # entity index - allow duplicates (required)
44
+ if hIndex.has_key?('allowDuplicates')
45
+ if hIndex['allowDuplicates'] === true
46
+ intIndex[:duplicate] = true
47
+ end
48
+ end
49
49
 
50
- # entity index - attribute list [] (required)
51
- # return nil if no attribute list is provided
52
- if hIndex.has_key?('attributeCodeName')
53
- intIndex[:attributeNames] = hIndex['attributeCodeName']
54
- else
55
- intIndex[:attributeNames] = []
56
- end
57
- if intIndex[:attributeNames].empty?
58
- responseObj[:readerExecutionMessages] << 'Data Dictionary entity index attribute list is missing'
59
- responseObj[:readerExecutionPass] = false
60
- return nil
61
- end
50
+ # entity index - attribute list [] (required)
51
+ # return nil if no attribute list is provided
52
+ if hIndex.has_key?('attributeCodeName')
53
+ intIndex[:attributeNames] = hIndex['attributeCodeName']
54
+ end
55
+ if intIndex[:attributeNames].empty?
56
+ responseObj[:readerExecutionMessages] <<
57
+ 'ERROR: mdJson reader: data dictionary entity index attribute list is missing'
58
+ responseObj[:readerExecutionPass] = false
59
+ return nil
60
+ end
62
61
 
63
- return intIndex
62
+ return intIndex
64
63
 
65
- end
66
-
67
- end
64
+ end
68
65
 
69
66
  end
70
- end
71
- end
67
+
68
+ end
69
+ end
70
+ end
72
71
  end
@@ -2,82 +2,96 @@
2
2
  # Reader - mdJson to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-30 original script
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-30 original script
6
7
 
7
8
  require_relative 'module_geographicExtent'
8
9
  require_relative 'module_temporalExtent'
9
10
  require_relative 'module_verticalExtent'
10
11
 
11
12
  module ADIWG
12
- module Mdtranslator
13
- module Readers
14
- module MdJson
13
+ module Mdtranslator
14
+ module Readers
15
+ module MdJson
15
16
 
16
- module Extent
17
+ module Extent
17
18
 
18
- def self.unpack(hExtent, responseObj)
19
+ def self.unpack(hExtent, responseObj)
19
20
 
20
- # return nil object if input is empty
21
- if hExtent.empty?
22
- responseObj[:readerExecutionMessages] << 'Extent object is empty'
23
- responseObj[:readerExecutionPass] = false
24
- return nil
25
- end
21
+ # return nil object if input is empty
22
+ if hExtent.empty?
23
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: extent object is empty'
24
+ return nil
25
+ end
26
26
 
27
- # instance classes needed in script
28
- intMetadataClass = InternalMetadata.new
29
- intExtent = intMetadataClass.newExtent
27
+ # instance classes needed in script
28
+ intMetadataClass = InternalMetadata.new
29
+ intExtent = intMetadataClass.newExtent
30
30
 
31
- # extent - description
32
- if hExtent.has_key?('description')
33
- if hExtent['description'] != ''
34
- intExtent[:description] = hExtent['description']
35
- end
36
- end
31
+ haveExtent = false
37
32
 
38
- # extent - geographicExtent
39
- if hExtent.has_key?('geographicExtent')
40
- hExtent['geographicExtent'].each do |item|
41
- unless item.empty?
42
- hReturn = GeographicExtent.unpack(item, responseObj)
43
- unless hReturn.nil?
44
- intExtent[:geographicExtents] << hReturn
45
- end
46
- end
47
- end
33
+ # extent - description
34
+ if hExtent.has_key?('description')
35
+ unless hExtent['description'] == ''
36
+ intExtent[:description] = hExtent['description']
37
+ haveExtent = true
38
+ end
39
+ end
40
+
41
+ # extent - geographicExtent
42
+ if hExtent.has_key?('geographicExtent')
43
+ hExtent['geographicExtent'].each do |item|
44
+ unless item.empty?
45
+ hReturn = GeographicExtent.unpack(item, responseObj)
46
+ unless hReturn.nil?
47
+ intExtent[:geographicExtents] << hReturn
48
+ haveExtent = true
49
+ end
48
50
  end
51
+ end
52
+ end
49
53
 
50
- # extent - temporalExtent
51
- if hExtent.has_key?('temporalExtent')
52
- hExtent['temporalExtent'].each do |item|
53
- unless item.empty?
54
- hReturn = TemporalExtent.unpack(item, responseObj)
55
- unless hReturn.nil?
56
- intExtent[:temporalExtents] << hReturn
57
- end
58
- end
59
- end
54
+ # extent - temporalExtent
55
+ if hExtent.has_key?('temporalExtent')
56
+ hExtent['temporalExtent'].each do |item|
57
+ unless item.empty?
58
+ hReturn = TemporalExtent.unpack(item, responseObj)
59
+ unless hReturn.nil?
60
+ intExtent[:temporalExtents] << hReturn
61
+ haveExtent = true
62
+ end
60
63
  end
64
+ end
65
+ end
61
66
 
62
- # extent - verticalExtent
63
- if hExtent.has_key?('verticalExtent')
64
- hExtent['verticalExtent'].each do |item|
65
- unless item.empty?
66
- hReturn = VerticalExtent.unpack(item, responseObj)
67
- unless hReturn.nil?
68
- intExtent[:verticalExtents] << hReturn
69
- end
70
- end
71
- end
67
+ # extent - verticalExtent
68
+ if hExtent.has_key?('verticalExtent')
69
+ hExtent['verticalExtent'].each do |item|
70
+ unless item.empty?
71
+ hReturn = VerticalExtent.unpack(item, responseObj)
72
+ unless hReturn.nil?
73
+ intExtent[:verticalExtents] << hReturn
74
+ haveExtent = true
75
+ end
72
76
  end
77
+ end
78
+ end
73
79
 
74
- return intExtent
80
+ # error messages
81
+ unless haveExtent
82
+ responseObj[:readerExecutionMessages] <<
83
+ 'ERROR: mdJson reader: extent must have description or at least one geographic, temporal, or vertical extent'
84
+ responseObj[:readerExecutionPass] = false
85
+ return nil
86
+ end
75
87
 
76
- end
88
+ return intExtent
77
89
 
78
- end
90
+ end
79
91
 
80
92
  end
81
- end
82
- end
93
+
94
+ end
95
+ end
96
+ end
83
97
  end
@@ -2,86 +2,87 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-10 added computedBbox computation
6
- # Stan Smith 2016-10-25 original script
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-11-10 added computedBbox computation
7
+ # Stan Smith 2016-10-25 original script
7
8
 
8
9
  require_relative 'module_geoJson'
9
10
  require 'adiwg/mdtranslator/internal/module_coordinates'
10
11
 
11
12
  module ADIWG
12
- module Mdtranslator
13
- module Readers
14
- module MdJson
13
+ module Mdtranslator
14
+ module Readers
15
+ module MdJson
15
16
 
16
- module FeatureCollection
17
+ module FeatureCollection
17
18
 
18
- def self.unpack(hFeatCol, responseObj)
19
+ def self.unpack(hFeatCol, responseObj)
19
20
 
20
- # return nil object if input is empty
21
- if hFeatCol.empty?
22
- responseObj[:readerExecutionMessages] << 'Feature Collection object is empty'
23
- responseObj[:readerExecutionPass] = false
24
- return nil
25
- end
21
+ # return nil object if input is empty
22
+ if hFeatCol.empty?
23
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GeoJson feature collection object is empty'
24
+ return nil
25
+ end
26
26
 
27
- # instance classes needed in script
28
- intMetadataClass = InternalMetadata.new
29
- intFeatCol = intMetadataClass.newFeatureCollection
30
-
31
- # feature collection - type (required)
32
- if hFeatCol.has_key?('type')
33
- if hFeatCol['type'] != ''
34
- if hFeatCol['type'] == 'FeatureCollection'
35
- intFeatCol[:type] = hFeatCol['type']
36
- else
37
- responseObj[:readerExecutionMessages] << 'Feature Collection type must be GeometryCollection'
38
- responseObj[:readerExecutionPass] = false
39
- return nil
40
- end
41
- end
42
- end
43
- if intFeatCol[:type].nil? || intFeatCol[:type] == ''
44
- responseObj[:readerExecutionMessages] << 'Feature Collection is missing type'
45
- responseObj[:readerExecutionPass] = false
46
- return nil
47
- end
27
+ # instance classes needed in script
28
+ intMetadataClass = InternalMetadata.new
29
+ intFeatCol = intMetadataClass.newFeatureCollection
48
30
 
49
- # feature collection - bounding box
50
- if hFeatCol.has_key?('bbox')
51
- unless hFeatCol['bbox'].empty?
52
- intFeatCol[:bbox] = hFeatCol['bbox']
53
- end
54
- end
55
-
56
- # feature collection - features (required, but can be empty)
57
- if hFeatCol.has_key?('features')
58
- hFeatCol['features'].each do |hFeature|
59
- hReturn = GeoJson.unpack(hFeature, responseObj)
60
- unless hReturn.nil?
61
- intFeatCol[:features] << hReturn
62
- end
63
- end
31
+ # feature collection - type (required)
32
+ if hFeatCol.has_key?('type')
33
+ unless hFeatCol['type'] == ''
34
+ if hFeatCol['type'] == 'FeatureCollection'
35
+ intFeatCol[:type] = hFeatCol['type']
64
36
  else
65
- responseObj[:readerExecutionMessages] << 'Features Collection is missing features'
66
- responseObj[:readerExecutionPass] = false
67
- return nil
37
+ responseObj[:readerExecutionMessages] <<
38
+ 'ERROR: mdJson reader: GeoJson feature collection type must be FeatureCollection'
39
+ responseObj[:readerExecutionPass] = false
40
+ return nil
68
41
  end
69
-
70
- # geometry feature - computed bounding box for extent
71
- unless intFeatCol[:features].empty?
72
- intFeatCol[:computedBbox] = AdiwgCoordinates.computeBbox(intFeatCol[:features])
42
+ end
43
+ end
44
+ if intFeatCol[:type].nil? || intFeatCol[:type] == ''
45
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection type is missing'
46
+ responseObj[:readerExecutionPass] = false
47
+ return nil
48
+ end
49
+
50
+ # feature collection - bounding box
51
+ if hFeatCol.has_key?('bbox')
52
+ unless hFeatCol['bbox'].empty?
53
+ intFeatCol[:bbox] = hFeatCol['bbox']
54
+ end
55
+ end
56
+
57
+ # feature collection - features (required, but can be empty)
58
+ if hFeatCol.has_key?('features')
59
+ hFeatCol['features'].each do |hFeature|
60
+ hReturn = GeoJson.unpack(hFeature, responseObj)
61
+ unless hReturn.nil?
62
+ intFeatCol[:features] << hReturn
73
63
  end
64
+ end
65
+ else
66
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection features are missing'
67
+ responseObj[:readerExecutionPass] = false
68
+ return nil
69
+ end
74
70
 
75
- # geometry feature - save native GeoJSON for feature
76
- intFeatCol[:nativeGeoJson] = hFeatCol
71
+ # geometry feature - computed bounding box for extent
72
+ unless intFeatCol[:features].empty?
73
+ intFeatCol[:computedBbox] = AdiwgCoordinates.computeBbox(intFeatCol[:features])
74
+ end
77
75
 
78
- return intFeatCol
76
+ # geometry feature - save native GeoJSON for feature
77
+ intFeatCol[:nativeGeoJson] = hFeatCol
79
78
 
80
- end
79
+ return intFeatCol
81
80
 
82
- end
81
+ end
83
82
 
84
83
  end
85
- end
86
- end
84
+
85
+ end
86
+ end
87
+ end
87
88
  end
@@ -2,6 +2,7 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
5
6
  # Stan Smith 2018-02-05 add 'technicalPrerequisite'
6
7
  # Stan Smith 2016-10-20 original script
7
8
 
@@ -18,8 +19,7 @@ module ADIWG
18
19
 
19
20
  # return nil object if input is empty
20
21
  if hFormat.empty?
21
- responseObj[:readerExecutionMessages] << 'Format object is empty'
22
- responseObj[:readerExecutionPass] = false
22
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distribution media format object is empty'
23
23
  return nil
24
24
  end
25
25
 
@@ -38,28 +38,28 @@ module ADIWG
38
38
  end
39
39
  end
40
40
  if intFormat[:formatSpecification].empty?
41
- responseObj[:readerExecutionMessages] << 'Format is missing formatSpecification'
41
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: distribution media format specification is missing'
42
42
  responseObj[:readerExecutionPass] = false
43
43
  return nil
44
44
  end
45
45
 
46
46
  # format - amendment number
47
47
  if hFormat.has_key?('amendmentNumber')
48
- if hFormat['amendmentNumber'] != ''
48
+ unless hFormat['amendmentNumber'] == ''
49
49
  intFormat[:amendmentNumber] = hFormat['amendmentNumber']
50
50
  end
51
51
  end
52
52
 
53
53
  # format - compression method
54
54
  if hFormat.has_key?('compressionMethod')
55
- if hFormat['compressionMethod'] != ''
55
+ unless hFormat['compressionMethod'] == ''
56
56
  intFormat[:compressionMethod] = hFormat['compressionMethod']
57
57
  end
58
58
  end
59
59
 
60
60
  # format - compression method
61
61
  if hFormat.has_key?('technicalPrerequisite')
62
- if hFormat['technicalPrerequisite'] != ''
62
+ unless hFormat['technicalPrerequisite'] == ''
63
63
  intFormat[:technicalPrerequisite] = hFormat['technicalPrerequisite']
64
64
  end
65
65
  end