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
@@ -0,0 +1,56 @@
1
+ # unpack time instant
2
+ # Reader - ADIwg JSON V1 to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2013-12-11 original script
6
+ # Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+
9
+ require $ReaderNS.readerModule('module_dateTime')
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Readers
14
+ module MdJson
15
+
16
+ module TimeInstant
17
+
18
+ def self.unpack(hTimeInst)
19
+
20
+ # instance classes needed in script
21
+ intMetadataClass = InternalMetadata.new
22
+
23
+ # time instant
24
+ intTimeInst = intMetadataClass.newTimeInstant
25
+
26
+ if hTimeInst.has_key?('id')
27
+ s = hTimeInst['id']
28
+ if s != ''
29
+ intTimeInst[:timeId] = s
30
+ end
31
+ end
32
+
33
+ if hTimeInst.has_key?('description')
34
+ s = hTimeInst['description']
35
+ if s != ''
36
+ intTimeInst[:description] = s
37
+ end
38
+ end
39
+
40
+ # time instant will only be inserted if time position provided
41
+ if hTimeInst.has_key?('timePosition')
42
+ s = hTimeInst['timePosition']
43
+ if s != ''
44
+ intTimeInst[:timePosition] = $ReaderNS::DateTime.unpack(s)
45
+ end
46
+ end
47
+
48
+ return intTimeInst
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,64 @@
1
+ # unpack time period
2
+ # Reader - ADIwg JSON V1 to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2013-12-11 original script
6
+ # Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+
9
+ require $ReaderNS.readerModule('module_dateTime')
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Readers
14
+ module MdJson
15
+
16
+ module TimePeriod
17
+
18
+ def self.unpack(hTimePeriod)
19
+
20
+ # instance classes needed in script
21
+ intMetadataClass = InternalMetadata.new
22
+
23
+ # time period
24
+ intTimePer = intMetadataClass.newTimePeriod
25
+
26
+ if hTimePeriod.has_key?('id')
27
+ s = hTimePeriod['id']
28
+ if s != ''
29
+ intTimePer[:timeId] = s
30
+ end
31
+ end
32
+
33
+ if hTimePeriod.has_key?('description')
34
+ s = hTimePeriod['description']
35
+ if s != ''
36
+ intTimePer[:description] = s
37
+ end
38
+ end
39
+
40
+ if hTimePeriod.has_key?('beginPosition')
41
+ s = hTimePeriod['beginPosition']
42
+ if s != ''
43
+ intTimePer[:beginTime] = $ReaderNS::DateTime.unpack(s)
44
+
45
+ end
46
+ end
47
+
48
+ if hTimePeriod.has_key?('endPosition')
49
+ s = hTimePeriod['endPosition']
50
+ if s != ''
51
+ intTimePer[:endTime] = $ReaderNS::DateTime.unpack(s)
52
+
53
+ end
54
+ end
55
+
56
+ return intTimePer
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,64 @@
1
+ # unpack vertical element
2
+ # Reader - ADIwg JSON V1 to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2013-11-18 original script
6
+ # Stan Smith 2013-12-11 modified to handle single vertical element
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Readers
12
+ module MdJson
13
+
14
+ module VerticalElement
15
+
16
+ def self.unpack(hVertElement)
17
+
18
+ # instance classes needed in script
19
+ intMetadataClass = InternalMetadata.new
20
+
21
+ intVertEle = intMetadataClass.newVerticalElement
22
+
23
+ # vertical element - minimum value
24
+ if hVertElement.has_key?('minimumValue')
25
+ s = hVertElement['minimumValue']
26
+ if s != ''
27
+ intVertEle[:minValue] = s
28
+ end
29
+ end
30
+
31
+ # vertical element - maximum value
32
+ if hVertElement.has_key?('maximumValue')
33
+ s = hVertElement['maximumValue']
34
+ if s != ''
35
+ intVertEle[:maxValue] = s
36
+ end
37
+ end
38
+
39
+ # vertical element - vertical crs title attribute
40
+ if hVertElement.has_key?('verticalCRSTitle')
41
+ s = hVertElement['verticalCRSTitle']
42
+ if s != ''
43
+ intVertEle[:crsTitle] = s
44
+ end
45
+ end
46
+
47
+ # vertical element - vertical crs link attribute
48
+ if hVertElement.has_key?('verticalCRSUri')
49
+ s = hVertElement['verticalCRSUri']
50
+ if s != ''
51
+ intVertEle[:crsURI] = s
52
+ end
53
+ end
54
+
55
+ return intVertEle
56
+
57
+ end
58
+
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,49 @@
1
+ # unpack voucher
2
+ # Reader - ADIwg JSON V1 to internal data structure
3
+
4
+ # History:
5
+ # Stan Smith 2013-11-21 original script
6
+ # Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
7
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
8
+
9
+ require $ReaderNS.readerModule('module_responsibleParty')
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Readers
14
+ module MdJson
15
+
16
+ module Voucher
17
+
18
+ def self.unpack(hVoucher)
19
+
20
+ # instance classes needed in script
21
+ intMetadataClass = InternalMetadata.new
22
+ intTaxVoucher = intMetadataClass.newTaxonVoucher
23
+
24
+ # taxonomy voucher - specimen
25
+ if hVoucher.has_key?('specimen')
26
+ s = hVoucher['specimen']
27
+ if s != ''
28
+ intTaxVoucher[:specimen] = s
29
+ end
30
+ end
31
+
32
+ # taxonomy - repository - responsible party
33
+ if hVoucher.has_key?('repository')
34
+ hRepository = hVoucher['repository']
35
+ unless hRepository.empty?
36
+ intTaxVoucher[:repository] = $ReaderNS::ResponsibleParty.unpack(hRepository)
37
+ end
38
+ end
39
+
40
+ return intTaxVoucher
41
+
42
+ end
43
+
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  ### Supported versions
5
5
 
