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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-19 original script
|
7
7
|
|
8
8
|
require_relative 'module_gridRepresentation'
|
@@ -17,24 +17,30 @@ module ADIWG
|
|
17
17
|
|
18
18
|
module SpatialRepresentation
|
19
19
|
|
20
|
-
def self.unpack(hRepresent, responseObj)
|
20
|
+
def self.unpack(hRepresent, 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 hRepresent.empty?
|
24
|
-
responseObj
|
26
|
+
@MessagePath.issueWarning(790, responseObj, inContext)
|
25
27
|
return nil
|
26
28
|
end
|
27
29
|
|
28
30
|
# instance classes needed in script
|
29
31
|
intMetadataClass = InternalMetadata.new
|
30
32
|
intRepresent = intMetadataClass.newSpatialRepresentation
|
33
|
+
|
34
|
+
outContext = 'spatial representation'
|
35
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
36
|
+
|
31
37
|
haveOne = false
|
32
38
|
|
33
39
|
# spatial representation - grid representation (required if not others)
|
34
40
|
if hRepresent.has_key?('gridRepresentation')
|
35
41
|
hRep = hRepresent['gridRepresentation']
|
36
42
|
unless hRep.empty?
|
37
|
-
hObject = GridRepresentation.unpack(hRep, responseObj)
|
43
|
+
hObject = GridRepresentation.unpack(hRep, responseObj, outContext)
|
38
44
|
unless hObject.nil?
|
39
45
|
intRepresent[:gridRepresentation] = hObject
|
40
46
|
haveOne = true
|
@@ -46,7 +52,7 @@ module ADIWG
|
|
46
52
|
if hRepresent.has_key?('vectorRepresentation')
|
47
53
|
hRep = hRepresent['vectorRepresentation']
|
48
54
|
unless hRep.empty?
|
49
|
-
hObject = VectorRepresentation.unpack(hRep, responseObj)
|
55
|
+
hObject = VectorRepresentation.unpack(hRep, responseObj, outContext)
|
50
56
|
unless hObject.nil?
|
51
57
|
intRepresent[:vectorRepresentation] = hObject
|
52
58
|
haveOne = true
|
@@ -58,7 +64,7 @@ module ADIWG
|
|
58
64
|
if hRepresent.has_key?('georectifiedRepresentation')
|
59
65
|
hRep = hRepresent['georectifiedRepresentation']
|
60
66
|
unless hRep.empty?
|
61
|
-
hObject = GeorectifiedRepresentation.unpack(hRep, responseObj)
|
67
|
+
hObject = GeorectifiedRepresentation.unpack(hRep, responseObj, outContext)
|
62
68
|
unless hObject.nil?
|
63
69
|
intRepresent[:georectifiedRepresentation] = hObject
|
64
70
|
haveOne = true
|
@@ -70,7 +76,7 @@ module ADIWG
|
|
70
76
|
if hRepresent.has_key?('georeferenceableRepresentation')
|
71
77
|
hRep = hRepresent['georeferenceableRepresentation']
|
72
78
|
unless hRep.empty?
|
73
|
-
hObject = GeoreferenceableRepresentation.unpack(hRep, responseObj)
|
79
|
+
hObject = GeoreferenceableRepresentation.unpack(hRep, responseObj, outContext)
|
74
80
|
unless hObject.nil?
|
75
81
|
intRepresent[:georeferenceableRepresentation] = hObject
|
76
82
|
haveOne = true
|
@@ -80,10 +86,7 @@ module ADIWG
|
|
80
86
|
|
81
87
|
# error messages
|
82
88
|
unless haveOne
|
83
|
-
responseObj
|
84
|
-
'ERROR: mdJson reader: spatial representation did not have an object of supported type'
|
85
|
-
responseObj[:readerExecutionPass] = false
|
86
|
-
return nil
|
89
|
+
@MessagePath.issueError(791, responseObj, inContext)
|
87
90
|
end
|
88
91
|
|
89
92
|
return intRepresent
|
@@ -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-25 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-10-19 add geographic resolution
|
7
7
|
# Stan Smith 2017-10-19 add bearingDistance resolution
|
8
8
|
# Stan Smith 2017-10-19 add coordinate resolution
|
@@ -24,17 +24,23 @@ module ADIWG
|
|
24
24
|
|
25
25
|
module SpatialResolution
|
26
26
|
|
27
|
-
def self.unpack(hResolution, responseObj)
|
27
|
+
def self.unpack(hResolution, responseObj, inContext = nil)
|
28
|
+
|
29
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
28
30
|
|
29
31
|
# return nil object if input is empty
|
30
32
|
if hResolution.empty?
|
31
|
-
responseObj
|
33
|
+
@MessagePath.issueWarning(800, responseObj, inContext)
|
32
34
|
return nil
|
33
35
|
end
|
34
36
|
|
35
37
|
# instance classes needed in script
|
36
38
|
intMetadataClass = InternalMetadata.new
|
37
39
|
intResolution = intMetadataClass.newSpatialResolution
|
40
|
+
|
41
|
+
outContext = 'spatial resolution'
|
42
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
43
|
+
|
38
44
|
haveOne = false
|
39
45
|
|
40
46
|
# spatial resolution - scale factor (required if not others)
|
@@ -49,7 +55,7 @@ module ADIWG
|
|
49
55
|
if hResolution.has_key?('measure')
|
50
56
|
hMeasure = hResolution['measure']
|
51
57
|
unless hMeasure.empty?
|
52
|
-
hObject = Measure.unpack(hMeasure, responseObj)
|
58
|
+
hObject = Measure.unpack(hMeasure, responseObj, outContext)
|
53
59
|
unless hObject.nil?
|
54
60
|
intResolution[:measure] = hObject
|
55
61
|
haveOne = true
|
@@ -61,7 +67,7 @@ module ADIWG
|
|
61
67
|
if hResolution.has_key?('coordinateResolution')
|
62
68
|
hCoordRes = hResolution['coordinateResolution']
|
63
69
|
unless hCoordRes.empty?
|
64
|
-
hReturn = CoordinateResolution.unpack(hCoordRes, responseObj)
|
70
|
+
hReturn = CoordinateResolution.unpack(hCoordRes, responseObj, outContext)
|
65
71
|
unless hReturn.nil?
|
66
72
|
intResolution[:coordinateResolution] = hReturn
|
67
73
|
haveOne = true
|
@@ -73,7 +79,7 @@ module ADIWG
|
|
73
79
|
if hResolution.has_key?('bearingDistanceResolution')
|
74
80
|
hBearRes = hResolution['bearingDistanceResolution']
|
75
81
|
unless hBearRes.empty?
|
76
|
-
hReturn = BearingDistanceResolution.unpack(hBearRes, responseObj)
|
82
|
+
hReturn = BearingDistanceResolution.unpack(hBearRes, responseObj, outContext)
|
77
83
|
unless hReturn.nil?
|
78
84
|
intResolution[:bearingDistanceResolution] = hReturn
|
79
85
|
haveOne = true
|
@@ -85,7 +91,7 @@ module ADIWG
|
|
85
91
|
if hResolution.has_key?('geographicResolution')
|
86
92
|
hGeoRes = hResolution['geographicResolution']
|
87
93
|
unless hGeoRes.empty?
|
88
|
-
hReturn = GeographicResolution.unpack(hGeoRes, responseObj)
|
94
|
+
hReturn = GeographicResolution.unpack(hGeoRes, responseObj, outContext)
|
89
95
|
unless hReturn.nil?
|
90
96
|
intResolution[:geographicResolution] = hReturn
|
91
97
|
haveOne = true
|
@@ -103,9 +109,7 @@ module ADIWG
|
|
103
109
|
|
104
110
|
# error messages
|
105
111
|
unless haveOne
|
106
|
-
responseObj
|
107
|
-
'WARNING: mdJson reader: spatial resolution did not have an object of supported type'
|
108
|
-
return nil
|
112
|
+
@MessagePath.issueError(801, responseObj, inContext)
|
109
113
|
end
|
110
114
|
|
111
115
|
return intResolution
|
@@ -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-26 refactored error and warning messaging
|
6
6
|
# Stan Smith 2018-04-06 renamed latinName to taxonomicName
|
7
7
|
# Stan Smith 2018-02-19 refactored error and warning messaging
|
8
8
|
# Stan Smith 2017-01-31 added taxonomicSystemId
|
@@ -19,10 +19,11 @@ module ADIWG
|
|
19
19
|
|
20
20
|
def self.unpack(hTaxClass, responseObj)
|
21
21
|
|
22
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
23
|
+
|
22
24
|
# return nil object if input is empty
|
23
25
|
if hTaxClass.empty?
|
24
|
-
responseObj
|
25
|
-
'WARNING: mdJson reader: taxonomic classification object is empty'
|
26
|
+
@MessagePath.issueWarning(810, responseObj)
|
26
27
|
return nil
|
27
28
|
end
|
28
29
|
|
@@ -45,14 +46,10 @@ module ADIWG
|
|
45
46
|
# support deprecation until schema version 3.0
|
46
47
|
if hTaxClass.has_key?('taxonomicRank')
|
47
48
|
intTaxClass[:taxonRank] = hTaxClass['taxonomicRank']
|
48
|
-
responseObj
|
49
|
-
'NOTICE: mdJson reader: taxonomic classification taxonomicRank is deprecated, use taxonomicLevel'
|
49
|
+
@MessagePath.issueNotice(811, responseObj)
|
50
50
|
end
|
51
51
|
if intTaxClass[:taxonRank].nil? || intTaxClass[:taxonRank] == ''
|
52
|
-
responseObj
|
53
|
-
'ERROR: mdJson reader: taxonomic classification level is missing'
|
54
|
-
responseObj[:readerExecutionPass] = false
|
55
|
-
return nil
|
52
|
+
@MessagePath.issueError(812, responseObj)
|
56
53
|
end
|
57
54
|
|
58
55
|
# taxonomic classification - taxonomic name (required)
|
@@ -63,14 +60,10 @@ module ADIWG
|
|
63
60
|
# support deprecation until schema version 3.0
|
64
61
|
if hTaxClass.has_key?('latinName')
|
65
62
|
intTaxClass[:taxonValue] = hTaxClass['latinName']
|
66
|
-
responseObj
|
67
|
-
'NOTICE: mdJson reader: taxonomic classification latinName is deprecated, use taxonomicName'
|
63
|
+
@MessagePath.issueNotice(813, responseObj)
|
68
64
|
end
|
69
65
|
if intTaxClass[:taxonValue].nil? || intTaxClass[:taxonValue] == ''
|
70
|
-
responseObj
|
71
|
-
'ERROR: mdJson reader: taxonomic classification name is missing'
|
72
|
-
responseObj[:readerExecutionPass] = false
|
73
|
-
return nil
|
66
|
+
@MessagePath.issueError(814, responseObj)
|
74
67
|
end
|
75
68
|
|
76
69
|
# taxonomic classification - common name []
|
@@ -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-26 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-12-09 original script
|
7
7
|
|
8
8
|
require_relative 'module_citation'
|
@@ -16,9 +16,11 @@ module ADIWG
|
|
16
16
|
|
17
17
|
def self.unpack(hSystem, responseObj)
|
18
18
|
|
19
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
20
|
+
|
19
21
|
# return nil object if input is empty
|
20
22
|
if hSystem.empty?
|
21
|
-
responseObj
|
23
|
+
@MessagePath.issueWarning(820, responseObj)
|
22
24
|
return nil
|
23
25
|
end
|
24
26
|
|
@@ -37,9 +39,7 @@ module ADIWG
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
if intSystem[:citation].empty?
|
40
|
-
responseObj
|
41
|
-
responseObj[:readerExecutionPass] = false
|
42
|
-
return nil
|
42
|
+
@MessagePath.issueError(821, responseObj)
|
43
43
|
end
|
44
44
|
|
45
45
|
# taxonomy system - modifications
|
@@ -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-26 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-22 original script
|
7
7
|
|
8
8
|
require_relative 'module_taxonomicSystem'
|
@@ -20,9 +20,11 @@ module ADIWG
|
|
20
20
|
|
21
21
|
def self.unpack(hTaxonomy, responseObj)
|
22
22
|
|
23
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
24
|
+
|
23
25
|
# return nil object if input is empty
|
24
26
|
if hTaxonomy.empty?
|
25
|
-
responseObj
|
27
|
+
@MessagePath.issueWarning(830, responseObj)
|
26
28
|
return nil
|
27
29
|
end
|
28
30
|
|
@@ -41,9 +43,7 @@ module ADIWG
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
if intTaxonomy[:taxonSystem].empty?
|
44
|
-
responseObj
|
45
|
-
responseObj[:readerExecutionPass] = false
|
46
|
-
return nil
|
46
|
+
@MessagePath.issueError(831, responseObj)
|
47
47
|
end
|
48
48
|
|
49
49
|
# taxonomy - general taxonomic scope
|
@@ -84,9 +84,7 @@ module ADIWG
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
if intTaxonomy[:idProcedure].nil? || intTaxonomy[:idProcedure] == ''
|
87
|
-
responseObj
|
88
|
-
responseObj[:readerExecutionPass] = false
|
89
|
-
return nil
|
87
|
+
@MessagePath.issueError(832, responseObj)
|
90
88
|
end
|
91
89
|
|
92
90
|
# taxonomy - identification completeness
|
@@ -118,9 +116,7 @@ module ADIWG
|
|
118
116
|
end
|
119
117
|
end
|
120
118
|
if intTaxonomy[:taxonClass].empty?
|
121
|
-
responseObj
|
122
|
-
responseObj[:readerExecutionPass] = false
|
123
|
-
return nil
|
119
|
+
@MessagePath.issueError(833, responseObj)
|
124
120
|
end
|
125
121
|
|
126
122
|
return intTaxonomy
|
@@ -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-26 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-24 original script
|
7
7
|
|
8
8
|
require_relative 'module_timeInstant'
|
@@ -15,24 +15,30 @@ module ADIWG
|
|
15
15
|
|
16
16
|
module TemporalExtent
|
17
17
|
|
18
|
-
def self.unpack(hTemporal, responseObj)
|
18
|
+
def self.unpack(hTemporal, responseObj, inContext = nil)
|
19
|
+
|
20
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
19
21
|
|
20
22
|
# return nil object if input is empty
|
21
23
|
if hTemporal.empty?
|
22
|
-
responseObj
|
24
|
+
@MessagePath.issueWarning(840, responseObj, inContext)
|
23
25
|
return nil
|
24
26
|
end
|
25
27
|
|
26
28
|
# instance classes needed in script
|
27
29
|
intMetadataClass = InternalMetadata.new
|
28
30
|
intTemporal = intMetadataClass.newTemporalExtent
|
31
|
+
|
32
|
+
outContext = 'temporal extent'
|
33
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
34
|
+
|
29
35
|
haveOne = false
|
30
36
|
|
31
37
|
# temporal extent - time instant (required if not others)
|
32
38
|
if hTemporal.has_key?('timeInstant')
|
33
39
|
hTime = hTemporal['timeInstant']
|
34
40
|
unless hTime.empty?
|
35
|
-
hObject = TimeInstant.unpack(hTime, responseObj)
|
41
|
+
hObject = TimeInstant.unpack(hTime, responseObj, outContext)
|
36
42
|
unless hObject.nil?
|
37
43
|
intTemporal[:timeInstant] = hObject
|
38
44
|
haveOne = true
|
@@ -44,7 +50,7 @@ module ADIWG
|
|
44
50
|
if hTemporal.has_key?('timePeriod')
|
45
51
|
hTime = hTemporal['timePeriod']
|
46
52
|
unless hTime.empty?
|
47
|
-
hObject = TimePeriod.unpack(hTime, responseObj)
|
53
|
+
hObject = TimePeriod.unpack(hTime, responseObj, outContext)
|
48
54
|
unless hObject.nil?
|
49
55
|
intTemporal[:timePeriod] = hObject
|
50
56
|
haveOne = true
|
@@ -54,10 +60,7 @@ module ADIWG
|
|
54
60
|
|
55
61
|
# error messages
|
56
62
|
unless haveOne
|
57
|
-
responseObj
|
58
|
-
'ERROR: mdJson reader: temporal extent must have a time period or time instant'
|
59
|
-
responseObj[:readerExecutionPass] = false
|
60
|
-
return nil
|
63
|
+
@MessagePath.issueError(841, responseObj, inContext)
|
61
64
|
end
|
62
65
|
|
63
66
|
return intTemporal
|
@@ -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-27 refactored error and warning messaging
|
6
6
|
# Stan Smith 2017-11-07 add geologic age
|
7
7
|
# Stan Smith 2016-10-24 original script
|
8
8
|
|
@@ -17,11 +17,13 @@ module ADIWG
|
|
17
17
|
|
18
18
|
module TimeInstant
|
19
19
|
|
20
|
-
def self.unpack(hInstant, responseObj)
|
20
|
+
def self.unpack(hInstant, 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 hInstant.empty?
|
24
|
-
responseObj
|
26
|
+
@MessagePath.issueWarning(850, responseObj, inContext)
|
25
27
|
return nil
|
26
28
|
end
|
27
29
|
|
@@ -29,6 +31,9 @@ module ADIWG
|
|
29
31
|
intMetadataClass = InternalMetadata.new
|
30
32
|
intInstant = intMetadataClass.newTimeInstant
|
31
33
|
|
34
|
+
outContext = 'time instant'
|
35
|
+
outContext = inContext + ' > ' + outContext unless inContext.nil?
|
36
|
+
|
32
37
|
# time instant - id
|
33
38
|
if hInstant.has_key?('id')
|
34
39
|
unless hInstant['id'] == ''
|
@@ -46,7 +51,7 @@ module ADIWG
|
|
46
51
|
# time instant - identifier {Identifier}
|
47
52
|
if hInstant.has_key?('identifier')
|
48
53
|
unless hInstant['identifier'].empty?
|
49
|
-
hReturn = Identifier.unpack(hInstant['identifier'], responseObj)
|
54
|
+
hReturn = Identifier.unpack(hInstant['identifier'], responseObj, outContext)
|
50
55
|
unless hReturn.nil?
|
51
56
|
intInstant[:identifier] = hReturn
|
52
57
|
end
|
@@ -65,7 +70,7 @@ module ADIWG
|
|
65
70
|
# time instant - datetime
|
66
71
|
if hInstant.has_key?('dateTime')
|
67
72
|
unless hInstant['dateTime'] == ''
|
68
|
-
hDate = DateTime.unpack(hInstant['dateTime'], responseObj)
|
73
|
+
hDate = DateTime.unpack(hInstant['dateTime'], responseObj, outContext)
|
69
74
|
unless hDate.nil?
|
70
75
|
intInstant[:timeInstant] = hDate
|
71
76
|
end
|
@@ -74,7 +79,7 @@ module ADIWG
|
|
74
79
|
# time instant - geologic age
|
75
80
|
if hInstant.has_key?('geologicAge')
|
76
81
|
unless hInstant['geologicAge'].empty?
|
77
|
-
hGeoAge = GeologicAge.unpack(hInstant['geologicAge'], responseObj)
|
82
|
+
hGeoAge = GeologicAge.unpack(hInstant['geologicAge'], responseObj, outContext)
|
78
83
|
unless hGeoAge.nil?
|
79
84
|
intInstant[:geologicAge] = hGeoAge
|
80
85
|
end
|
@@ -83,9 +88,7 @@ module ADIWG
|
|
83
88
|
|
84
89
|
# time instant must have either a timeInstant or geologicAge
|
85
90
|
if intInstant[:timeInstant].empty? && intInstant[:geologicAge].empty?
|
86
|
-
responseObj
|
87
|
-
responseObj[:readerExecutionPass] = false
|
88
|
-
return nil
|
91
|
+
@MessagePath.issueError(851, responseObj, inContext)
|
89
92
|
end
|
90
93
|
|
91
94
|
return intInstant
|
@@ -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-27 refactored error and warning messaging
|
6
6
|
# Stan Smith 2016-10-14 original script
|
7
7
|
|
8
8
|
module ADIWG
|
@@ -12,11 +12,13 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module TimeInterval
|
14
14
|
|
15
|
-
def self.unpack(hTimeInt, responseObj)
|
15
|
+
def self.unpack(hTimeInt, responseObj, inContext = nil)
|
16
|
+
|
17
|
+
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
|
16
18
|
|
17
19
|
# return nil object if input is empty
|
18
20
|
if hTimeInt.empty?
|
19
|
-
responseObj
|
21
|
+
@MessagePath.issueWarning(860, responseObj, inContext)
|
20
22
|
return nil
|
21
23
|
end
|
22
24
|
|
@@ -28,19 +30,15 @@ module ADIWG
|
|
28
30
|
if hTimeInt.has_key?('interval')
|
29
31
|
interval = hTimeInt['interval']
|
30
32
|
unless interval == ''
|
31
|
-
if interval.is_a?(Integer)
|
33
|
+
if interval.is_a?(Integer)
|
32
34
|
intTime[:interval] = hTimeInt['interval']
|
33
35
|
else
|
34
|
-
responseObj
|
35
|
-
responseObj[:readerExecutionPass] = false
|
36
|
-
return nil
|
36
|
+
@MessagePath.issueError(861, responseObj, inContext)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
if intTime[:interval].nil? || intTime[:interval] == ''
|
41
|
-
responseObj
|
42
|
-
responseObj[:readerExecutionPass] = false
|
43
|
-
return nil
|
41
|
+
@MessagePath.issueError(862, responseObj, inContext)
|
44
42
|
end
|
45
43
|
|
46
44
|
# time interval - units (required) {enum}
|
@@ -53,9 +51,7 @@ module ADIWG
|
|
53
51
|
end
|
54
52
|
end
|
55
53
|
if intTime[:units].nil? || intTime[:units] == ''
|
56
|
-
responseObj
|
57
|
-
responseObj[:readerExecutionPass] = false
|
58
|
-
return nil
|
54
|
+
@MessagePath.issueError(863, responseObj, inContext)
|
59
55
|
end
|
60
56
|
|
61
57
|
return intTime
|