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