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,13 +2,14 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-12 refactored for mdJson 2.0
6
- # Stan Smith 2015-07-14 refactored to remove global namespace constants
7
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
8
- # Stan Smith 2014-12-30 refactored
9
- # Stan Smith 2014-12-24 added return if input hash is empty
10
- # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
11
- # Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-12 refactored for mdJson 2.0
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-30 refactored
10
+ # Stan Smith 2014-12-24 added return if input hash is empty
11
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
12
+ # Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
12
13
  # Stan Smith 2013-11-27 modified to process single browse graphic rather than array
13
14
  # Stan Smith 2013-10-17 original script
14
15
 
@@ -16,81 +17,80 @@ require_relative 'module_onlineResource'
16
17
  require_relative 'module_constraint'
17
18
 
18
19
  module ADIWG
19
- module Mdtranslator
20
- module Readers
21
- module MdJson
22
-
23
- module Graphic
24
-
25
- def self.unpack(hGraphic, responseObj)
26
-
27
- # return nil object if input is empty
28
- if hGraphic.empty?
29
- responseObj[:readerExecutionMessages] << 'Graphic object is empty'
30
- responseObj[:readerExecutionPass] = false
31
- return nil
32
- end
33
-
34
- # instance classes needed in script
35
- intMetadataClass = InternalMetadata.new
36
- intGraphic = intMetadataClass.newGraphic
37
-
38
- # graphic - file name (required)
39
- if hGraphic.has_key?('fileName')
40
- intGraphic[:graphicName] = hGraphic['fileName']
41
- end
42
- if intGraphic[:graphicName].nil? || intGraphic[:graphicName] == ''
43
- responseObj[:readerExecutionMessages] << 'Graphic attribute fileName is missing'
44
- responseObj[:readerExecutionPass] = false
45
- return nil
46
- end
47
-
48
- # graphic - file description
49
- if hGraphic.has_key?('fileDescription')
50
- if hGraphic['fileDescription'] != ''
51
- intGraphic[:graphicDescription] = hGraphic['fileDescription']
52
- end
53
- end
54
-
55
- # graphic - file type
56
- if hGraphic.has_key?('fileType')
57
- if hGraphic['fileType'] != ''
58
- intGraphic[:graphicType] = hGraphic['fileType']
59
- end
60
- end
61
-
62
- # graphic - file constraint []
63
- if hGraphic.has_key?('fileConstraint')
64
- aItems = hGraphic['fileConstraint']
65
- aItems.each do |hItem|
66
- unless hItem.empty?
67
- hReturn = Constraint.unpack(hItem, responseObj)
68
- unless hReturn.nil?
69
- intGraphic[:graphicConstraints] << hReturn
70
- end
71
- end
72
- end
20
+ module Mdtranslator
21
+ module Readers
22
+ module MdJson
23
+
24
+ module Graphic
25
+
26
+ def self.unpack(hGraphic, responseObj)
27
+
28
+ # return nil object if input is empty
29
+ if hGraphic.empty?
30
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: graphic overview object is empty'
31
+ return nil
32
+ end
33
+
34
+ # instance classes needed in script
35
+ intMetadataClass = InternalMetadata.new
36
+ intGraphic = intMetadataClass.newGraphic
37
+
38
+ # graphic - file name (required)
39
+ if hGraphic.has_key?('fileName')
40
+ intGraphic[:graphicName] = hGraphic['fileName']
41
+ end
42
+ if intGraphic[:graphicName].nil? || intGraphic[:graphicName] == ''
43
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: graphic overview file name is missing'
44
+ responseObj[:readerExecutionPass] = false
45
+ return nil
46
+ end
47
+
48
+ # graphic - file description
49
+ if hGraphic.has_key?('fileDescription')
50
+ unless hGraphic['fileDescription'] == ''
51
+ intGraphic[:graphicDescription] = hGraphic['fileDescription']
52
+ end
53
+ end
54
+
55
+ # graphic - file type
56
+ if hGraphic.has_key?('fileType')
57
+ unless hGraphic['fileType'] == ''
58
+ intGraphic[:graphicType] = hGraphic['fileType']
59
+ end
60
+ end
61
+
62
+ # graphic - file constraint []
63
+ if hGraphic.has_key?('fileConstraint')
64
+ aItems = hGraphic['fileConstraint']
65
+ aItems.each do |hItem|
66
+ unless hItem.empty?
67
+ hReturn = Constraint.unpack(hItem, responseObj)
68
+ unless hReturn.nil?
69
+ intGraphic[:graphicConstraints] << hReturn
70
+ end
73
71
  end
