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,75 +0,0 @@
1
- require 'uri'
2
- require 'date'
3
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_metadataInfo')
4
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceInfo')
5
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_distributionInfo')
6
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_associatedResource')
7
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_additionalDocumentation')
8
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_citation')
9
-
10
- module ADIWG
11
- module Mdtranslator
12
- module Readers
13
- module SbJson
14
- module Metadata
15
- def self.unpack(hMetadata, responseObj, intObj)
16
- # instance classes needed in script
17
- intMetadataClass = InternalMetadata.new
18
- intMetadata = intMetadataClass.newMetadata
19
-
20
- # metadata - metadataInfo
21
- intMetadata[:metadataInfo] = MetadataInfo.unpack(hMetadata, responseObj, intObj)
22
-
23
- # metadata - resource identification info
24
- intMetadata[:resourceInfo] = ResourceInfo.unpack(hMetadata, responseObj, intObj)
25
-
26
- # metadata - distribution info
27
- if hMetadata.key?('distributionLinks')
28
- intMetadata[:distributorInfo] << DistributionInfo.unpack(hMetadata, responseObj, intObj)
29
- end
30
-
31
- # metadata - associated resources
32
- # if hMetadata.has_key?('associatedResource')
33
- # aAssocRes = hMetadata['associatedResource']
34
- # unless aAssocRes.empty?
35
- # aAssocRes.each do |hAssocRes|
36
- # intMetadata[:associatedResources] << AssociatedResource.unpack(hAssocRes, responseObj)
37
- # end
38
- # end
39
- # end
40
-
41
- # metadata - additional documents
42
- if hMetadata.key?('webLinks')
43
- aAddDocs = hMetadata['webLinks']
44
- unless aAddDocs.empty?
45
- aAddDocs.each do |hAddDoc|
46
- doc = {
47
- 'resourceType' => hAddDoc['type'],
48
- 'citation' => {
49
- 'title' => hAddDoc['title'] || hAddDoc['typeLabel'],
50
- 'date' => [{
51
- 'date' => DateTime.now.iso8601,
52
- 'dateType' => 'distribution'
53
- }],
54
- 'onlineResource' => [
55
- {
56
- 'uri' => hAddDoc['uri'],
57
- 'protocol' => URI.parse(hAddDoc['uri']).scheme,
58
- 'name' => hAddDoc['title'],
59
- 'function' => hAddDoc['type']
60
- }
61
- ]
62
- }
63
- }
64
- intMetadata[:additionalDocuments] << AdditionalDocumentation.unpack(doc, responseObj)
65
- end
66
- end
67
- end
68
-
69
- intMetadata
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,130 +0,0 @@
1
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_responsibleParty')
2
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_dateTime')
3
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceMaintenance')
4
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_metadataExtension')
5
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceIdentifier')
6
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_citation')
7
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_locale')
8
-
9
- module ADIWG
10
- module Mdtranslator
11
- module Readers
12
- module SbJson
13
- module MetadataInfo
14
- def self.unpack(hMetadata, responseObj, intObj)
15
- # return nil object if input is empty
16
- intMetadataInfo = nil
17
- return if hMetadata.empty?
18
-
19
- # instance classes needed in script
20
- intMetadataClass = InternalMetadata.new
21
- intMetadataInfo = intMetadataClass.newMetadataInfo
22
- hMetadataInfo = hMetadata
23
-
24
- # metadata - metadata identifier
25
- if hMetadataInfo.key?('id')
26
- hMetadataId = hMetadataInfo['id']
27
- unless hMetadataId.empty?
28
- rId = intMetadataClass.newResourceId
29
- rId[:identifier] = hMetadataId
30
- rId[:identifierType] = 'uuid'
31
- rId[:identifierNamespace] = 'gov.sciencebase.catalog'
32
- rId[:identifierDescription] = 'The unique ScienceBase id of the resource.'
33
- intMetadataInfo[:metadataId] = rId
34
- end
35
- end
36
-
37
- # metadata - parent metadata identifier
38
- if hMetadataInfo.key?('parentId')
39
- hParentId = hMetadataInfo['parentId']
40
- hParent = intMetadataClass.newCitation
41
- hParent[:citTitle] = 'Parent Metadata identifier'
42
- pId = intMetadataClass.newResourceId
43
- pId[:identifier] = hParentId
44
- pId[:identifierType] = 'uuid'
45
- pId[:identifierNamespace] = 'gov.sciencebase.catalog'
46
- pId[:identifierDescription] = 'The unique ScienceBase id of the parent resource.'
47
- hParent[:citResourceIds] << pId
48
- pParty = intMetadataClass.newRespParty
49
- pParty[:contactId] = 'SB'
50
- pParty[:roleName] = 'originator'
51
- hParent[:citResponsibleParty] << pParty
52
- intOLRes = intMetadataClass.newOnlineResource
53
- intOLRes[:olResURI] = 'https://www.sciencebase.gov/catalog/item/' + hParentId
54
- intOLRes[:olResProtocol] = 'http'
55
- intOLRes[:olResName] = 'Parent Resource Link'
56
- intOLRes[:olResDesc] = 'ScienceBase URL of resource'
57
- intOLRes[:olResFunction] = 'information'
58
- hParent[:citOlResources] << intOLRes
59
-
60
- intMetadataInfo[:parentMetadata] = hParent unless hParent.empty?
61
- end
62
-
63
- # metadata - metadata contacts, custodians
64
- # We're just injecting the first sbJSON contact here
65
- firstCont = intObj[:contacts][0]
66
- aCust = {}
67
- aCust['contactId'] = firstCont[:contactId]
68
- aCust['role'] = firstCont[:primaryRole]
69
- intMetadataInfo[:metadataCustodians] << ResponsibleParty.unpack(aCust, responseObj)
70
-
71
- # metadata - creation date
72
- if hMetadataInfo.key?('provenance')
73
- s = hMetadataInfo['provenance']['dateCreated']
74
- if s != ''
75
- hDateTime = SbDateTime.unpack(s, responseObj)
76
- hDateTime[:dateType] = 'creation'
77
- intMetadataInfo[:metadataCreateDate] = hDateTime
78
- end
79
- end
80
-
81
- # metadata - date of last metadata update
82
- if hMetadataInfo.key?('provenance')
83
- s = hMetadataInfo['provenance']['lastUpdated']
84
- if s != ''
85
- hDateTime = SbDateTime.unpack(s, responseObj)
86
- hDateTime[:dateType] = 'lastUpdate'
87
- intMetadataInfo[:metadataUpdateDate] = hDateTime
88
- end
89
- end
90
-
91
- # metadata - characterSet - default 'utf8'
92
- intMetadataInfo[:metadataCharacterSet] = 'utf8'
93
-
94
- # metadata - locale
95
- intLocale = intMetadataClass.newLocale
96
- intLocale[:languageCode] = 'eng'
97
- intLocale[:countryCode] = 'USA'
98
- intLocale[:characterEncoding] = 'UTF-8'
99
- intMetadataInfo[:metadataLocales] << intLocale
100
-
101
- # metadata - metadata URI
102
- intMetadataInfo[:metadataURI] = 'https://www.sciencebase.gov/catalog/item/' +
103
- hMetadataInfo['id'] unless hMetadataInfo['id'].nil?
104
-
105
- # metadata - status
106
- # if hMetadataInfo.has_key?('metadataStatus')
107
- # s = hMetadataInfo['metadataStatus']
108
- # if s != ''
109
- # intMetadataInfo[:metadataStatus] = s
110
- # end
111
- # end
112
-
113
- # metadata - metadata maintenance info
114
- intResMaint = intMetadataClass.newResourceMaint
115
-
116
- # resource maintenance - frequency code
117
- intResMaint[:maintFreq] = 'asNeeded'
118
-
119
- # resource maintenance - contact
120
- intResMaint[:maintContacts] << intMetadataInfo[:metadataCustodians][0]
121
-
122
- intMetadataInfo[:maintInfo] = intResMaint
123
-
124
- intMetadataInfo
125
- end
126
- end
127
- end
128
- end
129
- end
130
- end
@@ -1,71 +0,0 @@
1
- module ADIWG
2
- module Mdtranslator
3
- module Readers
4
- module SbJson
5
-
6
- module OnlineResource
7
-
8
- def self.unpack(hOlResource, responseObj)
9
-
10
- # return nil object if input is empty
11
- intOLRes = nil
12
- return if hOlResource.empty?
13
-
14
- # instance classes needed in script
15
- intMetadataClass = InternalMetadata.new
16
- intOLRes = intMetadataClass.newOnlineResource
17
-
18
- # unpack the online resource
19
- # resource - web link
20
- if hOlResource.has_key?('uri')
21
- s = hOlResource['uri']
22
- if s != ''
23
- intOLRes[:olResURI] = s
24
- else
25
- responseObj[:readerExecutionMessages] << 'Online Resource URI is missing'
26
- responseObj[:readerExecutionPass] = false
27
- return nil
28
- end
29
- end
30
-
31
- # resource - web link protocol
32
- if hOlResource.has_key?('protocol')
33
- s = hOlResource['protocol']
34
- if s != ''
35
- intOLRes[:olResProtocol] = s
36
- end
37
- end
38
-
39
- # resource - web link name
40
- if hOlResource.has_key?('name')
41
- s = hOlResource['name']
42
- if s != ''
43
- intOLRes[:olResName] = s
44
- end
45
- end
46
-
47
- # resource - web link description
48
- if hOlResource.has_key?('description')
49
- s = hOlResource['description']
50
- if s != ''
51
- intOLRes[:olResDesc] = s
52
- end
53
- end
54
-
55
- # resource - web link function
56
- if hOlResource.has_key?('function')
57
- s = hOlResource['function']
58
- if s != ''
59
- intOLRes[:olResFunction] = s
60
- end
61
- end
62
-
63
- return intOLRes
64
- end
65
-
66
- end
67
-
68
- end
69
- end
70
- end
71
- end
@@ -1,73 +0,0 @@
1
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_citation')
2
-
3
- module ADIWG
4
- module Mdtranslator
5
- module Readers
6
- module SbJson
7
-
8
- module ResourceIdentifier
9
-
10
- def self.unpack(hResID, responseObj)
11
-
12
- # instance classes needed in script
13
- intMetadataClass = InternalMetadata.new
14
- intResID = intMetadataClass.newResourceId
15
-
16
- # resource identifier - identifier
17
- if hResID.has_key?('identifier')
18
- s = hResID['identifier']
19
- if s != ''
20
- intResID[:identifier] = s
21
- end
22
- end
23
-
24
- # resource identifier - identifier type
25
- if hResID.has_key?('type')
26
- s = hResID['type']
27
- if s != ''
28
- intResID[:identifierType] = s
29
- end
30
- end
31
-
32
- # resource identifier - namespace
33
- if hResID.has_key?('namespace')
34
- s = hResID['namespace']
35
- if s != ''
36
- intResID[:identifierNamespace] = s
37
- end
38
- end
39
-
40
- # resource identifier - version
41
- if hResID.has_key?('version')
42
- s = hResID['version']
43
- if s != ''
44
- intResID[:identifierVersion] = s
45
- end
46
- end
47
-
48
- # resource identifier - description
49
- if hResID.has_key?('description')
50
- s = hResID['description']
51
- if s != ''
52
- intResID[:identifierDescription] = s
53
- end
54
- end
55
-
56
- # resource identifier - authority (expressed as a citation)
57
- if hResID.has_key?('authority')
58
- hCitation = hResID['authority']
59
- unless hCitation.empty?
60
- intResID[:identifierCitation] = Citation.unpack(hCitation, responseObj)
61
- end
62
- end
63
-
64
- return intResID
65
-
66
- end
67
-
68
- end
69
-
70
- end
71
- end
72
- end
73
- end
@@ -1,437 +0,0 @@
1
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_citation')
2
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_responsibleParty')
3
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceFormat')
4
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_descriptiveKeyword')
5
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceMaintenance')
6
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resourceSpecificUsage')
7
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_browseGraphic')
8
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_legalConstraint')
9
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_securityConstraint')
10
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_taxonomy')
11
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_resolution')
12
- require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_extent')
13
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_dataQuality')
14
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_spatialReference')
15
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_timePeriod')
16
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_locale')
17
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_gridInfo')
18
- # require ADIWG::Mdtranslator::Readers::SbJson.readerModule('module_coverageInfo')
19
- require 'uri'
20
-
21
- module ADIWG
22
- module Mdtranslator
23
- module Readers
24
- module SbJson
25
- module ResourceInfo
26
- def self.unpack(hResourceInfo, responseObj, intObj)
27
- # instance classes needed in script
28
- intMetadataClass = InternalMetadata.new
29
- intResInfo = intMetadataClass.newResourceInfo
30
-
31
- # resource information - resource type
32
- # we can check for the project "facet",
33
- # however there is no reliable way to determine
34
- # other types so just default to "dataset"
35
- if hResourceInfo.key?('facets')
36
- projectFacet = hResourceInfo['facets'].find { |s| s['className'] == 'gov.sciencebase.catalog.item.facet.ProjectFacet' }
37
- end
38
- intResInfo[:resourceType] = projectFacet.nil? ? 'dataset' : 'project'
39
-
40
- # resource information - citation
41
- hCitation = intMetadataClass.newCitation
42
- hCitation[:citTitle] = hResourceInfo['title']
43
- if hResourceInfo.key?('alternateTitles')
44
- hCitation[:citAltTitle] = hResourceInfo['alternateTitles'][0]
45
- end
46
-
47
- pId = intMetadataClass.newResourceId
48
- pId[:identifier] = hResourceInfo['id']
49
- pId[:identifierType] = 'uuid'
50
- pId[:identifierNamespace] = 'gov.sciencebase.catalog'
51
- pId[:identifierDescription] = 'The unique ScienceBase id of the parent resource.'
52
- hCitation[:citResourceIds] << pId
53
-
54
- if hResourceInfo.key?('identifiers')
55
- hResourceInfo['identifiers'].each do |id|
56
- pId = intMetadataClass.newResourceId
57
- pId[:identifier] = id['key']
58
- pId[:identifierType] = id['type']
59
- pId[:identifierNamespace] = id['scheme']
60
- hCitation[:citResourceIds] << pId
61
- end
62
- end
63
-
64
- # citation - presentation form
65
- if hResourceInfo.key?('browseTypes')
66
- aPForms = hResourceInfo['browseTypes']
67
- unless aPForms.empty?
68
- aPForms.each do |pForm|
69
- hCitation[:citResourceForms] << pForm
70
- end
71
- end
72
- end
73
-
74
- if hResourceInfo.key?('contacts')
75
- hResourceInfo['contacts'].each do |contact|
76
- aCont = {}
77
- aCont[:contactId] = contact['contactId']
78
- aCont[:roleName] = contact['type']
79
- hCitation[:citResponsibleParty] << aCont
80
- end
81
- end
82
-
83
- if hResourceInfo.key?('dates')
84
- hResourceInfo['dates'].each do |date|
85
- s = date['dateString']
86
- next unless s != ''
87
- hDateTime = SbDateTime.unpack(s, responseObj)
88
- hDateTime[:dateType] = date['type']
89
- hCitation[:citDate] << hDateTime
90
- end
91
- end
92
-
93
- if hResourceInfo.key?('link')
94
- link = hResourceInfo['link']
95
- intOLRes = intMetadataClass.newOnlineResource
96
- intOLRes[:olResURI] = link['url']
97
- intOLRes[:olResProtocol] = 'http'
98
- intOLRes[:olResName] = 'Resource Link'
99
- intOLRes[:olResDesc] = 'ScienceBase URL of resource'
100
- intOLRes[:olResFunction] = 'information'
101
- hCitation[:citOlResources] << intOLRes
102
- end
103
-
104
- unless hCitation.empty?
105
- intResInfo[:citation] = hCitation
106
- end
107
-
108
- # resource information - resource time period
109
- # if hResourceInfo.has_key?('resourceTimePeriod')
110
- # hResPeriod = hResourceInfo['resourceTimePeriod']
111
- # unless hResPeriod.empty?
112
- # intResInfo[:timePeriod] = TimePeriod.unpack(hResPeriod, responseObj)
113
- # end
114
- # end
115
-
116
- # resource information - point of contact
117
- # metadata - metadata contacts, custodians
118
- # We're just injecting the first sbJSON contact here
119
- firstCont = intObj[:contacts][0]
120
- aCust = {}
121
- aCust['contactId'] = firstCont[:contactId]
122
- aCust['role'] = firstCont[:primaryRole]
123
- intResInfo[:pointsOfContact] << ResponsibleParty.unpack(aCust, responseObj)
124
-
125
- # resource information - abstract
126
- if hResourceInfo.key?('body')
127
- s = hResourceInfo['body']
128
- intResInfo[:abstract] = s if s != ''
129
- end
130
-
131
- # resource information - short abstract
132
- if hResourceInfo.key?('summary')
133
- s = hResourceInfo['summary']
134
- intResInfo[:shortAbstract] = s if s != ''
135
- end
136
-
137
- # resource information - status
138
- # project status is sometimes available
139
- # otherwise just defaults to "published"
140
- if not projectFacet.nil?
141
-
142
- if projectFacet.key?('projectStatus')
143
- status = projectFacet['projectStatus']
144
- end
145
- end
146
- intResInfo[:status] = status.nil? ? 'published' : status
147
-
148
- # resource information - has mappable location
149
- intResInfo[:hasMapLocation?] = hResourceInfo.key?('spatial')
150
-
151
- # resource information - has data available
152
- intResInfo[:hasDataAvailable?] = hResourceInfo.key?('distributionLinks')
153
-
154
- # resource information - language
155
- intResInfo[:resourceLanguages] << 'eng'
156
-
157
- # resource information - characterSet [] - default 'utf8'
158
- intResInfo[:resourceCharacterSets] << 'UTF-8'
159
-
160
- # resource - locale
161
- intLocale = intMetadataClass.newLocale
162
- intLocale[:languageCode] = 'eng'
163
- intLocale[:countryCode] = 'USA'
164
- intLocale[:characterEncoding] = 'UTF-8'
165
- intResInfo[:resourceLocales] << intLocale
166
-
167
- # resource information - purpose
168
- if hResourceInfo.key?('purpose')
169
- s = hResourceInfo['purpose']
170
- intResInfo[:purpose] = s if s != ''
171
- end
172
-
173
- # resource information - credit
174
- if hResourceInfo.key?('citation')
175
- aCredits = hResourceInfo['citation']
176
- intResInfo[:credits] << aCredits
177
- end
178
-
179
- # resource information - topic category
180
- if hResourceInfo.key?('tags')
181
- tags = hResourceInfo['tags'].group_by { |t| t['scheme'] || 'None' }
182
- aTopics = tags['ISO 19115 Topic Categories']
183
- unless aTopics.nil?
184
- aTopics.each do |topic|
185
- intResInfo[:topicCategories] << topic['name']
186
- end
187
- end
188
- end
189
-
190
- # resource information - environment description
191
- # if hResourceInfo.has_key?('environmentDescription')
192
- # s = hResourceInfo['environmentDescription']
193
- # if s != ''
194
- # intResInfo[:environmentDescription] = s
195
- # end
196
- # end
197
-
198
- # resource information - resource format
199
- # if hResourceInfo.has_key?('resourceNativeFormat')
200
- # aResFormat = hResourceInfo['resourceNativeFormat']
201
- # unless aResFormat.empty?
202
- # aResFormat.each do |hResFormat|
203
- # intResInfo[:resourceFormats] << ResourceFormat.unpack(hResFormat, responseObj)
204
- # end
205
- # end
206
- # end
207
-
208
- # resource information - descriptive keywords
209
- unless tags.nil?
210
- aDesKeywords = tags.select { |t| t != 'ISO 19115 Topic Categories' }
211
- unless aDesKeywords.empty?
212
- aDesKeywords.each do |k, kScheme|
213
- kType = kScheme.group_by { |t| t['type'] || 'Theme' }
214
-
215
- kType.each do |type, words|
216
- intKw = intMetadataClass.newKeyword
217
- intKw[:keywordType] = type
218
- words.each do |kw|
219
- intKw[:keyword] << kw['name']
220
- end
221
- kCitation = intMetadataClass.newCitation
222
- kCitation[:citTitle] = 'ScienceBase Tags'
223
- pParty = intMetadataClass.newRespParty
224
- pParty[:contactId] = 'SB'
225
- pParty[:roleName] = 'publisher'
226
- kCitation[:citResponsibleParty] << pParty
227
- if k =~ /\A#{URI.regexp(%w(http https))}\z/
228
- intOLRes = intMetadataClass.newOnlineResource
229
- intOLRes[:olResURI] = k
230
- intOLRes[:olResProtocol] = 'http'
231
- intOLRes[:olResName] = 'Link to ScienceBase scheme'
232
- intOLRes[:olResDesc] = ' ScienceBase controlled vocabulary'
233
- intOLRes[:olResFunction] = 'information'
234
- kCitation[:citOlResources] << intOLRes
235
- end
236
- intKw[:keyTheCitation] = kCitation
237
- intResInfo[:descriptiveKeywords] << intKw
238
- end
239
- end
240
- end
241
- end
242
-
243
- # resource information - resource maintenance
244
- # if hResourceInfo.has_key?('resourceMaintenance')
245
- # aResMaint = hResourceInfo['resourceMaintenance']
246
- # unless aResMaint.empty?
247
- # aResMaint.each do |hResource|
248
- # intResInfo[:resourceMaint] << ResourceMaintenance.unpack(hResource, responseObj)
249
- # end
250
- # end
251
- # end
252
-
253
- # resource information - resource specific usage
254
- # if hResourceInfo.key?('resourceSpecificUsage')
255
- # aResUses = hResourceInfo['resourceSpecificUsage']
256
- # unless aResUses.empty?
257
- # aResUses.each do |hUsage|
258
- # intResInfo[:resourceUses] << ResourceSpecificUsage.unpack(hUsage, responseObj)
259
- # end
260
- # end
261
- # end
262
-
263
- # resource information - graphic overview
264
- if hResourceInfo.key?('previewImage')
265
- aBrowseGraph = hResourceInfo['previewImage']
266
-
267
- unless aBrowseGraph.empty?
268
- aBrowseGraph.each_pair do |name, bg|
269
- next unless bg.is_a?(Hash)
270
-
271
- hb = {
272
- 'fileName' => name,
273
- 'fileDescription' => 'Preview image.',
274
- 'fileType' => 'image',
275
- 'fileUri' => bg['uri']
276
- }
277
- intResInfo[:graphicOverview] << BrowseGraphic.unpack(hb, responseObj)
278
- end
279
- end
280
- end
281
-
282
- # resource information - use constraints
283
- # if hResourceInfo.key?('constraint')
284
- # hConstraint = hResourceInfo['constraint']
285
-
286
- # resource information - resource constraints - use
287
- # if hConstraint.key?('useLimitation')
288
- # aUseLimits = hConstraint['useLimitation']
289
- # unless aUseLimits.empty?
290
- # aUseLimits.each do |useLimit|
291
- # intResInfo[:useConstraints] << useLimit
292
- # end
293
- # end
294
- # end
295
-
296
- # resource information - resource constraints - legal
297
- if hResourceInfo.key?('rights')
298
- aLegalCons = hResourceInfo['rights']
299
- unless aLegalCons.empty?
300
- aCons = intMetadataClass.newLegalConstraint
301
- aCons[:useCodes] << aLegalCons
302
- intResInfo[:legalConstraints] << aCons
303
- end
304
- end
305
-
306
- # resource information - resource constraints - security
307
- # if hConstraint.key?('securityConstraint')
308
- # aSecurityCons = hConstraint['securityConstraint']
309
- # unless aSecurityCons.empty?
310
- # aSecurityCons.each do |hSecurityCon|
311
- # intResInfo[:securityConstraints] << SecurityConstraints.unpack(hSecurityCon, responseObj)
312
- # end
313
- # end
314
- # end
315
-
316
- # end
317
-
318
- # # resource information - taxonomy
319
- # if hResourceInfo.has_key?('taxonomy')
320
- # hTaxonomy = hResourceInfo['taxonomy']
321
- # unless hTaxonomy.empty?
322
- # intResInfo[:taxonomy] = Taxonomy.unpack(hTaxonomy, responseObj)
323
- # end
324
- # end
325
-
326
- # resource information - spatial reference systems
327
- # if hResourceInfo.key?('spatialReferenceSystem')
328
- # hSpatialRef = hResourceInfo['spatialReferenceSystem']
329
- # unless hSpatialRef.empty?
330
- # intResInfo[:spatialReferenceSystem] = SpatialReferenceSystem.unpack(hSpatialRef, responseObj)
331
- # end
332
- # end
333
- #
334
- # # resource information - spatial representation type
335
- # if hResourceInfo.key?('spatialRepresentation')
336
- # aSpatialType = hResourceInfo['spatialRepresentation']
337
- # unless aSpatialType.empty?
338
- # aSpatialType.each do |spType|
339
- # intResInfo[:spatialRepresentationTypes] << spType
340
- # end
341
- # end
342
- # end
343
-
344
- # resource information - spatial resolution
345
- # if hResourceInfo.has_key?('spatialResolution')
346
- # aSpRes = hResourceInfo['spatialResolution']
347
- # unless aSpRes.empty?
348
- # aSpRes.each do |hResolution|
349
- # intResInfo[:spatialResolutions] << Resolution.unpack(hResolution, responseObj)
350
- # end
351
- # end
352
- # end
353
-
354
- # resource information - extent
355
- if hResourceInfo.key?('spatial')
356
- aExtents = []
357
- bbox = hResourceInfo['spatial']['boundingBox']
358
- unless bbox.nil?
359
- aExtents << {
360
- 'description' => 'Spatial extent for Resource',
361
- 'geographicElement' => [
362
- {
363
- 'type' => 'Feature',
364
- 'id' => 'boundingBox',
365
- 'bbox' => [
366
- bbox['minX'],
367
- bbox['minY'],
368
- bbox['maxX'],
369
- bbox['maxY']
370
- ],
371
- 'crs' => {
372
- 'type' => 'name',
373
- 'properties' => {
374
- 'name' => 'EPSG:4326'
375
- }
376
- },
377
- 'geometry' => nil,
378
- 'properties' => {
379
- 'featureName' => 'Bounding box',
380
- 'description' => 'bounding box for resource'
381
- }
382
- }
383
- ]
384
- }
385
- end
386
- unless aExtents.empty?
387
- aExtents.each do |hExtent|
388
- intResInfo[:extents] << Extent.unpack(hExtent, responseObj)
389
- end
390
- end
391
- end
392
-
393
- # # resource information - grid information
394
- # if hResourceInfo.has_key?('gridInfo')
395
- # aGrids = hResourceInfo['gridInfo']
396
- # unless aGrids.empty?
397
- # aGrids.each do |hGrid|
398
- # intResInfo[:gridInfo] << GridInfo.unpack(hGrid, responseObj)
399
- # end
400
- # end
401
- # end
402
- #
403
- # # resource information - coverage information
404
- # if hResourceInfo.has_key?('coverageInfo')
405
- # aCoverage = hResourceInfo['coverageInfo']
406
- # unless aCoverage.empty?
407
- # aCoverage.each do |hCoverage|
408
- # intResInfo[:coverageInfo] << CoverageInfo.unpack(hCoverage, responseObj)
409
- # end
410
- # end
411
- # end
412
- #
413
- # # resource information - data quality information
414
- # if hResourceInfo.has_key?('dataQualityInfo')
415
- # aDataQual = hResourceInfo['dataQualityInfo']
416
- # unless aDataQual.empty?
417
- # aDataQual.each do |hDQ|
418
- # intResInfo[:dataQualityInfo] << DataQuality.unpack(hDQ, responseObj)
419
- # end
420
- # end
421
- # end
422
-
423
- # # resource information - supplemental info
424
- # if hResourceInfo.has_key?('supplementalInfo')
425
- # s = hResourceInfo['supplementalInfo']
426
- # if s != ''
427
- # intResInfo[:supplementalInfo] = s
428
- # end
429
- # end
430
-
431
- intResInfo
432
- end
433
- end
434
- end
435
- end
436
- end
437
- end