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,174 @@
1
+ # ISO 19110 <<Class>> FC_FeatureCatalogue
2
+ # writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2013-12-01 original script
6
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
7
+ # Stan Smith 2014-12-29 set builder object '@xml' into string 'metadata'
8
+
9
+ require 'class_responsibleParty'
10
+ require 'class_featureType'
11
+
12
+ class FC_FeatureCatalogue
13
+
14
+ def initialize(xml)
15
+ @xml = xml
16
+ end
17
+
18
+ def writeXML(internalObj)
19
+
20
+ # classes used
21
+ rPartyClass = $WriterNS::CI_ResponsibleParty.new(@xml)
22
+ featureClass = $WriterNS::FC_FeatureType.new(@xml)
23
+
24
+ intDataDictionary = internalObj[:dataDictionary]
25
+ hDDInfo = intDataDictionary[:dictionaryInfo]
26
+ aEntities = intDataDictionary[:entities]
27
+ hCitation = hDDInfo[:dictCitation]
28
+
29
+ $intContactList = internalObj[:contacts]
30
+ $domainList = intDataDictionary[:domains]
31
+
32
+ # document head
33
+ metadata = @xml.instruct! :xml, encoding: 'UTF-8'
34
+ @xml.comment!('core gfc based instance document for ISO 19110')
35
+ @xml.tag!('gfc:FC_FeatureCatalogue', {'xmlns:gmi' => 'http://www.isotc211.org/2005/gmi',
36
+ 'xmlns:gmd' => 'http://www.isotc211.org/2005/gmd',
37
+ 'xmlns:gco' => 'http://www.isotc211.org/2005/gco',
38
+ 'xmlns:gml' => 'http://www.opengis.net/gml/3.2',
39
+ 'xmlns:gsr' => 'http://www.isotc211.org/2005/gsr',
40
+ 'xmlns:gss' => 'http://www.isotc211.org/2005/gss',
41
+ 'xmlns:gst' => 'http://www.isotc211.org/2005/gst',
42
+ 'xmlns:gmx' => 'http://www.isotc211.org/2005/gmx',
43
+ 'xmlns:gfc' => 'http://www.isotc211.org/2005/gfc',
44
+ 'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
45
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
46
+ 'xsi:schemaLocation' => 'http://www.isotc211.org/2005/gfc ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd'}) do
47
+
48
+ # feature catalogue information - name - required
49
+ # name is pulled from citation title in data dictionary information section
50
+ s = nil
51
+ if hCitation
52
+ if hCitation[:citTitle]
53
+ s = hCitation[:citTitle]
54
+ end
55
+ end
56
+ if !s.nil?
57
+ @xml.tag!('gmx:name') do
58
+ @xml.tag!('gco:CharacterString', s)
59
+ end
60
+ else
61
+ @xml.tag!('gmx:name', {'gco:nilReason' => 'missing'})
62
+ end
63
+
64
+ # feature catalogue information - scope - required []
65
+ # only a single instance is being supported
66
+ s = hDDInfo[:dictResourceType]
67
+ if !s.nil?
68
+ @xml.tag!('gmx:scope') do
69
+ @xml.tag!('gco:CharacterString', s)
70
+ end
71
+ else
72
+ @xml.tag!('gmx:scope', {'gco:nilReason' => 'missing'})
73
+ end
74
+
75
+ # feature catalogue information - field of application []
76
+ # only a single instance is being supported
77
+ s = hDDInfo[:dictDescription]
78
+ if !s.nil?
79
+ @xml.tag!('gmx:fieldOfApplication') do
80
+ @xml.tag!('gco:CharacterString', s)
81
+ end
82
+ elsif $showAllTags
83
+ @xml.tag!('gmx:fieldOfApplication')
84
+ end
85
+
86
+ # feature catalogue information - version number - required
87
+ # version number is taken from citation citEdition in data dictionary the info section
88
+ s = nil
89
+ if hCitation
90
+ if hCitation[:citEdition]
91
+ s = hCitation[:citEdition]
92
+ end
93
+ end
94
+ if !s.nil?
95
+ @xml.tag!('gmx:versionNumber') do
96
+ @xml.tag!('gco:CharacterString', s)
97
+ end
98
+ else
99
+ @xml.tag!('gmx:versionNumber', {'gco:nilReason' => 'missing'})
100
+ end
101
+
102
+ # feature catalogue information - version date - required
103
+ # version number is taken from citation citEdition in data dictionary the info section
104
+ # citation allows an array of citation dates, only one can be used as version date
105
+ vDate = nil
106
+ if hCitation
107
+ if hCitation[:citDate]
108
+ if hCitation[:citDate][0]
109
+ hDate = hCitation[:citDate][0]
110
+ unless hDate.empty?
111
+ dateTime = hDate[:dateTime]
112
+ dateRes = hDate[:dateResolution]
113
+ unless dateTime.nil?
114
+ vDate = AdiwgDateTimeFun.stringDateFromDateTime(dateTime, dateRes)
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ if vDate.nil?
121
+ @xml.tag!('gmx:versionDate', {'gco:nilReason' => 'missing'})
122
+ else
123
+ @xml.tag!('gmx:versionDate') do
124
+ @xml.tag!('gco:Date', vDate)
125
+ end
126
+ end
127
+
128
+ # feature catalogue information - language
129
+ s = hDDInfo[:dictLanguage]
130
+ if !s.nil?
131
+ @xml.tag!('gmx:language') do
132
+ @xml.tag!('gco:CharacterString', s)
133
+ end
134
+ elsif $showAllTags
135
+ @xml.tag!('gmx:language')
136
+ end
137
+
138
+ # feature catalogue information - producer - required - CI_ResponsibleParty
139
+ # producer is taken from citation responsibleParty in data dictionary the info section
140
+ # citation allows an array of responsible parties, only one can be used as producer
141
+ rParty = nil
142
+ if hCitation
143
+ if hCitation[:citResponsibleParty]
144
+ if hCitation[:citResponsibleParty][0]
145
+ rParty = hCitation[:citResponsibleParty][0]
146
+ end
147
+ end
148
+ end
149
+ if rParty.nil? || rParty.empty?
150
+ @xml.tag!('gfc:producer', {'gco:nilReason' => 'missing'})
151
+ else
152
+ @xml.tag!('gfc:producer') do
153
+ rPartyClass.writeXML(rParty)
154
+ end
155
+ end
156
+
157
+ # feature catalogue feature type - required
158
+ # use feature type to represent entities
159
+ if !aEntities.empty?
160
+ aEntities.each do |hEntity|
161
+ @xml.tag!('gfc:featureType') do
162
+ featureClass.writeXML(hEntity)
163
+ end
164
+ end
165
+ else
166
+ @xml.tag!('gfc:featureType', {'gco:nilReason' => 'missing'})
167
+ end
168
+
169
+ return metadata
170
+ end
171
+
172
+ end
173
+
174
+ end
@@ -2,27 +2,56 @@
2
2
 