74
-
75
- # graphic - online resource []
76
- if hGraphic.has_key?('fileUri')
77
- hGraphic['fileUri'].each do |item|
78
- unless item.empty?
79
- uri = OnlineResource.unpack(item, responseObj)
80
- unless uri.nil?
81
- intGraphic[:graphicURI] << uri
82
- end
83
- end
84
- end
72
+ end
73
+ end
74
+
75
+ # graphic - online resource []
76
+ if hGraphic.has_key?('fileUri')
77
+ hGraphic['fileUri'].each do |item|
78
+ unless item.empty?
79
+ uri = OnlineResource.unpack(item, responseObj)
80
+ unless uri.nil?
81
+ intGraphic[:graphicURI] << uri
82
+ end
85
83
  end
84
+ end
85
+ end
86
86
 
87
- return intGraphic
87
+ return intGraphic
88
88
 
89
- end
90
-
91
- end
89
+ end
92
90
 
93
91
  end
94
- end
95
- end
92
+
93
+ end
94
+ end
95
+ end
96
96
  end
@@ -2,78 +2,83 @@
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 2016-10-19 original script
6
7
 
7
8
  require_relative 'module_dimension'
8
9
 
9
10
  module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module MdJson
11
+ module Mdtranslator
12
+ module Readers
13
+ module MdJson
13
14
 
14
- module GridRepresentation
15
+ module GridRepresentation
15
16
 
16
- def self.unpack(hGrid, responseObj)
17
+ def self.unpack(hGrid, responseObj)
17
18
 
18
- # return nil object if input is empty
19
- if hGrid.empty?
20
- responseObj[:readerExecutionMessages] << 'Grid Representation object is empty'
21
- responseObj[:readerExecutionPass] = false
22
- return nil
23
- end
24
-
25
- # instance classes needed in script
26
- intMetadataClass = InternalMetadata.new
27
- intGrid = intMetadataClass.newGridInfo
19
+ # return nil object if input is empty
20
+ if hGrid.empty?
21
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: grid representation object is empty'
22
+ return nil
23
+ end
28
24
 
29
- # grid representation - number of dimensions (required)
30
- if hGrid.has_key?('numberOfDimensions')
31
- if hGrid['numberOfDimensions'] != ''
32
- intGrid[:numberOfDimensions] = hGrid['numberOfDimensions']
33
- end
34
- end
35
- if intGrid[:numberOfDimensions].nil?
36
- responseObj[:readerExecutionMessages] << 'Grid Representation attribute numberOfDimensions is missing'
37
- responseObj[:readerExecutionPass] = false
38
- return nil
39
- end
25
+ # instance classes needed in script
26
+ intMetadataClass = InternalMetadata.new
27
+ intGrid = intMetadataClass.newGridInfo
40
28
 
41
- # grid representation - dimensions []
42
- if hGrid.has_key?('dimension')
43
- hGrid['dimension'].each do |item|
44
- hDim = Dimension.unpack(item, responseObj)
45
- unless hDim.nil?
46
- intGrid[:dimension] << hDim
47
- end
48
- end
49
- end
29
+ # grid representation - number of dimensions (required)
30
+ if hGrid.has_key?('numberOfDimensions')
31
+ unless hGrid['numberOfDimensions'] == ''
32
+ intGrid[:numberOfDimensions] = hGrid['numberOfDimensions']
33
+ end
34
+ end
35
+ if intGrid[:numberOfDimensions].nil?
36
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation number-of-dimensions is missing'
37
+ responseObj[:readerExecutionPass] = false
38
+ return nil
39
+ end
50
40
 
