bolognese 1.0.6 → 1.0.7

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/bolognese/author_utils.rb +1 -1
  4. data/lib/bolognese/datacite_utils.rb +51 -55
  5. data/lib/bolognese/metadata.rb +16 -16
  6. data/lib/bolognese/metadata_utils.rb +5 -5
  7. data/lib/bolognese/readers/bibtex_reader.rb +4 -4
  8. data/lib/bolognese/readers/citeproc_reader.rb +9 -6
  9. data/lib/bolognese/readers/codemeta_reader.rb +7 -4
  10. data/lib/bolognese/readers/crossref_reader.rb +23 -17
  11. data/lib/bolognese/readers/datacite_json_reader.rb +21 -19
  12. data/lib/bolognese/readers/datacite_reader.rb +30 -66
  13. data/lib/bolognese/readers/ris_reader.rb +6 -3
  14. data/lib/bolognese/readers/schema_org_reader.rb +12 -9
  15. data/lib/bolognese/utils.rb +15 -14
  16. data/lib/bolognese/version.rb +1 -1
  17. data/lib/bolognese/writers/bibtex_writer.rb +2 -2
  18. data/lib/bolognese/writers/codemeta_writer.rb +3 -3
  19. data/lib/bolognese/writers/crosscite_writer.rb +6 -6
  20. data/lib/bolognese/writers/datacite_json_writer.rb +9 -9
  21. data/lib/bolognese/writers/jats_writer.rb +4 -4
  22. data/lib/bolognese/writers/ris_writer.rb +4 -4
  23. data/lib/bolognese/writers/schema_org_writer.rb +6 -6
  24. data/spec/author_utils_spec.rb +1 -1
  25. data/spec/datacite_utils_spec.rb +2 -2
  26. data/spec/fixtures/crosscite.json +26 -16
  27. data/spec/fixtures/datacite.json +20 -14
  28. data/spec/fixtures/datacite_software.json +10 -6
  29. data/spec/readers/bibtex_reader_spec.rb +6 -6
  30. data/spec/readers/citeproc_reader_spec.rb +3 -3
  31. data/spec/readers/codemeta_reader_spec.rb +14 -14
  32. data/spec/readers/crosscite_reader_spec.rb +8 -9
  33. data/spec/readers/crossref_reader_spec.rb +31 -28
  34. data/spec/readers/datacite_json_reader_spec.rb +20 -6
  35. data/spec/readers/datacite_reader_spec.rb +94 -93
  36. data/spec/readers/ris_reader_spec.rb +5 -5
  37. data/spec/readers/schema_org_reader_spec.rb +41 -34
  38. data/spec/utils_spec.rb +3 -3
  39. data/spec/writers/bibtex_writer_spec.rb +1 -1
  40. data/spec/writers/citeproc_writer_spec.rb +1 -1
  41. data/spec/writers/codemeta_writer_spec.rb +15 -15
  42. data/spec/writers/crosscite_writer_spec.rb +16 -16
  43. data/spec/writers/datacite_json_writer_spec.rb +17 -17
  44. data/spec/writers/datacite_writer_spec.rb +26 -26
  45. data/spec/writers/ris_writer_spec.rb +2 -1
  46. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba8f7ba69c381c964db85cd05abe07d5a1cbd75eb183a3b620bc374430b7dd5b
4
- data.tar.gz: 97d81da9e70f8942c66d577ab47e77f310244c37a7cccffa961bb1aefb46b974
3
+ metadata.gz: fb41752abec17479d1f11b7b7f0f7a4c5aad50698eae00d55e0e8adc71d2b5ce
4
+ data.tar.gz: d5b6df042eccfd780f2af437d79a12c26a28d99e6c740a06644f84a651cc458d
5
5
  SHA512:
