adiwg-mdtranslator 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adiwg-mdtranslator.gemspec +2 -2
- data/lib/adiwg/mdtranslator/readers/fgcd/version.rb +14 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_browseCategory.rb +2 -4
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_codelists.rb +196 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_date.rb +4 -5
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_extent.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_project.rb +2 -4
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_publication.rb +3 -5
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_relatedItem.rb +178 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_sbJson.rb +6 -0
- data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_tag.rb +0 -2
- data/lib/adiwg/mdtranslator/version.rb +2 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_browseCategory.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +160 -212
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_date.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_materialRequest.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_project.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +2 -4
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +20 -3
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +9 -2
- metadata +8 -6
- data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_metadataRepository.rb +0 -45
@@ -12,236 +12,184 @@ module ADIWG
|
|
12
12
|
|
13
13
|
module Codelists
|
14
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
|
-
{iso: 'coPrincipalInvestigator', sb: 'Co-Investigator'},
|
41
|
-
{iso: nil, sb: 'Associate Project Chief'},
|
42
|
-
{iso: nil, sb: 'Contact'},
|
43
|
-
{iso: nil, sb: 'Data Provider'},
|
44
|
-
{iso: nil, sb: 'Funding Agency'},
|
45
|
-
{iso: nil, sb: 'Lead Organization'},
|
46
|
-
{iso: nil, sb: 'Material Request Contact'},
|
47
|
-
{iso: nil, sb: 'Metadata Contact'},
|
48
|
-
{iso: nil, sb: 'Participant'},
|
49
|
-
{iso: nil, sb: 'Photographer'},
|
50
|
-
{iso: nil, sb: 'Process Contact'},
|
51
|
-
{iso: nil, sb: 'Project Chief'},
|
52
|
-
{iso: nil, sb: 'Project Team'},
|
53
|
-
{iso: nil, sb: 'Referred By'},
|
54
|
-
{iso: nil, sb: 'Report Prepared By'},
|
55
|
-
{iso: nil, sb: 'SoftwareEngineer'},
|
56
|
-
{iso: nil, sb: 'Subtask Leader'},
|
57
|
-
{iso: nil, sb: 'Supporter'},
|
58
|
-
{iso: nil, sb: 'Task Leader'},
|
59
|
-
{iso: nil, sb: 'Transmitted'},
|
60
|
-
{iso: nil, sb: 'User'},
|
61
|
-
{iso: nil, sb: 'USGS Mission Area'},
|
62
|
-
{iso: nil, sb: 'USGS Program'}
|
15
|
+
@role_adiwg2sb = [
|
16
|
+
{adiwg: 'administrator', sb: 'administrator'},
|
17
|
+
{adiwg: 'author', sb: 'Author'},
|
18
|
+
{adiwg: 'client', sb: 'client'},
|
19
|
+
{adiwg: 'coAuthor', sb: 'Author'},
|
20
|
+
{adiwg: 'collaborator', sb: 'Cooperator/Partner'},
|
21
|
+
{adiwg: 'contributor', sb: 'Cooperator/Partner'},
|
22
|
+
{adiwg: 'coPrincipalInvestigator', sb: 'Co-Investigator'},
|
23
|
+
{adiwg: 'custodian', sb: 'Custodian'},
|
24
|
+
{adiwg: 'distributor', sb: 'Distributor'},
|
25
|
+
{adiwg: 'editor', sb: 'Editor'},
|
26
|
+
{adiwg: 'funder', sb: 'funder'},
|
27
|
+
{adiwg: 'logistics', sb: 'logistics'},
|
28
|
+
{adiwg: 'mediator', sb: 'mediator'},
|
29
|
+
{adiwg: 'originator', sb: 'Originator'},
|
30
|
+
{adiwg: 'owner', sb: 'Data Owner'},
|
31
|
+
{adiwg: 'pointOfContact', sb: 'Point of Contact'},
|
32
|
+
{adiwg: 'principalInvestigator', sb: 'Principal Investigator'},
|
33
|
+
{adiwg: 'processor', sb: 'Processor'},
|
34
|
+
{adiwg: 'publisher', sb: 'publisher'},
|
35
|
+
{adiwg: 'resourceProvider', sb: 'Resource Provider'},
|
36
|
+
{adiwg: 'rightsHolder', sb: 'Data Owner'},
|
37
|
+
{adiwg: 'sponsor', sb: 'sponsor'},
|
38
|
+
{adiwg: 'stakeholder', sb: 'stakeholder'},
|
39
|
+
{adiwg: 'use', sb: 'User'}
|
63
40
|
]
|
64
41
|
|
65
|
-
@
|
66
|
-
{
|
67
|
-
{
|
68
|
-
{
|
69
|
-
{
|
70
|
-
{
|
71
|
-
{
|
72
|
-
{
|
73
|
-
{
|
74
|
-
{
|
75
|
-
{
|
76
|
-
{
|
77
|
-
{
|
78
|
-
{
|
79
|
-
{
|
80
|
-
{
|
81
|
-
{iso: nil, sb: 'arcgis'},
|
82
|
-
{iso: nil, sb: 'citation'},
|
83
|
-
{iso: nil, sb: 'configFile'},
|
84
|
-
{iso: nil, sb: 'kml'},
|
85
|
-
{iso: nil, sb: 'mapapp'},
|
86
|
-
{iso: nil, sb: 'method'},
|
87
|
-
{iso: nil, sb: 'oia-pmh'},
|
88
|
-
{iso: nil, sb: 'dpf'},
|
89
|
-
{iso: nil, sb: 'publicationReferenceSouce'},
|
90
|
-
{iso: nil, sb: 'repo'},
|
91
|
-
{iso: nil, sb: 'serviceCapabilitiesUri'},
|
92
|
-
{iso: nil, sb: 'serviceFeatureInfoUri'},
|
93
|
-
{iso: nil, sb: 'serviceLegendUri'},
|
94
|
-
{iso: nil, sb: 'serviceLink'},
|
95
|
-
{iso: nil, sb: 'serviceMapUri'},
|
96
|
-
{iso: nil, sb: 'serviceWfsBackingUri'},
|
97
|
-
{iso: nil, sb: 'siteMap'},
|
98
|
-
{iso: nil, sb: 'sourceCode'},
|
99
|
-
{iso: nil, sb: 'txt'},
|
100
|
-
{iso: nil, sb: 'WAF'},
|
101
|
-
{iso: nil, sb: 'xls'},
|
102
|
-
{iso: nil, sb: 'zip'}
|
42
|
+
@onlineFunction_adiwg2sb = [
|
43
|
+
{adiwg: 'browseGraphic', sb: 'browseImage'},
|
44
|
+
{adiwg: 'browsing', sb: 'browsing'},
|
45
|
+
{adiwg: 'completeMetadata', sb: 'originalMetadata'},
|
46
|
+
{adiwg: 'dataUri', sb: nil},
|
47
|
+
{adiwg: 'doi', sb: nil},
|
48
|
+
{adiwg: 'download', sb: 'download'},
|
49
|
+
{adiwg: 'emailService', sb: 'emailService'},
|
50
|
+
{adiwg: 'fileAccess', sb: 'fileAccess'},
|
51
|
+
{adiwg: 'information', sb: 'webLink'},
|
52
|
+
{adiwg: 'offlineAccess', sb: 'offlineAccess'},
|
53
|
+
{adiwg: 'orcid', sb: nil},
|
54
|
+
{adiwg: 'order', sb: 'order'},
|
55
|
+
{adiwg: 'search', sb: 'search'},
|
56
|
+
{adiwg: 'upload', sb: 'upload'},
|
57
|
+
{adiwg: 'webApplication', sb: 'webapp'}
|
103
58
|
]
|
104
59
|
|
105
|
-
@
|
106
|
-
{
|
107
|
-
{
|
108
|
-
{
|
109
|
-
{
|
110
|
-
{
|
111
|
-
{
|
112
|
-
{
|
113
|
-
{
|
114
|
-
{
|
115
|
-
{
|
116
|
-
{
|
117
|
-
{
|
118
|
-
{
|
119
|
-
{
|
120
|
-
{
|
121
|
-
{
|
122
|
-
{
|
123
|
-
{
|
124
|
-
{
|
125
|
-
{
|
126
|
-
{
|
127
|
-
{
|
128
|
-
{
|
129
|
-
{
|
130
|
-
{
|
131
|
-
{
|
132
|
-
{
|
133
|
-
{
|
134
|
-
{
|
135
|
-
{
|
136
|
-
{
|
137
|
-
{
|
138
|
-
{
|
139
|
-
{
|
140
|
-
{
|
141
|
-
{
|
142
|
-
{
|
143
|
-
{
|
144
|
-
{
|
145
|
-
{
|
60
|
+
@scope_adiwg2sb = [
|
61
|
+
{adiwg: 'aggregate', sb: nil},
|
62
|
+
{adiwg: 'application', sb: 'Application'},
|
63
|
+
{adiwg: 'attribute', sb: nil},
|
64
|
+
{adiwg: 'attributeType', sb: nil},
|
65
|
+
{adiwg: 'awardInfo', sb: nil},
|
66
|
+
{adiwg: 'collection', sb: 'Collection'},
|
67
|
+
{adiwg: 'collectionHardware', sb: nil},
|
68
|
+
{adiwg: 'collectionSession', sb: nil},
|
69
|
+
{adiwg: 'collectionSite', sb: nil},
|
70
|
+
{adiwg: 'coverage', sb: nil},
|
71
|
+
{adiwg: 'dataDictionary', sb: nil},
|
72
|
+
{adiwg: 'dataset', sb: 'Data'},
|
73
|
+
{adiwg: 'dimensionGroup', sb: nil},
|
74
|
+
{adiwg: 'document', sb: 'Document'},
|
75
|
+
{adiwg: 'drawing', sb: nil},
|
76
|
+
{adiwg: 'factSheet', sb: nil},
|
77
|
+
{adiwg: 'feature', sb: nil},
|
78
|
+
{adiwg: 'featureType', sb: nil},
|
79
|
+
{adiwg: 'fieldSession', sb: nil},
|
80
|
+
{adiwg: 'initiative', sb: nil},
|
81
|
+
{adiwg: 'map', sb: 'map'},
|
82
|
+
{adiwg: 'metadata', sb: nil},
|
83
|
+
{adiwg: 'model', sb: nil},
|
84
|
+
{adiwg: 'nonGeographicDataset', sb: nil},
|
85
|
+
{adiwg: 'photographicImage', sb: 'Image'},
|
86
|
+
{adiwg: 'presentation', sb: nil},
|
87
|
+
{adiwg: 'product', sb: nil},
|
88
|
+
{adiwg: 'project', sb: 'Project'},
|
89
|
+
{adiwg: 'propertyType', sb: nil},
|
90
|
+
{adiwg: 'publication', sb: 'Publication'},
|
91
|
+
{adiwg: 'report', sb: 'Report'},
|
92
|
+
{adiwg: 'repository', sb: nil},
|
93
|
+
{adiwg: 'sample', sb: 'Physical Item'},
|
94
|
+
{adiwg: 'sciencePaper', sb: 'Report'},
|
95
|
+
{adiwg: 'series', sb: nil},
|
96
|
+
{adiwg: 'service', sb: nil},
|
97
|
+
{adiwg: 'software', sb: 'Software'},
|
98
|
+
{adiwg: 'tabularDataset', sb: 'Data'},
|
99
|
+
{adiwg: 'tile', sb: nil},
|
100
|
+
{adiwg: 'userGuide', sb: nil},
|
101
|
+
{adiwg: 'website', sb: 'Web Site'}
|
146
102
|
]
|
147
103
|
|
148
|
-
@
|
149
|
-
{
|
150
|
-
{
|
151
|
-
{
|
152
|
-
{
|
153
|
-
{
|
154
|
-
{
|
155
|
-
{
|
156
|
-
{
|
157
|
-
{
|
158
|
-
{
|
159
|
-
{
|
160
|
-
{
|
161
|
-
{
|
162
|
-
{
|
163
|
-
{
|
164
|
-
{
|
165
|
-
{
|
166
|
-
{
|
167
|
-
{
|
168
|
-
{
|
169
|
-
{
|
170
|
-
{
|
171
|
-
{
|
172
|
-
{
|
173
|
-
{
|
174
|
-
{
|
175
|
-
{iso: 'received', sb: 'Received'},
|
176
|
-
{iso: 'reported', sb: 'Reported'},
|
177
|
-
{iso: nil, sb: 'Repository Created'},
|
178
|
-
{iso: nil, sb: 'Repository Updated'},
|
179
|
-
{iso: 'start', sb: 'Start'},
|
180
|
-
{iso: 'transmitted', sb: 'Transmitted'}
|
104
|
+
@date_adiwg2sb = [
|
105
|
+
{adiwg: 'acquisition', sb: 'Acquisition'},
|
106
|
+
{adiwg: 'adopted', sb: 'Adopted'},
|
107
|
+
{adiwg: 'assessment', sb: 'AssessmentDate'},
|
108
|
+
{adiwg: 'award', sb: 'Award'},
|
109
|
+
{adiwg: 'collected', sb: 'Collected'},
|
110
|
+
{adiwg: 'creation', sb: 'creation'},
|
111
|
+
{adiwg: 'deprecated', sb: 'deprecated'},
|
112
|
+
{adiwg: 'distribution', sb: 'distribution'},
|
113
|
+
{adiwg: 'due', sb: 'Due'},
|
114
|
+
{adiwg: 'end', sb: 'End'},
|
115
|
+
{adiwg: 'expiry', sb: nil},
|
116
|
+
{adiwg: 'inForce', sb: 'inForce'},
|
117
|
+
{adiwg: 'lastRevision', sb: 'lastRevision'},
|
118
|
+
{adiwg: 'lastUpdate', sb: 'lastUpdate'},
|
119
|
+
{adiwg: 'nextUpdate', sb: 'nextUpdate'},
|
120
|
+
{adiwg: 'publication', sb: 'Publication'},
|
121
|
+
{adiwg: 'received', sb: 'Received'},
|
122
|
+
{adiwg: 'released', sb: 'Release'},
|
123
|
+
{adiwg: 'reported', sb: 'Reported'},
|
124
|
+
{adiwg: 'revision', sb: 'revision'},
|
125
|
+
{adiwg: 'start', sb: 'Start'},
|
126
|
+
{adiwg: 'suspended', sb: 'suspended'},
|
127
|
+
{adiwg: 'transmitted', sb: 'Transmitted'},
|
128
|
+
{adiwg: 'unavailable', sb: 'unavailable'},
|
129
|
+
{adiwg: 'validityBegins', sb: 'validityBegins'},
|
130
|
+
{adiwg: 'validityExpires', sb: 'validityExpires'}
|
181
131
|
]
|
182
132
|
|
183
|
-
@
|
184
|
-
{
|
185
|
-
{
|
186
|
-
{
|
187
|
-
{
|
188
|
-
{
|
189
|
-
{
|
190
|
-
{
|
191
|
-
{
|
192
|
-
{
|
193
|
-
{
|
194
|
-
{
|
195
|
-
{
|
196
|
-
{
|
197
|
-
{
|
198
|
-
{
|
199
|
-
{
|
200
|
-
{
|
201
|
-
{
|
202
|
-
{
|
203
|
-
{
|
204
|
-
{
|
205
|
-
{iso: 'suspended', sb: nil}
|
133
|
+
@progress_adiwg2sb = [
|
134
|
+
{adiwg: 'accepted', sb: 'Approved'},
|
135
|
+
{adiwg: 'cancelled', sb: nil},
|
136
|
+
{adiwg: 'completed', sb: 'Completed'},
|
137
|
+
{adiwg: 'deprecated', sb: nil},
|
138
|
+
{adiwg: 'final', sb: nil},
|
139
|
+
{adiwg: 'funded', sb: nil},
|
140
|
+
{adiwg: 'historicalArchive', sb: nil},
|
141
|
+
{adiwg: 'notAccepted', sb: nil},
|
142
|
+
{adiwg: 'obsolete', sb: nil},
|
143
|
+
{adiwg: 'onGoing', sb: 'In Progress'},
|
144
|
+
{adiwg: 'pending', sb: nil},
|
145
|
+
{adiwg: 'planned', sb: nil},
|
146
|
+
{adiwg: 'proposed', sb: 'Proposed'},
|
147
|
+
{adiwg: 'required', sb: nil},
|
148
|
+
{adiwg: 'retired', sb: nil},
|
149
|
+
{adiwg: 'superseded', sb: nil},
|
150
|
+
{adiwg: 'suspended', sb: nil},
|
151
|
+
{adiwg: 'tentative', sb: nil},
|
152
|
+
{adiwg: 'underDevelopment', sb: nil},
|
153
|
+
{adiwg: 'valid', sb: nil},
|
154
|
+
{adiwg: 'withdrawn', sb: nil}
|
206
155
|
]
|
207
156
|
|
208
|
-
|
209
|
-
|
157
|
+
@association_adiwg2sb = [
|
158
|
+
{adiwg: 'alternate', sb: 'alternate'},
|
159
|
+
{adiwg: 'collectiveTitle', sb: nil},
|
160
|
+
{adiwg: 'crossReference', sb: 'related'},
|
161
|
+
{adiwg: 'dependency', sb: nil},
|
162
|
+
{adiwg: 'derivativeProduct', sb: 'derivativeOf'},
|
163
|
+
{adiwg: 'isComposedOf', sb: 'constituentOf'},
|
164
|
+
{adiwg: 'largerWorkCitation', sb: nil},
|
165
|
+
{adiwg: 'parentProject', sb: 'productOf'},
|
166
|
+
{adiwg: 'partOfSeamlessDatabase', sb: nil},
|
167
|
+
{adiwg: 'product', sb: 'productOf'},
|
168
|
+
{adiwg: 'revisionOf', sb: nil},
|
169
|
+
{adiwg: 'series', sb: nil},
|
170
|
+
{adiwg: 'source', sb: nil},
|
171
|
+
{adiwg: 'stereoMate', sb: nil},
|
172
|
+
{adiwg: 'subProject', sb: 'subprojectOf'},
|
173
|
+
{adiwg: 'supplementalResource', sb: nil},
|
174
|
+
|
175
|
+
{adiwg: 'mainprojectOf', sb: 'subprojectOf', deprecated: true},
|
176
|
+
{adiwg: 'produced', sb: 'productOf', deprecated: true},
|
177
|
+
{adiwg: 'productOf', sb: 'productOf', deprecated: true},
|
178
|
+
{adiwg: 'projectProduct', sb: 'productOf', deprecated: true},
|
179
|
+
{adiwg: 'subprojectOf', sb: 'subprojectOf', deprecated: true}
|
180
|
+
]
|
210
181
|
|
182
|
+
# translate iso/adiwg code to sb
|
183
|
+
def self.codelist_adiwg2sb(codelist, adiwgCode)
|
211
184
|
codeList = instance_variable_get("@#{codelist}")
|
212
|
-
|
213
|
-
unless isoCode.nil?
|
185
|
+
unless adiwgCode.nil?
|
214
186
|
codeList.each do |obj|
|
215
|
-
if obj[:
|
187
|
+
if obj[:adiwg] == adiwgCode
|
216
188
|
return obj[:sb]
|
217
189
|
end
|
218
190
|
end
|
219
191
|
end
|
220
|
-
|
221
|
-
unless sbCode.nil?
|
222
|
-
codeList.each do |obj|
|
223
|
-
if obj[:sb] == sbCode
|
224
|
-
return obj[:iso]
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
# not found
|
230
192
|
return nil
|
231
|
-
|
232
|
-
end
|
233
|
-
|
234
|
-
# test if provided code is a valid sb code
|
235
|
-
def self.is_sb_code(codelist, sbCode)
|
236
|
-
codeList = instance_variable_get("@#{codelist}")
|
237
|
-
unless sbCode.nil?
|
238
|
-
codeList.each do |obj|
|
239
|
-
if obj[:sb] == sbCode
|
240
|
-
return true
|
241
|
-
end
|
242
|
-
end
|
243
|
-
end
|
244
|
-
return false
|
245
193
|
end
|
246
194
|
|
247
195
|
# get requested codelist from the adiwg-mdcodes gem
|
@@ -34,7 +34,7 @@ module ADIWG
|
|
34
34
|
aContactList = []
|
35
35
|
aResponsibility.each do |hResponsibility|
|
36
36
|
role = hResponsibility[:roleName]
|
37
|
-
sbRole = Codelists.
|
37
|
+
sbRole = Codelists.codelist_adiwg2sb('role_adiwg2sb', role)
|
38
38
|
sbRole = sbRole.nil? ? role : sbRole
|
39
39
|
hResponsibility[:parties].each do |hParty|
|
40
40
|
aContactList << { :role => sbRole, :index => hParty[:contactIndex] }
|
@@ -21,7 +21,7 @@ module ADIWG
|
|
21
21
|
unless hCitation.empty?
|
22
22
|
hCitation[:dates].each do |hDate|
|
23
23
|
sbDate = {}
|
24
|
-
dateType = Codelists.
|
24
|
+
dateType = Codelists.codelist_adiwg2sb('date_adiwg2sb', hDate[:dateType])
|
25
25
|
|
26
26
|
# if iso date codes does not map to scienceBase use type = 'Info'
|
27
27
|
if dateType.nil?
|
@@ -25,7 +25,7 @@ module ADIWG
|
|
25
25
|
end
|
26
26
|
unless hDistributor[:contact].empty?
|
27
27
|
role = hDistributor[:contact][:roleName]
|
28
|
-
sbRole = Codelists.
|
28
|
+
sbRole = Codelists.codelist_adiwg2sb('role_adiwg2sb', role)
|
29
29
|
sbRole = sbRole.nil? ? role : sbRole
|
30
30
|
aParties = hDistributor[:contact][:parties]
|
31
31
|
aParties.each do |hParty|
|
@@ -20,7 +20,7 @@ module ADIWG
|
|
20
20
|
if hResourceType[:type] == 'project'
|
21
21
|
hProject[:className] = 'gov.sciencebase.catalog.item.facet.ProjectFacet'
|
22
22
|
hResource[:status].each do |status|
|
23
|
-
sbStatus = Codelists.
|
23
|
+
sbStatus = Codelists.codelist_adiwg2sb('progress_adiwg2sb', status)
|
24
24
|
unless sbStatus.nil?
|
25
25
|
hProject[:projectStatus] = sbStatus
|
26
26
|
break
|
@@ -19,7 +19,6 @@ require_relative 'sbJson_tag'
|
|
19
19
|
require_relative 'sbJson_date'
|
20
20
|
require_relative 'sbJson_spatial'
|
21
21
|
require_relative 'sbJson_facet'
|
22
|
-
require_relative 'sbJson_metadataRepository'
|
23
22
|
require_relative 'sbJson_geographicExtent'
|
24
23
|
require_relative 'sbJson_abstract'
|
25
24
|
|
@@ -48,18 +47,17 @@ module ADIWG
|
|
48
47
|
json.identifiers @Namespace.json_map(hCitation[:identifiers], Identifier) unless hCitation.empty?
|
49
48
|
json.purpose resourceInfo[:purpose]
|
50
49
|
json.rights Rights.build(resourceInfo[:constraints]) unless resourceInfo[:constraints].empty?
|
51
|
-
json.provenance Provenance.build
|
50
|
+
json.provenance Provenance.build
|
52
51
|
json.materialRequestInstructions MaterialRequest.build(distributorInfo) unless distributorInfo.empty?
|
53
52
|
json.parentId ParentId.build(metadataInfo[:parentMetadata]) unless metadataInfo[:parentMetadata].empty?
|
54
53
|
aContactList = Contact.get_contact_list(intObj)
|
55
54
|
json.contacts @Namespace.json_map(aContactList, Contact) unless aContactList.empty?
|
56
55
|
json.webLinks WebLink.build(intObj[:metadata])
|
57
56
|
json.browseCategories BrowseCategory.build(resourceInfo[:resourceTypes])
|
58
|
-
json.tags Tag.build(
|
57
|
+
json.tags Tag.build(intObj)
|
59
58
|
json.dates Date.build(resourceInfo) unless resourceInfo.empty?
|
60
59
|
json.spatial Spatial.build(resourceInfo[:extents]) unless resourceInfo[:extents].empty?
|
61
60
|
json.facets Facet.build(intObj[:metadata])
|
62
|
-
json.metadataRepository Repository.build(intObj[:metadataRepositories]) unless intObj[:metadataRepositories].empty?
|
63
61
|
json.geographicExtents GeographicExtent.build(resourceInfo[:extents]) unless resourceInfo[:extents].empty?
|
64
62
|
|
65
63
|
end
|
@@ -13,15 +13,16 @@ module ADIWG
|
|
13
13
|
|
14
14
|
module Tag
|
15
15
|
|
16
|
-
def self.build(
|
16
|
+
def self.build(intObj)
|
17
17
|
|
18
|
+
hResource = intObj[:metadata][:resourceInfo]
|
18
19
|
aTags = []
|
19
20
|
|
20
21
|
# tags from resource type
|
21
22
|
hResource[:resourceTypes].each do |hType|
|
22
23
|
hTag = {}
|
23
24
|
type = hType[:type]
|
24
|
-
sbType = Codelists.
|
25
|
+
sbType = Codelists.codelist_adiwg2sb('scope_adiwg2sb', type)
|
25
26
|
sbType = sbType.nil? ? type : sbType
|
26
27
|
hTag[:type] = 'Resource Type'
|
27
28
|
hTag[:name] = sbType
|
@@ -50,7 +51,7 @@ module ADIWG
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
# tags
|
54
|
+
# tags from status
|
54
55
|
hResource[:status].each do |status|
|
55
56
|
hTag = {}
|
56
57
|
hTag[:type] = 'Status'
|
@@ -58,6 +59,22 @@ module ADIWG
|
|
58
59
|
aTags << hTag
|
59
60
|
end
|
60
61
|
|
62
|
+
# tags from repositories
|
63
|
+
intObj[:metadataRepositories].each do |hRepo|
|
64
|
+
if hRepo[:repository] == 'data.gov'
|
65
|
+
unless hRepo[:citation].empty?
|
66
|
+
tagName = nil
|
67
|
+
tagName = hRepo[:citation][:title] unless hRepo[:citation][:title].nil?
|
68
|
+
unless tagName.nil?
|
69
|
+
hTag = {}
|
70
|
+
hTag[:type] = 'Harvest Set'
|
71
|
+
hTag[:name] = tagName
|
72
|
+
aTags << hTag
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
61
78
|
if aTags.empty?
|
62
79
|
return nil
|
63
80
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
# Stan Smith 2017-05-30 original script
|
5
5
|
|
6
6
|
require 'jbuilder'
|
7
|
+
require 'adiwg/mdtranslator/readers/sbJson/modules/module_codelists'
|
7
8
|
require_relative 'sbJson_codelists'
|
8
9
|
|
9
10
|
module ADIWG
|
@@ -13,18 +14,24 @@ module ADIWG
|
|
13
14
|
|
14
15
|
module WebLink
|
15
16
|
|
17
|
+
@Namespace = ADIWG::Mdtranslator::Readers::SbJson
|
18
|
+
|
16
19
|
def self.buildWebLink(hResource)
|
17
20
|
|
18
21
|
hWebLink = {}
|
19
22
|
|
20
23
|
function = hResource[:olResFunction]
|
24
|
+
# if function is nil use sbJson type 'webLink'
|
25
|
+
# if function was entered as a valid sbJson code use it
|
26
|
+
# if function was entered as a valid ADIwg/ISO code translate it to sbJson
|
27
|
+
# if the translation is not possible use sbJson type 'webLink'
|
21
28
|
if function.nil?
|
22
29
|
hWebLink[:type] = 'webLink'
|
23
30
|
else
|
24
|
-
if Codelists.is_sb_code('
|
31
|
+
if @Namespace::Codelists.is_sb_code('onlineFunction_sb2adiwg', function)
|
25
32
|
hWebLink[:type] = function
|
26
33
|
else
|
27
|
-
sbFunction = Codelists.
|
34
|
+
sbFunction = Codelists.codelist_adiwg2sb('onlineFunction_adiwg2sb', function)
|
28
35
|
hWebLink[:type] = sbFunction.nil? ? 'webLink' : sbFunction
|
29
36
|
end
|
30
37
|
end
|