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
@@ -0,0 +1,54 @@
|
|
1
|
+
# unpack additional documentation
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-11-06 original script
|
6
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
7
|
+
# Stan Smith 2014-12-30 added return if empty input
|
8
|
+
# ... found & fixed error of method using associatedResource object instead of
|
9
|
+
# ... additionalDocumentation object
|
10
|
+
|
11
|
+
require $ReaderNS.readerModule('module_citation')
|
12
|
+
|
13
|
+
module ADIWG
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module MdJson
|
17
|
+
|
18
|
+
module AdditionalDocumentation
|
19
|
+
|
20
|
+
def self.unpack(hAddDoc)
|
21
|
+
|
22
|
+
# return nil object if input is empty
|
23
|
+
intAddDoc = nil
|
24
|
+
return if hAddDoc.empty?
|
25
|
+
|
26
|
+
# instance classes needed in script
|
27
|
+
intMetadataClass = InternalMetadata.new
|
28
|
+
intAddDoc = intMetadataClass.newAdditionalDocumentation
|
29
|
+
|
30
|
+
# additional documentation - resource type
|
31
|
+
if hAddDoc.has_key?('resourceType')
|
32
|
+
s = hAddDoc['resourceType']
|
33
|
+
if s != ''
|
34
|
+
intAddDoc[:resourceType] = s
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# additional documentation - resource citation
|
39
|
+
if hAddDoc.has_key?('citation')
|
40
|
+
hCitation = hAddDoc['citation']
|
41
|
+
unless hCitation.empty?
|
42
|
+
intAddDoc[:citation] = $ReaderNS::Citation.unpack(hCitation)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
return intAddDoc
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# unpack address
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-10-21 original script
|
6
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
7
|
+
# Stan Smith 2014-12-19 prevented passing blank deliveryPoints and
|
8
|
+
# ... electronicMailAddresses into internal object
|
9
|
+
# Stan Smith 2014-12-30 refactored
|
10
|
+
|
11
|
+
module ADIWG
|
12
|
+
module Mdtranslator
|
13
|
+
module Readers
|
14
|
+
module MdJson
|
15
|
+
|
16
|
+
module Address
|
17
|
+
|
18
|
+
def self.unpack(hConAddress)
|
19
|
+
|
20
|
+
# return nil object if input is empty
|
21
|
+
intAdd = nil
|
22
|
+
return if hConAddress.empty?
|
23
|
+
|
24
|
+
# instance classes needed in script
|
25
|
+
intMetadataClass = InternalMetadata.new
|
26
|
+
intAdd = intMetadataClass.newAddress
|
27
|
+
|
28
|
+
# address - delivery point
|
29
|
+
if hConAddress.has_key?('deliveryPoint')
|
30
|
+
aDevPoint = hConAddress['deliveryPoint']
|
31
|
+
aDevPoint.each do |addLine|
|
32
|
+
if addLine != ''
|
33
|
+
intAdd[:deliveryPoints] << addLine
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# address - city
|
39
|
+
if hConAddress.has_key?('city')
|
40
|
+
s = hConAddress['city']
|
41
|
+
if s != ''
|
42
|
+
intAdd[:city] = s
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# address - admin area
|
47
|
+
if hConAddress.has_key?('administrativeArea')
|
48
|
+
s = hConAddress['administrativeArea']
|
49
|
+
if s != ''
|
50
|
+
intAdd[:adminArea] = s
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# address - postal code
|
55
|
+
if hConAddress.has_key?('postalCode')
|
56
|
+
s = hConAddress['postalCode']
|
57
|
+
if s != ''
|
58
|
+
intAdd[:postalCode] = s
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# address - country
|
63
|
+
if hConAddress.has_key?('country')
|
64
|
+
s = hConAddress['country']
|
65
|
+
if s != ''
|
66
|
+
intAdd[:country] = s
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# address - email
|
71
|
+
if hConAddress.has_key?('electronicMailAddress')
|
72
|
+
eMailList = hConAddress['electronicMailAddress']
|
73
|
+
eMailList.each do |email|
|
74
|
+
if email != ''
|
75
|
+
intAdd[:eMailList] << email
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
return intAdd
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# unpack associated resource
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-05-02 original script
|
6
|
+
# Stan Smith 2014-05-28 added resource identifier section
|
7
|
+
# Stan Smith 2014-06-02 added resource metadata citation section
|
8
|
+
# Stan Smith 2014-07-08 resolve require statements using Mdtranslator.reader_module
|
9
|
+
# Stan Smith 2014-08-18 moved resourceIdentifier to citation module schema 0.6.0
|
10
|
+
# Stan Smith 2014-11-06 changed resourceType to initiative type for 0.9.0
|
11
|
+
# Stan Smith 2014-11-06 added resourceType for 0.9.0
|
12
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
13
|
+
# Stan Smith 2014-12-30 added return if empty input
|
14
|
+
|
15
|
+
require $ReaderNS.readerModule('module_citation')
|
16
|
+
|
17
|
+
module ADIWG
|
18
|
+
module Mdtranslator
|
19
|
+
module Readers
|
20
|
+
module MdJson
|
21
|
+
|
22
|
+
module AssociatedResource
|
23
|
+
|
24
|
+
def self.unpack(hAssocRes)
|
25
|
+
|
26
|
+
# return nil object if input is empty
|
27
|
+
intAssocRes = nil
|
28
|
+
return if hAssocRes.empty?
|
29
|
+
|
30
|
+
# instance classes needed in script
|
31
|
+
intMetadataClass = InternalMetadata.new
|
32
|
+
intAssocRes = intMetadataClass.newAssociatedResource
|
33
|
+
|
34
|
+
# associated resource - association type
|
35
|
+
if hAssocRes.has_key?('associationType')
|
36
|
+
s = hAssocRes['associationType']
|
37
|
+
if s != ''
|
38
|
+
intAssocRes[:associationType] = s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# associated resource - initiative type
|
43
|
+
if hAssocRes.has_key?('initiativeType')
|
44
|
+
s = hAssocRes['initiativeType']
|
45
|
+
if s != ''
|
46
|
+
intAssocRes[:initiativeType] = s
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# associated resource - resource type
|
51
|
+
if hAssocRes.has_key?('resourceType')
|
52
|
+
s = hAssocRes['resourceType']
|
53
|
+
if s != ''
|
54
|
+
intAssocRes[:resourceType] = s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# associated resource - resource citation
|
59
|
+
if hAssocRes.has_key?('resourceCitation')
|
60
|
+
hCitation = hAssocRes['resourceCitation']
|
61
|
+
unless hCitation.empty?
|
62
|
+
intAssocRes[:resourceCitation] = $ReaderNS::Citation.unpack(hCitation)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# associated resource - metadata citation
|
67
|
+
if hAssocRes.has_key?('metadataCitation')
|
68
|
+
hCitation = hAssocRes['metadataCitation']
|
69
|
+
unless hCitation.empty?
|
70
|
+
intAssocRes[:metadataCitation] = $ReaderNS::Citation.unpack(hCitation)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
return intAssocRes
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# unpack bounding box
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-11-07 original script
|
6
|
+
# Stan Smith 2014-04-28 reorganized for json schema 0.3.0
|
7
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Readers
|
12
|
+
module MdJson
|
13
|
+
|
14
|
+
module BoundingBox
|
15
|
+
|
16
|
+
def self.unpack(aBBox)
|
17
|
+
|
18
|
+
# instance classes needed in script
|
19
|
+
intMetadataClass = InternalMetadata.new
|
20
|
+
intGeometry = intMetadataClass.newGeometry
|
21
|
+
intGeometry[:geoType] = 'BoundingBox'
|
22
|
+
|
23
|
+
# unpack GeoJSON bounding box elements
|
24
|
+
intBBox = intMetadataClass.newBoundingBox
|
25
|
+
west = aBBox[0]
|
26
|
+
south = aBBox[1]
|
27
|
+
east = aBBox[2]
|
28
|
+
north = aBBox[3]
|
29
|
+
|
30
|
+
# validate coordinates if easting +/-180 and northing +/-90
|
31
|
+
valid = false
|
32
|
+
if (180 >= west) && (west >= -180)
|
33
|
+
if (90 >= south) && (south >= -90)
|
34
|
+
if (180 >= east) && (east >= -180)
|
35
|
+
if (90 >= north) &&(north >= -90)
|
36
|
+
valid = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# build internal geo element if valid
|
43
|
+
if valid
|
44
|
+
intBBox[:westLong] = west
|
45
|
+
intBBox[:eastLong] = east
|
46
|
+
intBBox[:southLat] = south
|
47
|
+
intBBox[:northLat] = north
|
48
|
+
intGeometry[:geometry] = intBBox
|
49
|
+
|
50
|
+
return intGeometry
|
51
|
+
else
|
52
|
+
return nil
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# unpack browse graphic
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-10-17 original script
|
6
|
+
# Stan Smith 2013-11-27 modified to process single browse graphic rather than array
|
7
|
+
# Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
|
8
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
9
|
+
# Stan Smith 2014-12-24 added return if input hash is empty
|
10
|
+
# Stan Smith 2014-12-30 refactored
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
16
|
+
|
17
|
+
module BrowseGraphic
|
18
|
+
|
19
|
+
def self.unpack(hBgraphic)
|
20
|
+
|
21
|
+
# return nil object if input is empty
|
22
|
+
intBGraphic = nil
|
23
|
+
return if hBgraphic.empty?
|
24
|
+
|
25
|
+
# instance classes needed in script
|
26
|
+
intMetadataClass = InternalMetadata.new
|
27
|
+
intBGraphic = intMetadataClass.newBrowseGraphic
|
28
|
+
|
29
|
+
# graphic - file name
|
30
|
+
if hBgraphic.has_key?('fileName')
|
31
|
+
s = hBgraphic['fileName']
|
32
|
+
if s != ''
|
33
|
+
intBGraphic[:bGName] = s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# graphic - file description
|
38
|
+
if hBgraphic.has_key?('fileDescription')
|
39
|
+
s = hBgraphic['fileDescription']
|
40
|
+
if s != ''
|
41
|
+
intBGraphic[:bGDescription] = s
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# graphic - file type
|
46
|
+
if hBgraphic.has_key?('fileType')
|
47
|
+
s = hBgraphic['fileType']
|
48
|
+
if s != ''
|
49
|
+
intBGraphic[:bGType] = s
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# graphic - web link
|
54
|
+
if hBgraphic.has_key?('fileUri')
|
55
|
+
s = hBgraphic['fileUri']
|
56
|
+
if s != ''
|
57
|
+
intBGraphic[:bGURI] = s
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
return intBGraphic
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
# unpack citation
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-08-26 original script
|
6
|
+
# Stan Smith 2014-04-25 modified to support json schema 0.3.0
|
7
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
8
|
+
# Stan Smith 2014-08-18 changed additionalIdentifier section to identifier schema 0.6.0
|
9
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-12-19 refactored to return nil when hCitation is empty
|
11
|
+
# Stan Smith 2014-12-30 refactored
|
12
|
+
|
13
|
+
require $ReaderNS.readerModule('module_dateTime')
|
14
|
+
require $ReaderNS.readerModule('module_responsibleParty')
|
15
|
+
require $ReaderNS.readerModule('module_onlineResource')
|
16
|
+
require $ReaderNS.readerModule('module_resourceIdentifier')
|
17
|
+
|
18
|
+
module ADIWG
|
19
|
+
module Mdtranslator
|
20
|
+
module Readers
|
21
|
+
module MdJson
|
22
|
+
|
23
|
+
module Citation
|
24
|
+
|
25
|
+
def self.unpack(hCitation)
|
26
|
+
|
27
|
+
# return nil object if input is empty
|
28
|
+
intCitation = nil
|
29
|
+
return if hCitation.empty?
|
30
|
+
|
31
|
+
# instance classes needed in script
|
32
|
+
intMetadataClass = InternalMetadata.new
|
33
|
+
intCitation = intMetadataClass.newCitation
|
34
|
+
|
35
|
+
# citation - title
|
36
|
+
if hCitation.has_key?('title')
|
37
|
+
s = hCitation['title']
|
38
|
+
if s != ''
|
39
|
+
intCitation[:citTitle] = s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# citation - date
|
44
|
+
if hCitation.has_key?('date')
|
45
|
+
aCitDates = hCitation['date']
|
46
|
+
unless aCitDates.empty?
|
47
|
+
aCitDates.each do |hCitDate|
|
48
|
+
if hCitDate.has_key?('date')
|
49
|
+
s = hCitDate['date']
|
50
|
+
if s != ''
|
51
|
+
intDateTime = $ReaderNS::DateTime.unpack(s)
|
52
|
+
if hCitDate.has_key?('dateType')
|
53
|
+
s = hCitDate['dateType']
|
54
|
+
if s != ''
|
55
|
+
intDateTime[:dateType] = s
|
56
|
+
end
|
57
|
+
end
|
58
|
+
intCitation[:citDate] << intDateTime
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# citation - edition
|
66
|
+
if hCitation.has_key?('edition')
|
67
|
+
s = hCitation['edition']
|
68
|
+
if s != ''
|
69
|
+
intCitation[:citEdition] = s
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# citation - responsible party
|
74
|
+
if hCitation.has_key?('responsibleParty')
|
75
|
+
aRParty = hCitation['responsibleParty']
|
76
|
+
unless aRParty.empty?
|
77
|
+
aRParty.each do |hRParty|
|
78
|
+
intCitation[:citResponsibleParty] << $ReaderNS::ResponsibleParty.unpack(hRParty)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# citation - presentation form
|
84
|
+
if hCitation.has_key?('presentationForm')
|
85
|
+
aPForms = hCitation['presentationForm']
|
86
|
+
unless aPForms.empty?
|
87
|
+
aPForms.each do |pForm|
|
88
|
+
intCitation[:citResourceForms] << pForm
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# citation - resource identifiers
|
94
|
+
if hCitation.has_key?('identifier')
|
95
|
+
aResIds = hCitation['identifier']
|
96
|
+
aResIds.each do |hIdentifier|
|
97
|
+
unless hIdentifier.empty?
|
98
|
+
intCitation[:citResourceIds] << $ReaderNS::ResourceIdentifier.unpack(hIdentifier)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# citation - online resources
|
104
|
+
if hCitation.has_key?('onlineResource')
|
105
|
+
aOlRes = hCitation['onlineResource']
|
106
|
+
aOlRes.each do |hOlRes|
|
107
|
+
unless hOlRes.empty?
|
108
|
+
intCitation[:citOlResources] << $ReaderNS::OnlineResource.unpack(hOlRes)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
return intCitation
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|