adiwg-mdtranslator 0.10.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -4
  3. data/Rakefile +4 -1
  4. data/adiwg-mdtranslator.gemspec +10 -8
  5. data/bin/mdtranslator +8 -2
  6. data/lib/adiwg/mdtranslator.rb +72 -147
  7. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +538 -538
  8. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +78 -78
  9. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +153 -74
  10. data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +41 -108
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_additionalDocumentation.rb +54 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_address.rb +89 -0
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_associatedResource.rb +82 -0
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_boundingBox.rb +62 -0
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_browseGraphic.rb +69 -0
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_citation.rb +122 -0
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_contacts.rb +150 -0
  18. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_coordinates.rb +63 -0
  19. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataDictionary.rb +63 -0
  20. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataQuality.rb +51 -0
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dateTime.rb +38 -0
  22. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_descriptiveKeyword.rb +60 -0
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dictionaryInfo.rb +63 -0
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_distributionInfo.rb +161 -0
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domain.rb +73 -0
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domainItem.rb +53 -0
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entity.rb +103 -0
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityAttribute.rb +102 -0
  29. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityForeignKey.rb +54 -0
  30. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityIndex.rb +53 -0
  31. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_extent.rb +73 -0
  32. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoCoordSystem.rb +57 -0
  33. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoProperties.rb +100 -0
  34. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geographicElement.rb +179 -0
  35. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_legalConstraint.rb +56 -0
  36. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineString.rb +36 -0
  37. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineage.rb +61 -0
  38. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_mdJson.rb +69 -0
  39. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadata.rb +88 -0
  40. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataExtension.rb +51 -0
  41. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataInfo.rb +123 -0
  42. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_onlineResource.rb +79 -0
  43. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_phone.rb +79 -0
  44. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_point.rb +36 -0
  45. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_polygon.rb +66 -0
  46. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_processStep.rb +75 -0
  47. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resolution.rb +53 -0
  48. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceFormat.rb +46 -0
  49. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceIdentifier.rb +60 -0
  50. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceInfo.rb +328 -0
  51. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceMaintenance.rb +61 -0
  52. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceSpecificUsage.rb +61 -0
  53. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_responsibleParty.rb +48 -0
  54. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_securityConstraint.rb +63 -0
  55. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_source.rb +59 -0
  56. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_spatialReference.rb +59 -0
  57. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonClass.rb +54 -0
  58. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonomy.rb +94 -0
  59. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_temporalElement.rb +82 -0
  60. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timeInstant.rb +56 -0
  61. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timePeriod.rb +64 -0
  62. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_verticalElement.rb +64 -0
  63. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_voucher.rb +49 -0
  64. data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +1 -1
  65. data/lib/adiwg/mdtranslator/readers/mdJson/validator.rb +43 -0
  66. data/lib/adiwg/mdtranslator/readers/mdReaders.rb +55 -0
  67. data/lib/adiwg/mdtranslator/version.rb +15 -4
  68. data/lib/adiwg/mdtranslator/writers/iso/classes/class_address.rb +107 -86
  69. data/lib/adiwg/mdtranslator/writers/iso/classes/class_aggregateInformation.rb +68 -57
  70. data/lib/adiwg/mdtranslator/writers/iso/classes/class_boundingPolygon.rb +59 -48
  71. data/lib/adiwg/mdtranslator/writers/iso/classes/class_browseGraphic.rb +57 -46
  72. data/lib/adiwg/mdtranslator/writers/iso/classes/class_citation.rb +149 -138
  73. data/lib/adiwg/mdtranslator/writers/iso/classes/class_contact.rb +83 -72
  74. data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataIdentification.rb +334 -322
  75. data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb +46 -34
  76. data/lib/adiwg/mdtranslator/writers/iso/classes/class_date.rb +47 -36
  77. data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +42 -31
  78. data/lib/adiwg/mdtranslator/writers/iso/classes/class_distribution.rb +29 -18
  79. data/lib/adiwg/mdtranslator/writers/iso/classes/class_distributor.rb +77 -66
  80. data/lib/adiwg/mdtranslator/writers/iso/classes/class_extent.rb +87 -76
  81. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +113 -102
  82. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +44 -33
  83. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +121 -110
  84. data/lib/adiwg/mdtranslator/writers/iso/classes/class_format.rb +45 -34
  85. data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +45 -36
  86. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicBoundingBox.rb +78 -67
  87. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicDescription.rb +25 -14
  88. data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicElement.rb +30 -19
  89. data/lib/adiwg/mdtranslator/writers/iso/classes/class_identifier.rb +41 -30
  90. data/lib/adiwg/mdtranslator/writers/iso/classes/class_keyword.rb +58 -49
  91. data/lib/adiwg/mdtranslator/writers/iso/classes/class_legalConstraints.rb +65 -54
  92. data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineString.rb +77 -66
  93. data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineage.rb +62 -51
  94. data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +70 -59
  95. data/lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb +54 -43
  96. data/lib/adiwg/mdtranslator/writers/iso/classes/class_medium.rb +58 -47
  97. data/lib/adiwg/mdtranslator/writers/iso/classes/class_metadataExtension.rb +154 -143
  98. data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiGeometry.rb +138 -127
  99. data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +37 -26
  100. data/lib/adiwg/mdtranslator/writers/iso/classes/class_onlineResource.rb +79 -68
  101. data/lib/adiwg/mdtranslator/writers/iso/classes/class_point.rb +77 -66
  102. data/lib/adiwg/mdtranslator/writers/iso/classes/class_polygon.rb +98 -87
  103. data/lib/adiwg/mdtranslator/writers/iso/classes/class_processStep.rb +80 -69
  104. data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceIdentifier.rb +38 -27
  105. data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +25 -14
  106. data/lib/adiwg/mdtranslator/writers/iso/classes/class_resolution.rb +51 -40
  107. data/lib/adiwg/mdtranslator/writers/iso/classes/class_responsibleParty.rb +88 -77
  108. data/lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb +70 -59
  109. data/lib/adiwg/mdtranslator/writers/iso/classes/class_source.rb +58 -47
  110. data/lib/adiwg/mdtranslator/writers/iso/classes/class_standardOrderProcess.rb +75 -63
  111. data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonClassification.rb +55 -44
  112. data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonSystem.rb +98 -87
  113. data/lib/adiwg/mdtranslator/writers/iso/classes/class_telephone.rb +73 -62
  114. data/lib/adiwg/mdtranslator/writers/iso/classes/class_temporalExtent.rb +58 -47
  115. data/lib/adiwg/mdtranslator/writers/iso/classes/class_timeInstant.rb +36 -27
  116. data/lib/adiwg/mdtranslator/writers/iso/classes/class_timePeriod.rb +42 -33
  117. data/lib/adiwg/mdtranslator/writers/iso/classes/class_usage.rb +59 -48
  118. data/lib/adiwg/mdtranslator/writers/iso/classes/class_useConstraints.rb +26 -15
  119. data/lib/adiwg/mdtranslator/writers/iso/classes/class_verticalExtent.rb +52 -41
  120. data/lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb +39 -28
  121. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_associationType.rb +41 -29
  122. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_characterSet.rb +82 -47
  123. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_classification.rb +42 -24
  124. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_datatype.rb +56 -34
  125. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_dateType.rb +34 -19
  126. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_initiativeType.rb +41 -29
  127. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_keywordType.rb +46 -27
  128. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_maintenanceFrequency.rb +55 -36
  129. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumFormat.rb +44 -26
  130. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumName.rb +68 -38
  131. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_obligation.rb +32 -25
  132. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_onlineFunction.rb +42 -25
  133. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_presentationForm.rb +58 -31
  134. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_progress.rb +44 -25
  135. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_restriction.rb +47 -32
  136. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_role.rb +52 -29
  137. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_scope.rb +58 -35
  138. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_spatialRepresentationType.rb +43 -30
  139. data/lib/adiwg/mdtranslator/writers/iso/codelists/code_topicCategory.rb +51 -44
  140. data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +26 -15
  141. data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +56 -45
  142. data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +23 -12
  143. data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +30 -19
  144. data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +223 -212
  145. data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +174 -0
  146. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +41 -12
  147. data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +347 -0
  148. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +151 -119
  149. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +63 -0
  150. data/test/readers/mdJson/v0_9/tc_reader_mdjson_additionalDocumentation.rb +84 -0
  151. data/test/readers/mdJson/v0_9/tc_reader_mdjson_address.rb +100 -0
  152. data/test/readers/mdJson/v0_9/tc_reader_mdjson_associatedResource.rb +100 -0
  153. data/test/readers/mdJson/v0_9/tc_reader_mdjson_browseGraphic.rb +66 -0
  154. data/test/readers/mdJson/v0_9/tc_reader_mdjson_citation.rb +115 -0
  155. data/test/readers/mdJson/v0_9/tc_reader_mdjson_contact.rb +137 -0
  156. data/test/readers/mdJson/v0_9/tc_reader_mdjson_onlineResource.rb +47 -0
  157. data/test/readers/mdJson/v0_9/tc_reader_mdjson_phone.rb +128 -0
  158. data/test/readers/mdJson/v0_9/tc_translation.rb +82 -0
  159. data/test/writers/iso19115_2/tc_writer_iso19115_2_address.rb +222 -0
  160. metadata +87 -60
  161. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_additionalDocumentation.rb +0 -36
  162. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_address.rb +0 -71
  163. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_associatedResource.rb +0 -66
  164. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_boundingBox.rb +0 -51
  165. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_browseGraphic.rb +0 -52
  166. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_citation.rb +0 -104
  167. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_contacts.rb +0 -121
  168. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_coordinates.rb +0 -52
  169. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +0 -53
  170. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataQuality.rb +0 -40
  171. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dateTime.rb +0 -27
  172. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_descriptiveKeyword.rb +0 -49
  173. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +0 -52
  174. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_distributionInfo.rb +0 -150
  175. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +0 -62
  176. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +0 -42
  177. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +0 -92
  178. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +0 -91
  179. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +0 -43
  180. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +0 -42
  181. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_extent.rb +0 -62
  182. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoCoordSystem.rb +0 -46
  183. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoProperties.rb +0 -89
  184. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geographicElement.rb +0 -168
  185. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_legalConstraint.rb +0 -45
  186. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineString.rb +0 -25
  187. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineage.rb +0 -50
  188. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadata.rb +0 -77
  189. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataExtension.rb +0 -40
  190. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataInfo.rb +0 -112
  191. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_onlineResource.rb +0 -62
  192. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_phone.rb +0 -59
  193. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_point.rb +0 -25
  194. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_polygon.rb +0 -55
  195. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_processStep.rb +0 -64
  196. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resolution.rb +0 -42
  197. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceFormat.rb +0 -35
  198. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceIdentifier.rb +0 -49
  199. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceInfo.rb +0 -317
  200. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceMaintenance.rb +0 -50
  201. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceSpecificUsage.rb +0 -50
  202. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_responsibleParty.rb +0 -37
  203. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_securityConstraint.rb +0 -52
  204. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_source.rb +0 -48
  205. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_spatialReference.rb +0 -48
  206. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonClass.rb +0 -43
  207. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonomy.rb +0 -83
  208. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_temporalElement.rb +0 -71
  209. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timeInstant.rb +0 -45
  210. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timePeriod.rb +0 -53
  211. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_verticalElement.rb +0 -53
  212. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_voucher.rb +0 -38
  213. data/lib/adiwg/mdtranslator/validator.rb +0 -43
  214. data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +0 -171
  215. data/lib/adiwg/mdtranslator/writers/iso/classes/class_MImetadata.rb +0 -333
  216. data/test/tc_translation.rb +0 -73
