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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/Rakefile +4 -1
- data/adiwg-mdtranslator.gemspec +10 -8
- data/bin/mdtranslator +8 -2
- data/lib/adiwg/mdtranslator.rb +72 -147
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +538 -538
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +153 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +41 -108
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_additionalDocumentation.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_address.rb +89 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_associatedResource.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_boundingBox.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_browseGraphic.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_citation.rb +122 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_contacts.rb +150 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_coordinates.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataDictionary.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataQuality.rb +51 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dateTime.rb +38 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_descriptiveKeyword.rb +60 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dictionaryInfo.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_distributionInfo.rb +161 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domain.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domainItem.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entity.rb +103 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityAttribute.rb +102 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityForeignKey.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityIndex.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_extent.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoCoordSystem.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoProperties.rb +100 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geographicElement.rb +179 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_legalConstraint.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineString.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineage.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_mdJson.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadata.rb +88 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataExtension.rb +51 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataInfo.rb +123 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_onlineResource.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_phone.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_point.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_polygon.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_processStep.rb +75 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resolution.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceFormat.rb +46 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceIdentifier.rb +60 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceInfo.rb +328 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceMaintenance.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceSpecificUsage.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_responsibleParty.rb +48 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_securityConstraint.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_source.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_spatialReference.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonClass.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonomy.rb +94 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_temporalElement.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timeInstant.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timePeriod.rb +64 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_verticalElement.rb +64 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_voucher.rb +49 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/validator.rb +43 -0
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +55 -0
- data/lib/adiwg/mdtranslator/version.rb +15 -4
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_address.rb +107 -86
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_aggregateInformation.rb +68 -57
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_boundingPolygon.rb +59 -48
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_browseGraphic.rb +57 -46
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_citation.rb +149 -138
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_contact.rb +83 -72
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataIdentification.rb +334 -322
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb +46 -34
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_date.rb +47 -36
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +42 -31
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_distribution.rb +29 -18
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_distributor.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_extent.rb +87 -76
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +113 -102
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +44 -33
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +121 -110
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_format.rb +45 -34
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +45 -36
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicBoundingBox.rb +78 -67
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicDescription.rb +25 -14
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicElement.rb +30 -19
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_identifier.rb +41 -30
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_keyword.rb +58 -49
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_legalConstraints.rb +65 -54
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineString.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineage.rb +62 -51
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +70 -59
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb +54 -43
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_medium.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_metadataExtension.rb +154 -143
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiGeometry.rb +138 -127
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +37 -26
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_onlineResource.rb +79 -68
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_point.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_polygon.rb +98 -87
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_processStep.rb +80 -69
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceIdentifier.rb +38 -27
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +25 -14
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_resolution.rb +51 -40
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_responsibleParty.rb +88 -77
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb +70 -59
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_source.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_standardOrderProcess.rb +75 -63
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonClassification.rb +55 -44
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonSystem.rb +98 -87
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_telephone.rb +73 -62
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_temporalExtent.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_timeInstant.rb +36 -27
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_timePeriod.rb +42 -33
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_usage.rb +59 -48
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_useConstraints.rb +26 -15
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_verticalExtent.rb +52 -41
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb +39 -28
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_associationType.rb +41 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_characterSet.rb +82 -47
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_classification.rb +42 -24
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_datatype.rb +56 -34
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_dateType.rb +34 -19
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_initiativeType.rb +41 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_keywordType.rb +46 -27
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_maintenanceFrequency.rb +55 -36
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumFormat.rb +44 -26
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumName.rb +68 -38
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_obligation.rb +32 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_onlineFunction.rb +42 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_presentationForm.rb +58 -31
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_progress.rb +44 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_restriction.rb +47 -32
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_role.rb +52 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_scope.rb +58 -35
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_spatialRepresentationType.rb +43 -30
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_topicCategory.rb +51 -44
- data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +26 -15
- data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +56 -45
- data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +23 -12
- data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +30 -19
- data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +223 -212
- data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +174 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +41 -12
- data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +347 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +151 -119
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +63 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_additionalDocumentation.rb +84 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_address.rb +100 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_associatedResource.rb +100 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_browseGraphic.rb +66 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_citation.rb +115 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_contact.rb +137 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_onlineResource.rb +47 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_phone.rb +128 -0
- data/test/readers/mdJson/v0_9/tc_translation.rb +82 -0
- data/test/writers/iso19115_2/tc_writer_iso19115_2_address.rb +222 -0
- metadata +87 -60
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_additionalDocumentation.rb +0 -36
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_address.rb +0 -71
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_associatedResource.rb +0 -66
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_boundingBox.rb +0 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_browseGraphic.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_citation.rb +0 -104
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_contacts.rb +0 -121
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_coordinates.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataQuality.rb +0 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dateTime.rb +0 -27
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_descriptiveKeyword.rb +0 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_distributionInfo.rb +0 -150
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +0 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +0 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +0 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_extent.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoCoordSystem.rb +0 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoProperties.rb +0 -89
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geographicElement.rb +0 -168
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_legalConstraint.rb +0 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineString.rb +0 -25
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineage.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadata.rb +0 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataExtension.rb +0 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataInfo.rb +0 -112
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_onlineResource.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_phone.rb +0 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_point.rb +0 -25
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_polygon.rb +0 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_processStep.rb +0 -64
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resolution.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceFormat.rb +0 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceIdentifier.rb +0 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceInfo.rb +0 -317
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceMaintenance.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceSpecificUsage.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_responsibleParty.rb +0 -37
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_securityConstraint.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_source.rb +0 -48
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_spatialReference.rb +0 -48
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonClass.rb +0 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonomy.rb +0 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_temporalElement.rb +0 -71
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timeInstant.rb +0 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timePeriod.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_verticalElement.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_voucher.rb +0 -38
- data/lib/adiwg/mdtranslator/validator.rb +0 -43
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +0 -171
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_MImetadata.rb +0 -333
- data/test/tc_translation.rb +0 -73
@@ -5,127 +5,159 @@
|
|
5
5
|
# Stan Smith 2014-06-04 add internal object pre-scan to create extents
|
6
6
|
# ... for geometry supplemental information
|
7
7
|
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
8
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
9
|
+
|
10
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/codelists'))
|
11
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../iso/classes'))
|
8
12
|
|
9
13
|
require 'builder'
|
10
14
|
require 'date'
|
11
15
|
require 'uuidtools'
|
12
|
-
require 'class_MImetadata'
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
16
|
+
require 'adiwg/mdtranslator/writers/iso19115_2/class_MImetadata'
|
17
|
+
|
18
|
+
module ADIWG
|
19
|
+
module Mdtranslator
|
20
|
+
module Writers
|
21
|
+
module Iso
|
22
|
+
|
23
|
+
# set writer namespace
|
24
|
+
$WriterNS = ADIWG::Mdtranslator::Writers::Iso
|
25
|
+
|
26
|
+
class Iso19115_2
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
# reset ISO id='' counter
|
30
|
+
$idCount = '_000'
|
31
|
+
end
|
32
|
+
|
33
|
+
def writeXML(internalObj)
|
34
|
+
|
35
|
+
|
36
|
+
# set the format of the output file based on the writer specified
|
37
|
+
$response[:writerFormat] = 'xml'
|
38
|
+
$response[:writerVersion] = ADIWG::Mdtranslator::VERSION
|
39
|
+
|
40
|
+
# pre-scan the internal object to create a new extents for each geometry
|
41
|
+
# ... that has supplemental information (temporal, vertical, identity).
|
42
|
+
# ... the new extents will be added to internalObj
|
43
|
+
prescanGeoElements(internalObj)
|
44
|
+
|
45
|
+
# create new XML document
|
46
|
+
xml = Builder::XmlMarkup.new(indent: 3)
|
47
|
+
metadataWriter = $WriterNS::MI_Metadata.new(xml)
|
48
|
+
metadata = metadataWriter.writeXML(internalObj)
|
49
|
+
|
50
|
+
# set writer pass to true if no messages
|
51
|
+
# false or warning will be set by code that places the message
|
52
|
+
if $response[:writerMessages].length == 0
|
53
|
+
$response[:writerPass] = true
|
54
|
+
end
|
55
|
+
|
56
|
+
return metadata
|
57
|
+
end
|
58
|
+
|
59
|
+
def prescanGeoElements(internalObj)
|
60
|
+
# supplemental information for the geographic element is carried in the
|
61
|
+
# ... internal structure in the temporalElements:, verticalElements:,
|
62
|
+
# ... and elementIdentifiers: attributes of the extGeoElements:
|
63
|
+
# ... of the extent.
|
64
|
+
# since temporal, vertical, and identify information in ISO is a property
|
65
|
+
# ... of EX_Extent and not of the geographicElement,
|
66
|
+
# ... this code creates a new extent for each geographicElement
|
67
|
+
# ... that has supplemental information and
|
68
|
+
# ... moves the supplemental information from the geometry to the new extent.
|
69
|
+
# In this implementation, supplemental information is only allowed for
|
70
|
+
# ... geometry types of Point, LineString, and Polygon
|
71
|
+
aExtents = internalObj[:metadata][:resourceInfo][:extents]
|
72
|
+
unless aExtents.empty?
|
73
|
+
aExtents.each do |hExtent|
|
74
|
+
aGeoElements = hExtent[:extGeoElements]
|
75
|
+
unless aGeoElements.empty?
|
76
|
+
aGeoElements.each do |hGeoElement|
|
77
|
+
hGeometry = hGeoElement[:elementGeometry]
|
78
|
+
unless hGeometry.empty?
|
79
|
+
geoType = hGeometry[:geoType]
|
80
|
+
case geoType
|
81
|
+
when 'Point', 'LineString', 'Polygon'
|
82
|
+
newExtent = extentFromGeoElement(hGeoElement, geoType)
|
83
|
+
if !newExtent.nil?
|
84
|
+
aExtents << newExtent
|
85
|
+
end
|
86
|
+
|
87
|
+
when 'MultiGeometry'
|
88
|
+
aGeoMembers = hGeometry[:geometry]
|
89
|
+
unless aGeoMembers.empty?
|
90
|
+
aGeoMembers.each do |hGeoMemberElement|
|
91
|
+
hGeometry = hGeoMemberElement[:elementGeometry]
|
92
|
+
unless hGeometry.empty?
|
93
|
+
geoType = hGeometry[:geoType]
|
94
|
+
case geoType
|
95
|
+
when 'Point', 'LineString', 'Polygon'
|
96
|
+
newExtent = extentFromGeoElement(hGeoMemberElement, geoType)
|
97
|
+
if !newExtent.nil?
|
98
|
+
aExtents << newExtent
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def extentFromGeoElement(hGeoElement, geoType)
|
113
|
+
# build new extent to portray supplemental information
|
114
|
+
# from elementGeometry
|
115
|
+
if !hGeoElement[:temporalElements].empty? ||
|
116
|
+
!hGeoElement[:verticalElements].empty? ||
|
117
|
+
!hGeoElement[:elementIdentifiers].empty?
|
118
|
+
|
119
|
+
# get unique id for geometry
|
120
|
+
# if geometry id was missing, set it at this time so
|
121
|
+
# ... it will match the supplemental information extent description
|
122
|
+
geoID = hGeoElement[:elementId]
|
123
|
+
if geoID.nil?
|
124
|
+
$idCount = $idCount.succ
|
125
|
+
geoID = geoType + $idCount
|
126
|
+
hGeoElement[:elementId] = geoID
|
127
|
+
end
|
128
|
+
|
129
|
+
# build unique id for extent geometry
|
130
|
+
$idCount = $idCount.succ
|
131
|
+
extGeoID = geoType + $idCount
|
132
|
+
|
133
|
+
intMetadataClass = InternalMetadata.new
|
134
|
+
intExtent = intMetadataClass.newExtent
|
135
|
+
intGeoEle = intMetadataClass.newGeoElement
|
136
|
+
|
137
|
+
intGeoEle[:elementId] = extGeoID
|
138
|
+
intGeoEle[:elementGeometry] = hGeoElement[:elementGeometry]
|
139
|
+
|
140
|
+
intExtent[:extDesc] = 'Supplemental information for ' + geoID
|
141
|
+
intExtent[:extGeoElements] << intGeoEle
|
142
|
+
intExtent[:extIdElements] = hGeoElement[:elementIdentifiers]
|
143
|
+
intExtent[:extTempElements] = hGeoElement[:temporalElements]
|
144
|
+
intExtent[:extVertElements] = hGeoElement[:verticalElements]
|
145
|
+
|
146
|
+
return intExtent
|
147
|
+
|
148
|
+
else
|
149
|
+
return nil
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
131
159
|
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# MdTranslator - controller for evaluating and directing writers
|
2
|
+
|
3
|
+
# History:
|
4
|
+
# Stan Smith 2014-12-11 original script
|
5
|
+
# Stan Smith 2012-12-16 generalized handleWriter to use :writerName
|
6
|
+
|
7
|
+
module ADIWG
|
8
|
+
module Mdtranslator
|
9
|
+
module Writers
|
10
|
+
|
11
|
+
def self.handleWriter(intObj)
|
12
|
+
|
13
|
+
# use writer name to load and initiate requested writer
|
14
|
+
# build directory path for writer from writerName
|
15
|
+
writerDir = File.join(path_to_resources, $response[:writerName])
|
16
|
+
if File.directory?(writerDir)
|
17
|
+
|
18
|
+
# if directory path exists, build writer file name and then require it
|
19
|
+
writerFile = File.join(writerDir, $response[:writerName] + '_writer')
|
20
|
+
require writerFile
|
21
|
+
|
22
|
+
# build class name for writer from writerName
|
23
|
+
# ... class name must begin with upper case
|
24
|
+
# ... (1) writer file name must be writerName_writer.rb
|
25
|
+
# ... (2) writer class name must be capitalized writerName
|
26
|
+
# ... (3) $WriterNS is the writer namespace constant set in
|
27
|
+
# ... writerName_writer.rb and initialized when the file is required
|
28
|
+
writerUpCase = $response[:writerName][0].upcase + $response[:writerName][1..-1]
|
29
|
+
writerClass = $WriterNS.const_get(writerUpCase).new
|
30
|
+
|
31
|
+
# pass internal object to requested writer
|
32
|
+
$response[:writerOutput] = writerClass.writeXML(intObj)
|
33
|
+
return $response
|
34
|
+
else
|
35
|
+
# directory path was not found
|
36
|
+
$response[:writerValidationPass] = false
|
37
|
+
$response[:readerValidationMessages] << "Writer name '#{$response[:writerName]}' is not supported."
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# return path to writers
|
44
|
+
def self.path_to_resources
|
45
|
+
File.dirname(File.expand_path(__FILE__))
|
46
|
+
end
|
47
|
+
|
48
|
+
# return writer readme text
|
49
|
+
def self.get_writer_readme(writer)
|
50
|
+
readmeText = 'No readme found'
|
51
|
+
path = File.join(path_to_resources, writer, 'readme.md')
|
52
|
+
if File.exist?(path)
|
53
|
+
file = File.open(path, 'r')
|
54
|
+
readmeText = file.read
|
55
|
+
file.close
|
56
|
+
end
|
57
|
+
return readmeText
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_additionalDocumentation
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-30 original script
|
6
|
+
|
7
|
+
#set globals used in testing
|
8
|
+
#set globals used by mdJson_reader.rb before requiring module
|
9
|
+
$response = {
|
10
|
+
readerVersionUsed: '0.9'
|
11
|
+
}
|
12
|
+
|
13
|
+
require 'minitest/autorun'
|
14
|
+
require 'json'
|
15
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
16
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
17
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_additionalDocumentation'
|
18
|
+
|
19
|
+
class TestReaderMdJsonAdditionalDocumentation_v0_9 < MiniTest::Test
|
20
|
+
|
21
|
+
# get json test example
|
22
|
+
file = File.open('test/schemas/v0_9/examples/additionalDocumentation.json', 'r')
|
23
|
+
jsonFile = file.read
|
24
|
+
file.close
|
25
|
+
aIn = JSON.parse(jsonFile)
|
26
|
+
@@hIn = aIn[0]
|
27
|
+
|
28
|
+
# set namespace
|
29
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::AdditionalDocumentation
|
30
|
+
|
31
|
+
def test_complete_additionalDocumentation_object
|
32
|
+
|
33
|
+
hIn = @@hIn.clone
|
34
|
+
hIn.delete('citation')
|
35
|
+
|
36
|
+
intObj = {
|
37
|
+
resourceType: 'resourceType',
|
38
|
+
citation: {}
|
39
|
+
}
|
40
|
+
|
41
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_empty_additionalDocumentation_elements
|
46
|
+
|
47
|
+
hIn = @@hIn.clone
|
48
|
+
hIn['resourceType'] = ''
|
49
|
+
hIn['citation'] = {}
|
50
|
+
|
51
|
+
intObj = {
|
52
|
+
resourceType: nil,
|
53
|
+
citation: {}
|
54
|
+
}
|
55
|
+
|
56
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_missing_additionalDocumentation_citation
|
61
|
+
|
62
|
+
# note: except for resourceType
|
63
|
+
|
64
|
+
hIn = @@hIn.clone
|
65
|
+
hIn.delete('citation')
|
66
|
+
|
67
|
+
intObj = {
|
68
|
+
resourceType: 'resourceType',
|
69
|
+
citation: {}
|
70
|
+
}
|
71
|
+
|
72
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_empty_additionalDocumentation_object
|
77
|
+
|
78
|
+
hIn = JSON.parse('{}')
|
79
|
+
|
80
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_address
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-09 original script
|
6
|
+
# Stan Smith 2014-12-15 modified to use namespaces added to mdTranslator
|
7
|
+
# Stan Smith 2014-12-16 restructure tests to use schema examples
|
8
|
+
# Stan Smith 2014-12-19 added test for blank elements
|
9
|
+
|
10
|
+
require 'minitest/autorun'
|
11
|
+
require 'json'
|
12
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
13
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_address'
|
14
|
+
|
15
|
+
class TestReaderMdJsonAddress_v0_9 < MiniTest::Test
|
16
|
+
|
17
|
+
# get json test example
|
18
|
+
file = File.open('test/schemas/v0_9/examples/address.json', 'r')
|
19
|
+
jsonFile = file.read
|
20
|
+
file.close
|
21
|
+
aIn = JSON.parse(jsonFile)
|
22
|
+
@@hIn = aIn[0]
|
23
|
+
|
24
|
+
# set namespace
|
25
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::Address
|
26
|
+
|
27
|
+
def test_complete_address_object
|
28
|
+
|
29
|
+
hIn = @@hIn.clone
|
30
|
+
|
31
|
+
intObj = {
|
32
|
+
deliveryPoints: %w[deliveryPoint1 deliveryPoint2],
|
33
|
+
city: 'city',
|
34
|
+
adminArea: 'administrativeArea',
|
35
|
+
postalCode: 'postalCode',
|
36
|
+
country: 'country',
|
37
|
+
eMailList: %w[example1@example.com example2@example.com]
|
38
|
+
}
|
39
|
+
|
40
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_email_address_only
|
45
|
+
|
46
|
+
# note: this test also serves to test missing elements
|
47
|
+
# ... except for missing electronicMailAddress
|
48
|
+
|
49
|
+
hIn = @@hIn.clone
|
50
|
+
hIn.delete('deliveryPoint')
|
51
|
+
hIn.delete('city')
|
52
|
+
hIn.delete('administrativeArea')
|
53
|
+
hIn.delete('postalCode')
|
54
|
+
hIn.delete('country')
|
55
|
+
|
56
|
+
intObj = {
|
57
|
+
deliveryPoints: [],
|
58
|
+
city: nil,
|
59
|
+
adminArea: nil,
|
60
|
+
postalCode: nil,
|
61
|
+
country: nil,
|
62
|
+
eMailList: %w[example1@example.com example2@example.com]
|
63
|
+
}
|
64
|
+
|
65
|
+
assert_equal intObj,@@NameSpace.unpack(hIn)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_empty_address_elements
|
70
|
+
|
71
|
+
hIn = @@hIn.clone
|
72
|
+
hIn['deliveryPoint'] = ['']
|
73
|
+
hIn['city'] = ''
|
74
|
+
hIn['administrativeArea'] = ''
|
75
|
+
hIn['postalCode'] = ''
|
76
|
+
hIn['country'] = ''
|
77
|
+
hIn['electronicMailAddress'] = ['']
|
78
|
+
|
79
|
+
intObj = {
|
80
|
+
deliveryPoints: [],
|
81
|
+
city: nil,
|
82
|
+
adminArea: nil,
|
83
|
+
postalCode: nil,
|
84
|
+
country: nil,
|
85
|
+
eMailList: []
|
86
|
+
}
|
87
|
+
|
88
|
+
assert_equal intObj,@@NameSpace.unpack(hIn)
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_empty_address_object
|
93
|
+
|
94
|
+
hIn = JSON.parse('{}')
|
95
|
+
|
96
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|