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
@@ -3,29 +3,40 @@
3
3
 
4
4
  # History:
5
5
  # Stan Smith 2014-12-03 original script
6
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
6
7
 
7
- class DerivedUnit
8
+ module ADIWG
9
+ module Mdtranslator
10
+ module Writers
11
+ module Iso
8
12
 
9
- def initialize(xml)
10
- @xml = xml
11
- end
13
+ class DerivedUnit
12
14
 
13
- def writeXML(hDerived)
15
+ def initialize(xml)
16
+ @xml = xml
17
+ end
14
18
 
15
- # create and identity for the unit
16
- $idCount = $idCount.succ
17
- unitID = 'unit' + $idCount
18
- @xml.tag!('gml:DerivedUnit', {'gml:id' => unitID}) do
19
- @xml.tag!('gml:identifier', {'codeSpace' => hDerived[:codeSpace]}, hDerived[:identifier])
20
- @xml.tag!('gml:name', hDerived[:name])
21
- @xml.tag!('gml:remarks', hDerived[:remarks])
22
- @xml.tag!('gml:catalogSymbol', hDerived[:catalogSymbol])
23
- aTerms = hDerived[:derivationUnitTerm]
24
- aTerms.each do |term|
25
- @xml.tag!('gml:derivationUnitTerm',term)
26
- end
27
- end
19
+ def writeXML(hDerived)
28
20
 
29
- end
21
+ # create and identity for the unit
22
+ $idCount = $idCount.succ
23
+ unitID = 'unit' + $idCount
24
+ @xml.tag!('gml:DerivedUnit', {'gml:id' => unitID}) do
25
+ @xml.tag!('gml:identifier', {'codeSpace' => hDerived[:codeSpace]}, hDerived[:identifier])
26
+ @xml.tag!('gml:name', hDerived[:name])
27
+ @xml.tag!('gml:remarks', hDerived[:remarks])
28
+ @xml.tag!('gml:catalogSymbol', hDerived[:catalogSymbol])
29
+ aTerms = hDerived[:derivationUnitTerm]
30
+ aTerms.each do |term|
31
+ @xml.tag!('gml:derivationUnitTerm', term)
32
+ end
33
+ end
30
34
 
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
41
+ end
31
42
  end
@@ -3,222 +3,233 @@
3
3
 
4
4
  # History:
5
5
  # Stan Smith 2014-12-03 original script
6
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
6
7
 
7
8
  require 'class_baseUnit'
8
9
  require 'class_conventionalUnit'
9
10
  require 'class_derivedUnit'
10
11
  require 'class_definitionUnit'
11
12
 