6
- > 0.9.0
6
+ > 0.9.1, 0.9.4
7
7
 
8
8
  ### Reader for ADIwg JSON metadata format (mdJson)
9
9
 
@@ -0,0 +1,43 @@
1
+ =begin
2
+ * Description: Patches json-schema gem to work on windows
3
+ * Author: Josh Bradley
4
+ * Date: 2014-09-17
5
+ * License: Public Domain
6
+ =end
7
+
8
+ module JSON
9
+
10
+ class Validator
11
+
12
+ def load_ref_schema(parent_schema, ref)
13
+ uri = URI.parse(ref)
14
+ if uri.relative?
15
+ uri = parent_schema.uri.clone
16
+
17
+ # Check for absolute path
18
+ path = ref.split("#")[0]
19
+
20
+ # This is a self reference and thus the schema does not need to be re-loaded
21
+ if path.nil? || path == ''
22
+ return
23
+ end
24
+
25
+ if path && path[0, 1] == '/'
26
+ uri.path = Pathname.new(path).cleanpath.to_s
27
+ else
28
+ uri = parent_schema.uri.merge(path)
29
+ end
30
+ uri.fragment = ''
31
+ end
32
+
33
+ if Validator.schemas[uri.to_s].nil?
34
+ schema = JSON::Schema.new(JSON::Validator.parse(open(uri.to_s.chomp('#')).read), uri, @options[:version])
35
+ Validator.add_schema(schema)
36
+ build_schemas(schema)
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -0,0 +1,55 @@
1
+ # MdTranslator - controller for evaluating and directing readers
2
+
3
+ # History:
4
+ # Stan Smith 2014-12-11 original script
5
+ # Stan Smith 2012-12-16 generalized handleReader to use :readerRequested
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Readers
10
+
11
+ def self.handleReader(file)
12
+
13
+ # use reader name to load and initiate reader
14
+ # build directory path name for reader
15
+ readerDir = File.join(path_to_resources, $response[:readerRequested])
16
+ if File.directory?(readerDir)
17
+
18
+ # if directory path exists, build reader file name and require it
19
+ readerFile = File.join(readerDir, $response[:readerRequested] + '_reader')
20
+ require readerFile
21
+
22
+ # pass file to requested reader and return internal object
23
+ # $ReaderNS is the reader namespace constant set in
24
+ # ... readerRequested_reader.rb and initialized when the file is required
25
+ intObj = $ReaderNS.readFile(file)
26
+ return intObj
27
+ else
28
+ # directory path was not found
29
+ $response[:readerValidationPass] = false
30
+ $response[:readerValidationMessages] << "Reader name '#{$response[:readerRequested]}' is not supported."
31
+ return false
32
+ end
33
+
34
+ end
35
+
36
+ # return path to readers
37
+ def self.path_to_resources
38
+ File.dirname(File.expand_path(__FILE__))
39
+ end
40
+
41
+ # return reader readme text
42
+ def self.get_reader_readme(reader)
43
+ readmeText = 'No readme found'
44
+ path = File.join(path_to_resources, reader, 'readme.md')
45
+ if File.exist?(path)
46
+ file = File.open(path, 'r')
47
+ readmeText = file.read
48
+ file.close
49
+ end
50
+ return readmeText
51
+ end
52
+
53
+ end
54
+ end
55
+ end
@@ -21,11 +21,22 @@
21
21
  # 0.9.2 2014-12-01 added data dictionary support