3
3
  # History:
4
4
  # Stan Smith 2014-12-01 original script
5
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/units'))
8
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/codelists'))
9
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/classes'))
5
10
 
6
11
  require 'builder'
7
12
  require 'date'
8
13
  require 'uuidtools'
9
- require 'class_FCfeatureCatalogue'
14
+ require 'adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue'
15
+
16
+ module ADIWG
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso
20
+
21
+ # set writer namespace
22
+ $WriterNS = ADIWG::Mdtranslator::Writers::Iso
10
23
 
11
- $idCount = '_000'
24
+ class Iso19110
12
25
 
13
- class Iso19110Writer
26
+ def initialize
27
+ # reset ISO id='' counter
28
+ $idCount = '_000'
29
+ end
14
30
 
15
- def initialize
16
- end
31
+ def writeXML(intObj)
17
32
 
18
- def writeXML(internalObj)
33
+ # set the format of the output file based on the writer specified
34
+ $response[:writerFormat] = 'xml'
35
+ $response[:writerVersion] = ADIWG::Mdtranslator::VERSION
19
36
 
20
- # create new XML document
21
- xml = Builder::XmlMarkup.new(indent: 3)
22
- metadataWriter = FC_FeatureCatalogue.new(xml)
23
- metadata = metadataWriter.writeXML(internalObj)
37
+ # create new XML document
38
+ xml = Builder::XmlMarkup.new(indent: 3)
39
+ metadataWriter = FC_FeatureCatalogue.new(xml)
40
+ metadata = metadataWriter.writeXML(intObj)
24
41
 
