adiwg-mdtranslator 0.9.0 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -6
- data/adiwg-mdtranslator.gemspec +2 -2
- data/bin/mdtranslator +10 -10
- data/lib/adiwg/mdtranslator.rb +54 -12
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +87 -7
- data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_reader.rb → mdJson/mdJson_reader.rb} +13 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_validator.rb → mdJson/mdJson_validator.rb} +18 -10
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_additionalDocumentation.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_address.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_associatedResource.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_boundingBox.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_browseGraphic.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_citation.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_contacts.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_coordinates.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dataQuality.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dateTime.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_descriptiveKeyword.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +52 -0
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_distributionInfo.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +42 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +92 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +91 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +43 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +42 -0
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_extent.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoCoordSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoProperties.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geographicElement.rb +12 -12
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_legalConstraint.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineString.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineage.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadata.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataExtension.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataInfo.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_onlineResource.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_phone.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_point.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_polygon.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_processStep.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resolution.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceFormat.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceIdentifier.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceInfo.rb +16 -16
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceMaintenance.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceSpecificUsage.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_responsibleParty.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_securityConstraint.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_source.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_spatialReference.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonClass.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonomy.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_temporalElement.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timeInstant.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timePeriod.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_verticalElement.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_voucher.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +19 -0
- data/lib/adiwg/mdtranslator/version.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +171 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2/classes/class_metadata.rb → iso/classes/class_MImetadata.rb} +3 -3
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_address.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_aggregateInformation.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_boundingPolygon.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_browseGraphic.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_citation.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_contact.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataIdentification.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataQuality.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_date.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_digitalTransferOptions.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distribution.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distributor.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_extent.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +114 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +55 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +120 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_format.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_genericMetaData.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicBoundingBox.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicDescription.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicElement.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_identifier.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_keyword.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_legalConstraints.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineString.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineage.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +68 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_maintenanceInformation.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_medium.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_metadataExtension.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_multiGeometry.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +44 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_onlineResource.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_point.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_polygon.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_processStep.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceIdentifier.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceSystem.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_resolution.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_responsibleParty.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_securityConstraints.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_source.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_standardOrderProcess.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonClassification.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonSystem.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_telephone.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_temporalExtent.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timeInstant.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timePeriod.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_usage.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_useConstraints.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_verticalExtent.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_vouchers.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_associationType.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_characterSet.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_classification.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_datatype.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_dateType.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_initiativeType.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_keywordType.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_maintenanceFrequency.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumFormat.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumName.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_obligation.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_onlineFunction.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_presentationForm.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_progress.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_restriction.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_role.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_scope.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_spatialRepresentationType.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_topicCategory.rb +0 -0
- data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +27 -0
- data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +53 -0
- data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +24 -0
- data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +31 -0
- data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +224 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +28 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/readme.md +13 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +6 -9
- data/test/tc_translation.rb +35 -18
- metadata +166 -146
- data/lib/adiwg/mdtranslator/readers/adiwgJson/readme.md +0 -19
- data/mdtranslator.rb +0 -187
@@ -0,0 +1,92 @@
|
|
1
|
+
# unpack a data dictionary entity
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-12-01 original script
|
6
|
+
|
7
|
+
require ADIWG::Mdtranslator.reader_module('module_entityIndex', $response[:readerVersionUsed])
|
8
|
+
require ADIWG::Mdtranslator.reader_module('module_entityAttribute', $response[:readerVersionUsed])
|
9
|
+
require ADIWG::Mdtranslator.reader_module('module_entityForeignKey', $response[:readerVersionUsed])
|
10
|
+
|
11
|
+
module Md_Entity
|
12
|
+
|
13
|
+
def self.unpack(hEntity)
|
14
|
+
|
15
|
+
# instance classes needed in script
|
16
|
+
intMetadataClass = InternalMetadata.new
|
17
|
+
intEntity = intMetadataClass.newEntity
|
18
|
+
|
19
|
+
# data entity - id
|
20
|
+
if hEntity.has_key?('entityId')
|
21
|
+
s = hEntity['entityId']
|
22
|
+
if s != ''
|
23
|
+
intEntity[:entityId] = s
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# data entity - name
|
28
|
+
if hEntity.has_key?('commonName')
|
29
|
+
s = hEntity['commonName']
|
30
|
+
if s != ''
|
31
|
+
intEntity[:entityName] = s
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# data entity - code
|
36
|
+
if hEntity.has_key?('codeName')
|
37
|
+
s = hEntity['codeName']
|
38
|
+
if s != ''
|
39
|
+
intEntity[:entityCode] = s
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# data entity - definition
|
44
|
+
if hEntity.has_key?('definition')
|
45
|
+
s = hEntity['definition']
|
46
|
+
if s != ''
|
47
|
+
intEntity[:entityDefinition] = s
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# data entity - primary key
|
52
|
+
if hEntity.has_key?('primaryKeyAttributeCodeName')
|
53
|
+
aKeyAttributes = hEntity['primaryKeyAttributeCodeName']
|
54
|
+
unless aKeyAttributes.empty?
|
55
|
+
intEntity[:primaryKey] = aKeyAttributes
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# data entity - indexes []
|
60
|
+
if hEntity.has_key?('index')
|
61
|
+
aIndexes = hEntity['index']
|
62
|
+
aIndexes.each do |hIndex|
|
63
|
+
unless hIndex.empty?
|
64
|
+
intEntity[:indexes] << Md_EntityIndex.unpack(hIndex)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# data entity - attributes []
|
70
|
+
if hEntity.has_key?('attribute')
|
71
|
+
aAttributes = hEntity['attribute']
|
72
|
+
aAttributes.each do |hAttribute|
|
73
|
+
unless hAttribute.empty?
|
74
|
+
intEntity[:attributes] << Md_EntityAttribute.unpack(hAttribute)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# data entity - foreign keys []
|
80
|
+
if hEntity.has_key?('foreignKey')
|
81
|
+
aFKeys = hEntity['foreignKey']
|
82
|
+
aFKeys.each do |hFKey|
|
83
|
+
unless hFKey.empty?
|
84
|
+
intEntity[:foreignKeys] << Md_EntityForeignKey.unpack(hFKey)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
return intEntity
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# unpack an data entity attribute
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-12-01 original script
|
6
|
+
|
7
|
+
module Md_EntityAttribute
|
8
|
+
|
9
|
+
def self.unpack(hAttribute)
|
10
|
+
|
11
|
+
# instance classes needed in script
|
12
|
+
intMetadataClass = InternalMetadata.new
|
13
|
+
intAttribute = intMetadataClass.newEntityAttribute
|
14
|
+
|
15
|
+
# attribute - common name
|
16
|
+
if hAttribute.has_key?('commonName')
|
17
|
+
s = hAttribute['commonName']
|
18
|
+
if s != ''
|
19
|
+
intAttribute[:attributeName] = s
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# attribute - code name
|
24
|
+
if hAttribute.has_key?('codeName')
|
25
|
+
s = hAttribute['codeName']
|
26
|
+
if s != ''
|
27
|
+
intAttribute[:attributeCode] = s
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# attribute - definition
|
32
|
+
if hAttribute.has_key?('definition')
|
33
|
+
s = hAttribute['definition']
|
34
|
+
if s != ''
|
35
|
+
intAttribute[:attributeDefinition] = s
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# attribute - data type
|
40
|
+
if hAttribute.has_key?('dataType')
|
41
|
+
s = hAttribute['dataType']
|
42
|
+
if s != ''
|
43
|
+
intAttribute[:dataType] = s
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# attribute - required attribute?
|
48
|
+
if hAttribute.has_key?('allowNull')
|
49
|
+
s = hAttribute['allowNull']
|
50
|
+
if s != ''
|
51
|
+
intAttribute[:allowNull] = s
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# attribute - units of measure
|
56
|
+
if hAttribute.has_key?('units')
|
57
|
+
s = hAttribute['units']
|
58
|
+
if s != ''
|
59
|
+
intAttribute[:unitOfMeasure] = s
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# attribute - domain ID
|
64
|
+
if hAttribute.has_key?('domainId')
|
65
|
+
s = hAttribute['domainId']
|
66
|
+
if s != ''
|
67
|
+
intAttribute[:domainId] = s
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# attribute - minimum value
|
72
|
+
if hAttribute.has_key?('minValue')
|
73
|
+
s = hAttribute['minValue']
|
74
|
+
if s != ''
|
75
|
+
intAttribute[:minValue] = s
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# attribute - maximum value
|
80
|
+
if hAttribute.has_key?('maxValue')
|
81
|
+
s = hAttribute['maxValue']
|
82
|
+
if s != ''
|
83
|
+
intAttribute[:maxValue] = s
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
return intAttribute
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# unpack an data entity foreign key
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-12-01 original script
|
6
|
+
|
7
|
+
module Md_EntityForeignKey
|
8
|
+
|
9
|
+
def self.unpack(hFKey)
|
10
|
+
|
11
|
+
# instance classes needed in script
|
12
|
+
intMetadataClass = InternalMetadata.new
|
13
|
+
intFKey = intMetadataClass.newEntityForeignKey
|
14
|
+
|
15
|
+
# entity foreign key - local attribute code name
|
16
|
+
if hFKey.has_key?('localAttributeCodeName')
|
17
|
+
aLocalAttributes = hFKey['localAttributeCodeName']
|
18
|
+
unless aLocalAttributes.empty?
|
19
|
+
intFKey[:fkLocalAttributes] = aLocalAttributes
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# entity foreign key - referenced entity code name
|
24
|
+
if hFKey.has_key?('referencedEntityCodeName')
|
25
|
+
s = hFKey['referencedEntityCodeName']
|
26
|
+
if s != ''
|
27
|
+
intFKey[:fkReferencedEntity] = s
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# entity foreign key - referenced attribute code name
|
32
|
+
if hFKey.has_key?('referencedAttributeCodeName')
|
33
|
+
aRefAttributes = hFKey['referencedAttributeCodeName']
|
34
|
+
unless aRefAttributes.empty?
|
35
|
+
intFKey[:fkReferencedAttributes] = aRefAttributes
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
return intFKey
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# unpack an data entity index
|
2
|
+
# Reader - ADIwg JSON V1 to internal data structure
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2013-12-01 original script
|
6
|
+
|
7
|
+
module Md_EntityIndex
|
8
|
+
|
9
|
+
def self.unpack(hIndex)
|
10
|
+
|
11
|
+
# instance classes needed in script
|
12
|
+
intMetadataClass = InternalMetadata.new
|
13
|
+
intIndex = intMetadataClass.newEntityIndex
|
14
|
+
|
15
|
+
# entity index - code name
|
16
|
+
if hIndex.has_key?('codeName')
|
17
|
+
s = hIndex['codeName']
|
18
|
+
if s != ''
|
19
|
+
intIndex[:indexCode] = s
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# entity index - allow duplicates
|
24
|
+
if hIndex.has_key?('allowDuplicates')
|
25
|
+
s = hIndex['allowDuplicates']
|
26
|
+
if s != ''
|
27
|
+
intIndex[:duplicate] = s
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# entity index - attribute list
|
32
|
+
if hIndex.has_key?('attributeCodeName')
|
33
|
+
aKeyAttributes = hIndex['attributeCodeName']
|
34
|
+
unless aKeyAttributes.empty?
|
35
|
+
intIndex[:attributeNames] = aKeyAttributes
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
return intIndex
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -13,7 +13,7 @@ require ADIWG::Mdtranslator.reader_module('module_geographicElement', $response[
|
|
13
13
|
require ADIWG::Mdtranslator.reader_module('module_temporalElement', $response[:readerVersionUsed])
|
14
14
|
require ADIWG::Mdtranslator.reader_module('module_verticalElement', $response[:readerVersionUsed])
|
15
15
|
|
16
|
-
module
|
16
|
+
module Md_Extent
|
17
17
|
|
18
18
|
def self.unpack(hExtent)
|
19
19
|
|
@@ -33,7 +33,7 @@ module Adiwg_Extent
|
|
33
33
|
if hExtent.has_key?('geographicElement')
|
34
34
|
aGeoElements = hExtent['geographicElement']
|
35
35
|
unless aGeoElements.empty?
|
36
|
-
intExtent[:extGeoElements] =
|
36
|
+
intExtent[:extGeoElements] = Md_GeographicElement.unpack(aGeoElements)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -41,7 +41,7 @@ module Adiwg_Extent
|
|
41
41
|
if hExtent.has_key?('temporalElement')
|
42
42
|
hTempElement = hExtent['temporalElement']
|
43
43
|
unless hTempElement.empty?
|
44
|
-
intExtent[:extTempElements] =
|
44
|
+
intExtent[:extTempElements] = Md_TemporalElement.unpack(hTempElement)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ module Adiwg_Extent
|
|
50
50
|
aVertElements = hExtent['verticalElement']
|
51
51
|
unless aVertElements.empty?
|
52
52
|
aVertElements.each do |hVertElement|
|
53
|
-
intExtent[:extVertElements] <<
|
53
|
+
intExtent[:extVertElements] << Md_VerticalElement.unpack(hVertElement)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoProperties.rb
RENAMED
@@ -10,7 +10,7 @@ require ADIWG::Mdtranslator.reader_module('module_temporalElement', $response[:r
|
|
10
10
|
require ADIWG::Mdtranslator.reader_module('module_verticalElement', $response[:readerVersionUsed])
|
11
11
|
require ADIWG::Mdtranslator.reader_module('module_resourceIdentifier', $response[:readerVersionUsed])
|
12
12
|
|
13
|
-
module
|
13
|
+
module Md_GeoProperties
|
14
14
|
|
15
15
|
def self.unpack(hGeoProps, intElement)
|
16
16
|
|
@@ -42,7 +42,7 @@ module Adiwg_GeoProperties
|
|
42
42
|
if hGeoProps.has_key?('temporalElement')
|
43
43
|
hTempEle = hGeoProps['temporalElement']
|
44
44
|
unless hTempEle.empty?
|
45
|
-
intElement[:temporalElements] =
|
45
|
+
intElement[:temporalElements] = Md_TemporalElement.unpack(hTempEle)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -51,7 +51,7 @@ module Adiwg_GeoProperties
|
|
51
51
|
aVertEle = hGeoProps['verticalElement']
|
52
52
|
unless aVertEle.empty?
|
53
53
|
aVertEle.each do |hVertEle|
|
54
|
-
intElement[:verticalElements] <<
|
54
|
+
intElement[:verticalElements] << Md_VerticalElement.unpack(hVertEle)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -61,7 +61,7 @@ module Adiwg_GeoProperties
|
|
61
61
|
aResIds = hGeoProps['identifier']
|
62
62
|
unless aResIds.empty?
|
63
63
|
aResIds.each do |hIdentifier|
|
64
|
-
intElement[:elementIdentifiers] <<
|
64
|
+
intElement[:elementIdentifiers] << Md_ResourceIdentifier.unpack(hIdentifier)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geographicElement.rb
RENAMED
@@ -22,7 +22,7 @@ require ADIWG::Mdtranslator.reader_module('module_point', $response[:readerVersi
|
|
22
22
|
require ADIWG::Mdtranslator.reader_module('module_lineString', $response[:readerVersionUsed])
|
23
23
|
require ADIWG::Mdtranslator.reader_module('module_polygon', $response[:readerVersionUsed])
|
24
24
|
|
25
|
-
module
|
25
|
+
module Md_GeographicElement
|
26
26
|
|
27
27
|
def self.unpack(aGeoElements)
|
28
28
|
|
@@ -58,13 +58,13 @@ module Adiwg_GeographicElement
|
|
58
58
|
# set geographic element coordinate reference system - CRS
|
59
59
|
if hGeoJsonElement.has_key?('crs')
|
60
60
|
hGeoCrs = hGeoJsonElement['crs']
|
61
|
-
|
61
|
+
Md_GeoCoordSystem.unpack(hGeoCrs, hGeoElement)
|
62
62
|
end
|
63
63
|
|
64
64
|
# set geographic element properties
|
65
65
|
if hGeoJsonElement.has_key?('properties')
|
66
66
|
hGeoProps = hGeoJsonElement['properties']
|
67
|
-
|
67
|
+
Md_GeoProperties.unpack(hGeoProps, hGeoElement)
|
68
68
|
end
|
69
69
|
|
70
70
|
# process geographic element bounding box
|
@@ -75,7 +75,7 @@ module Adiwg_GeographicElement
|
|
75
75
|
aBBox = hGeoJsonElement['bbox']
|
76
76
|
|
77
77
|
boxElement = Marshal.load(Marshal.dump(hGeoElement))
|
78
|
-
boxElement[:elementGeometry] =
|
78
|
+
boxElement[:elementGeometry] = Md_BoundingBox.unpack(aBBox)
|
79
79
|
|
80
80
|
aIntGeoEle << boxElement
|
81
81
|
end
|
@@ -99,11 +99,11 @@ module Adiwg_GeographicElement
|
|
99
99
|
unless aCoordinates.empty?
|
100
100
|
case geometryType
|
101
101
|
when 'Point', 'MultiPoint'
|
102
|
-
hGeoElement[:elementGeometry] =
|
102
|
+
hGeoElement[:elementGeometry] = Md_Point.unpack(aCoordinates, geometryType)
|
103
103
|
when 'LineString', 'MultiLineString'
|
104
|
-
hGeoElement[:elementGeometry] =
|
104
|
+
hGeoElement[:elementGeometry] = Md_LineString.unpack(aCoordinates, geometryType)
|
105
105
|
when 'Polygon', 'MultiPolygon'
|
106
|
-
hGeoElement[:elementGeometry] =
|
106
|
+
hGeoElement[:elementGeometry] = Md_Polygon.unpack(aCoordinates, geometryType)
|
107
107
|
else
|
108
108
|
# log - the GeoJSON geometry type is not supported
|
109
109
|
end
|
@@ -122,7 +122,7 @@ module Adiwg_GeographicElement
|
|
122
122
|
unless aFeatures.empty?
|
123
123
|
intGeometry = intMetadataClass.newGeometry
|
124
124
|
intGeometry[:geoType] = 'MultiGeometry'
|
125
|
-
intGeometry[:geometry] =
|
125
|
+
intGeometry[:geometry] = Md_GeographicElement.unpack(aFeatures)
|
126
126
|
hGeoElement[:elementGeometry] = intGeometry
|
127
127
|
aIntGeoEle << hGeoElement
|
128
128
|
end
|
@@ -131,17 +131,17 @@ module Adiwg_GeographicElement
|
|
131
131
|
# GeoJSON Geometries
|
132
132
|
when 'Point', 'MultiPoint'
|
133
133
|
aCoordinates = hGeoJsonElement['coordinates']
|
134
|
-
hGeoElement[:elementGeometry] =
|
134
|
+
hGeoElement[:elementGeometry] = Md_Point.unpack(aCoordinates, elementType)
|
135
135
|
aIntGeoEle << hGeoElement
|
136
136
|
|
137
137
|
when 'LineString', 'MultiLineString'
|
138
138
|
aCoordinates = hGeoJsonElement['coordinates']
|
139
|
-
hGeoElement[:elementGeometry] =
|
139
|
+
hGeoElement[:elementGeometry] = Md_LineString.unpack(aCoordinates, elementType)
|
140
140
|
aIntGeoEle << hGeoElement
|
141
141
|
|
142
142
|
when 'Polygon', 'MultiPolygon'
|
143
143
|
aCoordinates = hGeoJsonElement['coordinates']
|
144
|
-
hGeoElement[:elementGeometry] =
|
144
|
+
hGeoElement[:elementGeometry] = Md_Polygon.unpack(aCoordinates, elementType)
|
145
145
|
aIntGeoEle << hGeoElement
|
146
146
|
|
147
147
|
# GeoJSON Geometry Collection
|
@@ -151,7 +151,7 @@ module Adiwg_GeographicElement
|
|
151
151
|
unless aGeometries.empty?
|
152
152
|
intGeometry = intMetadataClass.newGeometry
|
153
153
|
intGeometry[:geoType] = 'MultiGeometry'
|
154
|
-
intGeometry[:geometry] =
|
154
|
+
intGeometry[:geometry] = Md_GeographicElement.unpack(aGeometries)
|
155
155
|
hGeoElement[:elementGeometry] = intGeometry
|
156
156
|
aIntGeoEle << hGeoElement
|
157
157
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
require ADIWG::Mdtranslator.reader_module('module_coordinates', $response[:readerVersionUsed])
|
11
11
|
|
12
|
-
module
|
12
|
+
module Md_LineString
|
13
13
|
|
14
14
|
def self.unpack(aCoords, geoType)
|
15
15
|
intMetadataClass = InternalMetadata.new
|
@@ -17,7 +17,7 @@ module Adiwg_LineString
|
|
17
17
|
|
18
18
|
intLine[:geoType] = geoType
|
19
19
|
intLine[:geometry] = aCoords
|
20
|
-
intLine[:dimension] =
|
20
|
+
intLine[:dimension] = Md_Coordinates.getDimension(aCoords)
|
21
21
|
|
22
22
|
return intLine
|
23
23
|
end
|