22
22
  # 0.10.0 2014-12-01 added ISO 19110 writer
23
23
  # 0.10.1 2014-12-04 fixed problem with messages not returned in an array
24
+ # 0.10.2 2014-12-05
25
+ # 0.11.0 2014-12-15 refactored code managing the readers and writers
26
+ # ... added namespaces to readers and writers
27
+ # 0.11.1 2014-12-16 fixed problem of rails not access reader and writer readme files
28
+ # ... changed mdReader and mdWriter to use requested reader and writer
29
+ # ... names to resolved require and call statements
30
+ # 0.11.2 2014-12-29 fixed problem with handling xml builder object rather than output
31
+ # ... output string created by builder
32
+ # 0.11.3 2015-01-14 change return type from false to $response when writer name is invalid
33
+ # 0.12.0 2015-01-16 changed translate entry point method to use keyword parameters
34
+ # ... must now be ruby version 2.0.0 or higher
24
35
 
25
36
  module ADIWG
26
- module Mdtranslator
27
- # current mdtranslator version
28
- VERSION = "0.10.2"
29
- end
37
+ module Mdtranslator
38
+ # current mdtranslator version
39
+ VERSION = "0.12.0"
40
+ end
30
41
  end
31
42
 
@@ -3,89 +3,110 @@
3
3
 
4
4
  # History:
5
5
  # Stan Smith 2013-08-09 original script