6
- metadata.gz: d0ae170b389bc7a005935f3da908c4a1754674462011eff2e425b796641a5c5f675e6dff6d2bf4de4354cb452309fc467bdb8064a626391e050d736ea035d0f4
7
- data.tar.gz: 51bb1e44e863de1670cd31ebcdb53cd6193f925d83d8d4a675dece1d0246fe88cb54ae829098e6f9b71af291753a4810d772fb10af0a1269f4c46d61659d4592
6
+ metadata.gz: 54669b2f390738ea6232ffde8866b4e57d829784b96168f5d0fde43b7672250be828e4c62cab815670cbac7056569e012338539022a78b0ef8979c4a05f8a52b
7
+ data.tar.gz: fc73f2fd0a8306c71458b0eff727f6b338d65623c5bf58079bb08eb711a02d90e57895599ba2b499a9fbf23f8a22f22e02490f12cf2a2c6af4afadcd8857d018
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.0.6)
4
+ bolognese (1.0.7)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -105,7 +105,7 @@ module Bolognese
105
105
 
106
106
  # parse array of author strings into CSL format
107
107
  def get_authors(authors)
108
- Array.wrap(authors).map { |author| get_one_author(author) }.unwrap
108
+ Array.wrap(authors).map { |author| get_one_author(author) }.compact
109
109
  end
110
110
 
111
111
  # parse nameIdentifier from DataCite
@@ -58,7 +58,7 @@ module Bolognese
58
58
 
59
59
  xml.contributors do
60
60
  Array.wrap(contributor).each do |con|
61
- xml.contributor("contributorType" => con["contributorType"] || "Other") do
61
+ xml.contributor("contributorType" => con["contributor_type"] || "Other") do
62
62
  insert_person(xml, con, "contributor")
63
63
  end
64
64
  end
@@ -67,8 +67,9 @@ module Bolognese
67
67
 
68
68
  def insert_person(xml, person, type)
69
69
  person_name = person["familyName"].present? ? [person["familyName"], person["givenName"]].compact.join(", ") : person["name"]
70
+ attributes = person["type"].present? ? { "nameType" => person["type"] + "al" } : {}
70
71
 
71
- xml.send(type + "Name", person_name)
72
+ xml.send(type + "Name", person_name, attributes)
72
73
  xml.givenName(person["givenName"]) if person["givenName"].present?
73
74
  xml.familyName(person["familyName"]) if person["familyName"].present?
74
75
  xml.nameIdentifier(person["id"], 'schemeURI' => 'http://orcid.org/', 'nameIdentifierScheme' => 'ORCID') if person["id"].present?
@@ -76,16 +77,16 @@ module Bolognese
76
77
 
77
78
  def insert_titles(xml)
78
79
  xml.titles do
79
- Array.wrap(title).each do |tit|
80
- if tit.is_a?(Hash)
81
- t = tit
80
+ Array.wrap(titles).each do |title|
81
+ if title.is_a?(Hash)
82
+ t = title
82
83
  else
83
84
  t = {}
84
- t["text"] = tit
85
+ t["title"] = title
85
86
  end
86
87
 
87
- attributes = { 'lang' => t["lang"], 'titleType' => t["title_type"] }.compact
88
- xml.title(t["text"], attributes)
88
+ attributes = { 'titleType' => t["title_type"], 'lang' => t["lang"] }.compact
89
+ xml.title(t["title"], attributes)
89
90
  end
90
91
  end
91
92
  end
@@ -98,16 +99,11 @@ module Bolognese
98
99
  xml.publicationYear(publication_year)
99
100
  end
100
101
 
101
- def res_type
102
- { "resource_type_general" => types["resource_type_general"] || Metadata::SO_TO_DC_TRANSLATIONS[types["type"]] || "Other",
103
- "__content__" => types["resource_type"] || types["type"] }
104
- end
105
-
106
102
  def insert_resource_type(xml)
107
103
  return xml unless types["type"].present?
108
104
 
109
- xml.resourceType(res_type["__content__"],
110
- 'resourceTypeGeneral' => res_type["resource_type_general"])
105
+ xml.resourceType(types["resource_type"] || types["type"],
106
+ 'resourceTypeGeneral' => types["resource_type_general"] || Metadata::SO_TO_DC_TRANSLATIONS[types["type"]] || "Other")
111
107
  end
