adiwg-mdtranslator 2.0.0rc8 → 2.0.0rc9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +26 -1
  3. data/lib/adiwg/mdtranslator/version.rb +4 -1
  4. data/lib/adiwg/mdtranslator/writers/html/readme.md +4 -0
  5. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +53 -42
  6. data/lib/adiwg/mdtranslator/writers/sbJson/readme.md +8 -1
  7. data/lib/adiwg/mdtranslator/writers/sbJson/sbJson_writer.rb +30 -1
  8. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_browseCategory.rb +39 -0
  9. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_budget.rb +63 -0
  10. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +10 -3
  11. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_codelists.rb +170 -0
  12. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_contact.rb +119 -40
  13. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_date.rb +40 -0
  14. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_facet.rb +47 -24
  15. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_hours.rb +35 -0
  16. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_materialRequest.rb +59 -0
  17. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_parentId.rb +37 -0
  18. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_project.rb +47 -0
  19. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_provenance.rb +4 -0
  20. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_publication.rb +54 -0
  21. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_sbJson.rb +25 -27
  22. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_spatial.rb +49 -41
  23. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_tag.rb +82 -0
  24. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_webLink.rb +66 -0
  25. metadata +14 -4
  26. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_base.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13bbb8eca7807bfba16ecf13280d1a558c347677
4
- data.tar.gz: d5a3d8d0dea0fd2a0ef8165aeeae4c335782ab4e
3
+ metadata.gz: ad510fae06cdf03810393ba683686f22f9fe569e
4
+ data.tar.gz: 24acaf6b181b68e723835ab70648b76481abfac3
5
5
  SHA512:
6
- metadata.gz: 9ef6d70c38ce2070c82b4511ba0fbdccb704bf7963ebc90468e02cd7a40fdacefff5613ed0da2f18cdf74e4941869bc126f1532f09f3dbc26041456b5596c438
7
- data.tar.gz: 317c72de89f921ead67cc611b9b7f480d1bd6020b1024923db3f44684d7eb48930b11c941b84c9c57838a4cdfe3ef34ba1837eb6ce43369dab3a1ab4227a8f61
6
+ metadata.gz: 9476a3bc114e8c5d5f98fa695f629b857b6a530ecceaa254b60cc9dfb33c1a9628de3c73ed47ea6d233746caa9575cb6c0e1df4c969bda4ab41b7068c7d97029
7
+ data.tar.gz: 9f5c4dac97608fc35749ee8e5f407c26deb48c00c7d5dcf885c14b1fb8dd7b81cafe895ec20fc52364a0c9c8640a0598e97b0c1ec44c0b3ff38d6f855cb57d63
@@ -13,6 +13,8 @@
13
13
 
14
14
  module AdiwgCoordinates
15
15
 
16
+ @spanWorld = 0
17
+
16
18
  # repack coordinate array into single string for ISO
17
19
  def self.stringifyCoords(aCoords, responseObj)
18
20
 
@@ -63,6 +65,9 @@ module AdiwgCoordinates
63
65
  # compute bounding box
64
66
  def self.computeBbox(aGeo)
65
67
 
68
+ # reset spanned world to 0 before computing bounding box
69
+ @spanWorld = 0
70
+
66
71
  # find all the eastings (x) and northings (y) in the GeoJSON object
67
72
  aNorthings = []
68
73
  aEastings = []
@@ -155,7 +160,8 @@ module AdiwgCoordinates
155
160
 
156
161
  end
157
162
 
158
- # move geometry to real world if necessary
163
+ # move geometry to real world if possible
164
+ # move geometry to a single spanned meridian
159
165
  def self.checkGeometry(aCoords, aNorthings, aEastings)
160
166
 
161
167
  aGeoNorthings = []
@@ -165,6 +171,8 @@ module AdiwgCoordinates
165
171
 
166
172
  minEast = aGeoEastings.min
167
173
  maxEast = aGeoEastings.max
174
+
175
+ # if all coordinates in -1 or +1 world, move back to real world
168
176
  if maxEast < -180
169
177
  aGeoEastings.collect! { |x| x + 360 }
170
178
  end
@@ -172,6 +180,23 @@ module AdiwgCoordinates
172
180
  aGeoEastings.collect! { |x| x - 360 }
173
181
  end
174
182
 
