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,56 @@
|
|
1
|
+
# unpack legal constraint
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-11-14 original script
|
6
|
+
# Stan Smith 2013-11-27 modified to process a single legal constraint
|
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
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Readers
|
13
|
+
module MdJson
|
14
|
+
|
15
|
+
module LegalConstraints
|
16
|
+
|
17
|
+
def self.unpack(hLegalCon)
|
18
|
+
|
19
|
+
# instance classes needed in script
|
20
|
+
intMetadataClass = InternalMetadata.new
|
21
|
+
hIntCon = intMetadataClass.newLegalConstraint
|
22
|
+
|
23
|
+
# legal constraint - access code
|
24
|
+
if hLegalCon.has_key?('accessConstraint')
|
25
|
+
aAccCodes = hLegalCon['accessConstraint']
|
26
|
+
unless aAccCodes.empty?
|
27
|
+
hIntCon[:accessCodes] = aAccCodes
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# legal constraint - use code
|
32
|
+
if hLegalCon.has_key?('useConstraint')
|
33
|
+
aUseCodes = hLegalCon['useConstraint']
|
34
|
+
unless aUseCodes.empty?
|
35
|
+
hIntCon[:useCodes] = aUseCodes
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# legal constraint - other constraints
|
40
|
+
if hLegalCon.has_key?('otherConstraint')
|
41
|
+
aOtherCons = hLegalCon['otherConstraint']
|
42
|
+
unless aOtherCons.empty?
|
43
|
+
hIntCon[:otherCons] = aOtherCons
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
return hIntCon
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# unpack line string
|
2
|
+
# line string is coded in GeoJSON
|
3
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
4
|
+
|
5
|
+
# History:
|
6
|
+
# Stan Smith 2013-11-13 original script
|
7
|
+
# Stan Smith 2014-04-30 reorganized for json schema 0.3.0
|
8
|
+
# Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module
|
9
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
10
|
+
|
11
|
+
require $ReaderNS.readerModule('module_coordinates')
|
12
|
+
|
13
|
+
module ADIWG
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module MdJson
|
17
|
+
|
18
|
+
module LineString
|
19
|
+
|
20
|
+
def self.unpack(aCoords, geoType)
|
21
|
+
intMetadataClass = InternalMetadata.new
|
22
|
+
intLine = intMetadataClass.newGeometry
|
23
|
+
|
24
|
+
intLine[:geoType] = geoType
|
25
|
+
intLine[:geometry] = aCoords
|
26
|
+
intLine[:dimension] = $ReaderNS::Coordinates.getDimension(aCoords)
|
27
|
+
|
28
|
+
return intLine
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# unpack lineage
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-11-26 original script
|
6
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
7
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
8
|
+
|
9
|
+
require $ReaderNS.readerModule('module_processStep')
|
10
|
+
require $ReaderNS.readerModule('module_source')
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
16
|
+
|
17
|
+
module Lineage
|
18
|
+
|
19
|
+
def self.unpack(hLineage)
|
20
|
+
|
21
|
+
# instance classes needed in script
|
22
|
+
intMetadataClass = InternalMetadata.new
|
23
|
+
intDataLine = intMetadataClass.newLineage
|
24
|
+
|
25
|
+
# lineage - statement
|
26
|
+
if hLineage.has_key?('statement')
|
27
|
+
s = hLineage['statement']
|
28
|
+
if s != ''
|
29
|
+
intDataLine[:statement] = s
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# lineage - process steps
|
34
|
+
if hLineage.has_key?('processStep')
|
35
|
+
aProcSteps = hLineage['processStep']
|
36
|
+
unless aProcSteps.empty?
|
37
|
+
aProcSteps.each do |hProcStep|
|
38
|
+
intDataLine[:processSteps] << $ReaderNS::ProcessStep.unpack(hProcStep)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# lineage - data sources
|
44
|
+
if hLineage.has_key?('source')
|
45
|
+
aSources = hLineage['source']
|
46
|
+
unless aSources.empty?
|
47
|
+
aSources.each do |hSource|
|
48
|
+
intDataLine[:dataSources] << $ReaderNS::Source.unpack(hSource)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
return intDataLine
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# unpack address
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-12 original script
|
6
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
7
|
+
|
8
|
+
require $ReaderNS.readerModule('module_contacts')
|
9
|
+
require $ReaderNS.readerModule('module_metadata')
|
10
|
+
require $ReaderNS.readerModule('module_dataDictionary')
|
11
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
12
|
+
|
13
|
+
module ADIWG
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module MdJson
|
17
|
+
|
18
|
+
def self.unpack(hMdJson)
|
19
|
+
|
20
|
+
# instance classes needed in script
|
21
|
+
intMetadataClass = InternalMetadata.new
|
22
|
+
|
23
|
+
# create new internal metadata container for the reader
|
24
|
+
intObj = intMetadataClass.newBase
|
25
|
+
|
26
|
+
# get json schema name and version
|
27
|
+
hVersion = hMdJson['version']
|
28
|
+
intObj[:schema][:name] = hVersion['name']
|
29
|
+
intObj[:schema][:version] = hVersion['version']
|
30
|
+
|
31
|
+
# contact array
|
32
|
+
# load the array of contacts from the json input
|
33
|
+
# ... the program uses the 'contactId' provided by the user
|
34
|
+
# ... to reference a contact
|
35
|
+
if hMdJson.has_key?('contact')
|
36
|
+
aContacts = hMdJson['contact']
|
37
|
+
aContacts.each do |hContact|
|
38
|
+
unless hContact.empty?
|
39
|
+
intObj[:contacts] << $ReaderNS::Contact.unpack(hContact)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# add default contacts
|
45
|
+
intObj[:contacts].concat($ReaderNS::Contact.setDefaultContacts)
|
46
|
+
|
47
|
+
# metadata
|
48
|
+
# load metadata from the hash object
|
49
|
+
if hMdJson.has_key?('metadata')
|
50
|
+
hMetadata = hMdJson['metadata']
|
51
|
+
intObj[:metadata] = $ReaderNS::Metadata.unpack(hMetadata)
|
52
|
+
end
|
53
|
+
|
54
|
+
# data dictionary
|
55
|
+
if hMdJson.has_key?('dataDictionary')
|
56
|
+
hDictionary = hMdJson['dataDictionary']
|
57
|
+
intObj[:dataDictionary] = $ReaderNS::DataDictionary.unpack(hDictionary)
|
58
|
+
end
|
59
|
+
|
60
|
+
# return ADIwg internal container
|
61
|
+
return intObj
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# unpack metadata
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-08-22 original script
|
6
|
+
# Stan Smith 2013-09-23 added distributor info section
|
7
|
+
# Stan Smith 2013-11-26 added metadata maintenance section
|
8
|
+
# Stan Smith 2013-11-26 added hierarchy section
|
9
|
+
# Stan Smith 2013-11-26 added data quality section
|
10
|
+
# Stan Smith 2013-12-27 added parent identifier
|
11
|
+
# Stan Smith 2014-04-24 reorganized for json schema 0.3.0
|
12
|
+
# Stan Smith 2014-05-02 added associated resources
|
13
|
+
# Stan Smith 2014-05-02 added additional documentation
|
14
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
15
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
16
|
+
|
17
|
+
require $ReaderNS.readerModule('module_metadataInfo')
|
18
|
+
require $ReaderNS.readerModule('module_resourceInfo')
|
19
|
+
require $ReaderNS.readerModule('module_distributionInfo')
|
20
|
+
require $ReaderNS.readerModule('module_associatedResource')
|
21
|
+
require $ReaderNS.readerModule('module_additionalDocumentation')
|
22
|
+
require $ReaderNS.readerModule('module_citation')
|
23
|
+
|
24
|
+
module ADIWG
|
25
|
+
module Mdtranslator
|
26
|
+
module Readers
|
27
|
+
module MdJson
|
28
|
+
|
29
|
+
module Metadata
|
30
|
+
|
31
|
+
def self.unpack(hMetadata)
|
32
|
+
|
33
|
+
# instance classes needed in script
|
34
|
+
intMetadataClass = InternalMetadata.new
|
35
|
+
intMetadata = intMetadataClass.newMetadata
|
36
|
+
|
37
|
+
# metadata - metadataInfo
|
38
|
+
# metadataInfo needs access to resourceInfo to check taxonomy
|
39
|
+
if hMetadata.has_key?('metadataInfo')
|
40
|
+
intMetadata[:metadataInfo] = $ReaderNS::MetadataInfo.unpack(hMetadata)
|
41
|
+
end
|
42
|
+
|
43
|
+
# metadata - resource identification info
|
44
|
+
if hMetadata.has_key?('resourceInfo')
|
45
|
+
hResourceInfo = hMetadata['resourceInfo']
|
46
|
+
intMetadata[:resourceInfo] = $ReaderNS::ResourceInfo.unpack(hResourceInfo)
|
47
|
+
end
|
48
|
+
|
49
|
+
# metadata - distribution info
|
50
|
+
if hMetadata.has_key?('distributionInfo')
|
51
|
+
aDistributors = hMetadata['distributionInfo']
|
52
|
+
unless aDistributors.empty?
|
53
|
+
aDistributors.each do |hDistributor|
|
54
|
+
intMetadata[:distributorInfo] << $ReaderNS::DistributionInfo.unpack(hDistributor)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# metadata - associated resources
|
60
|
+
if hMetadata.has_key?('associatedResource')
|
61
|
+
aAssocRes = hMetadata['associatedResource']
|
62
|
+
unless aAssocRes.empty?
|
63
|
+
aAssocRes.each do |hAssocRes|
|
64
|
+
intMetadata[:associatedResources] << $ReaderNS::AssociatedResource.unpack(hAssocRes)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# metadata - additional documents
|
70
|
+
if hMetadata.has_key?('additionalDocumentation')
|
71
|
+
aAddDocs = hMetadata['additionalDocumentation']
|
72
|
+
unless aAddDocs.empty?
|
73
|
+
aAddDocs.each do |hAddDoc|
|
74
|
+
intMetadata[:additionalDocuments] << $ReaderNS::AdditionalDocumentation.unpack(hAddDoc)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
return intMetadata
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# unpack metadata extension information
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-11-22 original script
|
6
|
+
# Stan Smith 2014-05-15 modified for JSON schema 0.4.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 MetadataExtension
|
15
|
+
|
16
|
+
def self.addExtensionISObio()
|
17
|
+
|
18
|
+
intMetadataClass = InternalMetadata.new
|
19
|
+
intMetaExt = intMetadataClass.newMetadataExtension
|
20
|
+
intContactRole = intMetadataClass.newRespParty
|
21
|
+
|
22
|
+
# extension online information
|
23
|
+
intMetaExt[:onLineResource] = {}
|
24
|
+
|
25
|
+
# extension entity information
|
26
|
+
intMetaExt[:extName] = 'Taxonomy System'
|
27
|
+
intMetaExt[:extShortName] = 'TaxonSys'
|
28
|
+
intMetaExt[:extDefinition] = 'Documentation of taxonomic sources, procedures, and treatments'
|
29
|
+
intMetaExt[:obligation] = 'optional'
|
30
|
+
intMetaExt[:dataType] = 'class'
|
31
|
+
intMetaExt[:maxOccurrence] = '1'
|
32
|
+
intMetaExt[:parentEntities] << 'MD_Identification'
|
33
|
+
intMetaExt[:rule] = 'New Metadata section as a class to MD_Identification'
|
34
|
+
intMetaExt[:rationales] << 'The set of data elements contained within this class element ' +
|
35
|
+
'represents an attempt to provide better documentation of ' +
|
36
|
+
'taxonomic sources, procedures, and treatments.'
|
37
|
+
|
38
|
+
# source information
|
39
|
+
intContactRole[:contactId] = 'ADIwgBio'
|
40
|
+
intContactRole[:roleName] = 'resourceProvider'
|
41
|
+
intMetaExt[:extSources] << intContactRole
|
42
|
+
|
43
|
+
return intMetaExt
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# unpack metadata information block
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-04-24 original script - moved from module_metadata
|
6
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
7
|
+
# Stan Smith 2014-09-19 changed metadata identifier type resource identifier json 0.8.0
|
8
|
+
# Stan Smith 2014-09-19 changed parent metadata identifier type citation json 0.8.0
|
9
|
+
# Stan Smith 2014-11-06 removed metadataScope, moved to resourceType under resourceInfo json 0.9.0
|
10
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
11
|
+
|
12
|
+
require $ReaderNS.readerModule('module_responsibleParty')
|
13
|
+
require $ReaderNS.readerModule('module_dateTime')
|
14
|
+
require $ReaderNS.readerModule('module_resourceMaintenance')
|
15
|
+
require $ReaderNS.readerModule('module_metadataExtension')
|
16
|
+
require $ReaderNS.readerModule('module_resourceIdentifier')
|
17
|
+
require $ReaderNS.readerModule('module_citation')
|
18
|
+
|
19
|
+
module ADIWG
|
20
|
+
module Mdtranslator
|
21
|
+
module Readers
|
22
|
+
module MdJson
|
23
|
+
|
24
|
+
module MetadataInfo
|
25
|
+
|
26
|
+
def self.unpack(hMetadata)
|
27
|
+
|
28
|
+
# instance classes needed in script
|
29
|
+
intMetadataClass = InternalMetadata.new
|
30
|
+
intMetadataInfo = intMetadataClass.newMetadataInfo
|
31
|
+
hMetadataInfo = hMetadata['metadataInfo']
|
32
|
+
|
33
|
+
# metadata - metadata identifier
|
34
|
+
if hMetadataInfo.has_key?('metadataIdentifier')
|
35
|
+
hMetadataId = hMetadataInfo['metadataIdentifier']
|
36
|
+
unless hMetadataId.empty?
|
37
|
+
intMetadataInfo[:metadataId] = $ReaderNS::ResourceIdentifier.unpack(hMetadataId)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# metadata - parent metadata identifier
|
42
|
+
if hMetadataInfo.has_key?('parentMetadata')
|
43
|
+
hParent = hMetadataInfo['parentMetadata']
|
44
|
+
unless hParent.empty?
|
45
|
+
intMetadataInfo[:parentMetadata] = $ReaderNS::Citation.unpack(hParent)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# metadata - metadata contacts, custodians
|
50
|
+
if hMetadataInfo.has_key?('metadataContact')
|
51
|
+
aCust = hMetadataInfo['metadataContact']
|
52
|
+
unless aCust.empty?
|
53
|
+
aCust.each do |rParty|
|
54
|
+
intMetadataInfo[:metadataCustodians] << $ReaderNS::ResponsibleParty.unpack(rParty)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# metadata - creation date
|
60
|
+
if hMetadataInfo.has_key?('metadataCreationDate')
|
61
|
+
s = hMetadataInfo['metadataCreationDate']
|
62
|
+
if s != ''
|
63
|
+
hDateTime = $ReaderNS::DateTime.unpack(s)
|
64
|
+
hDateTime[:dateType] = 'publication'
|
65
|
+
intMetadataInfo[:metadataCreateDate] = hDateTime
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# metadata - date of last metadata update
|
70
|
+
if hMetadataInfo.has_key?('metadataLastUpdate')
|
71
|
+
s = hMetadataInfo['metadataLastUpdate']
|
72
|
+
if s != ''
|
73
|
+
hDateTime = $ReaderNS::DateTime.unpack(s)
|
74
|
+
hDateTime[:dateType] = 'revision'
|
75
|
+
intMetadataInfo[:metadataUpdateDate] = hDateTime
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# metadata - metadata URI
|
80
|
+
if hMetadataInfo.has_key?('metadataUri')
|
81
|
+
s = hMetadataInfo['metadataUri']
|
82
|
+
if s != ''
|
83
|
+
intMetadataInfo[:metadataURI] = s
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# metadata - status
|
88
|
+
if hMetadataInfo.has_key?('metadataStatus')
|
89
|
+
s = hMetadataInfo['metadataStatus']
|
90
|
+
if s != ''
|
91
|
+
intMetadataInfo[:metadataStatus] = s
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# metadata - metadata maintenance info
|
96
|
+
if hMetadataInfo.has_key?('metadataMaintenance')
|
97
|
+
hMetaMaint = hMetadataInfo['metadataMaintenance']
|
98
|
+
unless hMetaMaint.empty?
|
99
|
+
intMetadataInfo[:maintInfo] = $ReaderNS::ResourceMaintenance.unpack(hMetaMaint)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# metadata - extension info - if biological extension
|
104
|
+
if hMetadata.has_key?('resourceInfo')
|
105
|
+
resourceInfo = hMetadata['resourceInfo']
|
106
|
+
if resourceInfo.has_key?('taxonomy')
|
107
|
+
hTaxonomy = resourceInfo['taxonomy']
|
108
|
+
unless hTaxonomy.empty?
|
109
|
+
intMetadataInfo[:extensions] << $ReaderNS::MetadataExtension.addExtensionISObio
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
return intMetadataInfo
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|