112
108
 
113
109
  def insert_alternate_identifiers(xml)
@@ -115,7 +111,7 @@ module Bolognese
115
111
 
116
112
  xml.alternateIdentifiers do
117
113
  Array.wrap(alternate_identifiers).each do |alternate_identifier|
118
- xml.alternateIdentifier(alternate_identifier["name"], 'alternateIdentifierType' => alternate_identifier["type"])
114
+ xml.alternateIdentifier(alternate_identifier["alternate_identifier"], 'alternateIdentifierType' => alternate_identifier["alternate_identifier_type"])
119
115
  end
120
116
  end
121
117
  end
@@ -125,7 +121,8 @@ module Bolognese
125
121
 
126
122
  xml.dates do
127
123
  Array.wrap(dates).each do |date|
128
- xml.date(date["date"], 'dateType' => date["date_type"] || "Issued")
124
+ attributes = { 'dateType' => date["date_type"] || "Issued", 'dateInformation' => date["date_information"] }.compact
125
+ xml.date(date["date"], attributes)
129
126
  end
130
127
  end
131
128
  end
@@ -136,36 +133,30 @@ module Bolognese
136
133
  xml.fundingReferences do
137
134
  Array.wrap(funding_references).each do |funding_reference|
138
135
  xml.fundingReference do
139
- insert_funding_reference(xml, funding_reference)
136
+ xml.funderName(funding_reference["funder_name"])
137
+ xml.funderIdentifier(funding_reference["funder_identifier"], { "funderIdentifierType" => funding_reference["funder_identifier_type"] }.compact) if funding_reference["funder_identifier"].present?
138
+ xml.awardNumber(funding_reference["award_number"], { "awardURI" => funding_reference["award_uri"] }.compact) if funding_reference["award_number"].present? || funding_reference["award_uri"].present?
139
+ xml.awardTitle(funding_reference["award_title"]) if funding_reference["award_title"].present?
140
140
  end
141
141
  end
142
142
  end
143
143
  end
144
144
 
145
- def insert_funding_reference(xml, funding_reference)
146
- xml.funderName(funding_reference["funder_name"]) if funding_reference["funder_name"].present?
147
- xml.funderIdentifier(funding_reference["funder_identifier"], "funderIdentifierType" => "Crossref Funder ID") if funding_reference["funder_identifier"].present?
148
- end
149
-
150
145
  def insert_subjects(xml)
151
- return xml unless keywords.present?
146
+ return xml unless subjects.present?
152
147
 
153
148
  xml.subjects do
154
- keywords.each do |subject|
155
- if subject.is_a?(String) then
156
- # If we've been read from somewhere that it was just a string output that
157
- xml.subject(subject)
149
+ subjects.each do |subject|
150
+ if subject.is_a?(Hash)
151
+ s = subject
158
152
  else
159
- # Otherwise we'll assume a hash and therefore find/add attributes as appropriate
160
- subject_node = xml.subject(subject['text'])
161
- if subject["subject_scheme"].present? then
162
- subject_node['subjectScheme'] = subject["subject_scheme"]
163
- end
164
-
165
- if subject["scheme_uri"].present? then
166
- subject_node['schemeURI'] = subject["scheme_uri"]
167
- end
153
+ s = {}
154
+ s["subject"] = subject
168
155
  end
156
+
157
+ attributes = { "subjectScheme" => s["subject_scheme"], "schemeURI" => s["scheme_uri"], "valueURI" => s["value_uri"], "lang" => s["lang"] }.compact
158
+
159
+ xml.subject(s["subject"], attributes)
169
160
  end
170
161
  end
171
162
  end
@@ -185,51 +176,56 @@ module Bolognese
185
176
  'relatedIdentifierType' => related_identifier["related_identifier_type"],
186
177
  'relationType' => related_identifier["relation_type"],