183
+ minEast = aGeoEastings.min
184
+ maxEast = aGeoEastings.max
185
+
186
+ # if geoObject spans a meridian, find out which one and make it default
187
+ if @spanWorld == 0
188
+ @spanWorld = -1 if maxEast < 0 && minEast < -180
189
+ @spanWorld = 1 if minEast > 0 && maxEast > 180
190
+ end
191
+
192
+ # bring -1 and +1 world objects back into default meridian world
193
+ if @spanWorld == -1 && maxEast > 180
194
+ aGeoEastings.collect! { |x| x - 360 }
195
+ end
196
+ if @spanWorld == 1 && minEast < -180
197
+ aGeoEastings.collect! { |x| x + 360 }
198
+ end
199
+
175
200
  aEastings.concat(aGeoEastings)
176
201
  aNorthings.concat(aGeoNorthings)
177
202
 
@@ -1,6 +1,9 @@
1
1
  # adiwg mdTranslator
2
2
 
3
3
  # version 2 history
4
+ # 2.0.0rc9 2017-05-26 allow choice of which dictionary to translate
5
+ # ... fix bug when no dictionary is provided in mdJson
6
+ # ... add sbJson writer
4
7
  # 2.0.0rc6 2017-05-24 move geometries to real world if in -1 or +1 world
5
8
  # --- removed special characters from ids for gml:id= in iso writers
6
9
  # 2.0.0rc5 2017-05-20 Fixed bug with no writer provided
@@ -13,7 +16,7 @@
13
16
  module ADIWG
14
17
  module Mdtranslator
15
18
  # current mdtranslator version
16
- VERSION = "2.0.0rc8"
19
+ VERSION = "2.0.0rc9"
17
20
  end
18
21
  end
19
22
 
@@ -1,6 +1,10 @@
1
1
 
2
2
  ## html
3
3
 
4
+ ### Supported versions
5
+
6
+ > Supports mdTranslator version 2.x
7
+
4
8
  ### Writer for HTML 'human-readable' output of metadata
5
9
 
6
10
  The HTML Metadata Record output from the mdTranslator is intended to
@@ -1,68 +1,79 @@
1
1
  # Writer - internal data structure to ISO 19110:2003
2
2
 
3
3
  # History:
4
- # Stan Smith 2017-01-20 refactor for mdJson/mdTranslator 2.0
4
+ # Stan Smith 2017-05-26 allow choice of which dictionary to translate
5
+ # ... fix bug when no dictionary is provided in mdJson
6
+ # Stan Smith 2017-01-20 refactor for mdJson/mdTranslator 2.0
7
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
10
+ # Stan Smith 2015-03-02 added test and return for missing data dictionary
11
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
5
12
  # Stan Smith 2014-12-01 original script
6
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
7
- # Stan Smith 2015-03-02 added test and return for missing data dictionary
8
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
9
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
10
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
11
13
 
12
14
  require 'builder'
13
15
  require_relative 'classes/class_fcFeatureCatalogue'
14
16
 
15
17
  module ADIWG
16
- module Mdtranslator
17
- module Writers
18
- module Iso19110
18
+ module Mdtranslator
19
+ module Writers
20
+ module Iso19110
19
21
 
20
- def self.startWriter(intObj, responseObj)
22
+ def self.startWriter(intObj, responseObj, whichDict: 0)
21
23
 
22
- # make contacts and domains available to the instance
23
- @contacts = intObj[:contacts]
24
- @domains = intObj[:dataDictionaries][0][:domains]
24
+ # Iso19110 can only output one dictionary at a time
25
+ # test if requested dictionary is in input file
26
+ if intObj[:dataDictionaries][whichDict].nil?
27
+ responseObj[:writerMessages] << 'Dictionary is missing'
28
+ responseObj[:writerPass] = false
29
+ return nil
30
+ end
25
31
 
26
- # set the format of the output file based on the writer specified
27
- responseObj[:writerFormat] = 'xml'
32
+ # make contacts and domains available to the instance
33
+ @contacts = intObj[:contacts]
34
+ dictionary = intObj[:dataDictionaries][whichDict]
35
+ @domains = dictionary[:domains]
28
36
 
29
- # create new XML document
30
- xml = Builder::XmlMarkup.new(indent: 3)
37
+ # set the format of the output file based on the writer specified
38
+ responseObj[:writerFormat] = 'xml'
31
39
 