25
- return metadata
26
- end
42
+ # set writer pass to true if no messages
43
+ # false or warning will be set by code that places the message
44
+ if $response[:writerMessages].length == 0
45
+ $response[:writerPass] = true
46
+ end
27
47
 
48
+ return metadata
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
55
+ end
28
56
  end
57
+
@@ -0,0 +1,347 @@
1
+ # ISO 19115-2 <<Class>> MI_Metadata
2
+ # writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2013-08-09 original script
6
+ # Stan Smith 2013-09-25 added distribution
7
+ # Stan Smith 2013-09-25 added data quality
8
+ # Stan Smith 2013-09-25 added metadata maintenance
9
+ # Stan Smith 2013-09-25 added reference system info
10
+ # Stan Smith 2013-12-27 added parent identifier
11
+ # Stan Smith 2014-05-14 modify for JSON schema 0.4.0
12
+ # Stan Smith 2014-05-14 refactored method calls to be consistent w/ other classes
13
+ # Stan Smith 2014-05-28 added resource URI
14
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
15
+ # Stan Smith 2014-08-18 add dataSetURI
16
+ # Stan Smith 2014-09-03 replaced spatial reference system code with named, epsg, and
17
+ # ... wkt reference system descriptions using RS_Identifier for 0.7.0
18
+ # Stan Smith 2014-09-19 changed file identifier to read from internal storage as
19
+ # ... an MD_Identifier class. To support version 0.8.0 json.
20
+ # Stan Smith 2014-10-07 changed source of dataSetURI to
21
+ # ... metadata: {resourceInfo: {citation: {citOlResources[0]: {olResURI:}}}}
22
+ # Stan Smith 2014-10-10 modified to pass minimum metadata input test
23
+ # ... test were added to handle a missing metadata > metadataInfo block in the input
24
+ # Stan Smith 2014-11-06 changed hierarchy level to load values from resourceInfo > resourceType
25
+ # Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
26
+ # Stan Smith 2014-12-29 set builder object '@xml' into string 'metadata'
27
+
28
+ require 'code_characterSet'
29
+ require 'code_scope'
30
+ require 'class_responsibleParty'
31
+ require 'class_metadataExtension'
32
+ require 'class_dataIdentification'
33
+ require 'class_distribution'
34
+ require 'class_dataQuality'
35
+ require 'class_maintenanceInformation'
36
+ require 'class_referenceSystem'
37
+ require 'module_dateTimeFun'
38
+
39
+ module ADIWG
40
+ module Mdtranslator
41
+ module Writers
42
+ module Iso
43
+
44
+ class MI_Metadata
45
+
46
+ def initialize(xml)
47
+ @xml = xml
48
+ end
49
+
50
+ def writeXML(internalObj)
51
+
52
+ # classes used
53
+ charCode = $WriterNS::MD_CharacterSetCode.new(@xml)
54
+ scopeCode = $WriterNS::MD_ScopeCode.new(@xml)
55
+ rPartyClass = $WriterNS::CI_ResponsibleParty.new(@xml)
56
+ mdExtClass = $WriterNS::MD_MetadataExtensionInformation.new(@xml)
57
+ dataIdClass = $WriterNS::MD_DataIdentification.new(@xml)
58
+ distClass = $WriterNS::MD_Distribution.new(@xml)
59
+ dqClass = $WriterNS::DQ_DataQuality.new(@xml)
60
+ metaMaintClass = $WriterNS::MD_MaintenanceInformation.new(@xml)
61
+ refSysClass = $WriterNS::MD_ReferenceSystem.new(@xml)
62
+
63
+ intMetadata = internalObj[:metadata]
64
+ hMetaInfo = intMetadata[:metadataInfo]
65
+ hResInfo = intMetadata[:resourceInfo]
66
+ aAssocRes = intMetadata[:associatedResources]
67
+ $intContactList = internalObj[:contacts]
68
+
69
+ # document head
70
+ metadata = @xml.instruct! :xml, encoding: 'UTF-8'
71
+ @xml.comment!('core gmi based instance document ISO 19115-2')
72
+ @xml.tag!('gmi:MI_Metadata', {'xmlns:gmi' => 'http://www.isotc211.org/2005/gmi',
73
+ 'xmlns:gmd' => 'http://www.isotc211.org/2005/gmd',
74
+ 'xmlns:gco' => 'http://www.isotc211.org/2005/gco',
75
+ 'xmlns:gml' => 'http://www.opengis.net/gml/3.2',
76
+ 'xmlns:gsr' => 'http://www.isotc211.org/2005/gsr',
77
+ 'xmlns:gss' => 'http://www.isotc211.org/2005/gss',
78
+ 'xmlns:gst' => 'http://www.isotc211.org/2005/gst',
79
+ 'xmlns:gmx' => 'http://www.isotc211.org/2005/gmx',
80
+ 'xmlns:gfc' => 'http://www.isotc211.org/2005/gfc',
81
+ 'xmlns:srv' => 'http://www.isotc211.org/2005/srv',
82
+ 'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
83
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
84
+ 'xsi:schemaLocation' => 'http://www.isotc211.org/2005/gmi ftp://ftp.ncddc.noaa.gov/pub/Metadata/Online_ISO_Training/Intro_to_ISO/schemas/ISObio/schema.xsd'}) do
85
+
86
+ # metadata information - file identifier - default
87
+ # the internal object stores the file identifier as a MD_Identifier to support 19115-1
88
+ # hMetaInfo => metadata > metadataInfo
89
+ # hMetaInfo[:metadataId] => MD_Identifier
90
+ # ISO 19115-2 only support the file identifier as a character string
91
+ @xml.tag!('gmd:fileIdentifier') do
92
+ s = nil
93
+ if hMetaInfo
94
+ if hMetaInfo[:metadataId]
95
+ s = hMetaInfo[:metadataId][:identifier]
96
+ unless s.nil?
97
+ @xml.tag!('gco:CharacterString', s)
98
+ end
99
+ end
100
+ end
101
+ if s.nil?
102
+ # generate fileIdentifier if one not provided
103
+ @xml.tag!('gco:CharacterString', UUIDTools::UUID.random_create.to_s)
104
+ end
105
+ end
106
+
107
+ # metadata information - file language - default
108
+ @xml.tag!('gmd:language') do
109
+ # all xml is written in US English
110
+ @xml.tag!('gco:CharacterString', 'eng; USA')
111
+ end
112
+
113
+ # metadata information - character set - default
114
+ @xml.tag!('gmd:characterSet') do
115
+ # all out put is in utf8
116
+ charCode.writeXML('utf8')
117
+ end
118
+
119
+ # metadata information - parent identifier
120
+ # the internal object stores the parent identifier as a CI_Citation to support 19115-1
121
+ # hMetaInfo => metadata > metadataInfo
122
+ # hMetaInfo[:parentMetadata] => hParent => CI_Citation
123
+ # ISO 19115-2 only support the parent identifier as a character string
124
+ s = nil
125
+ if hMetaInfo
126
+ if hMetaInfo[:parentMetadata]
127
+ hParent = hMetaInfo[:parentMetadata]
128
+ if !hParent.empty?
129
+ s = hParent[:citTitle]
130
+ aResIds = hParent[:citResourceIds]
131
+ if aResIds.length > 0
132
+ s += ' ids: | '
133
+ aResIds.each do |resource|
134
+ s += resource[:identifierType] + ': ' + resource[:identifier] + ' | '
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ if !s.nil?
141
+ @xml.tag!('gmd:parentIdentifier') do
142
+ @xml.tag!('gco:CharacterString', s)
143
+ end
144
+ elsif $showAllTags
145
+ @xml.tag!('gmd:parentIdentifier')
146
+ end
147
+
148
+ # metadata information - hierarchy level - defaults to 'dataset',
149
+ # values taken from resourceInfo > resourceType
150
+ fileHierarchy = false
151
+ s = hResInfo[:resourceType]
152
+ if s != ''
153
+ fileHierarchy = true
154
+ @xml.tag!('gmd:hierarchyLevel') do
155
+ scopeCode.writeXML(s)
156
+ end
157
+ end
158
+ if !fileHierarchy
159
+ @xml.tag!('gmd:hierarchyLevel') do
160
+ scopeCode.writeXML('dataset')
161
+ end
162
+ end
163
+
164
+ # metadata information - metadata custodian - required
165
+ custodians = false
166
+ if hMetaInfo
167
+ if hMetaInfo[:metadataCustodians]
168
+ aCustodians = hMetaInfo[:metadataCustodians]
169
+ unless aCustodians.empty?
170
+ custodians = true
171
+ aCustodians.each do |hCustodian|
172
+ @xml.tag!('gmd:contact') do
173
+ rPartyClass.writeXML(hCustodian)
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
179
+ if !custodians
180
+ @xml.tag!('gmd:contact', {'gco:nilReason' => 'missing'})
181
+ end
182
+
183
+ # metadata information - date stamp - required - default to now()
184
+ mDate = AdiwgDateTimeFun.stringDateFromDateTime(DateTime.now, 'YMD')
185
+ if hMetaInfo
186
+ if hMetaInfo[:metadataCreateDate]
187
+ hDate = hMetaInfo[:metadataCreateDate]
188
+ unless hDate.empty?
189
+ mDateTime = hDate[:dateTime]
190
+ mDateRes = hDate[:dateResolution]
191
+ unless mDateTime.nil?
192
+ mDate = AdiwgDateTimeFun.stringDateFromDateTime(mDateTime, mDateRes)
193
+ end
194
+ end
195
+ end
196
+ end
197
+ @xml.tag!('gmd:dateStamp') do
198
+ @xml.tag!('gco:Date', mDate)
199
+ end
200
+
201
+ # metadata information - metadata standard name - default
202
+ @xml.tag!('gmd:metadataStandardName') do
203
+ @xml.tag!('gco:CharacterString', 'ISO 19115-2')
204
+ end
205
+
206
+ # metadata information - metadata standard version - default
207
+ @xml.tag!('gmd:metadataStandardVersion') do
208
+ @xml.tag!('gco:CharacterString', 'ISO 19115-2:2009(E)')
209
+ end
210
+
211
+ # metadata information - dataset URI
212
+ # for the dataset URI adiwgJson follows the ISO 19115-1 convention which is
213
+ # ... to include links to the resource in the onlineResource section of the
214
+ # ... resource citation. Because citation onlineResource(s) are not supported
215
+ # ... in -2, the URI from the first onlineResource in the adiwgJson is used
216
+ # ... for the datasetURI.
217
+ # ... metadata: {resourceInfo: {citation: {citOlResources[0]: {olResURI:}}}}
218
+ s = nil
219
+ if hResInfo[:citation]
220
+ if hResInfo[:citation][:citOlResources][0]
221
+ if hResInfo[:citation][:citOlResources][0][:olResURI]
222
+ s = hResInfo[:citation][:citOlResources][0][:olResURI]
223
+ end
224
+ end
225
+ end
226
+ if !s.nil?
227
+ @xml.tag!('gmd:dataSetURI') do
228
+ @xml.tag!('gco:CharacterString', s)
229
+ end
230
+ elsif $showAllTags
231
+ @xml.tag!('gmd:dataSetURI')
232
+ end
233
+
234
+ # metadata information - reference system
235
+ hRefSystems = hResInfo[:spatialReferenceSystem]
236
+ if !hRefSystems.empty?
237
+
238
+ # named reference systems
239
+ aRefNames = hRefSystems[:sRNames]
240
+ aRefNames.each do |refName|
241
+ @xml.tag!('gmd:referenceSystemInfo') do
242
+ refSysClass.writeXML(refName, 'name')
243
+ end
244
+ end
245
+
246
+ # epsg reference systems
247
+ aRefNames = hRefSystems[:sREPSGs]
248
+ aRefNames.each do |refName|
249
+ @xml.tag!('gmd:referenceSystemInfo') do
250
+ refSysClass.writeXML(refName, 'epsg')
251
+ end
252
+ end
253
+
254
+ # wkt reference systems
255
+ aRefNames = hRefSystems[:sRWKTs]
256
+ aRefNames.each do |refName|
257
+ @xml.tag!('gmd:referenceSystemInfo') do
258
+ refSysClass.writeXML(refName, 'wkt')
259
+ end
260
+ end
261
+
262
+ elsif $showAllTags
263
+ @xml.tag!('gmd:referenceSystemInfo')
264
+ end
265
+
266
+ # metadata information - metadata extension info
267
+ extensions = false
268
+ if hMetaInfo
269
+ if hMetaInfo[:extensions]
270
+ aExtensions = hMetaInfo[:extensions]
271
+ if !aExtensions.empty?
272
+ extensions = true
273
+ aExtensions.each do |hExtension|
274
+ @xml.tag!('gmd:metadataExtensionInfo') do
275
+ mdExtClass.writeXML(hExtension)
276
+ end
277
+ end
278
+ end
279
+ end
280
+ end
281
+ if !extensions && $showAllTags
282
+ @xml.tag!('gmd:metadataExtensionInfo')
283
+ end
284
+
285
+ # metadata information - identification info - required
286
+ if hResInfo.empty?
287
+ @xml.tag!('gmd:identificationInfo', {'gco:nilReason' => 'missing'})
288
+ else
289
+ @xml.tag!('gmd:identificationInfo') do
290
+ dataIdClass.writeXML(hResInfo, aAssocRes)
291
+ end
292
+ end
293
+
294
+ # metadata information - content info
295
+ # ... information about data and link to 19110
296
+ # ... on hold until 19115-1 release
297
+
298
+ # metadata information - distribution info []
299
+ aDistInfo = intMetadata[:distributorInfo]
300
+ if !aDistInfo.empty?
301
+ @xml.tag!('gmd:distributionInfo') do
302
+ distClass.writeXML(aDistInfo)
303
+ end
304
+ elsif $showAllTags
305
+ @xml.tag!('gmd:distributionInfo')
306
+ end
307
+
308
+ # metadata information - data quality info
309
+ aDQInfo = hResInfo[:dataQualityInfo]
310
+ if !aDQInfo.empty?
311
+ aDQInfo.each do |hDQInfo|
312
+ @xml.tag!('gmd:dataQualityInfo') do
313
+ dqClass.writeXML(hDQInfo)
314
+ end
315
+ end
316
+ elsif $showAllTags
317
+ @xml.tag!('gmd:dataQualityInfo')
318
+ end
319
+
320
+ # metadata information - metadata maintenance
321
+ maintInfo = false
322
+ if hMetaInfo
323
+ if hMetaInfo[:maintInfo]
324
+ hMetaMaint = hMetaInfo[:maintInfo]
325
+ if !hMetaMaint.empty?
326
+ maintInfo = true
327
+ @xml.tag!('gmd:metadataMaintenance') do
328
+ metaMaintClass.writeXML(hMetaMaint)
329
+ end
330
+ end
331
+ end
332
+ end
333
+ if !maintInfo && $showAllTags
334
+ @xml.tag!('gmd:metadataMaintenance')
335
+ end
336
+
337
+ end
338
+
339
+ return metadata
340
+ end
341
+
342
+ end
343
+
344
+ end
345
+ end
346
+ end
347
+ end