187
178
  'resourceTypeGeneral' => related_identifier["resource_type_general"] }.compact
188
- xml.relatedIdentifier(related_identifier["id"], attributes)
179
+
180
+ attributes.merge({ 'relatedMetadataScheme' => related_identifier["related_metadata_schema"],
181
+ 'schemeURI' => related_identifier["scheme_uri"],
182
+ 'schemeType' => related_identifier["scheme_type"]}.compact) if %w(HasMetadata IsMetadataFor).include?(related_identifier["relation_type"])
183
+
184
+ xml.relatedIdentifier(related_identifier["related_identifier"], attributes)
189
185
  end
190
186
  end
191
187
  end
192
188
 
193
189
  def insert_rights_list(xml)
194
- return xml unless rights.present?
190
+ return xml unless rights_list.present?
195
191
 
196
192
  xml.rightsList do
197
- Array.wrap(rights).each do |lic|
198
- if lic.is_a?(Hash)
199
- l = lic
193
+ Array.wrap(rights_list).each do |rights|
194
+ if rights.is_a?(Hash)
195
+ r = rights
200
196
  else
201
- l = {}
202
- l["name"] = lic
203
- l["id"] = normalize_id(lic)
197
+ r = {}
198
+ r["rights"] = rights
199
+ r["rights_uri"] = normalize_id(rights)
204
200
  end
205
201
 
206
- attributes = { 'rightsURI' => l["id"] }.compact
202
+ attributes = { 'rightsURI' => r["rights_uri"], 'lang' => r["lang"] }.compact
207
203
 
208
- xml.rights(l["name"], attributes)
204
+ xml.rights(r["rights"], attributes)
209
205
  end
210
206
  end
211
207
  end
212
208
 
213
209
  def insert_descriptions(xml)
214
- return xml unless description.present? || periodical && periodical["title"].present?
210
+ return xml unless descriptions.present? || periodical && periodical["title"].present?
215
211
 
216
212
  xml.descriptions do
217
213
  if periodical && periodical["title"].present?
218
214
  xml.description(periodical["title"], 'descriptionType' => "SeriesInformation")
219
215
  end
220
216
 
221
- Array.wrap(description).each do |des|
222
- if des.is_a?(Hash)
223
- d = des
217
+ Array.wrap(descriptions).each do |description|
218
+ if description.is_a?(Hash)
219
+ d = description
224
220
  else
225
221
  d = {}
226
- d["text"] = des
227
- d["type"] = "Abstract"
222
+ d["description"] = description
223
+ d["description_type"] = "Abstract"
228
224
  end
229
225
 
230
- attributes = { 'lang' => d["lang"], 'descriptionType' => d["type"] || "Abstract" }.compact
226
+ attributes = { 'lang' => d["lang"], 'descriptionType' => d["description_type"] || "Abstract" }.compact
231
227
 
232
- xml.description(d["text"], attributes)
228
+ xml.description(d["description"], attributes)
233
229
  end
234
230
  end
235
231
  end
@@ -6,11 +6,11 @@ module Bolognese
6
6
  class Metadata
7
7
  include Bolognese::MetadataUtils
8
8
 
9
- attr_writer :id, :provider_id, :client_id, :doi, :identifier, :creator, :contributor, :title, :publisher,
10
- :rights, :dates, :publication_year, :volume, :first_page, :last_page, :url, :version,
11
- :keywords, :contributor, :description, :alternate_identifiers, :language, :size,
9
+ attr_writer :id, :provider_id, :client_id, :doi, :identifier, :creator, :contributor, :titles, :publisher,
10
+ :rights_list, :dates, :publication_year, :volume, :first_page, :last_page, :url, :version,
11
+ :subjects, :contributor, :descriptions, :alternate_identifiers, :language, :sizes,
12
12
  :formats, :schema_version, :meta, :periodical,
13
- :format, :funding_references, :state, :geo_location,
13
+ :format, :funding_references, :state, :geo_locations,
14
14
  :types, :content_url, :related_identifiers
