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,13 +2,14 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-12 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-14 refactored to remove global namespace constants
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
9
|
+
# Stan Smith 2014-12-30 refactored
|
10
|
+
# Stan Smith 2014-12-24 added return if input hash is empty
|
11
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
|
12
13
|
# Stan Smith 2013-11-27 modified to process single browse graphic rather than array
|
13
14
|
# Stan Smith 2013-10-17 original script
|
14
15
|
|
@@ -16,81 +17,80 @@ require_relative 'module_onlineResource'
|
|
16
17
|
require_relative 'module_constraint'
|
17
18
|
|
18
19
|
module ADIWG
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
20
|
+
module Mdtranslator
|
21
|
+
module Readers
|
22
|
+
module MdJson
|
23
|
+
|
24
|
+
module Graphic
|
25
|
+
|
26
|
+
def self.unpack(hGraphic, responseObj)
|
27
|
+
|
28
|
+
# return nil object if input is empty
|
29
|
+
if hGraphic.empty?
|
30
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: graphic overview object is empty'
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
|
34
|
+
# instance classes needed in script
|
35
|
+
intMetadataClass = InternalMetadata.new
|
36
|
+
intGraphic = intMetadataClass.newGraphic
|
37
|
+
|
38
|
+
# graphic - file name (required)
|
39
|
+
if hGraphic.has_key?('fileName')
|
40
|
+
intGraphic[:graphicName] = hGraphic['fileName']
|
41
|
+
end
|
42
|
+
if intGraphic[:graphicName].nil? || intGraphic[:graphicName] == ''
|
43
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: graphic overview file name is missing'
|
44
|
+
responseObj[:readerExecutionPass] = false
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
|
48
|
+
# graphic - file description
|
49
|
+
if hGraphic.has_key?('fileDescription')
|
50
|
+
unless hGraphic['fileDescription'] == ''
|
51
|
+
intGraphic[:graphicDescription] = hGraphic['fileDescription']
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# graphic - file type
|
56
|
+
if hGraphic.has_key?('fileType')
|
57
|
+
unless hGraphic['fileType'] == ''
|
58
|
+
intGraphic[:graphicType] = hGraphic['fileType']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# graphic - file constraint []
|
63
|
+
if hGraphic.has_key?('fileConstraint')
|
64
|
+
aItems = hGraphic['fileConstraint']
|
65
|
+
aItems.each do |hItem|
|
66
|
+
unless hItem.empty?
|
67
|
+
hReturn = Constraint.unpack(hItem, responseObj)
|
68
|
+
unless hReturn.nil?
|
69
|
+
intGraphic[:graphicConstraints] << hReturn
|
70
|
+
end
|
73
71
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# graphic - online resource []
|
76
|
+
if hGraphic.has_key?('fileUri')
|
77
|
+
hGraphic['fileUri'].each do |item|
|
78
|
+
unless item.empty?
|
79
|
+
uri = OnlineResource.unpack(item, responseObj)
|
80
|
+
unless uri.nil?
|
81
|
+
intGraphic[:graphicURI] << uri
|
82
|
+
end
|
85
83
|
end
|
84
|
+
end
|
85
|
+
end
|
86
86
|
|
87
|
-
|
87
|
+
return intGraphic
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
end
|
89
|
+
end
|
92
90
|
|
93
91
|
end
|
94
|
-
|
95
|
-
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
96
|
end
|
@@ -2,78 +2,83 @@
|
|
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 2016-10-19 original script
|
6
7
|
|
7
8
|
require_relative 'module_dimension'
|
8
9
|
|
9
10
|
module ADIWG
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
module Mdtranslator
|
12
|
+
module Readers
|
13
|
+
module MdJson
|
13
14
|
|
14
|
-
|
15
|
+
module GridRepresentation
|
15
16
|
|
16
|
-
|
17
|
+
def self.unpack(hGrid, responseObj)
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
# instance classes needed in script
|
26
|
-
intMetadataClass = InternalMetadata.new
|
27
|
-
intGrid = intMetadataClass.newGridInfo
|
19
|
+
# return nil object if input is empty
|
20
|
+
if hGrid.empty?
|
21
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: grid representation object is empty'
|
22
|
+
return nil
|
23
|
+
end
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
intGrid[:numberOfDimensions] = hGrid['numberOfDimensions']
|
33
|
-
end
|
34
|
-
end
|
35
|
-
if intGrid[:numberOfDimensions].nil?
|
36
|
-
responseObj[:readerExecutionMessages] << 'Grid Representation attribute numberOfDimensions is missing'
|
37
|
-
responseObj[:readerExecutionPass] = false
|
38
|
-
return nil
|
39
|
-
end
|
25
|
+
# instance classes needed in script
|
26
|
+
intMetadataClass = InternalMetadata.new
|
27
|
+
intGrid = intMetadataClass.newGridInfo
|
40
28
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
29
|
+
# grid representation - number of dimensions (required)
|
30
|
+
if hGrid.has_key?('numberOfDimensions')
|
31
|
+
unless hGrid['numberOfDimensions'] == ''
|
32
|
+
intGrid[:numberOfDimensions] = hGrid['numberOfDimensions']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if intGrid[:numberOfDimensions].nil?
|
36
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation number-of-dimensions is missing'
|
37
|
+
responseObj[:readerExecutionPass] = false
|
38
|
+
return nil
|
39
|
+
end
|
50
40
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if intGrid[:cellGeometry].nil?
|
58
|
-
responseObj[:readerExecutionMessages] << 'Grid Representation attribute cellGeometry is missing'
|
59
|
-
responseObj[:readerExecutionPass] = false
|
60
|
-
return nil
|
41
|
+
# grid representation - dimensions [] (required)
|
42
|
+
if hGrid.has_key?('dimension')
|
43
|
+
hGrid['dimension'].each do |item|
|
44
|
+
hDim = Dimension.unpack(item, responseObj)
|
45
|
+
unless hDim.nil?
|
46
|
+
intGrid[:dimension] << hDim
|
61
47
|
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if intGrid[:dimension].empty?
|
51
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation dimensions are missing'
|
52
|
+
responseObj[:readerExecutionPass] = false
|
53
|
+
return nil
|
54
|
+
end
|
62
55
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
56
|
+
# grid representation - cell geometry (required)
|
57
|
+
if hGrid.has_key?('cellGeometry')
|
58
|
+
unless hGrid['cellGeometry'] == ''
|
59
|
+
intGrid[:cellGeometry] = hGrid['cellGeometry']
|
60
|
+
end
|
61
|
+
end
|
62
|
+
if intGrid[:cellGeometry].nil?
|
63
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: grid representation cell geometry is missing'
|
64
|
+
responseObj[:readerExecutionPass] = false
|
65
|
+
return nil
|
66
|
+
end
|
69
67
|
|
70
|
-
|
68
|
+
# grid representation - transformation parameter available {Boolean} (required)
|
69
|
+
if hGrid.has_key?('transformationParameterAvailable')
|
70
|
+
if hGrid['transformationParameterAvailable'] === true
|
71
|
+
intGrid[:transformationParameterAvailable] = hGrid['transformationParameterAvailable']
|
72
|
+
end
|
73
|
+
end
|
71
74
|
|
72
|
-
|
75
|
+
return intGrid
|
73
76
|
|
74
|
-
|
77
|
+
end
|
75
78
|
|
76
79
|
end
|
77
|
-
|
78
|
-
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
79
84
|
end
|
@@ -2,86 +2,86 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
5
|
+
# Stan Smith 2018-02-18 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-13 refactored for mdJson 2.0
|
7
|
+
# Stan Smith 2015-07-31 added support for fields added by ISO 19115-1 (RS_Identifier)
|
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
|
11
|
+
# Stan Smith 2014-08-18 added type to identifier schema 0.6.0
|
12
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
12
13
|
# Stan Smith 2014-05-28 original script
|
13
14
|
|
14
15
|
require_relative 'module_citation'
|
15
16
|
|
16
17
|
module ADIWG
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
18
|
+
module Mdtranslator
|
19
|
+
module Readers
|
20
|
+
module MdJson
|
21
|
+
|
22
|
+
module Identifier
|
23
|
+
|
24
|
+
def self.unpack(hIdentifier, responseObj)
|
25
|
+
|
26
|
+
# return nil object if input is empty
|
27
|
+
if hIdentifier.empty?
|
28
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: identifier object is empty'
|
29
|
+
return nil
|
30
|
+
end
|
31
|
+
|
32
|
+
# instance classes needed in script
|
33
|
+
intMetadataClass = InternalMetadata.new
|
34
|
+
intIdent = intMetadataClass.newIdentifier
|
35
|
+
|
36
|
+
# identifier - identifier (required)
|
37
|
+
if hIdentifier.has_key?('identifier')
|
38
|
+
intIdent[:identifier] = hIdentifier['identifier']
|
39
|
+
end
|
40
|
+
if intIdent[:identifier].nil? || intIdent[:identifier] == ''
|
41
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: identifier object identifier is missing'
|
42
|
+
responseObj[:readerExecutionPass] = false
|
43
|
+
return nil
|
44
|
+
end
|
45
|
+
|
46
|
+
# identifier - namespace
|
47
|
+
if hIdentifier.has_key?('namespace')
|
48
|
+
unless hIdentifier['namespace'] == ''
|
49
|
+
intIdent[:namespace] = hIdentifier['namespace']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# identifier - version
|
54
|
+
if hIdentifier.has_key?('version')
|
55
|
+
unless hIdentifier['version'] == ''
|
56
|
+
intIdent[:version] = hIdentifier['version']
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# identifier - description
|
61
|
+
if hIdentifier.has_key?('description')
|
62
|
+
unless hIdentifier['description'] == ''
|
63
|
+
intIdent[:description] = hIdentifier['description']
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# identifier - authority (citation)
|
68
|
+
if hIdentifier.has_key?('authority')
|
69
|
+
hObject = hIdentifier['authority']
|
70
|
+
unless hObject.empty?
|
71
|
+
hReturn = Citation.unpack(hObject, responseObj)
|
72
|
+
unless hReturn.nil?
|
73
|
+
intIdent[:citation] = hReturn
|
30
74
|
end
|
75
|
+
end
|
76
|
+
end
|
31
77
|
|
32
|
-
|
33
|
-
intMetadataClass = InternalMetadata.new
|
34
|
-
intIdent= intMetadataClass.newIdentifier
|
78
|
+
return intIdent
|
35
79
|
|
36
|
-
|
37
|
-
if hIdentifier.has_key?('identifier')
|
38
|
-
intIdent[:identifier] = hIdentifier['identifier']
|
39
|
-
end
|
40
|
-
if intIdent[:identifier].nil? || intIdent[:identifier] == ''
|
41
|
-
responseObj[:readerExecutionMessages] << 'Identifier attribute identifier is missing'
|
42
|
-
responseObj[:readerExecutionPass] = false
|
43
|
-
return nil
|
44
|
-
end
|
45
|
-
|
46
|
-
# identifier - namespace
|
47
|
-
if hIdentifier.has_key?('namespace')
|
48
|
-
if hIdentifier['namespace'] != ''
|
49
|
-
intIdent[:namespace] = hIdentifier['namespace']
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# identifier - version
|
54
|
-
if hIdentifier.has_key?('version')
|
55
|
-
if hIdentifier['version'] != ''
|
56
|
-
intIdent[:version] = hIdentifier['version']
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# identifier - description
|
61
|
-
if hIdentifier.has_key?('description')
|
62
|
-
if hIdentifier['description'] != ''
|
63
|
-
intIdent[:description] = hIdentifier['description']
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# identifier - authority (citation)
|
68
|
-
if hIdentifier.has_key?('authority')
|
69
|
-
hObject = hIdentifier['authority']
|
70
|
-
unless hObject.empty?
|
71
|
-
hReturn = Citation.unpack(hObject, responseObj)
|
72
|
-
unless hReturn.nil?
|
73
|
-
intIdent[:citation] = hReturn
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
return intIdent
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
80
|
+
end
|
83
81
|
|
84
82
|
end
|
85
|
-
|
86
|
-
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
87
|
end
|