32
- # start writing the ISO 19110 XML record
33
- metadataWriter = FC_FeatureCatalogue.new(xml, responseObj)
34
- metadata = metadataWriter.writeXML(intObj)
40
+ # create new XML document
41
+ xml = Builder::XmlMarkup.new(indent: 3)
35
42
 
36
- return metadata
43
+ # start writing the ISO 19110 XML record
44
+ metadataWriter = FC_FeatureCatalogue.new(xml, responseObj)
45
+ metadata = metadataWriter.writeXML(intObj)
37
46
 
38
- end
47
+ return metadata
39
48
 
40
- # find contact in contact array and return the contact hash
41
- def self.getContact(contactId)
49
+ end
42
50
 
43
- @contacts.each do |contact|
44
- if contact[:contactId] == contactId
45
- return contact
46
- end
47
- end
48
- return {}
51
+ # find contact in contact array and return the contact hash
52
+ def self.getContact(contactId)
49
53
 
50
- end
54
+ @contacts.each do |contact|
55
+ if contact[:contactId] == contactId
56
+ return contact
57
+ end
58
+ end
59
+ return {}
51
60
 
52
- # find domain in domain array and return the domain hash
53
- def self.getDomain(domainId)
61
+ end
54
62
 
55
- @domains.each do |domain|
56
- if domain[:domainId] == domainId
57
- return domain
58
- end
59
- end
60
- return {}
63
+ # find domain in domain array and return the domain hash
64
+ def self.getDomain(domainId)
61
65
 
62
- end
66
+ @domains.each do |domain|
67
+ if domain[:domainId] == domainId
68
+ return domain
69
+ end
70
+ end
71
+ return {}
63
72
 
64
73
  end
65
- end
66
- end
74
+
75
+ end
76
+ end
77
+ end
67
78
  end
68
79
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  ### Supported versions
5
5
 
6
- > 0.0.x
6
+ > 0.0.x (sbJSON is not currently versioned)
7
7
 
8
8
  ### Writer for ScienceBase JSON metadata format (sbJSON)
9
9
 
@@ -17,3 +17,10 @@ information assets important to science teams using ScienceBase.
17
17
 
18
18
  The sbJSON format is fully documented on