15
15
 
16
16
  def initialize(input: nil, from: nil, **options)
@@ -104,24 +104,24 @@ module Bolognese
104
104
  meta.fetch("errors", nil) || datacite_errors(xml: datacite, schema_version: schema_version)
105
105
  end
106
106
 
107
- def description
108
- @description ||= meta.fetch("description", nil)
107
+ def descriptions
108
+ @descriptions ||= meta.fetch("descriptions", nil)
109
109
  end
110
110
 
111
- def rights
112
- @rights ||= meta.fetch("rights", nil)
111
+ def rights_list
112
+ @rights_list ||= meta.fetch("rights_list", nil)
113
113
  end
114
114
 
115
- def keywords
116
- @keywords ||= meta.fetch("keywords", nil)
115
+ def subjects
116
+ @subjects ||= meta.fetch("subjects", nil)
117
117
  end
118
118
 
119
119
  def language
120
120
  @language ||= meta.fetch("language", nil)
121
121
  end
122
122
 
123
- def size
124
- @size ||= meta.fetch("size", nil)
123
+ def sizes
124
+ @sizes ||= meta.fetch("sizes", nil)
125
125
  end
126
126
 
127
127
  def formats
@@ -156,8 +156,8 @@ module Bolognese
156
156
  @periodical ||= meta.fetch("periodical", nil)
157
157
  end
158
158
 
159
- def geo_location
160
- @geo_location ||= meta.fetch("geo_location", nil)
159
+ def geo_locations
160
+ @geo_locations ||= meta.fetch("geo_locations", nil)
161
161
  end
162
162
 
163
163
  def dates
@@ -188,8 +188,8 @@ module Bolognese
188
188
  @types ||= meta.fetch("types", nil)
189
189
  end
190
190
 
191
- def title
192
- @title ||= meta.fetch("title", nil)
191
+ def titles
192
+ @titles ||= meta.fetch("titles", nil)
193
193
  end
194
194
 
195
195
  def creator
@@ -103,12 +103,12 @@ module Bolognese
103
103
 
104
104
  def reverse
105
105
  { "citation" => Array.wrap(related_identifiers).select { |ri| ri["relation_type"] == "IsReferencedBy" }.map do |r|
106
- { "@id" => normalize_doi(r["id"]),
106
+ { "@id" => normalize_doi(r["related_identifier"]),
107
107
  "@type" => r["resource_type_general"] || "CreativeWork",
108
108
  "identifier" => r["related_identifier_type"] == "DOI" ? nil : to_identifier(r) }.compact
109
109
  end.unwrap,
110
110
  "isBasedOn" => Array.wrap(related_identifiers).select { |ri| ri["relation_type"] == "IsSupplementTo" }.map do |r|
111
- { "@id" => normalize_doi(r["id"]),
111
+ { "@id" => normalize_doi(r["related_identifier"]),
112
112
  "@type" => r["resource_type_general"] || "CreativeWork",
113
113
  "identifier" => r["related_identifier_type"] == "DOI" ? nil : to_identifier(r) }.compact
114
114
  end.unwrap }.compact
@@ -122,19 +122,19 @@ module Bolognese
122
122
  {
123
123
  "type" => types["citeproc"],
124
124
  "id" => identifier,
125
- "categories" => Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.presence,
125
+ "categories" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence,
126
126
  "language" => language,
127
127
  "author" => to_citeproc(creator),
128
128
  "contributor" => to_citeproc(contributor),
129
129
  "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : nil,
130
130
  "submitted" => Array.wrap(dates).find { |d| d["type"] == "Submitted" }.to_h.fetch("__content__", nil),
131
- "abstract" => parse_attributes(description, content: "text", first: true),
131
+ "abstract" => parse_attributes(descriptions, content: "description", first: true),
132
132
  "container-title" => periodical && periodical["title"],
133
133
  "DOI" => doi,
134
134
  "issue" => issue,
135
135
  "page" => [first_page, last_page].compact.join("-").presence,
136
136
  "publisher" => publisher,
137
- "title" => parse_attributes(title, content: "text", first: true),
137
+ "title" => parse_attributes(titles, content: "title", first: true),
138
138
  "URL" => url,
139
139
  "version" => version,
140
140
  "volume" => volume
@@ -52,7 +52,7 @@ module Bolognese
52
52
  "relation_type" => "IsPartOf",
53
53
  "related_identifier_type" => "ISSN",
54
54
  "title" => meta.journal.to_s,
55
- "id" => meta.try(:issn).to_s.presence }.compact]
55
+ "related_identifier" => meta.try(:issn).to_s.presence }.compact]
56
56
  else