6
-
7
- class CI_Address
8
-
9
- def initialize(xml)
10
- @xml = xml
11
- end
12
-
13
- def writeXML(hAddress)
14
-
15
- deliveryPoints = hAddress[:deliveryPoints].length
16
- eMails = hAddress[:eMailList].length
17
-
18
- if deliveryPoints + eMails > 0
19
- @xml.tag!('gmd:CI_Address') do
20
- # address - address
21
- if deliveryPoints > 0
22
-
23
- # address - delivery points (address lines)
24
- aDeliveryPoints = hAddress[:deliveryPoints]
25
- aDeliveryPoints.each do |myPoint|
26
- @xml.tag!('gmd:deliveryPoint') do
27
- @xml.tag!('gco:CharacterString',myPoint)
28
- end
29
- end
30
-
31
- elsif $showAllTags
32
- @xml.tag!('gmd:deliveryPoint')
33
- end
34
-
35
- # address - city
36
- s = hAddress[:city]
37
- if !s.nil?
38
- @xml.tag!('gmd:city') do
39
- @xml.tag!('gco:CharacterString',s)
40
- end
41
- elsif $showAllTags
42
- @xml.tag!('gmd:city')
43
- end
44
-
45
- # address - admin area (state)
46
- s = hAddress[:adminArea]
47
- if !s.nil?
48
- @xml.tag!('gmd:administrativeArea') do
49
- @xml.tag!('gco:CharacterString',s)
50
- end
51
- elsif $showAllTags
52
- @xml.tag!('gmd:administrativeArea')
53
- end
54
-
55
- # address - postal code
56
- s = hAddress[:postalCode]
57
- if !s.nil?
58
- @xml.tag!('gmd:postalCode') do
59
- @xml.tag!('gco:CharacterString',s)
60
- end
61
- elsif $showAllTags
62
- @xml.tag!('gmd:postalCode')
63
- end
64
-
65
- # address - country
66
- s = hAddress[:country]
67
- if !s.nil?
68
- @xml.tag!('gmd:country') do
69
- @xml.tag!('gco:CharacterString',s)
70
- end
71
- elsif $showAllTags
72
- @xml.tag!('gmd:country')
73
- end
74
-
75
- # address - email addresses
76
- if eMails > 0
77
- hAddress[:eMailList].each do |myEmail|
78
- @xml.tag!('gmd:electronicMailAddress') do
79
- @xml.tag!('gco:CharacterString',myEmail)
80
- end
81
- end
82
- elsif $showAllTags
83
- @xml.tag!('gmd:electronicMailAddress')
84
- end
85
-
86
- end
87
- end
88
-
89
- end
90
-
91
- end
6
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
7
+ # Stan Smith 2014-12-22 added return if passed nil address objects
8
+ # Stan Smith 2014-12-23 refactored to drop physical address elements if no
9
+ # ... deliveryPoints are provided
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso
15
+
16
+ class CI_Address
17
+
18
+ def initialize(xml)
19
+ @xml = xml
20
+ end
21
+
22
+ def writeXML(hAddress)
23
+
24
+ return if hAddress.nil?
25
+
26
+ deliveryPoints = hAddress[:deliveryPoints].length
27
+ eMails = hAddress[:eMailList].length
28
+
29
+ if deliveryPoints + eMails > 0
30
+ @xml.tag!('gmd:CI_Address') do
31
+
32
+ # physical address
33
+ # ... if no delivery points are provided ignore rest
34
+ # ... of physical address items
35
+ if deliveryPoints > 0
36
+
37
+ # address - delivery points (address lines)
38
+ aDeliveryPoints = hAddress[:deliveryPoints]
39
+ aDeliveryPoints.each do |myPoint|
40
+ @xml.tag!('gmd:deliveryPoint') do
41
+ @xml.tag!('gco:CharacterString', myPoint)
42
+ end
43
+ end
44
+
45
+ # address - city
46
+ s = hAddress[:city]
47
+ if !s.nil?
48
+ @xml.tag!('gmd:city') do
49
+ @xml.tag!('gco:CharacterString', s)
50
+ end
51
+ elsif $showAllTags
52
+ @xml.tag!('gmd:city')
53
+ end
54
+
55
+ # address - admin area (state)
56
+ s = hAddress[:adminArea]
57
+ if !s.nil?
58
+ @xml.tag!('gmd:administrativeArea') do
59
+ @xml.tag!('gco:CharacterString', s)
60
+ end
61
+ elsif $showAllTags
62
+ @xml.tag!('gmd:administrativeArea')
63
+ end
64
+
65
+ # address - postal code
66
+ s = hAddress[:postalCode]
67
+ if !s.nil?
68
+ @xml.tag!('gmd:postalCode') do
69
+ @xml.tag!('gco:CharacterString', s)
70
+ end
71
+ elsif $showAllTags
72
+ @xml.tag!('gmd:postalCode')
73
+ end
74
+
75
+ # address - country
76
+ s = hAddress[:country]
77
+ if !s.nil?
78
+ @xml.tag!('gmd:country') do
79
+ @xml.tag!('gco:CharacterString', s)
80
+ end
81
+ elsif $showAllTags
82
+ @xml.tag!('gmd:country')
83
+ end
84
+
85
+ elsif $showAllTags
86
+ @xml.tag!('gmd:deliveryPoint')
87
+ @xml.tag!('gmd:city')
88
+ @xml.tag!('gmd:administrativeArea')
89
+ @xml.tag!('gmd:postalCode')
90
+ @xml.tag!('gmd:country')
91
+ end
92
+
93
+ # address - email addresses
94
+ if eMails > 0
95
+ hAddress[:eMailList].each do |myEmail|
96
+ @xml.tag!('gmd:electronicMailAddress') do
97
+ @xml.tag!('gco:CharacterString', myEmail)
98
+ end
99
+ end
100
+ elsif $showAllTags
101
+ @xml.tag!('gmd:electronicMailAddress')
102
+ end
103
+
104
+ end
105
+ end
106
+ end # writeXML
107
+ end # CI_Address
108
+
109
+ end
110
+ end
111
+ end
112
+ end