adiwg-mdtranslator 2.13.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +26 -14
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +56 -41
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +1 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader_messages_eng.yml +377 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +10 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +11 -21
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +18 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +22 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +17 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contactPostprocess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +9 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +6 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +17 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +12 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +14 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +20 -19
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +7 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +8 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +8 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +10 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +8 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +4 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +13 -20
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +12 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +10 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +9 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +59 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +9 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +10 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +16 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +8 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +25 -28
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +15 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +11 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +29 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +6 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +11 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +6 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +10 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +14 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +14 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +8 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +7 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +12 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +9 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +22 -26
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +13 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +7 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +12 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +12 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +10 -10
- data/lib/adiwg/mdtranslator/version.rb +8 -3
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialOrganization.rb +78 -84
- data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibility.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +23 -14
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer_messages_eng.yml +2 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +10 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_date.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_dictionary.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_geographicExtent.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_mdJson.rb +5 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_medium.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_party.rb +1 -5
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_repository.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_verticalDatumParameters.rb +1 -0
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +11 -11
- metadata +4 -3
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-19 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-25 original script
|
7
7
|
|
8
8
|
require_relative 'module_geometryObject'
|
@@ -17,11 +17,13 @@ module ADIWG
|
|
17
17
|
|
18
18
|
module GeoJson
|
19
19
|
|
20
|
-
def self.unpack(hGeoJson, responseObj)
|
20
|
+
def self.unpack(hGeoJson, responseObj, inContext = nil)
|
21
|
+
|
22
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
21
23
|
|
22
24
|
# return nil object if input is empty
|
23
25
|
if hGeoJson.empty?
|
24
|
-
responseObj
|
26
|
+
@MessagePath.issueWarning(340, responseObj, inContext)
|
25
27
|
return nil
|
26
28
|
end
|
27
29
|
|
@@ -54,6 +56,9 @@ module ADIWG
|
|
54
56
|
intGeoEle = hReturn
|
55
57
|
end
|
56
58
|
end
|
59
|
+
if intGeoEle.empty?
|
60
|
+
@MessagePath.issueError(341, responseObj, inContext)
|
61
|
+
end
|
57
62
|
|
58
63
|
end
|
59
64
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-19 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-10-23 original script
|
7
7
|
|
8
8
|
require_relative 'module_identifier'
|
@@ -14,11 +14,13 @@ module ADIWG
|
|
14
14
|
|
15
15
|
module Geodetic
|
16
16
|
|
17
|
-
def self.unpack(hGeodetic, responseObj)
|
17
|
+
def self.unpack(hGeodetic, responseObj, inContext = nil)
|
18
|
+
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
20
|
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hGeodetic.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(310, responseObj, inContext)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -26,10 +28,13 @@ module ADIWG
|
|
26
28
|
intMetadataClass = InternalMetadata.new
|
27
29
|
intGeodetic = intMetadataClass.newGeodetic
|
28
30
|
|
31
|
+
outContext = 'geodetic parameters'
|
32
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
33
|
+
|
29
34
|
# geodetic - datum identifier {identifier}
|
30
35
|
if hGeodetic.has_key?('datumIdentifier')
|
31
36
|
unless hGeodetic['datumIdentifier'].empty?
|
32
|
-
hReturn = Identifier.unpack(hGeodetic['datumIdentifier'], responseObj)
|
37
|
+
hReturn = Identifier.unpack(hGeodetic['datumIdentifier'], responseObj, outContext)
|
33
38
|
unless hReturn.nil?
|
34
39
|
intGeodetic[:datumIdentifier] = hReturn
|
35
40
|
end
|
@@ -46,7 +51,7 @@ module ADIWG
|
|
46
51
|
# geodetic - ellipsoid identifier {identifier}
|
47
52
|
if hGeodetic.has_key?('ellipsoidIdentifier')
|
48
53
|
unless hGeodetic['ellipsoidIdentifier'].empty?
|
49
|
-
hReturn = Identifier.unpack(hGeodetic['ellipsoidIdentifier'], responseObj)
|
54
|
+
hReturn = Identifier.unpack(hGeodetic['ellipsoidIdentifier'], responseObj, outContext)
|
50
55
|
unless hReturn.nil?
|
51
56
|
intGeodetic[:ellipsoidIdentifier] = hReturn
|
52
57
|
end
|
@@ -58,9 +63,7 @@ module ADIWG
|
|
58
63
|
intGeodetic[:ellipsoidName] = hGeodetic['ellipsoidName']
|
59
64
|
end
|
60
65
|
if intGeodetic[:ellipsoidName].nil? || intGeodetic[:ellipsoidName] == ''
|
61
|
-
responseObj
|
62
|
-
responseObj[:readerExecutionPass] = false
|
63
|
-
return nil
|
66
|
+
@MessagePath.issueError(311, responseObj, inContext)
|
64
67
|
end
|
65
68
|
|
66
69
|
# geodetic - semi-major axis
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Reader - ADIwg JSON to internal data structure
|
4
4
|
|
5
5
|
# History:
|
6
|
-
# Stan Smith 2018-
|
6
|
+
# Stan Smith 2018-06-19 refactored error and warning messaging
|
7
7
|
# Stan Smith 2017-09-28 added description element to support fgdc
|
8
8
|
# Stan Smith 2016-12-01 original script
|
9
9
|
|
@@ -18,11 +18,13 @@ module ADIWG
|
|
18
18
|
|
19
19
|
module GeographicExtent
|
20
20
|
|
21
|
-
def self.unpack(hGeoExt, responseObj)
|
21
|
+
def self.unpack(hGeoExt, responseObj, inContext = nil)
|
22
|
+
|
23
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
24
|
|
23
25
|
# return nil object if input is empty
|
24
26
|
if hGeoExt.empty?
|
25
|
-
responseObj
|
27
|
+
@MessagePath.issueWarning(320, responseObj, inContext)
|
26
28
|
return nil
|
27
29
|
end
|
28
30
|
|
@@ -30,6 +32,9 @@ module ADIWG
|
|
30
32
|
intMetadataClass = InternalMetadata.new
|
31
33
|
intGeoExt = intMetadataClass.newGeographicExtent
|
32
34
|
|
35
|
+
outContext = 'geographic extent'
|
36
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
37
|
+
|
33
38
|
haveGExtent = false
|
34
39
|
|
35
40
|
# geographic extent - description
|
@@ -50,7 +55,7 @@ module ADIWG
|
|
50
55
|
# geographic extent - identifier
|
51
56
|
if hGeoExt.has_key?('identifier')
|
52
57
|
unless hGeoExt['identifier'].empty?
|
53
|
-
hReturn = Identifier.unpack(hGeoExt['identifier'], responseObj)
|
58
|
+
hReturn = Identifier.unpack(hGeoExt['identifier'], responseObj, outContext)
|
54
59
|
unless hReturn.nil?
|
55
60
|
intGeoExt[:identifier] = hReturn
|
56
61
|
end
|
@@ -61,7 +66,7 @@ module ADIWG
|
|
61
66
|
# geographic extent - bounding box
|
62
67
|
if hGeoExt.has_key?('boundingBox')
|
63
68
|
unless hGeoExt['boundingBox'].empty?
|
64
|
-
hReturn = BoundingBox.unpack(hGeoExt['boundingBox'], responseObj)
|
69
|
+
hReturn = BoundingBox.unpack(hGeoExt['boundingBox'], responseObj, outContext)
|
65
70
|
unless hReturn.nil?
|
66
71
|
intGeoExt[:boundingBox] = hReturn
|
67
72
|
haveGExtent = true
|
@@ -72,7 +77,7 @@ module ADIWG
|
|
72
77
|
# geographic extent - geographic elements
|
73
78
|
if hGeoExt.has_key?('geographicElement')
|
74
79
|
hGeoExt['geographicElement'].each do |hElement|
|
75
|
-
hReturn = GeoJson.unpack(hElement, responseObj)
|
80
|
+
hReturn = GeoJson.unpack(hElement, responseObj, outContext)
|
76
81
|
unless hReturn.nil?
|
77
82
|
intGeoExt[:geographicElements] << hReturn
|
78
83
|
haveGExtent = true
|
@@ -94,10 +99,7 @@ module ADIWG
|
|
94
99
|
|
95
100
|
# error messages
|
96
101
|
unless haveGExtent
|
97
|
-
responseObj
|
98
|
-
'ERROR: mdJson reader: geographic extent must have at least one description, identifier, bounding box, or geographic element'
|
99
|
-
responseObj[:readerExecutionPass] = false
|
100
|
-
return nil
|
102
|
+
@MessagePath.issueError(321, responseObj, inContext)
|
101
103
|
end
|
102
104
|
|
103
105
|
return intGeoExt
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-19 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-10-19 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,15 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module GeographicResolution
|
14
14
|
|
15
|
-
def self.unpack(hGeoRes, responseObj)
|
15
|
+
def self.unpack(hGeoRes, responseObj, outContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
|
+
|
19
|
+
outContext = 'spatial resolution'
|
16
20
|
|
17
21
|
# return nil object if input is empty
|
18
22
|
if hGeoRes.empty?
|
19
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(330, responseObj, outContext)
|
20
24
|
return nil
|
21
25
|
end
|
22
26
|
|
@@ -29,10 +33,7 @@ module ADIWG
|
|
29
33
|
intGeoRes[:latitudeResolution] = hGeoRes['latitudeResolution']
|
30
34
|
end
|
31
35
|
if intGeoRes[:latitudeResolution].nil? || intGeoRes[:latitudeResolution] == ''
|
32
|
-
responseObj
|
33
|
-
'WARNING: mdJson reader: geographic spatial resolution latitude resolution is missing'
|
34
|
-
responseObj[:readerExecutionPass] = false
|
35
|
-
return nil
|
36
|
+
@MessagePath.issueError(331, responseObj, outContext)
|
36
37
|
end
|
37
38
|
|
38
39
|
# geographic resolution - longitude resolution (required)
|
@@ -40,9 +41,7 @@ module ADIWG
|
|
40
41
|
intGeoRes[:longitudeResolution] = hGeoRes['longitudeResolution']
|
41
42
|
end
|
42
43
|
if intGeoRes[:longitudeResolution].nil? || intGeoRes[:longitudeResolution] == ''
|
43
|
-
responseObj
|
44
|
-
responseObj[:readerExecutionPass] = false
|
45
|
-
return nil
|
44
|
+
@MessagePath.issueError(332, responseObj, outContext)
|
46
45
|
end
|
47
46
|
|
48
47
|
# geographic resolution - unit of measure (required)
|
@@ -50,9 +49,7 @@ module ADIWG
|
|
50
49
|
intGeoRes[:unitOfMeasure] = hGeoRes['unitOfMeasure']
|
51
50
|
end
|
52
51
|
if intGeoRes[:unitOfMeasure].nil? || intGeoRes[:unitOfMeasure] == ''
|
53
|
-
responseObj
|
54
|
-
responseObj[:readerExecutionPass] = false
|
55
|
-
return nil
|
52
|
+
@MessagePath.issueError(333, responseObj, outContext)
|
56
53
|
end
|
57
54
|
|
58
55
|
return intGeoRes
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-20 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-11-07 original script
|
7
7
|
|
8
8
|
require_relative 'module_citation'
|
@@ -14,11 +14,13 @@ module ADIWG
|
|
14
14
|
|
15
15
|
module GeologicAge
|
16
16
|
|
17
|
-
def self.unpack(hGeoAge, responseObj)
|
17
|
+
def self.unpack(hGeoAge, responseObj, inContext = nil)
|
18
|
+
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
18
20
|
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hGeoAge.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(350, responseObj, inContext)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -26,14 +28,15 @@ module ADIWG
|
|
26
28
|
intMetadataClass = InternalMetadata.new
|
27
29
|
intGeoAge = intMetadataClass.newGeologicAge
|
28
30
|
|
31
|
+
outContext = 'geologic age'
|
32
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
33
|
+
|
29
34
|
# geologic age - time scale (required)
|
30
35
|
if hGeoAge.has_key?('ageTimeScale')
|
31
36
|
intGeoAge[:ageTimeScale] = hGeoAge['ageTimeScale']
|
32
37
|
end
|
33
38
|
if intGeoAge[:ageTimeScale].nil? || intGeoAge[:ageTimeScale] == ''
|
34
|
-
responseObj
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
39
|
+
@MessagePath.issueError(351, responseObj, inContext)
|
37
40
|
end
|
38
41
|
|
39
42
|
# geologic age - age estimate (required)
|
@@ -41,9 +44,7 @@ module ADIWG
|
|
41
44
|
intGeoAge[:ageEstimate] = hGeoAge['ageEstimate']
|
42
45
|
end
|
43
46
|
if intGeoAge[:ageEstimate].nil? || intGeoAge[:ageEstimate] == ''
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
47
|
+
@MessagePath.issueError(352, responseObj, inContext)
|
47
48
|
end
|
48
49
|
|
49
50
|
# geologic age - age uncertainty
|
@@ -64,7 +65,7 @@ module ADIWG
|
|
64
65
|
if hGeoAge.has_key?('ageReference')
|
65
66
|
hGeoAge['ageReference'].each do |hCitation|
|
66
67
|
unless hCitation.empty?
|
67
|
-
hReturn = Citation.unpack(hCitation, responseObj)
|
68
|
+
hReturn = Citation.unpack(hCitation, responseObj, outContext)
|
68
69
|
unless hReturn.nil?
|
69
70
|
intGeoAge[:ageReferences] << hReturn
|
70
71
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-20 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-11-11 added computedBbox computation
|
7
7
|
# Stan Smith 2016-10-25 original script
|
8
8
|
|
9
|
-
require_relative 'module_geoJson'
|
10
9
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
10
|
+
require_relative 'module_geoJson'
|
11
11
|
|
12
12
|
module ADIWG
|
13
13
|
module Mdtranslator
|
@@ -18,9 +18,11 @@ module ADIWG
|
|
18
18
|
|
19
19
|
def self.unpack(hGeoCol, responseObj)
|
20
20
|
|
21
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
22
|
+
|
21
23
|
# return nil object if input is empty
|
22
24
|
if hGeoCol.empty?
|
23
|
-
responseObj
|
25
|
+
@MessagePath.issueWarning(360, responseObj)
|
24
26
|
return nil
|
25
27
|
end
|
26
28
|
|
@@ -34,16 +36,12 @@ module ADIWG
|
|
34
36
|
if hGeoCol['type'] == 'GeometryCollection'
|
35
37
|
intGeoCol[:type] = hGeoCol['type']
|
36
38
|
else
|
37
|
-
responseObj
|
38
|
-
responseObj[:readerExecutionPass] = false
|
39
|
-
return nil
|
39
|
+
@MessagePath.issueError(361, responseObj)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
if intGeoCol[:type].nil? || intGeoCol[:type] == ''
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
44
|
+
@MessagePath.issueError(362, responseObj)
|
47
45
|
end
|
48
46
|
|
49
47
|
# geometry collection - bounding box
|
@@ -62,9 +60,7 @@ module ADIWG
|
|
62
60
|
end
|
63
61
|
end
|
64
62
|
else
|
65
|
-
responseObj
|
66
|
-
responseObj[:readerExecutionPass] = false
|
67
|
-
return nil
|
63
|
+
@MessagePath.issueError(363, responseObj)
|
68
64
|
end
|
69
65
|
|
70
66
|
# geometry collection - compute bbox for geometry collection
|
@@ -2,14 +2,14 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-20 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-11-10 added computedBbox computation
|
7
7
|
# Stan Smith 2016-10-25 original script
|
8
8
|
|
9
|
+
require 'adiwg/mdtranslator/internal/module_coordinates'
|
9
10
|
require_relative 'module_geometryObject'
|
10
11
|
require_relative 'module_geometryProperties'
|
11
12
|
require_relative 'module_geometryCollection'
|
12
|
-
require 'adiwg/mdtranslator/internal/module_coordinates'
|
13
13
|
|
14
14
|
module ADIWG
|
15
15
|
module Mdtranslator
|
@@ -20,9 +20,11 @@ module ADIWG
|
|
20
20
|
|
21
21
|
def self.unpack(hFeature, responseObj)
|
22
22
|
|
23
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
24
|
+
|
23
25
|
# return nil object if input is empty
|
24
26
|
if hFeature.empty?
|
25
|
-
responseObj
|
27
|
+
@MessagePath.issueWarning(370, responseObj)
|
26
28
|
return nil
|
27
29
|
end
|
28
30
|
|
@@ -36,16 +38,12 @@ module ADIWG
|
|
36
38
|
if hFeature['type'] == 'Feature'
|
37
39
|
intFeature[:type] = hFeature['type']
|
38
40
|
else
|
39
|
-
responseObj
|
40
|
-
responseObj[:readerExecutionPass] = false
|
41
|
-
return nil
|
41
|
+
@MessagePath.issueError(371, responseObj)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
if intFeature[:type].nil? || intFeature[:type] == ''
|
46
|
-
responseObj
|
47
|
-
responseObj[:readerExecutionPass] = false
|
48
|
-
return nil
|
46
|
+
@MessagePath.issueError(372, responseObj)
|
49
47
|
end
|
50
48
|
|
51
49
|
# geometry feature - id
|
@@ -76,9 +74,7 @@ module ADIWG
|
|
76
74
|
end
|
77
75
|
end
|
78
76
|
else
|
79
|
-
responseObj
|
80
|
-
responseObj[:readerExecutionPass] = false
|
81
|
-
return nil
|
77
|
+
@MessagePath.issueError(373, responseObj)
|
82
78
|
end
|
83
79
|
|
84
80
|
# geometry feature - properties
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2018-
|
5
|
+
# Stan Smith 2018-06-20 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-24 original script
|
7
7
|
|
8
8
|
require_relative 'module_geometryCollection'
|
@@ -16,9 +16,11 @@ module ADIWG
|
|
16
16
|
|
17
17
|
def self.unpack(hGeoObject, responseObj)
|
18
18
|
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
20
|
+
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hGeoObject.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(380, responseObj)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -33,17 +35,12 @@ module ADIWG
|
|
33
35
|
if %w{ Point LineString Polygon MultiPoint MultiLineString MultiPolygon }.one? {|word| word == type}
|
34
36
|
intGeoObject[:type] = hGeoObject['type']
|
35
37
|
else
|
36
|
-
responseObj
|
37
|
-
'ERROR: mdJson reader: GeoJSON geometry object type must be Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon'
|
38
|
-
responseObj[:readerExecutionPass] = false
|
39
|
-
return nil
|
38
|
+
@MessagePath.issueError(381, responseObj)
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
43
42
|
if intGeoObject[:type].nil? || intGeoObject[:type] == ''
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
43
|
+
@MessagePath.issueError(382, responseObj)
|
47
44
|
end
|
48
45
|
|
49
46
|
# geometry object - coordinates (required)
|
@@ -51,9 +48,7 @@ module ADIWG
|
|
51
48
|
intGeoObject[:coordinates] = hGeoObject['coordinates']
|
52
49
|
end
|
53
50
|
if intGeoObject[:coordinates].empty?
|
54
|
-
responseObj
|
55
|
-
responseObj[:readerExecutionPass] = false
|
56
|
-
return nil
|
51
|
+
@MessagePath.issueError(383, responseObj)
|
57
52
|
end
|
58
53
|
|
59
54
|
# geometry object - save native GeoJSON
|