57
57
  nil
58
58
  end
@@ -79,7 +79,7 @@ module Bolognese
79
79
  "types" => types,
80
80
  "doi" => doi,
81
81
  "url" => meta.try(:url).to_s,
82
- "title" => [{ "text" => meta.try(:title).to_s }],
82
+ "titles" => [{ "title" => meta.try(:title).to_s }],
83
83
  "creator" => author,
84
84
  "periodical" => periodical,
85
85
  "publisher" => meta.try(:publisher).to_s.presence,
@@ -89,8 +89,8 @@ module Bolognese
89
89
  "volume" => meta.try(:volume).to_s.presence,
90
90
  "page_first" => page_first,
91
91
  "page_last" => page_last,
92
- "description" => [{ "text" => meta.try(:abstract) && sanitize(meta.abstract.to_s).presence }],
93
- "rights" => [{ "id" => meta.try(:copyright).to_s.presence }.compact],
92
+ "descriptions" => [{ "description" => meta.try(:abstract) && sanitize(meta.abstract.to_s).presence }],
93
+ "rights_list" => [{ "rights_uri" => meta.try(:copyright).to_s.presence }.compact],
94
94
  "state" => state
95
95
  }
96
96
  end
@@ -53,8 +53,8 @@ module Bolognese
53
53
  nil
54
54
  end
55
55
  publication_year = get_date_from_date_parts(meta.fetch("issued", nil)).to_s[0..3]
56
- rights = if meta.fetch("copyright", nil)
57
- [{ "id" => normalize_url(meta.fetch("copyright")) }.compact]
56
+ rights_list = if meta.fetch("copyright", nil)
57
+ [{ "rights_uri" => normalize_url(meta.fetch("copyright")) }.compact]
58
58
  else
59
59
  nil
60
60
  end
@@ -76,12 +76,15 @@ module Bolognese
76
76
  end
77
77
  id = normalize_id(meta.fetch("id", nil))
78
78
  state = id.present? ? "findable" : "not_found"
79
+ subjects = Array.wrap(meta.fetch("categories")).map do |s|
80
+ { "subject" => s }
81
+ end
79
82
 
80
83
  { "id" => id,
81
84
  "types" => types,
82
85
  "doi" => doi_from_url(doi),
83
86
  "url" => normalize_id(meta.fetch("URL", nil)),
84
- "title" => [{ "text" => meta.fetch("title", nil) }],
87
+ "titles" => [{ "title" => meta.fetch("title", nil) }],
85
88
  "creator" => creator,
86
89
  "contributor" => contributor,
87
90
  "periodical" => periodical,
@@ -91,10 +94,10 @@ module Bolognese
91
94
  "publication_year" => publication_year,
92
95
  "volume" => meta.fetch("volume", nil),
93
96
  #{}"pagination" => meta.pages.to_s.presence,
94
- "description" => meta.fetch("abstract", nil).present? ? [{ "text" => sanitize(meta.fetch("abstract")) }] : [],
95
- "rights" => rights,
97
+ "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract")) }] : [],
98
+ "rights_list" => rights_list,
96
99
  "version" => meta.fetch("version", nil),
97
- "keywords" => meta.fetch("categories", nil),
100
+ "subjects" => subjects,
98
101
  "state" => state
