adiwg-mdtranslator 2.0.0rc13 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_browseCategory.rb +47 -0
  3. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_budget.rb +79 -0
  4. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_contact.rb +248 -0
  5. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb +49 -0
  6. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_extent.rb +62 -0
  7. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_id.rb +10 -3
  8. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_identifier.rb +17 -15
  9. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_materialRequest.rb +72 -0
  10. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_parentId.rb +44 -0
  11. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_project.rb +48 -0
  12. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_publication.rb +77 -0
  13. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +90 -7
  14. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_spatial.rb +56 -0
  15. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +125 -0
  16. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkDocument.rb +99 -0
  17. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_webLinkGraphic.rb +92 -0
  18. data/lib/adiwg/mdtranslator/version.rb +2 -1
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_bodyScript.js +6 -1
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_citation.rb +6 -2
  21. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +1 -2
  22. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +29 -2
  23. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +0 -1
  24. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +7 -1
  25. metadata +18 -22
  26. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_additionalDocumentation.rb +0 -52
  27. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_boundingBox.rb +0 -54
  28. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_browseGraphic.rb +0 -66
  29. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_citation.rb +0 -125
  30. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_contacts.rb +0 -143
  31. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_dateTime.rb +0 -31
  32. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_distributionInfo.rb +0 -64
  33. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_extent.rb +0 -61
  34. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoCoordSystem.rb +0 -50
  35. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geoProperties.rb +0 -91
  36. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_geographicElement.rb +0 -161
  37. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadata.rb +0 -75
  38. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_metadataInfo.rb +0 -130
  39. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_onlineResource.rb +0 -71
  40. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceIdentifier.rb +0 -73
  41. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_resourceInfo.rb +0 -437
  42. data/lib/adiwg/mdtranslator/readers/sbJson/modules/Old/module_responsibleParty.rb +0 -53
