adiwg-mdtranslator 2.9.2 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
- data/lib/adiwg/mdtranslator/version.rb +9 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
- data/lib/adiwg/mdtranslator.rb +177 -165
- data/lib/adiwg/mdtranslator_cli.rb +8 -3
- metadata +2 -2
@@ -2,77 +2,76 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-06 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
9
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
10
|
+
# Stan Smith 2015-07-24 added error reporting of missing items
|
10
11
|
# Stan Smith 2013-12-01 original script
|
11
12
|
|
12
13
|
module ADIWG
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module MdJson
|
16
17
|
|
17
|
-
|
18
|
+
module EntityForeignKey
|
18
19
|
|
19
|
-
|
20
|
+
def self.unpack(hFKey, responseObj)
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
22
|
+
# return nil object if input is empty
|
23
|
+
if hFKey.empty?
|
24
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data entity foreign key object is empty'
|
25
|
+
return nil
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
# instance classes needed in script
|
29
|
+
intMetadataClass = InternalMetadata.new
|
30
|
+
intFKey = intMetadataClass.newEntityForeignKey
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
32
|
+
# entity foreign key - local attribute code name [] (required)
|
33
|
+
# return nil if no local attribute is provided
|
34
|
+
if hFKey.has_key?('localAttributeCodeName')
|
35
|
+
intFKey[:fkLocalAttributes] = hFKey['localAttributeCodeName']
|
36
|
+
end
|
37
|
+
if intFKey[:fkLocalAttributes].empty?
|
38
|
+
responseObj[:readerExecutionMessages] <<
|
39
|
+
'ERROR: mdJson reader: data entity foreign key local attribute code name is missing'
|
40
|
+
responseObj[:readerExecutionPass] = false
|
41
|
+
return nil
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
# entity foreign key - referenced entity code name (required)
|
45
|
+
# return nil if no referenced entity is provided
|
46
|
+
if hFKey.has_key?('referencedEntityCodeName')
|
47
|
+
intFKey[:fkReferencedEntity] = hFKey['referencedEntityCodeName']
|
48
|
+
end
|
49
|
+
if intFKey[:fkReferencedEntity].nil? || intFKey[:fkReferencedEntity] == ''
|
50
|
+
responseObj[:readerExecutionMessages] <<
|
51
|
+
'ERROR: mdJson reader: data entity foreign key referenced entity name is missing'
|
52
|
+
responseObj[:readerExecutionPass] = false
|
53
|
+
return nil
|
54
|
+
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
56
|
+
# entity foreign key - referenced attribute code name [] (required)
|
57
|
+
# return nil if no referenced attribute is provided
|
58
|
+
if hFKey.has_key?('referencedAttributeCodeName')
|
59
|
+
intFKey[:fkReferencedAttributes] = hFKey['referencedAttributeCodeName']
|
60
|
+
end
|
61
|
+
if intFKey[:fkReferencedAttributes].empty?
|
62
|
+
responseObj[:readerExecutionMessages] <<
|
63
|
+
'ERROR: mdJson reader: data entity foreign key referenced attribute name is missing'
|
64
|
+
responseObj[:readerExecutionPass] = false
|
65
|
+
return nil
|
66
|
+
end
|
68
67
|
|
69
|
-
|
68
|
+
return intFKey
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
end
|
70
|
+
end
|
74
71
|
|
75
72
|
end
|
76
|
-
|
77
|
-
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
78
77
|
end
|
@@ -2,71 +2,70 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-07 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-24 added error reporting of missing items
|
8
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
10
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
10
11
|
# Stan Smith 2013-12-01 original script
|
11
12
|
|
12
13
|
module ADIWG
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
module Mdtranslator
|
15
|
+
module Readers
|
16
|
+
module MdJson
|
16
17
|
|
17
|
-
|
18
|
+
module EntityIndex
|
18
19
|
|
19
|
-
|
20
|
+
def self.unpack(hIndex, responseObj)
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
22
|
+
# return nil object if input is empty
|
23
|
+
if hIndex.empty?
|
24
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: data dictionary entity index object is empty'
|
25
|
+
return nil
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
# instance classes needed in script
|
29
|
+
intMetadataClass = InternalMetadata.new
|
30
|
+
intIndex = intMetadataClass.newEntityIndex
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
# entity index - code name (required)
|
33
|
+
# return nil if no entity index is provided
|
34
|
+
if hIndex.has_key?('codeName')
|
35
|
+
intIndex[:indexCode] = hIndex['codeName']
|
36
|
+
end
|
37
|
+
if intIndex[:indexCode].nil? || intIndex[:indexCode] == ''
|
38
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: data dictionary entity index code name is missing'
|
39
|
+
responseObj[:readerExecutionPass] = false
|
40
|
+
return nil
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
# entity index - allow duplicates (required)
|
44
|
+
if hIndex.has_key?('allowDuplicates')
|
45
|
+
if hIndex['allowDuplicates'] === true
|
46
|
+
intIndex[:duplicate] = true
|
47
|
+
end
|
48
|
+
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
50
|
+
# entity index - attribute list [] (required)
|
51
|
+
# return nil if no attribute list is provided
|
52
|
+
if hIndex.has_key?('attributeCodeName')
|
53
|
+
intIndex[:attributeNames] = hIndex['attributeCodeName']
|
54
|
+
end
|
55
|
+
if intIndex[:attributeNames].empty?
|
56
|
+
responseObj[:readerExecutionMessages] <<
|
57
|
+
'ERROR: mdJson reader: data dictionary entity index attribute list is missing'
|
58
|
+
responseObj[:readerExecutionPass] = false
|
59
|
+
return nil
|
60
|
+
end
|
62
61
|
|
63
|
-
|
62
|
+
return intIndex
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
end
|
64
|
+
end
|
68
65
|
|
69
66
|
end
|
70
|
-
|
71
|
-
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
72
71
|
end
|
@@ -2,82 +2,96 @@
|
|
2
2
|
# Reader - mdJson to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-30 original script
|
6
7
|
|
7
8
|
require_relative 'module_geographicExtent'
|
8
9
|
require_relative 'module_temporalExtent'
|
9
10
|
require_relative 'module_verticalExtent'
|
10
11
|
|
11
12
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
15
16
|
|
16
|
-
|
17
|
+
module Extent
|
17
18
|
|
18
|
-
|
19
|
+
def self.unpack(hExtent, responseObj)
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
# return nil object if input is empty
|
22
|
+
if hExtent.empty?
|
23
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: extent object is empty'
|
24
|
+
return nil
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
# instance classes needed in script
|
28
|
+
intMetadataClass = InternalMetadata.new
|
29
|
+
intExtent = intMetadataClass.newExtent
|
30
30
|
|
31
|
-
|
32
|
-
if hExtent.has_key?('description')
|
33
|
-
if hExtent['description'] != ''
|
34
|
-
intExtent[:description] = hExtent['description']
|
35
|
-
end
|
36
|
-
end
|
31
|
+
haveExtent = false
|
37
32
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
# extent - description
|
34
|
+
if hExtent.has_key?('description')
|
35
|
+
unless hExtent['description'] == ''
|
36
|
+
intExtent[:description] = hExtent['description']
|
37
|
+
haveExtent = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# extent - geographicExtent
|
42
|
+
if hExtent.has_key?('geographicExtent')
|
43
|
+
hExtent['geographicExtent'].each do |item|
|
44
|
+
unless item.empty?
|
45
|
+
hReturn = GeographicExtent.unpack(item, responseObj)
|
46
|
+
unless hReturn.nil?
|
47
|
+
intExtent[:geographicExtents] << hReturn
|
48
|
+
haveExtent = true
|
49
|
+
end
|
48
50
|
end
|
51
|
+
end
|
52
|
+
end
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
54
|
+
# extent - temporalExtent
|
55
|
+
if hExtent.has_key?('temporalExtent')
|
56
|
+
hExtent['temporalExtent'].each do |item|
|
57
|
+
unless item.empty?
|
58
|
+
hReturn = TemporalExtent.unpack(item, responseObj)
|
59
|
+
unless hReturn.nil?
|
60
|
+
intExtent[:temporalExtents] << hReturn
|
61
|
+
haveExtent = true
|
62
|
+
end
|
60
63
|
end
|
64
|
+
end
|
65
|
+
end
|
61
66
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
67
|
+
# extent - verticalExtent
|
68
|
+
if hExtent.has_key?('verticalExtent')
|
69
|
+
hExtent['verticalExtent'].each do |item|
|
70
|
+
unless item.empty?
|
71
|
+
hReturn = VerticalExtent.unpack(item, responseObj)
|
72
|
+
unless hReturn.nil?
|
73
|
+
intExtent[:verticalExtents] << hReturn
|
74
|
+
haveExtent = true
|
75
|
+
end
|
72
76
|
end
|
77
|
+
end
|
78
|
+
end
|
73
79
|
|
74
|
-
|
80
|
+
# error messages
|
81
|
+
unless haveExtent
|
82
|
+
responseObj[:readerExecutionMessages] <<
|
83
|
+
'ERROR: mdJson reader: extent must have description or at least one geographic, temporal, or vertical extent'
|
84
|
+
responseObj[:readerExecutionPass] = false
|
85
|
+
return nil
|
86
|
+
end
|
75
87
|
|
76
|
-
|
88
|
+
return intExtent
|
77
89
|
|
78
|
-
|
90
|
+
end
|
79
91
|
|
80
92
|
end
|
81
|
-
|
82
|
-
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
83
97
|
end
|
@@ -2,86 +2,87 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-11-10 added computedBbox computation
|
7
|
+
# Stan Smith 2016-10-25 original script
|
7
8
|
|
8
9
|
require_relative 'module_geoJson'
|
9
10
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
10
11
|
|
11
12
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
15
16
|
|
16
|
-
|
17
|
+
module FeatureCollection
|
17
18
|
|
18
|
-
|
19
|
+
def self.unpack(hFeatCol, responseObj)
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
# return nil object if input is empty
|
22
|
+
if hFeatCol.empty?
|
23
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GeoJson feature collection object is empty'
|
24
|
+
return nil
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# feature collection - type (required)
|
32
|
-
if hFeatCol.has_key?('type')
|
33
|
-
if hFeatCol['type'] != ''
|
34
|
-
if hFeatCol['type'] == 'FeatureCollection'
|
35
|
-
intFeatCol[:type] = hFeatCol['type']
|
36
|
-
else
|
37
|
-
responseObj[:readerExecutionMessages] << 'Feature Collection type must be GeometryCollection'
|
38
|
-
responseObj[:readerExecutionPass] = false
|
39
|
-
return nil
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
if intFeatCol[:type].nil? || intFeatCol[:type] == ''
|
44
|
-
responseObj[:readerExecutionMessages] << 'Feature Collection is missing type'
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
47
|
-
end
|
27
|
+
# instance classes needed in script
|
28
|
+
intMetadataClass = InternalMetadata.new
|
29
|
+
intFeatCol = intMetadataClass.newFeatureCollection
|
48
30
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
# feature collection - features (required, but can be empty)
|
57
|
-
if hFeatCol.has_key?('features')
|
58
|
-
hFeatCol['features'].each do |hFeature|
|
59
|
-
hReturn = GeoJson.unpack(hFeature, responseObj)
|
60
|
-
unless hReturn.nil?
|
61
|
-
intFeatCol[:features] << hReturn
|
62
|
-
end
|
63
|
-
end
|
31
|
+
# feature collection - type (required)
|
32
|
+
if hFeatCol.has_key?('type')
|
33
|
+
unless hFeatCol['type'] == ''
|
34
|
+
if hFeatCol['type'] == 'FeatureCollection'
|
35
|
+
intFeatCol[:type] = hFeatCol['type']
|
64
36
|
else
|
65
|
-
|
66
|
-
|
67
|
-
|
37
|
+
responseObj[:readerExecutionMessages] <<
|
38
|
+
'ERROR: mdJson reader: GeoJson feature collection type must be FeatureCollection'
|
39
|
+
responseObj[:readerExecutionPass] = false
|
40
|
+
return nil
|
68
41
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
42
|
+
end
|
43
|
+
end
|
44
|
+
if intFeatCol[:type].nil? || intFeatCol[:type] == ''
|
45
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection type is missing'
|
46
|
+
responseObj[:readerExecutionPass] = false
|
47
|
+
return nil
|
48
|
+
end
|
49
|
+
|
50
|
+
# feature collection - bounding box
|
51
|
+
if hFeatCol.has_key?('bbox')
|
52
|
+
unless hFeatCol['bbox'].empty?
|
53
|
+
intFeatCol[:bbox] = hFeatCol['bbox']
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# feature collection - features (required, but can be empty)
|
58
|
+
if hFeatCol.has_key?('features')
|
59
|
+
hFeatCol['features'].each do |hFeature|
|
60
|
+
hReturn = GeoJson.unpack(hFeature, responseObj)
|
61
|
+
unless hReturn.nil?
|
62
|
+
intFeatCol[:features] << hReturn
|
73
63
|
end
|
64
|
+
end
|
65
|
+
else
|
66
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GeoJson feature collection features are missing'
|
67
|
+
responseObj[:readerExecutionPass] = false
|
68
|
+
return nil
|
69
|
+
end
|
74
70
|
|
75
|
-
|
76
|
-
|
71
|
+
# geometry feature - computed bounding box for extent
|
72
|
+
unless intFeatCol[:features].empty?
|
73
|
+
intFeatCol[:computedBbox] = AdiwgCoordinates.computeBbox(intFeatCol[:features])
|
74
|
+
end
|
77
75
|
|
78
|
-
|
76
|
+
# geometry feature - save native GeoJSON for feature
|
77
|
+
intFeatCol[:nativeGeoJson] = hFeatCol
|
79
78
|
|
80
|
-
|
79
|
+
return intFeatCol
|
81
80
|
|
82
|
-
|
81
|
+
end
|
83
82
|
|
84
83
|
end
|
85
|
-
|
86
|
-
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
87
88
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
5
6
|
# Stan Smith 2018-02-05 add 'technicalPrerequisite'
|
6
7
|
# Stan Smith 2016-10-20 original script
|
7
8
|
|
@@ -18,8 +19,7 @@ module ADIWG
|
|
18
19
|
|
19
20
|
# return nil object if input is empty
|
20
21
|
if hFormat.empty?
|
21
|
-
responseObj[:readerExecutionMessages] << '
|
22
|
-
responseObj[:readerExecutionPass] = false
|
22
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: distribution media format object is empty'
|
23
23
|
return nil
|
24
24
|
end
|
25
25
|
|
@@ -38,28 +38,28 @@ module ADIWG
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
if intFormat[:formatSpecification].empty?
|
41
|
-
responseObj[:readerExecutionMessages] << '
|
41
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: distribution media format specification is missing'
|
42
42
|
responseObj[:readerExecutionPass] = false
|
43
43
|
return nil
|
44
44
|
end
|
45
45
|
|
46
46
|
# format - amendment number
|
47
47
|
if hFormat.has_key?('amendmentNumber')
|
48
|
-
|
48
|
+
unless hFormat['amendmentNumber'] == ''
|
49
49
|
intFormat[:amendmentNumber] = hFormat['amendmentNumber']
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
# format - compression method
|
54
54
|
if hFormat.has_key?('compressionMethod')
|
55
|
-
|
55
|
+
unless hFormat['compressionMethod'] == ''
|
56
56
|
intFormat[:compressionMethod] = hFormat['compressionMethod']
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
# format - compression method
|
61
61
|
if hFormat.has_key?('technicalPrerequisite')
|
62
|
-
|
62
|
+
unless hFormat['technicalPrerequisite'] == ''
|
63
63
|
intFormat[:technicalPrerequisite] = hFormat['technicalPrerequisite']
|
64
64
|
end
|
65
65
|
end
|