99
102
  }
100
103
  end
@@ -39,23 +39,26 @@ module Bolognese
39
39
  "bibtex" => Bolognese::Utils::SO_TO_BIB_TRANSLATIONS[type] || "misc",
40
40
  "ris" => Bolognese::Utils::SO_TO_RIS_TRANSLATIONS[type] || "GEN"
41
41
  }.compact
42
+ subjects = Array.wrap(meta.fetch("tags", nil)).map do |s|
43
+ { "subject" => s }
44
+ end
42
45
 
43
46
  { "id" => id,
44
47
  "types" => types,
45
48
  "identifier" => identifier,
46
49
  "doi" => validate_doi(id),
47
50
  "url" => normalize_id(meta.fetch("codeRepository", nil)),
48
- "title" => [{ "text" => meta.fetch("title", nil) }],
51
+ "titles" => [{ "title" => meta.fetch("title", nil) }],
49
52
  "creator" => author,
50
53
  "contributor" => contributor,
51
54
  "publisher" => publisher,
52
55
  #{}"is_part_of" => is_part_of,
53
56
  "dates" => dates,
54
57
  "publication_year" => publication_year,
55
- "description" => meta.fetch("description", nil).present? ? [{ "text" => sanitize(meta.fetch("description")) }] : nil,
56
- "rights" => [{ "id" => meta.fetch("license", nil) }.compact],
58
+ "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")) }] : nil,
59
+ "rights_list" => [{ "rights_uri" => meta.fetch("license", nil) }.compact],
57
60
  "version" => meta.fetch("version", nil),
58
- "keywords" => meta.fetch("tags", nil),
61
+ "subjects" => subjects,
59
62
  "state" => state
60
63
  }
61
64
  end
@@ -106,7 +106,7 @@ module Bolognese
106
106
  "types" => types,
107
107
  "doi" => doi,
108
108
  "url" => bibliographic_metadata.dig("doi_data", "resource"),
109
- "title" => [{ "text" => parse_attributes(bibliographic_metadata.dig("titles", "title")) }],
109
+ "titles" => [{ "title" => parse_attributes(bibliographic_metadata.dig("titles", "title")) }],
110
110
  "alternate_identifiers" => crossref_alternate_identifiers(bibliographic_metadata),
111
111
  "creator" => crossref_people(bibliographic_metadata, "author"),
112
112
  "contributor" => crossref_people(bibliographic_metadata, "editor"),
@@ -121,12 +121,12 @@ module Bolognese
121
121
  "issue" => journal_issue.dig("issue"),
122
122
  "first_page" => bibliographic_metadata.dig("pages", "first_page"),
123
123
  "last_page" => bibliographic_metadata.dig("pages", "last_page"),
124
- "description" => crossref_description(bibliographic_metadata),
125
- "rights" => crossref_license(program_metadata),
124
+ "descriptions" => crossref_description(bibliographic_metadata),
125
+ "rights_list" => crossref_license(program_metadata),
126
126
  "version" => nil,
127
- "keywords" => nil,
127
+ "subjects" => nil,
128
128
  "language" => nil,
129
- "size" => nil,
129
+ "sizes" => nil,
130
130
  "schema_version" => nil,
131
131
  "state" => state
132
132
  }
@@ -134,19 +134,21 @@ module Bolognese
134
134
 
135
135
  def crossref_alternate_identifiers(bibliographic_metadata)
136
136
  if bibliographic_metadata.fetch("publisher_item", nil).present?
137
- parse_attributes(bibliographic_metadata.dig("publisher_item", "item_number"))
137
+ { "alternate_identifier" => parse_attributes(bibliographic_metadata.dig("publisher_item", "item_number")),
138
+ "alternate_identifier_type" => "Publisher ID" }
138
139
  else
139
- parse_attributes(bibliographic_metadata.fetch("item_number", nil))
140
+ { "alternate_identifier" => parse_attributes(bibliographic_metadata.fetch("item_number", nil)),
141
+ "alternate_identifier_type" => "Publisher ID" }
140
142
  end