@@ -1,168 +0,0 @@
1
- # unpack geographic element
2
- # Reader - ADIwg JSON V1 to internal data structure
3
- # determine element type
4
-
5
- # History:
6
- # Stan Smith 2013-11-04 original script
7
- # Stan Smith 2013-11-13 added line string
8
- # Stan Smith 2013-11-13 added multi line string
9
- # Stan Smith 2013-11-18 added polygon
10
- # Stan Smith 2014-04-30 complete redesign for json schema 0.3.0
11
- # Stan Smith 2014-05-22 added multi polygon
12
- # Stan Smith 2014-05-23 cleaned up hash copy problem by using Marshal
13
- # Stan Smith 2014-05-23 added direct geometry support for Point, Line, Polygon
14
- # Stan Smith 2014-05-23 added direct geometry support for MultiPoint, MultiLine, MultiPolygon
15
- # Stan Smith 2014-05-23 added direct support for geometryCollection
16
- # Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
17
-
18
- require ADIWG::Mdtranslator.reader_module('module_geoCoordSystem', $response[:readerVersionUsed])
19
- require ADIWG::Mdtranslator.reader_module('module_geoProperties', $response[:readerVersionUsed])
20
- require ADIWG::Mdtranslator.reader_module('module_boundingBox', $response[:readerVersionUsed])
21
- require ADIWG::Mdtranslator.reader_module('module_point', $response[:readerVersionUsed])
22
- require ADIWG::Mdtranslator.reader_module('module_lineString', $response[:readerVersionUsed])
23
- require ADIWG::Mdtranslator.reader_module('module_polygon', $response[:readerVersionUsed])
24
-
25
- module Md_GeographicElement
26
-
27
- def self.unpack(aGeoElements)
28
-
29
- # only one geometry is allowed per geographic element.
30
- # ... in GeoJSON each geometry is allowed a bounding box;
31
- # ... This code splits bounding boxes to separate elements
32
-
33
- # instance classes needed in script
34
- aIntGeoEle = Array.new
35
-
36
- aGeoElements.each do |hGeoJsonElement|
37
-
38
- # instance classes needed in script
39
- intMetadataClass = InternalMetadata.new
40
- hGeoElement = intMetadataClass.newGeoElement
41
-
42
- # find geographic element type
43
- if hGeoJsonElement.has_key?('type')
44
- elementType = hGeoJsonElement['type']
45
- else
46
- # invalid geographic element
47
- return nil
48
- end
49
-
50
- # set geographic element id
51
- if hGeoJsonElement.has_key?('id')
52
- s = hGeoJsonElement['id']
53
- if s != ''
54
- hGeoElement[:elementId] = s
55
- end
56
- end
57
-
58
- # set geographic element coordinate reference system - CRS
59
- if hGeoJsonElement.has_key?('crs')
60
- hGeoCrs = hGeoJsonElement['crs']
61
- Md_GeoCoordSystem.unpack(hGeoCrs, hGeoElement)
62
- end
63
-
64
- # set geographic element properties
65
- if hGeoJsonElement.has_key?('properties')
66
- hGeoProps = hGeoJsonElement['properties']
67
- Md_GeoProperties.unpack(hGeoProps, hGeoElement)
68
- end
69
-
70
- # process geographic element bounding box
71
- # the bounding box must be represented as a separate geographic element for ISO
72
- # need to make a deep copy of current state of geographic element for bounding box
73
- if hGeoJsonElement.has_key?('bbox')
74
- if hGeoJsonElement['bbox'].length == 4
75
- aBBox = hGeoJsonElement['bbox']
76
-
77
- boxElement = Marshal.load(Marshal.dump(hGeoElement))
78
- boxElement[:elementGeometry] = Md_BoundingBox.unpack(aBBox)
79
-
80
- aIntGeoEle << boxElement
81
- end
82
- end
83
-
84
- # unpack geographic element
85
- case elementType
86
-
87
- # GeoJSON Features
88
- when 'Feature'
89
- if hGeoJsonElement.has_key?('geometry')
90
- hGeometry = hGeoJsonElement['geometry']
91
-
92
- # geoJSON requires geometry to be 'null' when geometry is bounding box only
93
- # JSON null converts in parsing to ruby nil
94
- unless hGeometry.nil?
95
- unless hGeometry.empty?
96
- if hGeometry.has_key?('type')
97
- geometryType = hGeometry['type']
98
- aCoordinates = hGeometry['coordinates']
99
- unless aCoordinates.empty?
100
- case geometryType
101
- when 'Point', 'MultiPoint'
102
- hGeoElement[:elementGeometry] = Md_Point.unpack(aCoordinates, geometryType)
103
- when 'LineString', 'MultiLineString'
104
- hGeoElement[:elementGeometry] = Md_LineString.unpack(aCoordinates, geometryType)
105
- when 'Polygon', 'MultiPolygon'
106
- hGeoElement[:elementGeometry] = Md_Polygon.unpack(aCoordinates, geometryType)
107
- else
108
- # log - the GeoJSON geometry type is not supported
109
- end
110
- aIntGeoEle << hGeoElement
111
- end
112
- end
113
- end
114
- end
115
-
116
- end
117
-
118
- # GeoJSON Feature Collection
119
- when 'FeatureCollection'
120
- if hGeoJsonElement.has_key?('features')
121
- aFeatures = hGeoJsonElement['features']
122
- unless aFeatures.empty?
123
- intGeometry = intMetadataClass.newGeometry
124
- intGeometry[:geoType] = 'MultiGeometry'
125
- intGeometry[:geometry] = Md_GeographicElement.unpack(aFeatures)
126
- hGeoElement[:elementGeometry] = intGeometry
127
- aIntGeoEle << hGeoElement
128
- end
129
- end
130
-
131
- # GeoJSON Geometries
132
- when 'Point', 'MultiPoint'
133
- aCoordinates = hGeoJsonElement['coordinates']
134
- hGeoElement[:elementGeometry] = Md_Point.unpack(aCoordinates, elementType)
135
- aIntGeoEle << hGeoElement
136
-
137
- when 'LineString', 'MultiLineString'
138
- aCoordinates = hGeoJsonElement['coordinates']
139
- hGeoElement[:elementGeometry] = Md_LineString.unpack(aCoordinates, elementType)
140
- aIntGeoEle << hGeoElement
141
-
142
- when 'Polygon', 'MultiPolygon'
143
- aCoordinates = hGeoJsonElement['coordinates']
144
- hGeoElement[:elementGeometry] = Md_Polygon.unpack(aCoordinates, elementType)
145
- aIntGeoEle << hGeoElement
146
-
147
- # GeoJSON Geometry Collection
148
- when 'GeometryCollection'
149
- if hGeoJsonElement.has_key?('geometries')
150
- aGeometries = hGeoJsonElement['geometries']
151
- unless aGeometries.empty?
152
- intGeometry = intMetadataClass.newGeometry
153
- intGeometry[:geoType] = 'MultiGeometry'
154
- intGeometry[:geometry] = Md_GeographicElement.unpack(aGeometries)
155
- hGeoElement[:elementGeometry] = intGeometry
156
- aIntGeoEle << hGeoElement
157
- end
158
- end
159
-
160
- end
161
-
162
- end
163
-
164
- return aIntGeoEle
165
-
166
- end
167
-
168
- end
@@ -1,45 +0,0 @@
1
- # unpack legal constraint
2
- # Reader - ADIwg JSON V1 to internal data structure
3
-
4
- # History:
5
- # Stan Smith 2013-11-14 original script
6
- # Stan Smith 2013-11-27 modified to process a single legal constraint
7
- # Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
8
-
9
- module Md_LegalConstraints
10
-
11
- def self.unpack(hLegalCon)
12
-
13
- # instance classes needed in script
14
- intMetadataClass = InternalMetadata.new
15
- hIntCon = intMetadataClass.newLegalConstraint
16
-
17
- # legal constraint - access code
18
- if hLegalCon.has_key?('accessConstraint')
19
- aAccCodes = hLegalCon['accessConstraint']
20
- unless aAccCodes.empty?
21
- hIntCon[:accessCodes] = aAccCodes
22
- end
23
- end
24
-
25
- # legal constraint - use code
26
- if hLegalCon.has_key?('useConstraint')
27
- aUseCodes = hLegalCon['useConstraint']
28
- unless aUseCodes.empty?
29
- hIntCon[:useCodes] = aUseCodes
30
- end
31
- end
32
-
33
- # legal constraint - other constraints
34
- if hLegalCon.has_key?('otherConstraint')
35
- aOtherCons = hLegalCon['otherConstraint']
36
- unless aOtherCons.empty?
37
- hIntCon[:otherCons] = aOtherCons
38
- end
39
- end
40
-
41
- return hIntCon
42
-
43
- end
44
-
45
- end
@@ -1,25 +0,0 @@
1
- # unpack line string
2
- # line string is coded in GeoJSON
3
- # Reader - ADIwg JSON V1 to internal data structure
4
-
5
- # History:
6
- # Stan Smith 2013-11-13 original script
7
- # Stan Smith 2014-04-30 reorganized for json schema 0.3.0
8
- # Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
9
-
10
- require ADIWG::Mdtranslator.reader_module('module_coordinates', $response[:readerVersionUsed])
11
-
12
- module Md_LineString
13
-
14
- def self.unpack(aCoords, geoType)
15
- intMetadataClass = InternalMetadata.new
16
- intLine = intMetadataClass.newGeometry
17
-
18
- intLine[:geoType] = geoType
19
- intLine[:geometry] = aCoords
20
- intLine[:dimension] = Md_Coordinates.getDimension(aCoords)
21
-
22
- return intLine
23
- end
24
-
25
- end
@@ -1,50 +0,0 @@
1
- # unpack lineage
2
- # Reader - ADIwg JSON V1 to internal data structure
3
-
4
- # History:
5
- # Stan Smith 2013-11-26 original script
6
- # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
7
-
8
- require ADIWG::Mdtranslator.reader_module('module_processStep', $response[:readerVersionUsed])
9
- require ADIWG::Mdtranslator.reader_module('module_source', $response[:readerVersionUsed])
10
-
11
- module Md_Lineage
12
-
13
- def self.unpack(hLineage)
14
-
15
- # instance classes needed in script
16
- intMetadataClass = InternalMetadata.new
17
- intDataLine = intMetadataClass.newLineage
18
-
19
- # lineage - statement
20
- if hLineage.has_key?('statement')
21
- s = hLineage['statement']
22
- if s != ''
23
- intDataLine[:statement] = s
24
- end
25
- end
26
-
27
- # lineage - process steps
28
- if hLineage.has_key?('processStep')
29
- aProcSteps = hLineage['processStep']
30
- unless aProcSteps.empty?
31
- aProcSteps.each do |hProcStep|
32
- intDataLine[:processSteps] << Md_ProcessStep.unpack(hProcStep)
33
- end
34
- end
35
- end
36
-
37
- # lineage - data sources
38
- if hLineage.has_key?('source')
39
- aSources = hLineage['source']
40
- unless aSources.empty?
41
- aSources.each do |hSource|
42
- intDataLine[:dataSources] << Md_Source.unpack(hSource)
43
- end
44
- end
45
- end
46
-
47
- return intDataLine
48
- end
49
-
50
- end
@@ -1,77 +0,0 @@
1
- # unpack metadata
2
- # Reader - ADIwg JSON V1 to internal data structure
3
-
4
- # History:
5
- # Stan Smith 2013-08-22 original script
6
- # Stan Smith 2013-09-23 added distributor info section
7
- # Stan Smith 2013-11-26 added metadata maintenance section
8
- # Stan Smith 2013-11-26 added hierarchy section
9
- # Stan Smith 2013-11-26 added data quality section
10
- # Stan Smith 2013-12-27 added parent identifier
11
- # Stan Smith 2014-04-24 reorganized for json schema 0.3.0
12
- # Stan Smith 2014-05-02 added associated resources
13
- # Stan Smith 2014-05-02 added additional documentation
14
- # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
15
-
16
- require ADIWG::Mdtranslator.reader_module('module_metadataInfo', $response[:readerVersionUsed])
17
- require ADIWG::Mdtranslator.reader_module('module_resourceInfo', $response[:readerVersionUsed])
18
- require ADIWG::Mdtranslator.reader_module('module_distributionInfo', $response[:readerVersionUsed])
19
- require ADIWG::Mdtranslator.reader_module('module_associatedResource', $response[:readerVersionUsed])
20
- require ADIWG::Mdtranslator.reader_module('module_additionalDocumentation', $response[:readerVersionUsed])
21
- require ADIWG::Mdtranslator.reader_module('module_citation', $response[:readerVersionUsed])
22
-
23
- module Md_Metadata
24
-
25
- def self.unpack(hMetadata)
26
-
27
- # instance classes needed in script
28
- intMetadataClass = InternalMetadata.new
29
- intMetadata = intMetadataClass.newMetadata
30
-
31
- # metadata - metadataInfo
32
- # metadataInfo needs access to resourceInfo to check taxonomy
33
- if hMetadata.has_key?('metadataInfo')
34
- intMetadata[:metadataInfo] = Md_MetadataInfo.unpack(hMetadata)
35
- end
36
-
37
- # metadata - resource identification info
38
- if hMetadata.has_key?('resourceInfo')
39
- hResourceInfo = hMetadata['resourceInfo']
40
- intMetadata[:resourceInfo] = Md_ResourceInfo.unpack(hResourceInfo)
41
- end
42
-
43
- # metadata - distribution info
44
- if hMetadata.has_key?('distributionInfo')
45
- aDistributors = hMetadata['distributionInfo']
46
- unless aDistributors.empty?
47
- aDistributors.each do |hDistributor|
48
- intMetadata[:distributorInfo] << Md_DistributionInfo.unpack(hDistributor)
49
- end
50
- end
51
- end
52
-
53
- # metadata - associated resources
54
- if hMetadata.has_key?('associatedResource')
55
- aAssocRes = hMetadata['associatedResource']
56
- unless aAssocRes.empty?
57
- aAssocRes.each do |hAssocRes|
58
- intMetadata[:associatedResources] << Md_AssociatedResource.unpack(hAssocRes)
59
- end
60
- end
61
- end
62
-
63
- # metadata - additional documents
64
- if hMetadata.has_key?('additionalDocumentation')
65
- aAddDocs = hMetadata['additionalDocumentation']
66
- unless aAddDocs.empty?
67
- aAddDocs.each do |hAddDoc|
68
- intMetadata[:additionalDocuments] << Md_AdditionalDocumentation.unpack(hAddDoc)
69
- end
70
- end
71
- end
72
-
73
- return intMetadata
74
-
75
- end
76
-
77
- end
@@ -1,40 +0,0 @@
1
- # unpack metadata extension information
2
- # Reader - ADIwg JSON V1 to internal data structure
3
-
4
- # History:
5
- # Stan Smith 2013-11-22 original script
6
- # Stan Smith 2014-05-15 modified for JSON schema 0.4.0
7
-
8
- module Md_MetadataExtension
9
-
10
- def self.addExtensionISObio()
11
-
12
- intMetadataClass = InternalMetadata.new
13
- intMetaExt = intMetadataClass.newMetadataExtension
14
- intContactRole = intMetadataClass.newRespParty
15
-
16
- # extension online information
17
- intMetaExt[:onLineResource] = {}
18
-
19
- # extension entity information
20
- intMetaExt[:extName] = 'Taxonomy System'
21
- intMetaExt[:extShortName] = 'TaxonSys'
22
- intMetaExt[:extDefinition] = 'Documentation of taxonomic sources, procedures, and treatments'
23
- intMetaExt[:obligation] = 'optional'
24
- intMetaExt[:dataType] = 'class'
25
- intMetaExt[:maxOccurrence] = '1'
26
- intMetaExt[:parentEntities] << 'MD_Identification'
27
- intMetaExt[:rule] = 'New Metadata section as a class to MD_Identification'
28
- intMetaExt[:rationales] << 'The set of data elements contained within this class element ' +
29
- 'represents an attempt to provide better documentation of ' +
30
- 'taxonomic sources, procedures, and treatments.'
31
-
32
- # source information
33
- intContactRole[:contactId] = 'ADIwgBio'
34
- intContactRole[:roleName] = 'resourceProvider'
35
- intMetaExt[:extSources] << intContactRole
36
-
37
- return intMetaExt
38
- end
39
-
40
- end
@@ -1,112 +0,0 @@
1
- # unpack metadata information block
2
- # Reader - ADIwg JSON V1 to internal data structure
3
-
4
- # History:
5
- # Stan Smith 2014-04-24 original script - moved from module_metadata
6
- # Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
7
- # Stan Smith 2014-09-19 changed metadata identifier type resource identifier json 0.8.0
8
- # Stan Smith 2014-09-19 changed parent metadata identifier type citation json 0.8.0
9
- # Stan Smith 2014-11-06 removed metadataScope, moved to resourceType under resourceInfo json 0.9.0
10
-
11
- require ADIWG::Mdtranslator.reader_module('module_responsibleParty', $response[:readerVersionUsed])
12
- require ADIWG::Mdtranslator.reader_module('module_dateTime', $response[:readerVersionUsed])
13
- require ADIWG::Mdtranslator.reader_module('module_resourceMaintenance', $response[:readerVersionUsed])
14
- require ADIWG::Mdtranslator.reader_module('module_metadataExtension', $response[:readerVersionUsed])
15
- require ADIWG::Mdtranslator.reader_module('module_resourceIdentifier', $response[:readerVersionUsed])
16
- require ADIWG::Mdtranslator.reader_module('module_citation', $response[:readerVersionUsed])
17
-
18
- module Md_MetadataInfo
19
-
20
- def self.unpack(hMetadata)
21
-
22
- # instance classes needed in script
23
- intMetadataClass = InternalMetadata.new
24
- intMetadataInfo = intMetadataClass.newMetadataInfo
25
- hMetadataInfo = hMetadata['metadataInfo']
26
-
27
- # metadata - metadata identifier
28
- if hMetadataInfo.has_key?('metadataIdentifier')
29
- hMetadataId = hMetadataInfo['metadataIdentifier']
30
- unless hMetadataId.empty?
31
- intMetadataInfo[:metadataId] = Md_ResourceIdentifier.unpack(hMetadataId)
32
- end
33
- end
34
-
35
- # metadata - parent metadata identifier
36
- if hMetadataInfo.has_key?('parentMetadata')
37
- hParent = hMetadataInfo['parentMetadata']
38
- unless hParent.empty?
39
- intMetadataInfo[:parentMetadata] = Md_Citation.unpack(hParent)
40
- end
41
- end
42
-
43
- # metadata - metadata contacts, custodians
44
- if hMetadataInfo.has_key?('metadataContact')
45
- aCust = hMetadataInfo['metadataContact']
46
- unless aCust.empty?
47
- aCust.each do |rParty|
48
- intMetadataInfo[:metadataCustodians] << Md_ResponsibleParty.unpack(rParty)
49
- end
50
- end
51
- end
52
-
53
- # metadata - creation date
54
- if hMetadataInfo.has_key?('metadataCreationDate')
55
- s = hMetadataInfo['metadataCreationDate']
56
- if s != ''
57
- hDateTime = Md_DateTime.unpack(s)
58
- hDateTime[:dateType] = 'publication'
59
- intMetadataInfo[:metadataCreateDate] = hDateTime
60
- end
61
- end
62
-
63
- # metadata - date of last metadata update
64
- if hMetadataInfo.has_key?('metadataLastUpdate')
65
- s = hMetadataInfo['metadataLastUpdate']
66
- if s != ''
67
- hDateTime = Md_DateTime.unpack(s)
68
- hDateTime[:dateType] = 'revision'
69
- intMetadataInfo[:metadataUpdateDate] = hDateTime
70
- end
71
- end
72
-
73
- # metadata - metadata URI
74
- if hMetadataInfo.has_key?('metadataUri')
75
- s = hMetadataInfo['metadataUri']
76
- if s != ''
77
- intMetadataInfo[:metadataURI] = s
78
- end
79
- end
80
-
81
- # metadata - status
82
- if hMetadataInfo.has_key?('metadataStatus')
83
- s = hMetadataInfo['metadataStatus']
84
- if s != ''
85
- intMetadataInfo[:metadataStatus] = s
86
- end
87
- end
88
-
89
- # metadata - metadata maintenance info
90
- if hMetadataInfo.has_key?('metadataMaintenance')
91
- hMetaMaint = hMetadataInfo['metadataMaintenance']
92
- unless hMetaMaint.empty?
93
- intMetadataInfo[:maintInfo] = Md_ResourceMaintenance.unpack(hMetaMaint)
94
- end
95
- end
96
-
97
- # metadata - extension info - if biological extension
98
- if hMetadata.has_key?('resourceInfo')
99
- resourceInfo = hMetadata['resourceInfo']
100
- if resourceInfo.has_key?('taxonomy')
101
- hTaxonomy = resourceInfo['taxonomy']
102
- unless hTaxonomy.empty?
103
- intMetadataInfo[:extensions] << Md_MetadataExtension.addExtensionISObio
104
- end
105
- end
106
- end
107
-
108
- return intMetadataInfo
109
-
110
- end
111
-
112
- end