12
- class UnitsOfMeasure
13
-
14
- def initialize(xml)
15
- @xml = xml
16
- end
17
-
18
- def writeUnits(unit)
19
-
20
- # define empty containers here to save lines of code
21
- # for base units
22
- hBase = {}
23
- hBase[:identifier] = ''
24
- hBase[:codeSpace] = 'http://www.bipm.org/en/si/'
25
- hBase[:name] = ''
26
- hBase[:catalogSymbol] = ''
27
- hBase[:unitsSystem] = 'base unit'
28
-
29
- # for conventional units
30
- hConvent = {}
31
- hConvent[:identifier] = ''
32
- hConvent[:codeSpace] = 'http://www.bipm.org/en/si/'
33
- hConvent[:name] = ''
34
- hConvent[:catalogSymbol] = ''
35
- hConvent[:preferredUnit] = ''
36
- hConvent[:factor] = nil
37
- hConvent[:a] = nil
38
- hConvent[:b] = nil
39
- hConvent[:c] = nil
40
- hConvent[:d] = nil
41
-
42
- # for derived units
43
- hDerived = {}
44
- hDerived[:identifier] = ''
45
- hDerived[:codeSpace] = ''
46
- hDerived[:name] = ''
47
- hDerived[:remarks] = ''
48
- hDerived[:catalogSymbol] = ''
49
- hDerived[:derivationUnitTerm] = nil
50
-
51
- # find matching units of measure
52
- case unit
53
-
54
- # angular degrees
55
- when 'deg', 'degree', 'degrees'
56
- hBase[:identifier] = 'degree'
57
- hBase[:codeSpace] = 'urn:ogc:def:uom:1.0'
58
- hBase[:name] = 'degree of arc'
59
- hBase[:catalogSymbol] = 'deg'
60
- hBase[:unitsSystem] = 'http://www.opengis.net/def/uom/OGC/1.0/degree'
61
-
62
- baseClass = BaseUnit.new(@xml)
63
- baseClass.writeXML(hBase)
64
-
65
- when 'm', 'meter', 'meters', 'metre'
66
- hBase[:identifier] = 'meter'
67
- hBase[:name] = 'meter'
68
- hBase[:catalogSymbol] = 'm'
69
-
70
- baseClass = BaseUnit.new(@xml)
71
- baseClass.writeXML(hBase)
72
-
73
- when 'kg', 'kilogram', 'kilograms'
74
- hBase[:identifier] = 'kilogram'
75
- hBase[:name] = 'kilogram'
76
- hBase[:catalogSymbol] = 'kg'
77
-
78
- baseClass = BaseUnit.new(@xml)
79
- baseClass.writeXML(hBase)
80
-
81
- when 's', 'second', 'seconds'
82
- hBase[:identifier] = 'second'
83
- hBase[:name] = 'second'
84
- hBase[:catalogSymbol] = 'd'
85
-
86
- baseClass = BaseUnit.new(@xml)
87
- baseClass.writeXML(hBase)
88
-
89
- when 'A', 'ampere', 'amperes'
90
- hBase[:identifier] = 'ampere'
91
- hBase[:name] = 'ampere'
92
- hBase[:catalogSymbol] = 'A'
93
-
94
- baseClass = BaseUnit.new(@xml)
95
- baseClass.writeXML(hBase)
96
-
97
- when 'K', 'kelvin'
98
- hBase[:identifier] = 'kelvin'
99
- hBase[:name] = 'kelvin'
100
- hBase[:catalogSymbol] = 'K'
101
-
102
- baseClass = BaseUnit.new(@xml)
103
- baseClass.writeXML(hBase)
104
-
105
- when 'mol', 'mole', 'moles'
106
- hBase[:identifier] = 'mole'
107
- hBase[:name] = 'mole'
108
- hBase[:catalogSymbol] = 'mol'
109
-
110
- baseClass = BaseUnit.new(@xml)
111
- baseClass.writeXML(hBase)
112
-
113
- when 'cd', 'candela', 'candelas'
114
- hBase[:identifier] = 'candela'
115
- hBase[:name] = 'candela'
116
- hBase[:catalogSymbol] = 'cd'
117
-
118
- baseClass = BaseUnit.new(@xml)
119
- baseClass.writeXML(hBase)
120
-
121
- when 'ft', 'foot', 'feet'
122
- hConvent[:identifier] = 'meter'
123
- hConvent[:name] = 'foot'
124
- hConvent[:catalogSymbol] = 'ft'
125
- hConvent[:preferredUnit] = 'meter'
126
- hConvent[:factor] = 3.280839
127
-
128
- convClass = ConventionalUnit.new(@xml)
129
- convClass.writeXML(hConvent)
130
-
131
- when 'in', 'inch', 'inches'
132
- hConvent[:identifier] = 'meter'
133
- hConvent[:name] = 'inch'
134
- hConvent[:catalogSymbol] = 'in'
135
- hConvent[:preferredUnit] = 'meter'
136
- hConvent[:factor] = 0.0254
137
-
138
- convClass = ConventionalUnit.new(@xml)
139
- convClass.writeXML(hConvent)
140
-
141
- when 'mm', 'millimeter', 'millimeters'
142
- hConvent[:identifier] = 'meter'
143
- hConvent[:name] = 'millimeter'
144
- hConvent[:catalogSymbol] = 'mm'
145
- hConvent[:preferredUnit] = 'meter'
146
- hConvent[:factor] = 0.001
147
-
148
- convClass = ConventionalUnit.new(@xml)
149
- convClass.writeXML(hConvent)
150
-
151
- when 'degC', 'centigrade', 'degreesC', 'Celsius'
152
- hConvent[:identifier] = 'kelvin'
153
- hConvent[:name] = 'degree Celsius'
154
- hConvent[:catalogSymbol] = 'degC'
155
- hConvent[:preferredUnit] = 'kelvin'
156
- hConvent[:a] = 273.16
157
- hConvent[:b] = 1
158
- hConvent[:c] = 1
159
- hConvent[:d] = 0
160
-
161
- convClass = ConventionalUnit.new(@xml)
162
- convClass.writeXML(hConvent)
163
-
164
- when 'degF', 'degreesF', 'Fahrenheit'
165
- hConvent[:identifier] = 'kelvin'
166
- hConvent[:name] = 'degree Fahrenheit'
167
- hConvent[:catalogSymbol] = 'degF'
168
- hConvent[:preferredUnit] = 'kelvin'
169
- hConvent[:a] = 2298.44
170
- hConvent[:b] = 5
171
- hConvent[:c] = 9
172
- hConvent[:d] = 0
173
-
174
- convClass = ConventionalUnit.new(@xml)
175
- convClass.writeXML(hConvent)
176
-
177
- when 'mph', 'miles per hour'
178
- hConvent[:identifier] = 'mi/h'
179
- hConvent[:name] = 'miles per hour'
180
- hConvent[:catalogSymbol] = 'mph'
181
- hConvent[:preferredUnit] = 'm/s'
182
- hConvent[:a] = 0
183
- hConvent[:b] = 1609.344
184
- hConvent[:c] = 0
185
- hConvent[:d] = 3600.0
186
-
187
- convClass = ConventionalUnit.new(@xml)
188
- convClass.writeXML(hConvent)
189
-
190
- when 'kph', 'kilometers per hour'
191
- hConvent[:identifier] = 'k/h'
192
- hConvent[:name] = 'kilometers per hour'
193
- hConvent[:catalogSymbol] = 'kph'
194
- hConvent[:preferredUnit] = 'm/s'
195
- hConvent[:a] = 0
196
- hConvent[:b] = 1000
197
- hConvent[:c] = 0
198
- hConvent[:d] = 3600
199
-
200
- convClass = ConventionalUnit.new(@xml)
201
- convClass.writeXML(hConvent)
202
-
203
- when 'density'
204
- hDerived = {}
205
- hDerived[:identifier] = 'kg/m^3'
206
- hDerived[:name] = 'kilograms per cubic meter'
207
- hDerived[:remarks] = 'volumetric mass density'
208
- hDerived[:catalogSymbol] = 'p'
209
- unitTerms = []
210
- unitTerms << { 'uom' => 'kg', 'exponent' => '1' }
211
- unitTerms << { 'uom' => 'm', 'exponent' => '-3' }
212
- hDerived[:derivationUnitTerm] = unitTerms
213
-
214
- dervClass = DerivedUnit.new(@xml)
215
- dervClass.writeXML(hDerived)
216
-
217
- else
218
- defnClass = UnitDefinition.new(@xml)
219
- defnClass.writeXML(unit)
220
-
221
- end
222
- end
223
-
13
+ module ADIWG
14
+ module Mdtranslator
15
+ module Writers
16
+ module Iso
17
+
18
+ class UnitsOfMeasure
19
+
20
+ def initialize(xml)
21
+ @xml = xml
22
+ end
23
+
24
+ def writeUnits(unit)
25
+
26
+ # define empty containers here to save lines of code
27
+ # for base units
28
+ hBase = {}
29
+ hBase[:identifier] = ''
30
+ hBase[:codeSpace] = 'http://www.bipm.org/en/si/'
31
+ hBase[:name] = ''
32
+ hBase[:catalogSymbol] = ''
33
+ hBase[:unitsSystem] = 'base unit'
34
+
35
+ # for conventional units
36
+ hConvent = {}
37
+ hConvent[:identifier] = ''
38
+ hConvent[:codeSpace] = 'http://www.bipm.org/en/si/'
39
+ hConvent[:name] = ''
40
+ hConvent[:catalogSymbol] = ''
41
+ hConvent[:preferredUnit] = ''
42
+ hConvent[:factor] = nil
43
+ hConvent[:a] = nil
44
+ hConvent[:b] = nil
45
+ hConvent[:c] = nil
46
+ hConvent[:d] = nil
47
+
48
+ # for derived units
49
+ hDerived = {}
50
+ hDerived[:identifier] = ''
51
+ hDerived[:codeSpace] = ''
52
+ hDerived[:name] = ''
53
+ hDerived[:remarks] = ''
54
+ hDerived[:catalogSymbol] = ''
55
+ hDerived[:derivationUnitTerm] = nil
56
+
57
+ # find matching units of measure
58
+ case unit
59
+
60
+ # angular degrees
61
+ when 'deg', 'degree', 'degrees'
62
+ hBase[:identifier] = 'degree'
63
+ hBase[:codeSpace] = 'urn:ogc:def:uom:1.0'
64
+ hBase[:name] = 'degree of arc'
65
+ hBase[:catalogSymbol] = 'deg'
66
+ hBase[:unitsSystem] = 'http://www.opengis.net/def/uom/OGC/1.0/degree'
67
+
68
+ baseClass = BaseUnit.new(@xml)
69
+ baseClass.writeXML(hBase)
70
+
71
+ when 'm', 'meter', 'meters', 'metre'
72
+ hBase[:identifier] = 'meter'
73
+ hBase[:name] = 'meter'
74
+ hBase[:catalogSymbol] = 'm'
75
+
76
+ baseClass = BaseUnit.new(@xml)
77
+ baseClass.writeXML(hBase)
78
+
79
+ when 'kg', 'kilogram', 'kilograms'
80
+ hBase[:identifier] = 'kilogram'
81
+ hBase[:name] = 'kilogram'
82
+ hBase[:catalogSymbol] = 'kg'
83
+
84
+ baseClass = BaseUnit.new(@xml)
85
+ baseClass.writeXML(hBase)
86
+
87
+ when 's', 'second', 'seconds'
88
+ hBase[:identifier] = 'second'
89
+ hBase[:name] = 'second'
90
+ hBase[:catalogSymbol] = 'd'
91
+
92
+ baseClass = BaseUnit.new(@xml)
93
+ baseClass.writeXML(hBase)
94
+
95
+ when 'A', 'ampere', 'amperes'
96
+ hBase[:identifier] = 'ampere'
97
+ hBase[:name] = 'ampere'
98
+ hBase[:catalogSymbol] = 'A'
99
+
100
+ baseClass = BaseUnit.new(@xml)
101
+ baseClass.writeXML(hBase)
102
+
103
+ when 'K', 'kelvin'
104
+ hBase[:identifier] = 'kelvin'
105
+ hBase[:name] = 'kelvin'
106
+ hBase[:catalogSymbol] = 'K'
107
+
108
+ baseClass = BaseUnit.new(@xml)
109
+ baseClass.writeXML(hBase)
110
+
111
+ when 'mol', 'mole', 'moles'
112
+ hBase[:identifier] = 'mole'
113
+ hBase[:name] = 'mole'
114
+ hBase[:catalogSymbol] = 'mol'
115
+
116
+ baseClass = BaseUnit.new(@xml)
117
+ baseClass.writeXML(hBase)
118
+
119
+ when 'cd', 'candela', 'candelas'
120
+ hBase[:identifier] = 'candela'
121
+ hBase[:name] = 'candela'
122
+ hBase[:catalogSymbol] = 'cd'
123
+
124
+ baseClass = BaseUnit.new(@xml)
125
+ baseClass.writeXML(hBase)
126
+
127
+ when 'ft', 'foot', 'feet'
128
+ hConvent[:identifier] = 'meter'
129
+ hConvent[:name] = 'foot'
130
+ hConvent[:catalogSymbol] = 'ft'
131
+ hConvent[:preferredUnit] = 'meter'
132
+ hConvent[:factor] = 3.280839
133
+
134
+ convClass = ConventionalUnit.new(@xml)
135
+ convClass.writeXML(hConvent)
136
+
137
+ when 'in', 'inch', 'inches'
138
+ hConvent[:identifier] = 'meter'
139
+ hConvent[:name] = 'inch'
140
+ hConvent[:catalogSymbol] = 'in'
141
+ hConvent[:preferredUnit] = 'meter'
142
+ hConvent[:factor] = 0.0254
143
+
144
+ convClass = ConventionalUnit.new(@xml)
145
+ convClass.writeXML(hConvent)
146
+
147
+ when 'mm', 'millimeter', 'millimeters'
148
+ hConvent[:identifier] = 'meter'
149
+ hConvent[:name] = 'millimeter'
150
+ hConvent[:catalogSymbol] = 'mm'
151
+ hConvent[:preferredUnit] = 'meter'
152
+ hConvent[:factor] = 0.001
153
+
154
+ convClass = ConventionalUnit.new(@xml)
155
+ convClass.writeXML(hConvent)
156
+
157
+ when 'degC', 'centigrade', 'degreesC', 'Celsius'
158
+ hConvent[:identifier] = 'kelvin'
159
+ hConvent[:name] = 'degree Celsius'
160
+ hConvent[:catalogSymbol] = 'degC'
161
+ hConvent[:preferredUnit] = 'kelvin'
162
+ hConvent[:a] = 273.16
163
+ hConvent[:b] = 1
164
+ hConvent[:c] = 1
165
+ hConvent[:d] = 0
166
+
167
+ convClass = ConventionalUnit.new(@xml)
168
+ convClass.writeXML(hConvent)
169
+
170
+ when 'degF', 'degreesF', 'Fahrenheit'
171
+ hConvent[:identifier] = 'kelvin'
172
+ hConvent[:name] = 'degree Fahrenheit'
173
+ hConvent[:catalogSymbol] = 'degF'
174
+ hConvent[:preferredUnit] = 'kelvin'
175
+ hConvent[:a] = 2298.44
176
+ hConvent[:b] = 5
177
+ hConvent[:c] = 9
178
+ hConvent[:d] = 0
179
+
180
+ convClass = ConventionalUnit.new(@xml)
181
+ convClass.writeXML(hConvent)
182
+
183
+ when 'mph', 'miles per hour'
184
+ hConvent[:identifier] = 'mi/h'
185
+ hConvent[:name] = 'miles per hour'
186
+ hConvent[:catalogSymbol] = 'mph'
187
+ hConvent[:preferredUnit] = 'm/s'
188
+ hConvent[:a] = 0
189
+ hConvent[:b] = 1609.344
190
+ hConvent[:c] = 0
191
+ hConvent[:d] = 3600.0
192
+
193
+ convClass = ConventionalUnit.new(@xml)
194
+ convClass.writeXML(hConvent)
195
+
196
+ when 'kph', 'kilometers per hour'
197
+ hConvent[:identifier] = 'k/h'
198
+ hConvent[:name] = 'kilometers per hour'
199
+ hConvent[:catalogSymbol] = 'kph'
200
+ hConvent[:preferredUnit] = 'm/s'
201
+ hConvent[:a] = 0
202
+ hConvent[:b] = 1000
203
+ hConvent[:c] = 0
204
+ hConvent[:d] = 3600
205
+
206
+ convClass = ConventionalUnit.new(@xml)
207
+ convClass.writeXML(hConvent)
208
+
209
+ when 'density'
210
+ hDerived = {}
211
+ hDerived[:identifier] = 'kg/m^3'
212
+ hDerived[:name] = 'kilograms per cubic meter'
213
+ hDerived[:remarks] = 'volumetric mass density'
214
+ hDerived[:catalogSymbol] = 'p'
215
+ unitTerms = []
216
+ unitTerms << {'uom' => 'kg', 'exponent' => '1'}
217
+ unitTerms << {'uom' => 'm', 'exponent' => '-3'}
218
+ hDerived[:derivationUnitTerm] = unitTerms
219
+
220
+ dervClass = DerivedUnit.new(@xml)
221
+ dervClass.writeXML(hDerived)
222
+
223
+ else
224
+ defnClass = UnitDefinition.new(@xml)
225
+ defnClass.writeXML(unit)
226
+
227
+ end
228
+ end
229
+
230
+ end
231
+
232
+ end
233
+ end
234
+ end
224
235
  end