141
143
  end
142
144
 
143
145
  def crossref_description(bibliographic_metadata)
144
146
  abstract = Array.wrap(bibliographic_metadata.dig("abstract")).map do |r|
145
- { "type" => "Abstract", "text" => sanitize(parse_attributes(r, content: 'p')) }.compact
147
+ { "description_type" => "Abstract", "description" => sanitize(parse_attributes(r, content: 'p')) }.compact
146
148
  end
147
149
 
148
150
  description = Array.wrap(bibliographic_metadata.dig("description")).map do |r|
149
- { "type" => "Other", "text" => sanitize(parse_attributes(r)) }.compact
151
+ { "description_type" => "Other", "description" => sanitize(parse_attributes(r)) }.compact
150
152
  end
151
153
 
152
154
  (abstract + description)
@@ -156,7 +158,7 @@ module Bolognese
156
158
  access_indicator = Array.wrap(program_metadata).find { |m| m["name"] == "AccessIndicators" }
157
159
  if access_indicator.present?
158
160
  Array.wrap(access_indicator["license_ref"]).map do |license|
159
- { "id" => normalize_url(parse_attributes(license)) }
161
+ { "rights_uri" => normalize_url(parse_attributes(license)) }
160
162
  end.uniq
161
163
  else
162
164
  nil
@@ -179,13 +181,17 @@ module Bolognese
179
181
  fundref = Array.wrap(program_metadata).find { |a| a["name"] == "fundref" } || {}
180
182
  Array.wrap(fundref.fetch("assertion", [])).select { |a| a["name"] == "fundgroup" }.map do |f|
181
183
  f = Array.wrap(f.fetch("assertion", nil)).first
182
-
183
- { "funder_identifier" => normalize_id(f.dig("assertion", "__content__")),
184
- "funder_name" => f.dig("__content__").strip,
185
- "award_title" => f.fetch("awardTitle", nil),
184
+ funder_identifier = normalize_id(f.dig("assertion", "__content__"))
185
+ funder_identifier_type = funder_identifier.present? ? "Crossref Funder ID" : nil
186
+ award_title = f.fetch("awardTitle", nil).present? ? f.fetch("awardTitle") : nil
187
+
188
+ { "funder_identifier" => funder_identifier,
189
+ "funder_identifier_type" => funder_identifier_type,
190
+ "funder_name" => f.fetch("__content__", "").strip,
191
+ "award_title" => award_title,
186
192
  "award_number" => f.dig("awardNumber", "__content__"),
187
193
  "award_uri" => f.dig("awardNumber", "awardURI") }.compact
188
- end.unwrap
194
+ end
189
195
  end
190
196
 
191
197
  def crossref_date_published(bibliographic_metadata)
@@ -200,7 +206,7 @@ module Bolognese
200
206
 
201
207
  def crossref_is_part_of(model_metadata)
202
208
  if model_metadata.present? && model_metadata.fetch("issn", nil).present?
203
- { "id" => parse_attributes(model_metadata.fetch("issn", nil), first: true),
209
+ { "related_identifier" => parse_attributes(model_metadata.fetch("issn", nil), first: true),
204
210
  "relation_type" => "IsPartOf",
205
211
  "related_identifier_type" => "ISSN",
206
212
  "type" => "Periodical",
@@ -214,7 +220,7 @@ module Bolognese
214
220
  refs = bibliographic_metadata.dig("citation_list", "citation")
215
221
  Array.wrap(refs).select { |a| a["doi"].present? }.map do |c|
216
222
  if c["doi"].present?
217
- { "id" => parse_attributes(c["doi"]).downcase,
223
+ { "related_identifier" => parse_attributes(c["doi"]).downcase,
218
224
  "relation_type" => "References",
219
225
  "related_identifier_type" => "DOI",
220
226
  "title" => c["article_title"] }.compact