19
19
  the [ScienceBase Confluence page](https://my.usgs.gov/confluence/display/sciencebase/ScienceBase+Information+Model).
20
+
21
+ The U.S. Geological Survey (USGS) ScienceBase Catalog contains
22
+ metadata about digital and non-digital scientific data assets.
23
+ The ScienceBase Catalog provides the central information about
24
+ everything in ScienceBase using a flexible information model
25
+ based on the simple metadata elements of the Dublin Core Metadata
26
+ Element Set.
@@ -35,13 +35,23 @@ module ADIWG
35
35
  end
36
36
 
37
37
  # find contact in contact array and return the contact hash
38
- def self.getContact(contactIndex)
38
+ def self.get_contact_by_index(contactIndex)
39
39
  if @contacts[contactIndex]
40
40
  return @contacts[contactIndex]
41
41
  end
42
42
  {}
43
43
  end
44
44
 
45
+ # find contact in contact array and return the contact hash
46
+ def self.get_contact_by_id(contactId)
47
+ @contacts.each do |hContact|
48
+ if hContact[:contactId] == contactId
49
+ return hContact
50
+ end
51
+ end
52
+ {}
53
+ end
54
+
45
55
  # ignore jBuilder object mapping when array is empty
46
56
  def self.json_map(collection = [], _class)
47
57
  if collection.nil? || collection.empty?
@@ -51,6 +61,25 @@ module ADIWG
51
61
  end
52
62
  end
53
63
 
64
+ # find all nested objects in 'obj' that contain the element 'ele'
65
+ def self.nested_objs_by_element(obj, ele)
66
+ aCollected = []
67
+ obj.each do |key, value|
68
+ if key == ele.to_sym
69
+ aCollected << obj
70
+ elsif obj.is_a?(Array)
71
+ if key.respond_to?(:each)
72
+ aReturn = nested_objs_by_element(key, ele)
73
+ aCollected = aCollected.concat(aReturn) unless aReturn.empty?
74
+ end
75
+ elsif obj[key].respond_to?(:each)
76
+ aReturn = nested_objs_by_element(value, ele)
77
+ aCollected = aCollected.concat(aReturn) unless aReturn.empty?
78
+ end
79
+ end
80
+ aCollected
81
+ end
82
+
54
83
  end
55
84
  end
56
85
  end
@@ -0,0 +1,39 @@
1
+ # sbJson 1.0 writer browse categories
2
+
3
+ # History:
4
+ # Stan Smith 2017-05-31 original script
5
+
6
+ require 'jbuilder'
7
+ require_relative 'sbJson_codelists'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module SbJson
13
+
14
+ module BrowseCategory
15
+
16
+ def self.build(aTypes)
17
+
18
+ aCategories = []
19
+
20
+ aTypes.each do |hType|
21
+ type = hType[:type]
22
+ sbType = Codelists.codelist_iso_to_sb('iso_sb_scope', :isoCode => type)
23
+ aCategories << sbType unless sbType.nil?
24
+ end
25
+
26
+ if aCategories.empty?
27
+ return nil
28
+ end
29
+
30
+ aCategories = aCategories.uniq
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,63 @@
1
+ # sbJson 1.0 writer budget
2
+
3
+ # History:
4
+ # Stan Smith 2017-06-02 original script
5
+
6
+ require_relative 'sbJson_codelists'
7
+
8
+ module ADIWG
9
+ module Mdtranslator
10
+ module Writers
11
+ module SbJson
12
+
13
+ module Budget
14
+
15
+ def self.build(aFunding)
16
+
17
+ hBudget = {}
18
+ hBudget[:className] = 'gov.sciencebase.catalog.item.facet.BudgetFacet'
19
+ hBudget[:annualBudgets] = []
20
+
21
+ aFunding.each do |hFunding|
22
+ budget = {}
23
+ fundingSources = []
24
+ hFunding[:allocations].each do |hAllocation|
25
+ hSource = {}
26
+ hSource[:amount] = hAllocation[:amount] unless hAllocation[:amount].nil?
27
+ hSource[:matching] = hAllocation[:matching].to_s
28
+ hSource[:recipient] = hAllocation[:recipientId] unless hAllocation[:recipientId].nil?
29
+ hSource[:source] = hAllocation[:sourceId] unless hAllocation[:sourceId].nil?
30
+ fundingSources << hSource
31
+ end
32
+ unless fundingSources.empty?
33
+ budget[:fundingSources] = fundingSources
34
+ end
35
+
36
+ # year only
37
+ unless hFunding[:timePeriod].empty?
38
+ unless hFunding[:timePeriod][:startDateTime].empty?
39
+ startDateTime = hFunding[:timePeriod][:startDateTime][:dateTime]
40
+ end
41
+ unless hFunding[:timePeriod][:endDateTime].empty?
42
+ endDateTime = hFunding[:timePeriod][:endDateTime][:dateTime]
43
+ end
44
+ dateTime = startDateTime.nil? ? endDateTime : startDateTime
45
+ unless dateTime.nil?
46
+ budget[:year] = AdiwgDateTimeFun.stringDateFromDateTime(dateTime, 'Y')
47
+ end
48
+ end
49
+
50
+ hBudget[:annualBudgets] << budget
51
+
52
+ end
53
+
54
+ hBudget
55
+
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,8 +1,10 @@
1
- # sbJson 1.0 writer
1
+ # sbJson 1.0 writer citation
2
2
 
3
3
  # History:
4
4
  # Stan Smith 2017-05-16 original script
5
5
 
6
+ require_relative 'sbJson_codelists'
7
+
6
8
  module ADIWG
7
9
  module Mdtranslator
8
10
  module Writers
@@ -39,7 +41,7 @@ module ADIWG
39
41
  end
40
42
  aIndexes.uniq!
41
43
  aIndexes.each do |hIndex|
42
- hContact = ADIWG::Mdtranslator::Writers::SbJson.getContact(hIndex[:index])
44
+ hContact = ADIWG::Mdtranslator::Writers::SbJson.get_contact_by_index(hIndex[:index])
43
45
  unless hContact.empty?
44
46
  unless hContact[:name].nil?
45
47
  citation += hContact[:name] + '(' + hIndex[:role] + '), '
@@ -50,7 +52,12 @@ module ADIWG
50
52
  # dates
51
53
  hCitation[:dates].each do |hDate|
52
54
  dateStr = AdiwgDateTimeFun.stringFromDateObject(hDate)
53
- citation += dateStr + '(' + hDate[:dateType] + '), '
55
+ dateType = Codelists.codelist_iso_to_sb('iso_sb_date', :isoCode => hDate[:dateType])
56
+ if dateType.nil?
57
+ citation += dateStr + ', '
58
+ else
59
+ citation += dateStr + '(' + dateType + '), '
60
+ end
54
61
  end
55
62
 
56
63
  # title
@@ -0,0 +1,170 @@
1
+ # sbJson 1.0 writer
2
+
3
+ # History:
4
+ # Stan Smith 2017-05-26 original script
5
+
6
+ module ADIWG
7
+ module Mdtranslator
8
+ module Writers
9
+ module SbJson
10
+
11
+ module Codelists
12
+
13
+ @iso_sb_role = [
14
+ {iso: 'resourceProvider', sb: 'Resource Provider'},
15
+ {iso: 'custodian', sb: 'Custodian'},
16
+ {iso: 'rightsHolder', sb: 'Data Owner'},
17
+ {iso: 'use', sb: 'User'},
18
+ {iso: 'distributor', sb: 'Distributor'},
19
+ {iso: 'originator', sb: 'Originator'},
20
+ {iso: 'pointOfContact', sb: 'Point of Contact'},
21
+ {iso: 'principalInvestigator', sb: 'Principal Investigator'},
22
+ {iso: 'processor', sb: 'Processor'},
23
+ {iso: 'author', sb: 'Author'},
24
+ {iso: 'coAuthor', sb: 'Author'},
25
+ {iso: 'collaborator', sb: 'Cooperator/Partner'},
26
+ {iso: 'contributor', sb: 'Cooperator/Partner'},
27
+ {iso: 'editor', sb: 'Editor'},
28
+ {iso: 'coPrincipalInvestigator', sb: 'Co-Investigator'},
29
+ {iso: 'publisher', sb: 'publisher'},
30
+ {iso: 'sponsor', sb: 'sponsor'},
31
+ {iso: 'stakeholder', sb: 'stakeholder'},
32
+ {iso: 'administrator', sb: 'administrator'},
33
+ {iso: 'client', sb: 'client'},
34
+ {iso: 'logistics', sb: 'logistics'},
35
+ {iso: 'mediator', sb: 'mediator'}
36
+ ]
37
+
38
+ @iso_sb_onlineFunction = [
39
+ {iso: 'information', sb: 'webLink'},
40
+ {iso: 'completeMetadata', sb: 'originalMetadata'},
41
+ {iso: 'browseGraphic', sb: 'browseImage'},
42
+ {iso: 'webApplication', sb: 'webapp'},
43
+ {iso: 'download', sb: 'download'},
44
+ {iso: 'offlineAccess', sb: 'offlineAccess'},
45
+ {iso: 'order', sb: 'order'},
46
+ {iso: 'search', sb: 'search'},
47
+ {iso: 'upload', sb: 'upload'},
48
+ {iso: 'emailService', sb: 'emailService'},
49
+ {iso: 'browsing', sb: 'browsing'},
50
+ {iso: 'fileAccess', sb: 'fileAccess'}
51
+ ]
52
+
53
+ @iso_sb_scope = [
54
+ {iso: 'collectionHardware', sb: 'Collection'},
55
+ {iso: 'collectionSession', sb: 'Collection'},
56
+ {iso: 'dataset', sb: 'Data'},
57
+ {iso: 'document', sb: 'Document'},
58
+ {iso: 'collection', sb: 'Collection'},
59
+ {iso: 'application', sb: 'Application'},
60
+ {iso: 'sciencePaper', sb: 'Report'},
61
+ {iso: 'project', sb: 'Project'},
62
+ {iso: 'map', sb: 'Data'},
63
+ {iso: 'photographicImage', sb: 'Image'},
64
+ {iso: 'publication', sb: 'Publication'},
65
+ {iso: 'tabularDataset', sb: 'Data'},
66
+ {iso: 'report', sb: 'Report'},
67
+ {iso: 'sample', sb: 'Physical Item'},
68
+ {iso: 'attribute', sb: nil},
69
+ {iso: 'attributeType', sb: nil},
70
+ {iso: 'series', sb: nil},
71
+ {iso: 'nonGeographicDataset', sb: nil},
72
+ {iso: 'dimensionGroup', sb: nil},
73
+ {iso: 'feature', sb: nil},
74
+ {iso: 'featureType', sb: nil},
75
+ {iso: 'propertyType', sb: nil},
76
+ {iso: 'fieldSession', sb: nil},
77
+ {iso: 'software', sb: nil},
78
+ {iso: 'model', sb: nil},
79
+ {iso: 'tile', sb: nil},
80
+ {iso: 'metadata', sb: nil},
81
+ {iso: 'repository', sb: nil},
82
+ {iso: 'aggregate', sb: nil},
83
+ {iso: 'product', sb: nil},
84
+ {iso: 'coverage', sb: nil},
85
+ {iso: 'userGuide', sb: nil},
86
+ {iso: 'dataDictionary', sb: nil},
87
+ {iso: 'website', sb: nil},
88
+ {iso: 'publication', sb: nil},
89
+ {iso: 'awardInfo', sb: nil},
90
+ {iso: 'collectionSite', sb: nil},
91
+ {iso: 'factSheet', sb: nil},
92
+ {iso: 'drawing', sb: nil},
93
+ {iso: 'presentation', sb: nil}
94
+ ]
95
+
96
+ @iso_sb_date = [
97
+ {iso: 'creation', sb: 'Creation'},
98
+ {iso: 'publication', sb: 'Publication'},
99
+ {iso: 'revision', sb: 'Revision'},
100
+ {iso: 'expiry', sb: nil},
101
+ {iso: 'lastUpdate', sb: 'lastUpdate'},
102
+ {iso: 'lastRevision', sb: 'lastRevision'},
103
+ {iso: 'nextUpdate', sb: 'nextUpdate'},
104
+ {iso: 'unavailable', sb: 'unavailable'},
105
+ {iso: 'inForce', sb: 'inForce'},
106
+ {iso: 'adopted', sb: 'adopted'},
107
+ {iso: 'deprecated', sb: 'deprecated'},
108
+ {iso: 'suspended', sb: 'suspended'},
109
+ {iso: 'validityBegins', sb: 'validityBegins'},
110
+ {iso: 'validityExpires', sb: 'validityExpires'},
111
+ {iso: 'released', sb: 'Release'},
112
+ {iso: 'distribution', sb: 'date identifiers when an instance of the resource was distributed'}
113
+ ]
114
+
115
+ @iso_sb_progress = [
116
+ {iso: 'completed', sb: 'Completed'},
117
+ {iso: 'historicalArchive', sb: nil},
118
+ {iso: 'obsolete', sb: nil},
119
+ {iso: 'onGoing', sb: 'In Progress'},
120
+ {iso: 'onGoing', sb: 'Active'},
121
+ {iso: 'planned', sb: nil},
122
+ {iso: 'required', sb: nil},
123
+ {iso: 'underDevelopment', sb: nil},
124
+ {iso: 'final', sb: nil},
125
+ {iso: 'pending', sb: nil},
126
+ {iso: 'retired', sb: nil},
127
+ {iso: 'superseded', sb: nil},
128
+ {iso: 'tentative', sb: nil},
129
+ {iso: 'valid', sb: nil},
130
+ {iso: 'accepted', sb: 'Approved'},
131
+ {iso: 'notAccepted', sb: nil},
132
+ {iso: 'withdrawn', sb: nil},
133
+ {iso: 'proposed', sb: 'Proposed'},
134
+ {iso: 'deprecated', sb: nil},
135
+ {iso: 'funded', sb: nil},
136
+ {iso: 'cancelled', sb: nil},
137
+ {iso: 'suspended', sb: nil}
138
+ ]
139
+
140
+ def self.codelist_iso_to_sb(codelist, isoCode: nil, sbCode: nil)
141
+
142
+ codeList = instance_variable_get("@#{codelist}")
143
+
144
+ unless isoCode.nil?
145
+ codeList.each do |obj|
146
+ if obj[:iso] == isoCode
147
+ return obj[:sb]
148
+ end
149
+ end
150
+ end
151
+
152
+ unless sbCode.nil?
153
+ codeList.each do |obj|
154
+ if obj[:sb] == sbCode
155
+ return obj[:iso]
156
+ end
157
+ end
158
+ end
159
+
160
+ # not found
161
+ return nil
162
+
163
+ end
164
+
165
+ end
166
+
167
+ end
168
+ end
169
+ end
170
+ end