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,12 +2,13 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2018-02-19 refactored error and warning messaging
|
6
|
+
# Stan Smith 2016-10-11 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-15 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module
|
11
|
+
# Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0
|
11
12
|
# Stan Smith 2013-11-27 modified to process a single resource usage
|
12
13
|
# Stan Smith 2013-11-25 original script
|
13
14
|
|
@@ -16,102 +17,101 @@ require_relative 'module_citation'
|
|
16
17
|
require_relative 'module_responsibleParty'
|
17
18
|
|
18
19
|
module ADIWG
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
20
|
+
module Mdtranslator
|
21
|
+
module Readers
|
22
|
+
module MdJson
|
23
|
+
|
24
|
+
module ResourceUsage
|
25
|
+
|
26
|
+
def self.unpack(hUsage, responseObj)
|
27
|
+
|
28
|
+
# return nil object if input is empty
|
29
|
+
if hUsage.empty?
|
30
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: resource usage object is empty'
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
|
34
|
+
# instance classes needed in script
|
35
|
+
intMetadataClass = InternalMetadata.new
|
36
|
+
intUsage = intMetadataClass.newResourceUsage
|
37
|
+
|
38
|
+
# resource usage - specific usage (required)
|
39
|
+
if hUsage.has_key?('specificUsage')
|
40
|
+
intUsage[:specificUsage] = hUsage['specificUsage']
|
41
|
+
end
|
42
|
+
if intUsage[:specificUsage].nil? || intUsage[:specificUsage] == ''
|
43
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: resource usage specific usage is missing'
|
44
|
+
responseObj[:readerExecutionPass] = false
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
|
48
|
+
# resource usage - temporal extent []
|
49
|
+
if hUsage.has_key?('temporalExtent')
|
50
|
+
aItems = hUsage['temporalExtent']
|
51
|
+
aItems.each do |hItem|
|
52
|
+
hReturn = TemporalExtent.unpack(hItem, responseObj)
|
53
|
+
unless hReturn.nil?
|
54
|
+
intUsage[:temporalExtents] << hReturn
|
32
55
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# resource usage - user determined limitations
|
60
|
+
if hUsage.has_key?('userDeterminedLimitation')
|
61
|
+
unless hUsage['userDeterminedLimitation'] == ''
|
62
|
+
intUsage[:userLimitation] = hUsage['userDeterminedLimitation']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# resource usage - repository - limitation response []
|
67
|
+
if hUsage.has_key?('limitationResponse')
|
68
|
+
hUsage['limitationResponse'].each do |item|
|
69
|
+
unless item == ''
|
70
|
+
intUsage[:limitationResponses] << item
|
41
71
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# resource usage - repository - documented issue
|
76
|
+
if hUsage.has_key?('documentedIssue')
|
77
|
+
hCitation = hUsage['documentedIssue']
|
78
|
+
unless hCitation.empty?
|
79
|
+
hReturn = Citation.unpack(hCitation, responseObj)
|
80
|
+
unless hReturn.nil?
|
81
|
+
intUsage[:identifiedIssue] = hReturn
|
46
82
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# resource usage - repository - additional documentation []
|
87
|
+
if hUsage.has_key?('additionalDocumentation')
|
88
|
+
aItems = hUsage['additionalDocumentation']
|
89
|
+
aItems.each do |hItem|
|
90
|
+
hReturn = Citation.unpack(hItem, responseObj)
|
91
|
+
unless hReturn.nil?
|
92
|
+
intUsage[:additionalDocumentation] << hReturn
|
57
93
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# resource usage - repository - responsible party []
|
98
|
+
if hUsage.has_key?('userContactInfo')
|
99
|
+
aContacts = hUsage['userContactInfo']
|
100
|
+
aContacts.each do |item|
|
101
|
+
hReturn = ResponsibleParty.unpack(item, responseObj)
|
102
|
+
unless hReturn.nil?
|
103
|
+
intUsage[:userContacts] << hReturn
|
64
104
|
end
|
105
|
+
end
|
106
|
+
end
|
65
107
|
|
66
|
-
|
67
|
-
if hUsage.has_key?('limitationResponse')
|
68
|
-
hUsage['limitationResponse'].each do |item|
|
69
|
-
if item != ''
|
70
|
-
intUsage[:limitationResponses] << item
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
108
|
+
return intUsage
|
74
109
|
|
75
|
-
|
76
|
-
if hUsage.has_key?('documentedIssue')
|
77
|
-
hCitation = hUsage['documentedIssue']
|
78
|
-
unless hCitation.empty?
|
79
|
-
hReturn = Citation.unpack(hCitation, responseObj)
|
80
|
-
unless hReturn.nil?
|
81
|
-
intUsage[:identifiedIssue] = hReturn
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
# resource usage - repository - additional documentation []
|
87
|
-
if hUsage.has_key?('additionalDocumentation')
|
88
|
-
aItems = hUsage['additionalDocumentation']
|
89
|
-
aItems.each do |hItem|
|
90
|
-
hReturn = Citation.unpack(hItem, responseObj)
|
91
|
-
unless hReturn.nil?
|
92
|
-
intUsage[:additionalDocumentation] << hReturn
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# resource usage - repository - responsible party []
|
98
|
-
if hUsage.has_key?('userContactInfo')
|
99
|
-
aContacts = hUsage['userContactInfo']
|
100
|
-
aContacts.each do |item|
|
101
|
-
hReturn = ResponsibleParty.unpack(item, responseObj)
|
102
|
-
unless hReturn.nil?
|
103
|
-
intUsage[:userContacts] << hReturn
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
return intUsage
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
110
|
+
end
|
113
111
|
|
114
112
|
end
|
115
|
-
|
116
|
-
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
117
|
end
|
@@ -2,90 +2,90 @@
|
|
2
2
|
# Reader - ADIwg JSON V1 to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
5
|
+
# Stan Smith 2018-02-19 refactored error and warning messaging
|
6
|
+
# Stan Smith 2017-01-19 changed timePeriod to extent []
|
7
|
+
# Stan Smith 2016-10-09 refactored for mdJson 2.0
|
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 2015-06-12 added check that contactId for responsibleParty
|
11
|
+
# ... matches an actual contact in the contact array
|
12
|
+
# Stan Smith 2015-01-18 added nil return if hRParty empty
|
13
|
+
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
14
|
+
# Stan Smith 2014-05-28 modified to support JSON schema 0.5.0
|
15
|
+
# ... removed resource IDs associated with contact
|
15
16
|
# Stan Smith 2013-08-26 original script
|
16
17
|
|
17
18
|
require_relative 'module_extent'
|
18
19
|
require_relative 'module_party'
|
19
20
|
|
20
21
|
module ADIWG
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
module Mdtranslator
|
23
|
+
module Readers
|
24
|
+
module MdJson
|
24
25
|
|
25
|
-
|
26
|
+
module ResponsibleParty
|
26
27
|
|
27
|
-
|
28
|
+
def self.unpack(hRParty, responseObj)
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
30
|
+
# return nil object if input is empty
|
31
|
+
if hRParty.empty?
|
32
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: responsible party object is empty'
|
33
|
+
return nil
|
34
|
+
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
# instance classes needed in script
|
37
|
+
# CI_Responsibility replaces CI_ResponsibleParty in 19115-1
|
38
|
+
# Responsibility object is translated to ResponsibleParty by 19115-2 writer
|
39
|
+
intMetadataClass = InternalMetadata.new
|
40
|
+
intResParty = intMetadataClass.newResponsibility
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
# responsible party - role - (required)
|
43
|
+
if hRParty.has_key?('role')
|
44
|
+
intResParty[:roleName] = hRParty['role']
|
45
|
+
end
|
46
|
+
if intResParty[:roleName].nil? || intResParty[:roleName] == ''
|
47
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: responsible party role is missing'
|
48
|
+
responseObj[:readerExecutionPass] = false
|
49
|
+
return nil
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
52
|
+
# responsible party - role extent
|
53
|
+
if hRParty.has_key?('roleExtent')
|
54
|
+
aExtent = hRParty['roleExtent']
|
55
|
+
aExtent.each do |hItem|
|
56
|
+
unless hItem.empty?
|
57
|
+
hTimeExtent = Extent.unpack(hItem, responseObj)
|
58
|
+
unless hTimeExtent.nil?
|
59
|
+
intResParty[:roleExtents] << hTimeExtent
|
60
|
+
end
|
63
61
|
end
|
62
|
+
end
|
63
|
+
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
65
|
+
# responsible party - party [] (minimum 1)
|
66
|
+
if hRParty.has_key?('party')
|
67
|
+
hRParty['party'].each do |hParty|
|
68
|
+
unless hParty.empty?
|
69
|
+
party = Party.unpack(hParty, responseObj)
|
70
|
+
unless party.nil?
|
71
|
+
intResParty[:parties] << party
|
72
|
+
end
|
75
73
|
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
74
|
+
end
|
75
|
+
end
|
76
|
+
if intResParty[:parties].empty?
|
77
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: responsible party must have at least one party'
|
78
|
+
responseObj[:readerExecutionPass] = false
|
79
|
+
return nil
|
80
|
+
end
|
83
81
|
|
84
|
-
|
82
|
+
return intResParty
|
85
83
|
|
86
|
-
|
84
|
+
end
|
87
85
|
|
88
86
|
end
|
89
|
-
|
90
|
-
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
91
|
end
|
@@ -2,55 +2,56 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-19 refactored error and warning messaging
|
5
6
|
# Stan Smith 2016-11-02 original script
|
6
7
|
|
7
8
|
module ADIWG
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
end
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
12
|
+
|
13
|
+
module Schema
|
14
|
+
|
15
|
+
def self.unpack(hSchema, responseObj)
|
16
|
+
|
17
|
+
# return nil object if input is empty
|
18
|
+
if hSchema.empty?
|
19
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema object is empty'
|
20
|
+
responseObj[:readerExecutionPass] = false
|
21
|
+
return nil
|
22
|
+
end
|
23
|
+
|
24
|
+
# instance classes needed in script
|
25
|
+
intMetadataClass = InternalMetadata.new
|
26
|
+
intSchema = intMetadataClass.newSchema
|
27
|
+
|
28
|
+
# schema - name (required)
|
29
|
+
if hSchema.has_key?('name')
|
30
|
+
intSchema[:name] = hSchema['name']
|
31
|
+
end
|
32
|
+
if intSchema[:name].nil? || intSchema[:name] == ''
|
33
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema name is missing'
|
34
|
+
responseObj[:readerExecutionPass] = false
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
# schema - version (required)
|
39
|
+
if hSchema.has_key?('version')
|
40
|
+
intSchema[:version] = hSchema['version']
|
41
|
+
end
|
42
|
+
if intSchema[:version].nil? || intSchema[:version] == ''
|
43
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: schema version is missing'
|
44
|
+
responseObj[:readerExecutionPass] = false
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
|
48
|
+
return intSchema
|
49
|
+
|
50
|
+
end
|
52
51
|
|
53
52
|
end
|
54
|
-
|
55
|
-
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
56
57
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# Reader - ADIwg JSON to internal data structure
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2018-02-19 refactored error and warning messaging
|
5
6
|
# Stan Smith 2016-10-14 original script
|
6
7
|
|
7
8
|
require_relative 'module_scopeDescription'
|
@@ -9,64 +10,63 @@ require_relative 'module_timePeriod'
|
|
9
10
|
require_relative 'module_extent'
|
10
11
|
|
11
12
|
module ADIWG
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
module Mdtranslator
|
14
|
+
module Readers
|
15
|
+
module MdJson
|
15
16
|
|
16
|
-
|
17
|
+
module Scope
|
17
18
|
|
18
|
-
|
19
|
+
def self.unpack(hScope, responseObj)
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
21
|
+
# return nil object if input is empty
|
22
|
+
if hScope.empty?
|
23
|
+
responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: mdJson scope object is empty'
|
24
|
+
return nil
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
# instance classes needed in script
|
28
|
+
intMetadataClass = InternalMetadata.new
|
29
|
+
intScope = intMetadataClass.newScope
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
# scope - scope code (required)
|
32
|
+
if hScope.has_key?('scopeCode')
|
33
|
+
intScope[:scopeCode] = hScope['scopeCode']
|
34
|
+
end
|
35
|
+
if intScope[:scopeCode].nil? || intScope[:scopeCode] == ''
|
36
|
+
responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: scope scopeCode is missing'
|
37
|
+
responseObj[:readerExecutionPass] = false
|
38
|
+
return nil
|
39
|
+
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
41
|
+
# scope - scope description [] {MD_ScopeDescription}
|
42
|
+
if hScope.has_key?('scopeDescription')
|
43
|
+
aScopeDes = hScope['scopeDescription']
|
44
|
+
aScopeDes.each do |item|
|
45
|
+
hScopeDes = ScopeDescription.unpack(item, responseObj)
|
46
|
+
unless hScopeDes.nil?
|
47
|
+
intScope[:scopeDescriptions] << hScopeDes
|
50
48
|
end
|
49
|
+
end
|
50
|
+
end
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
52
|
+
# scope - extent [] {EX_Extent}
|
53
|
+
if hScope.has_key?('scopeExtent')
|
54
|
+
aExtents = hScope['scopeExtent']
|
55
|
+
aExtents.each do |item|
|
56
|
+
hExtent = Extent.unpack(item, responseObj)
|
57
|
+
unless hExtent.nil?
|
58
|
+
intScope[:extents] << hExtent
|
61
59
|
end
|
60
|
+
end
|
61
|
+
end
|
62
62
|
|
63
|
-
|
63
|
+
return intScope
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
end
|
65
|
+
end
|
68
66
|
|
69
67
|
end
|
70
|
-
|
71
|
-
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
72
|
end
|