51
- # grid representation - cell geometry (required)
52
- if hGrid.has_key?('cellGeometry')
53
- if hGrid['cellGeometry'] != ''
54
- intGrid[:cellGeometry] = hGrid['cellGeometry']
55
- end
56
- end
57
- if intGrid[:cellGeometry].nil?
58
- responseObj[:readerExecutionMessages] << 'Grid Representation attribute cellGeometry is missing'
59
- responseObj[:readerExecutionPass] = false
60
- return nil
41
+ # grid representation - dimensions [] (required)
42
+ if hGrid.has_key?('dimension')
43
+ hGrid['dimension'].each do |item|
44
+ hDim = Dimension.unpack(item, responseObj)
45
+ unless hDim.nil?
46
+ intGrid[:dimension] << hDim
61
47
  end
48
+ end
49
+ end
50
+ if intGrid[:dimension].empty?
51
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation dimensions are missing'
52
+ responseObj[:readerExecutionPass] = false
53
+ return nil
54
+ end
62
55
 
63
- # grid representation - transformation parameter available {Boolean} (required)
64
- if hGrid.has_key?('transformationParameterAvailable')
65
- if hGrid['transformationParameterAvailable'] === true
66
- intGrid[:transformationParameterAvailable] = hGrid['transformationParameterAvailable']
67
- end
68
- end
56
+ # grid representation - cell geometry (required)
57
+ if hGrid.has_key?('cellGeometry')
58
+ unless hGrid['cellGeometry'] == ''
59
+ intGrid[:cellGeometry] = hGrid['cellGeometry']
60
+ end
61
+ end
62
+ if intGrid[:cellGeometry].nil?
63
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation cell geometry is missing'
64
+ responseObj[:readerExecutionPass] = false
65
+ return nil
66
+ end
69
67
 
70
- return intGrid
68
+ # grid representation - transformation parameter available {Boolean} (required)
69
+ if hGrid.has_key?('transformationParameterAvailable')
70
+ if hGrid['transformationParameterAvailable'] === true
71
+ intGrid[:transformationParameterAvailable] = hGrid['transformationParameterAvailable']
72
+ end
73
+ end
71
74
 
72
- end
75
+ return intGrid
73
76
 
74
- end
77
+ end
75
78
 
76
79
  end
77
- end
78
- end
80
+
81
+ end
82
+ end
83
+ end
79
84
  end
@@ -2,86 +2,86 @@
2
2
  # Reader - ADIwg JSON to internal data structure
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-10-13 refactored for mdJson 2.0
6
- # Stan Smith 2015-07-31 added support for fields added by ISO 19115-1 (RS_Identifier)
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
10
- # Stan Smith 2014-08-18 added type to identifier schema 0.6.0
11
- # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
5
+ # Stan Smith 2018-02-18 refactored error and warning messaging
6
+ # Stan Smith 2016-10-13 refactored for mdJson 2.0
7
+ # Stan Smith 2015-07-31 added support for fields added by ISO 19115-1 (RS_Identifier)
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
11
+ # Stan Smith 2014-08-18 added type to identifier schema 0.6.0
12
+ # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
12
13
  # Stan Smith 2014-05-28 original script
13
14
 
14
15
  require_relative 'module_citation'
15
16
 
16
17
  module ADIWG