@@ -1,31 +0,0 @@
1
- require 'adiwg/mdtranslator/internal/module_dateTimeFun'
2
-
3
- module ADIWG
4
- module Mdtranslator
5
- module Readers
6
- module SbJson
7
-
8
- module SbDateTime
9
-
10
- def self.unpack(sDateTime, responseObj)
11
-
12
- # instance classes needed in script
13
- intMetadataClass = InternalMetadata.new
14
-
15
- # dateTime
16
- intDateTime = intMetadataClass.newDateTime
17
-
18
- aDateTimeReturn = AdiwgDateTimeFun.dateTimeFromString(sDateTime)
19
- intDateTime[:dateTime] = aDateTimeReturn[0]
20
- intDateTime[:dateResolution] = aDateTimeReturn[1]
21
-
22
- return intDateTime
23
-
24
- end
25
-
26
- end
27
-
28
- end
29
- end
30
- end
31
- end
@@ -1,64 +0,0 @@
1
- require 'uri'
2
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_responsibleParty')
3
-
4
- module ADIWG
5
- module Mdtranslator
6
- module Readers
7
- module SbJson
8
- module DistributionInfo
9
- def self.unpack(hDistributor, responseObj, intObj)
10
- # instance classes needed in script
11
- intMetadataClass = InternalMetadata.new
12
- intDistributor = intMetadataClass.newDistributor
13
-
14
- # distributor - distribution contact - required
15
- # We're just injecting the first SB contact here
16
- # with a a role of "distributor", if none just use
17
- # the default SB contact
18
- aCust = {}
19
- dist = intObj[:contacts].find { |c| c[:primaryRole] == 'Distributor' }
20
-
21
- unless dist.nil?
22
- aCust['contactId'] = dist[:contactId]
23
- aCust['role'] = 'distributor'
24
- else
25
- aCust['contactId'] = 'SB'
26
- aCust['role'] = 'distributor'
27
- end
28
- intDistributor[:distContact] = ResponsibleParty.unpack(aCust, responseObj)
29
-
30
- # distributor - distribution order process
31
- if hDistributor.key?('materialRequestInstructions')
32
- aDistOrder = hDistributor['materialRequestInstructions']
33
- unless aDistOrder.empty?
34
- intDistOrder = intMetadataClass.newDistOrder
35
- intDistOrder[:orderInstructions] = hDistributor['materialRequestInstructions']
36
- intDistributor[:distOrderProcs] << intDistOrder
37
- end
38
- end
39
-
40
- # distributor - distribution transfer options
41
- if hDistributor.key?('distributionLinks')
42
- aDistTransOpt = hDistributor['distributionLinks']
43
- unless aDistTransOpt.empty?
44
- options = intMetadataClass.newDigitalTransOption
45
- aDistTransOpt.each do |opt|
46
- aOpt = intMetadataClass.newOnlineResource
47
- aOpt[:olResURI] = opt['uri']
48
- aOpt[:olResProtocol] = URI.parse(opt['uri']).scheme
49
- aOpt[:olResName] = opt['title']
50
- aOpt[:olResDesc] = opt['typeLabel']
51
- aOpt[:olResFunction] = 'information'
52
- options[:online] << aOpt
53
- end
54
- intDistributor[:distTransOptions] << options
55
- end
56
- end
57
-
58
- intDistributor
59
- end
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,61 +0,0 @@
1
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_geographicElement')
2
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_temporalElement')
3
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_verticalElement')
4
-
5
- module ADIWG
6
- module Mdtranslator
7
- module Readers
8
- module SbJson
9
-
10
- module Extent
11
-
12
- def self.unpack(hExtent, responseObj)
13
-
14
- # instance classes needed in script
15
- intMetadataClass = InternalMetadata.new
16
- intExtent = intMetadataClass.newExtent
17
-
18
- # extent - description
19
- if hExtent.has_key?('description')
20
- s = hExtent['description']
21
- if s != ''
22
- intExtent[:extDesc] = s
23
- end
24
- end
25
-
26
- # extent - geographic elements
27
- if hExtent.has_key?('geographicElement')
28
- aGeoElements = hExtent['geographicElement']
29
- unless aGeoElements.empty?
30
- intExtent[:extGeoElements] = GeographicElement.unpack(aGeoElements, responseObj)
31
- end
32
- end
33
-
34
- # extent - temporal elements
35
- # if hExtent.has_key?('temporalElement')
36
- # hTempElement = hExtent['temporalElement']
37
- # unless hTempElement.empty?
38
- # intExtent[:extTempElements] = TemporalElement.unpack(hTempElement, responseObj)
39
- # end
40
- # end
41
- #
42
- # # extent - vertical elements
43
- # if hExtent.has_key?('verticalElement')
44
- # aVertElements = hExtent['verticalElement']
45
- # unless aVertElements.empty?
46
- # aVertElements.each do |hVertElement|
47
- # intExtent[:extVertElements] << VerticalElement.unpack(hVertElement, responseObj)
48
- # end
49
- # end
50
- # end
51
-
52
- return intExtent
53
-
54
- end
55
-
56
- end
57
-
58
- end
59
- end
60
- end
61
- end
@@ -1,50 +0,0 @@
1
- module ADIWG
2
- module Mdtranslator
3
- module Readers
4
- module SbJson
5
-
6
- module GeoCoordSystem
7
-
8
- def self.unpack(hGeoCrs, intElement, responseObj)
9
-
10
- intMetadataClass = InternalMetadata.new
11
- intSRS = intMetadataClass.newSRS
12
-
13
- # get coordinate reference system
14
- # null crs will default to CRS84 in writer
15
- if hGeoCrs.has_key?('properties')
16
- hCRSProp = hGeoCrs['properties']
17
-
18
- if hCRSProp.has_key?('name')
19
- s = hCRSProp['name']
20
- if s != ''
21
- intSRS[:srsName] = s
22
- end
23
- end
24
-
25
- if hCRSProp.has_key?('href')
26
- s = hCRSProp['href']
27
- if s != ''
28
- intSRS[:srsHref] = s
29
- end
30
- end
31
-
32
- if hCRSProp.has_key?('type')
33
- s = hCRSProp['type']
34
- if s != ''
35
- intSRS[:srsType] = s
36
- end
37
- end
38
-
39
- intElement[:elementSrs] = intSRS
40
-
41
- end
42
-
43
- end
44
-
45
- end
46
-
47
- end
48
- end
49
- end
50
- end
@@ -1,91 +0,0 @@
1
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_temporalElement')
2
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_verticalElement')
3
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceIdentifier')
4
-
5
- module ADIWG
6
- module Mdtranslator
7
- module Readers
8
- module SbJson
9
-
10
- module GeoProperties
11
-
12
- def self.unpack(hGeoProps, intElement, responseObj)
13
-
14
- # set element extent - (default true)
15
- intElement[:elementIncludeData] = true
16
- if hGeoProps.has_key?('includesData')
17
- if !hGeoProps['includesData']
18
- intElement[:elementIncludeData] = false
19
- end
20
- end
21
-
22
- # set element feature name
23
- if hGeoProps.has_key?('featureName')
24
- s = hGeoProps['featureName']
25
- if s != ''
26
- intElement[:elementName] = s
27
- end
28
- end
29
-
30
- # set element description
31
- if hGeoProps.has_key?('description')
32
- s = hGeoProps['description']
33
- if s != ''
34
- intElement[:elementDescription] = s
35
- end
36
- end
37
-
38
- # # set temporal information
39
- # if hGeoProps.has_key?('temporalElement')
40
- # hTempEle = hGeoProps['temporalElement']
41
- # unless hTempEle.empty?
42
- # intElement[:temporalElements] = TemporalElement.unpack(hTempEle, responseObj)
43
- # end
44
- # end
45
- #
46
- # # set vertical information
47
- # if hGeoProps.has_key?('verticalElement')
48
- # aVertEle = hGeoProps['verticalElement']
49
- # unless aVertEle.empty?
50
- # aVertEle.each do |hVertEle|
51
- # intElement[:verticalElements] << VerticalElement.unpack(hVertEle, responseObj)
52
- # end
53
- # end
54
- # end
55
- #
56
- # # set other assigned IDs
57
- # if hGeoProps.has_key?('identifier')
58
- # aResIds = hGeoProps['identifier']
59
- # unless aResIds.empty?
60
- # aResIds.each do |hIdentifier|
61
- # intElement[:elementIdentifiers] << ResourceIdentifier.unpack(hIdentifier, responseObj)
62
- # end
63
- # end
64
- # end
65
- #
66
- # # set feature scope
67
- # if hGeoProps.has_key?('featureScope')
68
- # s = hGeoProps['featureScope']
69
- # if s != ''
70
- # intElement[:elementScope] = s
71
- # end
72
- # end
73
- #
74
- # # set feature acquisition methodology
75
- # if hGeoProps.has_key?('featureAcquisitionMethod')
76
- # s = hGeoProps['featureAcquisitionMethod']
77
- # if s != ''
78
- # intElement[:elementAcquisition] = s
79
- # end
80
- # end
81
-
82
- return intElement
83
-
84
- end
85
-
86
- end
87
-
88
- end
89
- end
90
- end
91
- end
@@ -1,161 +0,0 @@
1
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_geoCoordSystem')
2
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_geoProperties')
3
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_boundingBox')
4
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_point')
5
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_lineString')
6
- #require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_polygon')
7
-
8
- module ADIWG
9
- module Mdtranslator
10
- module Readers
11
- module SbJson
12
-
13
- module GeographicElement
14
-
15
- def self.unpack(aGeoElements, responseObj)
16
-
17
- # only one geometry is allowed per geographic element.
18
- # ... in GeoJSON each geometry is allowed a bounding box;
19
- # ... This code splits bounding boxes to separate elements
20
-
21
- # instance classes needed in script
22
- aIntGeoEle = Array.new
23
-
24
- aGeoElements.each do |hGeoJsonElement|
25
-
26
- # instance classes needed in script
27
- intMetadataClass = InternalMetadata.new
28
- hGeoElement = intMetadataClass.newGeoElement
29
-
30
- # find geographic element type
31
- if hGeoJsonElement.has_key?('type')
32
- elementType = hGeoJsonElement['type']
33
- else
34
- # invalid geographic element
35
- return nil
36
- end
37
-
38
- # set geographic element id
39
- if hGeoJsonElement.has_key?('id')
40
- s = hGeoJsonElement['id']
41
- if s != ''
42
- hGeoElement[:elementId] = s
43
- end
44
- end
45
-
46
- # set geographic element coordinate reference system - CRS
47
- if hGeoJsonElement.has_key?('crs')
48
- hGeoCrs = hGeoJsonElement['crs']
49
- GeoCoordSystem.unpack(hGeoCrs, hGeoElement, responseObj)
50
- end
51
-
52
- # set geographic element properties
53
- if hGeoJsonElement.has_key?('properties')
54
- hGeoProps = hGeoJsonElement['properties']
55
- GeoProperties.unpack(hGeoProps, hGeoElement, responseObj)
56
- end
57
-
58
- # process geographic element bounding box
59
- # the bounding box must be represented as a separate geographic element for ISO
60
- # need to make a deep copy of current state of geographic element for bounding box
61
- if hGeoJsonElement.has_key?('bbox')
62
- if hGeoJsonElement['bbox'].length == 4
63
- aBBox = hGeoJsonElement['bbox']
64
-
65
- boxElement = Marshal.load(Marshal.dump(hGeoElement))
66
- boxElement[:elementGeometry] = BoundingBox.unpack(aBBox, responseObj)
67
-
68
- aIntGeoEle << boxElement
69
- end
70
- end
71
-
72
- # unpack geographic element
73
- case elementType
74
-
75
- # GeoJSON Features
76
- when 'Feature'
77
- if hGeoJsonElement.has_key?('geometry')
78
- hGeometry = hGeoJsonElement['geometry']
79
-
80
- # geoJSON requires geometry to be 'null' when geometry is bounding box only
81
- # JSON null converts in parsing to ruby nil
82
- unless hGeometry.nil?
83
- unless hGeometry.empty?
84
- if hGeometry.has_key?('type')
85
- geometryType = hGeometry['type']
86
- aCoordinates = hGeometry['coordinates']
87
- unless aCoordinates.empty?
88
- case geometryType
89
- when 'Point', 'MultiPoint'
90
- hGeoElement[:elementGeometry] = ADIWG::Mdtranslator::Point.unpack(aCoordinates, geometryType, responseObj)
91
- when 'LineString', 'MultiLineString'
92
- hGeoElement[:elementGeometry] = ADIWG::Mdtranslator::LineString.unpack(aCoordinates, geometryType, responseObj)
93
- when 'Polygon', 'MultiPolygon'
94
- hGeoElement[:elementGeometry] = Polygon.unpack(aCoordinates, geometryType, responseObj)
95
- else
96
- # log - the GeoJSON geometry type is not supported
97
- end
98
- aIntGeoEle << hGeoElement
99
- end
100
- end
101
- end
102
- end
103
-
104
- end
105
-
106
- # GeoJSON Feature Collection
107
- when 'FeatureCollection'
108
- if hGeoJsonElement.has_key?('features')
109
- aFeatures = hGeoJsonElement['features']
110
- unless aFeatures.empty?
111
- intGeometry = intMetadataClass.newGeometry
112
- intGeometry[:geoType] = 'MultiGeometry'
113
- intGeometry[:geometry] = GeographicElement.unpack(aFeatures, responseObj)
114
- hGeoElement[:elementGeometry] = intGeometry
115
- aIntGeoEle << hGeoElement
116
- end
117
- end
118
-
119
- # GeoJSON Geometries
120
- when 'Point', 'MultiPoint'
121
- aCoordinates = hGeoJsonElement['coordinates']
122
- hGeoElement[:elementGeometry] = ADIWG::Mdtranslator::Point.unpack(aCoordinates, elementType, responseObj)
123
- aIntGeoEle << hGeoElement
124
-
125
- when 'LineString', 'MultiLineString'
126
- aCoordinates = hGeoJsonElement['coordinates']
127
- hGeoElement[:elementGeometry] = ADIWG::Mdtranslator::LineString.unpack(aCoordinates, elementType, responseObj)
128
- aIntGeoEle << hGeoElement
129
-
130
- when 'Polygon', 'MultiPolygon'
131
- aCoordinates = hGeoJsonElement['coordinates']
132
- hGeoElement[:elementGeometry] = Polygon.unpack(aCoordinates, elementType, responseObj)
133
- aIntGeoEle << hGeoElement
134
-
135
- # GeoJSON Geometry Collection
136
- when 'GeometryCollection'
137
- if hGeoJsonElement.has_key?('geometries')
138
- aGeometries = hGeoJsonElement['geometries']
139
- unless aGeometries.empty?
140
- intGeometry = intMetadataClass.newGeometry
141
- intGeometry[:geoType] = 'MultiGeometry'
142
- intGeometry[:geometry] = GeographicElement.unpack(aGeometries, responseObj)
143
- hGeoElement[:elementGeometry] = intGeometry
144
- aIntGeoEle << hGeoElement
145
- end
146
- end
147
-
148
- end
149
-
150
- end
151
-
152
- return aIntGeoEle
153
-
154
- end
155
-
156
- end
157
-
158
- end
159
- end
160
- end
161
- end