17
- module Mdtranslator
18
- module Readers
19
- module MdJson
20
-
21
- module Identifier
22
-
23
- def self.unpack(hIdentifier, responseObj)
24
-
25
- # return nil object if input is empty
26
- if hIdentifier.empty?
27
- responseObj[:readerExecutionMessages] << 'Identifier object is empty'
28
- responseObj[:readerExecutionPass] = false
29
- return nil
18
+ module Mdtranslator
19
+ module Readers
20
+ module MdJson
21
+
22
+ module Identifier
23
+
24
+ def self.unpack(hIdentifier, responseObj)
25
+
26
+ # return nil object if input is empty
27
+ if hIdentifier.empty?
28
+ responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: identifier object is empty'
29
+ return nil
30
+ end
31
+
32
+ # instance classes needed in script
33
+ intMetadataClass = InternalMetadata.new
34
+ intIdent = intMetadataClass.newIdentifier
35
+
36
+ # identifier - identifier (required)
37
+ if hIdentifier.has_key?('identifier')
38
+ intIdent[:identifier] = hIdentifier['identifier']
39
+ end
40
+ if intIdent[:identifier].nil? || intIdent[:identifier] == ''
41
+ responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: identifier object identifier is missing'
42
+ responseObj[:readerExecutionPass] = false
43
+ return nil
44
+ end
45
+
46
+ # identifier - namespace
47
+ if hIdentifier.has_key?('namespace')
48
+ unless hIdentifier['namespace'] == ''
49
+ intIdent[:namespace] = hIdentifier['namespace']
50
+ end
51
+ end
52
+
53
+ # identifier - version
54
+ if hIdentifier.has_key?('version')
55
+ unless hIdentifier['version'] == ''
56
+ intIdent[:version] = hIdentifier['version']
57
+ end
58
+ end
59
+
60
+ # identifier - description
61
+ if hIdentifier.has_key?('description')
62
+ unless hIdentifier['description'] == ''
63
+ intIdent[:description] = hIdentifier['description']
64
+ end
65
+ end
66
+
67
+ # identifier - authority (citation)
68
+ if hIdentifier.has_key?('authority')
69
+ hObject = hIdentifier['authority']
70
+ unless hObject.empty?
71
+ hReturn = Citation.unpack(hObject, responseObj)
72
+ unless hReturn.nil?
73
+ intIdent[:citation] = hReturn
30
74
  end
75
+ end
76
+ end
31
77
 
32
- # instance classes needed in script
33
- intMetadataClass = InternalMetadata.new
34
- intIdent= intMetadataClass.newIdentifier
78
+ return intIdent
35
79
 
36
- # identifier - identifier (required)
37
- if hIdentifier.has_key?('identifier')
38
- intIdent[:identifier] = hIdentifier['identifier']
39
- end
40
- if intIdent[:identifier].nil? || intIdent[:identifier] == ''
41
- responseObj[:readerExecutionMessages] << 'Identifier attribute identifier is missing'
42
- responseObj[:readerExecutionPass] = false
43
- return nil
44
- end
45
-
46
- # identifier - namespace
47
- if hIdentifier.has_key?('namespace')
48
- if hIdentifier['namespace'] != ''
49
- intIdent[:namespace] = hIdentifier['namespace']
50
- end
51
- end
52
-
53
- # identifier - version
54
- if hIdentifier.has_key?('version')
55
- if hIdentifier['version'] != ''
56
- intIdent[:version] = hIdentifier['version']
57
- end
58
- end
59
-
60
- # identifier - description
61
- if hIdentifier.has_key?('description')
62
- if hIdentifier['description'] != ''
63
- intIdent[:description] = hIdentifier['description']
64
- end
65
- end
66
-
67
- # identifier - authority (citation)
68
- if hIdentifier.has_key?('authority')
69
- hObject = hIdentifier['authority']
70
- unless hObject.empty?
71
- hReturn = Citation.unpack(hObject, responseObj)
72
- unless hReturn.nil?
73
- intIdent[:citation] = hReturn
74
- end
75
- end
76
- end
77
-
78
- return intIdent
79
-
80
- end
81
-
82
- end
80
+ end
83
81
 
84
82
  end
85
- end
86
- end
83
+
84
+ end
85
+ end
86
+ end
87
87
  end