bolognese 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -11,34 +11,36 @@ module Bolognese
11
11
 
12
12
  state = meta.fetch("doi", nil).present? ? "findable" : "not_found"
13
13
  related_identifiers = Array.wrap(meta.fetch("related-identifiers", nil)).map do |ri|
14
- { "id" => ri["id"],
14
+ { "related_identifier" => ri["related-identifier"],
15
15
  "relation_type" => ri["relation-type"],
16
16
  "related_identifier_type" => ri["related-identifier-type"],
17
17
  "resource_type_general" => ri["resource-type-general"] }.compact
18
18
  end
19
+ alternate_identifiers = Array.wrap(meta.fetch("alternate-identifiers", nil)).map do |ai|
20
+ { "alternate_identifier" => ai["alternate-identifier"],
21
+ "alternate_identifier_type" => ai["alternate-identifier-type"] }.compact
22
+ end
19
23
  dates = Array.wrap(meta.fetch("dates", nil)).map do |d|
20
24
  { "date" => d["date"],
21
- "date_type" => d["date-type"] }.compact
25
+ "date_type" => d["date-type"],
26
+ "date_information" => d["date-information"] }.compact
22
27
  end
23
28
  dates << { "date" => meta.fetch("publication-year", nil), "date_type" => "Issued" } if meta.fetch("publication-year", nil).present? && get_date(dates, "Issued").blank?
24
- resource_type_general = meta.fetch("resource-type-general", nil)
25
- resource_type = meta.fetch("resource-type", nil)
26
- type = Bolognese::Utils::CR_TO_SO_TRANSLATIONS[resource_type.to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || "CreativeWork"
27
- types = {
29
+ type = meta.dig("types", "type") || Bolognese::Utils::CR_TO_SO_TRANSLATIONS[meta.dig("types", "resource-type").to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_SO_TRANSLATIONS[meta.dig("types", "resource-type-general").to_s.dasherize] || "CreativeWork"
30
+ types = {
28
31
  "type" => type,
29
- "resource_type_general" => resource_type_general,
30
- "resource_type" => resource_type,
31
- "citeproc" => Bolognese::Utils::CR_TO_CP_TRANSLATIONS[resource_type.to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_CP_TRANSLATIONS[type] || "article",
32
- "bibtex" => Bolognese::Utils::CR_TO_BIB_TRANSLATIONS[resource_type.to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_BIB_TRANSLATIONS[type] || "misc",
33
- "ris" => Bolognese::Utils::CR_TO_RIS_TRANSLATIONS[resource_type.to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN"
34
- }.compact
32
+ "resource_type_general" => meta.dig("types", "resource-type-general"),
33
+ "resource_type" => meta.dig("types", "resource-type"),
34
+ "bibtex" => meta.dig("types", "bibtex") || Bolognese::Utils::CR_TO_BIB_TRANSLATIONS[meta.dig("types", "resource-type").to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_BIB_TRANSLATIONS[type] || "misc",
35
+ "citeproc" => meta.dig("types", "citeproc") || Bolognese::Utils::CR_TO_CP_TRANSLATIONS[meta.dig("types", "resource-type").to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_CP_TRANSLATIONS[type] || "article",
36
+ "ris" => meta.dig("types", "ris") || Bolognese::Utils::CR_TO_RIS_TRANSLATIONS[meta.dig("types", "resource-type").to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[meta.dig("types", "resource-type-general").to_s.dasherize] || "GEN" }.compact
35
37
 
36
38
  { "id" => meta.fetch("id", nil),
37
39
  "types" => types,
38
40
  "doi" => validate_doi(meta.fetch("doi", nil)),
39
41
  "url" => normalize_id(meta.fetch("url", nil)),
40
- "title" => meta.fetch("title", nil),
41
- "alternate_identifiers" => meta.fetch("alternate-identifiers", nil),
42
+ "titles" => meta.fetch("titles", nil),
43
+ "alternate_identifiers" => alternate_identifiers,
42
44
  "creator" => meta.fetch("creator", nil),
43
45
  "contributor" => meta.fetch("contributor", nil),
44
46
  "publisher" => meta.fetch("publisher", nil),
@@ -48,14 +50,14 @@ module Bolognese
48
50
  "related_identifiers" => related_identifiers,
49
51
  "dates" => dates,
50
52
  "publication_year" => meta.fetch("publication-year", nil),
51
- "description" => meta.fetch("description", nil),
52
- "rights" => meta.fetch("rights", nil),
53
+ "descriptions" => meta.fetch("descriptions", nil),
54
+ "rights_list" => meta.fetch("rights-list", nil),
53
55
  "version" => meta.fetch("version", nil),
54
- "keywords" => meta.fetch("subject", nil),
56
+ "subjects" => meta.fetch("subjects", nil),
55
57
  "language" => meta.fetch("language", nil),
56
- "size" => meta.fetch("size", nil),
58
+ "sizes" => meta.fetch("sizes", nil),
57
59
  "formats" => meta.fetch("formats", nil),
58
- "geo_location" => meta.fetch("geo-location", nil),
60
+ "geo_locations" => meta.fetch("geo-locations", nil),
59
61
  "schema_version" => meta.fetch("schema-version", nil),
60
62
  "state" => state
61
63
  }
@@ -84,37 +84,38 @@ module Bolognese
84
84
  "ris" => Bolognese::Utils::CR_TO_RIS_TRANSLATIONS[resource_type.to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN"
85
85
  }.compact
86
86
 
87
- title = Array.wrap(meta.dig("titles", "title")).map do |r|
87
+ titles = Array.wrap(meta.dig("titles", "title")).map do |r|
88
88
  if r.is_a?(String)
89
- { "text" => sanitize(r) }
89
+ { "title" => sanitize(r) }
90
90
  else
91
- { "title_type" => r["titleType"], "lang" => r["lang"], "text" => sanitize(r["__content__"]) }.compact
91
+ { "title" => sanitize(r["__content__"]), "title_type" => r["titleType"], "lang" => r["lang"] }.compact
92
92
  end
93
93
  end
94
94
 
95
95
  alternate_identifiers = Array.wrap(meta.dig("alternateIdentifiers", "alternateIdentifier")).map do |r|
96
- { "type" => r["alternateIdentifierType"], "name" => r["__content__"] }
97
- end.unwrap
98
- description = Array.wrap(meta.dig("descriptions", "description")).select { |r| r["descriptionType"] != "SeriesInformation" }.map do |r|
99
- { "type" => r["descriptionType"], "lang" => r["lang"], "text" => sanitize(r["__content__"]) }.compact
96
+ { "alternate_identifier_type" => r["alternateIdentifierType"], "alternate_identifier" => r["__content__"] }
100
97
  end
101
- rights = Array.wrap(meta.dig("rightsList", "rights")).map do |r|
102
- { "id" => normalize_url(r["rightsURI"]), "name" => r["__content__"] }.compact
98
+ descriptions = Array.wrap(meta.dig("descriptions", "description")).select { |r| r["descriptionType"] != "SeriesInformation" }.map do |r|
99
+ { "description" => sanitize(r["__content__"]), "description_type" => r["descriptionType"], "lang" => r["lang"] }.compact
103
100
  end
104
- keywords = Array.wrap(meta.dig("subjects", "subject")).map do |k|
101
+ rights_list = Array.wrap(meta.dig("rightsList", "rights")).map do |r|
102
+ { "rights" => r["__content__"], "rights_uri" => normalize_url(r["rightsURI"]), "lang" => r["lang"] }.compact
103
+ end
104
+ subjects = Array.wrap(meta.dig("subjects", "subject")).map do |k|
105
105
  if k.nil?
106
106
  nil
107
107
  elsif k.is_a?(String)
108
- { "text" => sanitize(k) }
108
+ { "subject" => sanitize(k) }
109
109
  else
110
- { "subject_scheme" => k["subjectScheme"], "scheme_uri" => k["schemeURI"], "text" => sanitize(k["__content__"]) }.compact
110
+ { "subject" => sanitize(k["__content__"]), "subject_scheme" => k["subjectScheme"], "scheme_uri" => k["schemeURI"], "value_uri" => k["valueURI"], "lang" => k["lang"] }.compact
111
111
  end
112
112
  end.compact
113
113
  dates = Array.wrap(meta.dig("dates", "date")).map do |d|
114
114
  {
115
115
  "date" => parse_attributes(d),
116
- "date_type" => parse_attributes(d, content: "dateType")
117
- }
116
+ "date_type" => parse_attributes(d, content: "dateType"),
117
+ "date_information" => parse_attributes(d, content: "dateInformation")
118
+ }.compact
118
119
  end
119
120
  dates << { "date" => meta.fetch("publicationYear", nil), "date_type" => "Issued" } if meta.fetch("publicationYear", nil).present? && get_date(dates, "Issued").blank?
120
121
  sizes = Array.wrap(meta.dig("sizes", "size"))
@@ -130,24 +131,26 @@ module Bolognese
130
131
  end
131
132
  related_identifiers = Array.wrap(meta.dig("relatedIdentifiers", "relatedIdentifier")).map do |ri|
132
133
  if ri["relatedIdentifierType"] == "DOI"
133
- rid = ri["__content__"].downcase
134
+ rid = ri["__content__"].to_s.downcase
134
135
  else
135
136
  rid = ri["__content__"]
136
137
  end
137
138
 
138
139
  {
139
- "id" => rid,
140
+ "related_identifier" => rid,
140
141
  "related_identifier_type" => ri["relatedIdentifierType"],
141
142
  "relation_type" => ri["relationType"],
142
- "resource_type_general" => ri["resourceTypeGeneral"]
143
+ "resource_type_general" => ri["resourceTypeGeneral"],
144
+ "related_metadata_scheme" => ri["relatedMetadataScheme"],
145
+ "scheme_uri" => ri["schemeURI"],
146
+ "scheme_type" => ri["schemeType"]
143
147
  }.compact
144
148
  end
145
- geo_location = Array.wrap(meta.dig("geoLocations", "geoLocation")).map do |gl|
149
+ geo_locations = Array.wrap(meta.dig("geoLocations", "geoLocation")).map do |gl|
146
150
  if gl["geoLocationPoint"].is_a?(String) || gl["geoLocationBox"].is_a?(String)
147
151
  nil
148
152
  else
149
153
  {
150
- "geo_location_place" => gl["geoLocationPlace"],
151
154
  "geo_location_point" => {
152
155
  "point_latitude" => gl.dig("geoLocationPoint", "pointLatitude"),
153
156
  "point_longitude" => gl.dig("geoLocationPoint", "pointLongitude")
@@ -157,7 +160,8 @@ module Bolognese
157
160
  "east_bound_longitude" => gl.dig("geoLocationBox", "eastBoundLongitude"),
158
161
  "south_bound_latitude" => gl.dig("geoLocationBox", "southBoundLatitude"),
159
162
  "north_bound_latitude" => gl.dig("geoLocationBox", "northBoundLatitude")
160
- }.compact.presence
163
+ }.compact.presence,
164
+ "geo_location_place" => gl["geoLocationPlace"],
161
165
  }.compact
162
166
  end
163
167
  end
@@ -169,7 +173,7 @@ module Bolognese
169
173
  "doi" => doi,
170
174
  "alternate_identifiers" => alternate_identifiers,
171
175
  "url" => options.fetch(:url, nil),
172
- "title" => title,
176
+ "titles" => titles,
173
177
  "creator" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
174
178
  "contributor" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))),
175
179
  "periodical" => periodical,
@@ -178,15 +182,15 @@ module Bolognese
178
182
  "funding_references" => funding_references,
179
183
  "dates" => dates,
180
184
  "publication_year" => meta.fetch("publicationYear", nil),
181
- "description" => description,
182
- "rights" => rights,
185
+ "descriptions" => descriptions,
186
+ "rights_list" => rights_list,
183
187
  "version" => meta.fetch("version", nil),
184
- "keywords" => keywords,
188
+ "subjects" => subjects,
185
189
  "language" => meta.fetch("language", nil),
186
- "geo_location" => geo_location,
190
+ "geo_locations" => geo_locations,
187
191
  "related_identifiers" => related_identifiers,
188
192
  "formats" => formats,
189
- "size" => sizes,
193
+ "sizes" => sizes,
190
194
  "schema_version" => schema_version,
191
195
  "state" => state
192
196
  }
@@ -205,46 +209,6 @@ module Bolognese
205
209
  }.compact
206
210
  end
207
211
  end
208
-
209
- def datacite_funding_reference(meta)
210
- Array.wrap(meta.dig("fundingReferences", "fundingReference")).compact.map do |f|
211
- funder_id = parse_attributes(f["funderIdentifier"])
212
- funder = { "type" => "Organization",
213
- "id" => normalize_id(funder_id),
214
- "name" => f["funderName"] }.compact
215
- if f["awardNumber"].present? || f["awardTitle"].present?
216
- { "type" => "Award",
217
- "name" => f.fetch("awardTitle", nil),
218
- "identifier" => f["awardNumber"].is_a?(Hash) ? f.dig("awardNumber", "__content__") : f["awardNumber"],
219
- "url" => f["awardNumber"].is_a?(Hash) ? f.dig("awardNumber", "awardURI") : nil,
220
- "funder" => funder }.compact
221
- else
222
- funder
223
- end
224
- end.uniq
225
- end
226
-
227
- def datacite_funder_contributor(meta)
228
- Array.wrap(meta.dig("contributors", "contributor")).reduce([]) do |sum, f|
229
- if f["contributorType"] == "Funder"
230
- # handle special case of OpenAIRE metadata
231
- id = f.dig("nameIdentifier", "__content__").to_s.start_with?("info:eu-repo/grantAgreement/EC") ? "https://doi.org/10.13039/501100000780" : nil
232
-
233
- funder = { "type" => "Organization",
234
- "id" => id,
235
- "name" => f["contributorName"] }.compact
236
- if f.dig("nameIdentifier", "nameIdentifierScheme") == "info"
237
- sum << { "type" => "Award",
238
- "identifier" => f.dig("nameIdentifier", "__content__").split("/").last,
239
- "funder" => funder }
240
- else
241
- sum << funder
242
- end
243
- else
244
- sum
245
- end
246
- end
247
- end
248
212
  end
249
213
  end
250
214
  end
@@ -70,24 +70,27 @@ module Bolognese
70
70
  nil
71
71
  end
72
72
  state = doi.present? ? "findable" : "not_found"
73
+ subjects = Array.wrap(meta.fetch("KW", nil)).map do |s|
74
+ { "subject" => s }
75
+ end
73
76
 
74
77
  { "id" => normalize_doi(doi),
75
78
  "types" => types,
76
79
  "doi" => doi,
77
80
  "url" => meta.fetch("UR", nil),
78
- "title" => meta.fetch("T1", nil).present? ? [{ "text" => meta.fetch("T1", nil) }] : nil,
81
+ "titles" => meta.fetch("T1", nil).present? ? [{ "title" => meta.fetch("T1", nil) }] : nil,
79
82
  "creator" => get_authors(author),
80
83
  "publisher" => meta.fetch("PB", "(:unav)"),
81
84
  "periodical" => periodical,
82
85
  "related_identifiers" => related_identifiers,
83
86
  "dates" => dates,
84
87
  "publication_year" => publication_year,
85
- "description" => meta.fetch("AB", nil).present? ? [{ "text" => sanitize(meta.fetch("AB")) }] : nil,
88
+ "descriptions" => meta.fetch("AB", nil).present? ? [{ "description" => sanitize(meta.fetch("AB")) }] : nil,
86
89
  "volume" => meta.fetch("VL", nil),
87
90
  "issue" => meta.fetch("IS", nil),
88
91
  "first_page" => meta.fetch("SP", nil),
89
92
  "last_page" => meta.fetch("EP", nil),
90
- "keywords" => meta.fetch("KW", nil),
93
+ "subjects" => subjects,
91
94
  "language" => meta.fetch("LA", nil),
92
95
  "state" => state
93
96
  }
@@ -39,11 +39,11 @@ module Bolognese
39
39
  if identifier.length > 1
40
40
  alternate_identifiers = identifier[1..-1].map do |r|
41
41
  if r.is_a?(String)
42
- { "type" => "URL", "name" => r }
42
+ { "alternate_identifier_type" => "URL", "alternate_identifier" => r }
43
43
  elsif r.is_a?(Hash)
44
- { "type" => r["propertyID"], "name" => r["value"] }
44
+ { "alternate_identifier_type" => r["propertyID"], "alternate_identifier" => r["value"] }
45
45
  end
46
- end.unwrap
46
+ end
47
47
  else
48
48
  alternate_identifiers = nil
49
49
  end
@@ -104,7 +104,7 @@ module Bolognese
104
104
  publication_year = meta.fetch("datePublished")[0..3] if meta.fetch("datePublished", nil).present?
105
105
 
106
106
  state = meta.present? ? "findable" : "not_found"
107
- geo_location = Array.wrap(meta.fetch("spatialCoverage", nil)).map do |gl|
107
+ geo_locations = Array.wrap(meta.fetch("spatialCoverage", nil)).map do |gl|
108
108
  if gl.dig("geo", "box")
109
109
  s, w, n, e = gl.dig("geo", "box").split(" ", 4)
110
110
  geo_location_box = {
@@ -124,6 +124,9 @@ module Bolognese
124
124
  "geo_location_box" => geo_location_box
125
125
  }.compact
126
126
  end
127
+ subjects = Array.wrap(meta.fetch("keywords", nil).to_s.split(", ")).map do |s|
128
+ { "subject" => s }
129
+ end
127
130
 
128
131
  { "id" => id,
129
132
  "types" => types,
@@ -132,9 +135,9 @@ module Bolognese
132
135
  "alternate_identifiers" => alternate_identifiers,
133
136
  "url" => normalize_id(meta.fetch("url", nil)),
134
137
  "content_url" => Array.wrap(meta.fetch("contentUrl", nil)),
135
- "size" => Array.wrap(meta.fetch("contenSize", nil)).presence,
138
+ "sizes" => Array.wrap(meta.fetch("contenSize", nil)).presence,
136
139
  "formats" => Array.wrap(meta.fetch("encodingFormat", nil) || meta.fetch("fileFormat", nil)),
137
- "title" => meta.fetch("name", nil).present? ? [{ "text" => meta.fetch("name", nil) }] : nil,
140
+ "titles" => meta.fetch("name", nil).present? ? [{ "title" => meta.fetch("name", nil) }] : nil,
138
141
  "creator" => author,
139
142
  "contributor" => contributor,
140
143
  "publisher" => publisher,
@@ -143,14 +146,14 @@ module Bolognese
143
146
  "related_identifiers" => related_identifiers,
144
147
  "publication_year" => publication_year,
145
148
  "dates" => dates,
146
- "description" => meta.fetch("description", nil).present? ? [{ "text" => sanitize(meta.fetch("description")) }] : nil,
149
+ "descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")) }] : nil,
147
150
  "rights" => rights,
148
151
  "version" => meta.fetch("version", nil),
149
- "keywords" => meta.fetch("keywords", nil).to_s.split(", "),
152
+ "subjects" => subjects,
150
153
  "state" => state,
151
154
  "schema_version" => meta.fetch("schemaVersion", nil),
152
155
  "funding_references" => funding_references,
153
- "geo_location" => geo_location
156
+ "geo_locations" => geo_locations
154
157
  }
155
158
  end
156
159
 
@@ -479,7 +479,7 @@ module Bolognese
479
479
  related_identifier_type = doi_from_url(id).present? ? "DOI" : "URL"
480
480
  id = doi_from_url(id) || id
481
481
 
482
- { "id" => id,
482
+ { "related_identifier" => id,
483
483
  "relation_type" => relation_type,
484
484
  "related_identifier_type" => related_identifier_type,
485
485
  "resource_type_general" => Metadata::SO_TO_DC_TRANSLATIONS[idx["@type"]],
@@ -524,16 +524,17 @@ module Bolognese
524
524
  nil
525
525
  end
526
526
 
527
- def to_datacite_json(element)
528
- Array.wrap(element).each do |e|
527
+ def to_datacite_json(element, options={})
528
+ a = Array.wrap(element).map do |e|
529
529
  e.inject({}) {|h, (k,v)| h[k.dasherize] = v; h }
530
- end.unwrap
530
+ end
531
+ options[:first] ? a.unwrap : a.presence
531
532
  end
532
533
 
533
534
  def from_datacite_json(element)
534
- Array.wrap(element).each do |e|
535
+ Array.wrap(element).map do |e|
535
536
  e.inject({}) {|h, (k,v)| h[k.underscore] = v; h }
536
- end.unwrap
537
+ end
537
538
  end
538
539
 
539
540
  def to_schema_org(element)
@@ -546,7 +547,7 @@ module Bolognese
546
547
  return nil unless (element.is_a?(Hash) || (element.nil? && options[:container_title].present?))
547
548
 
548
549
  {
549
- "@id" => element["id"],
550
+ "@id" => element["related_identifier"],
550
551
  "@type" => (options[:type] == "Dataset") ? "DataCatalog" : "Periodical",
551
552
  "name" => element["title"] || options[:container_title] }
552
553
  end
@@ -559,13 +560,13 @@ module Bolognese
559
560
 
560
561
  if options[:alternate_identifiers].present?
561
562
  [ident] + Array.wrap(options[:alternate_identifiers]).map do |ai|
562
- if ai["type"].to_s.downcase == "url"
563
- ai["name"]
563
+ if ai["alternate_identifier_type"].to_s.downcase == "url"
564
+ ai["alternate_identifier"]
564
565
  else
565
566
  {
566
567
  "@type" => "PropertyValue",
567
- "propertyID" => ai["type"],
568
- "value" => ai["name"] }
568
+ "propertyID" => ai["alternate_identifier_type"],
569
+ "value" => ai["alternate_identifier"] }
569
570
  end
570
571
  end
571
572
  else
@@ -582,11 +583,11 @@ module Bolognese
582
583
  if r["related_identifier_type"] == "ISSN" && r["relation_type"] == "IsPartOf"
583
584
  {
584
585
  "@type" => "Periodical",
585
- "issn" => r["id"],
586
+ "issn" => r["related_identifier"],
586
587
  "name" => r["title"] }.compact
587
588
  else
588
589
  {
589
- "@id" => normalize_id(r["id"]),
590
+ "@id" => normalize_id(r["related_identifier"]),
590
591
  "@type" => DC_TO_SO_TRANSLATIONS[r["resource_type_general"]] || "CreativeWork",
591
592
  "name" => r["title"] }.compact
592
593
  end
@@ -658,7 +659,7 @@ module Bolognese
658
659
  {
659
660
  "@type" => "PropertyValue",
660
661
  "propertyID" => identifier["related_identifier_type"],
661
- "value" => identifier["id"] }
662
+ "value" => identifier["related_identifier"] }
662
663
  end
663
664
 
664
665
  def from_citeproc(element)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -12,9 +12,9 @@ module Bolognese
12
12
  doi: doi,
13
13
  url: url,
14
14
  author: authors_as_string(creator),
15
- keywords: keywords.present? ? Array.wrap(keywords).map { |k| parse_attributes(k, content: "text", first: true) }.join(", ") : nil,
15
+ keywords: subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil,
16
16
  language: language,
17
- title: parse_attributes(title, content: "text", first: true),
17
+ title: parse_attributes(titles, content: "title", first: true),
18
18
  journal: periodical && periodical["title"],
19
19
  volume: volume,
20
20
  issue: issue,
@@ -12,11 +12,11 @@ module Bolognese
12
12
  "@id" => identifier,
13
13
  "identifier" => identifier,
14
14
  "codeRepository" => url,
15
- "title" => parse_attributes(title, content: "text", first: true),
15
+ "title" => parse_attributes(titles, content: "title", first: true),
16
16
  "agents" => creator,
17
- "description" => parse_attributes(description, content: "text", first: true),
17
+ "description" => parse_attributes(descriptions, content: "description", first: true),
18
18
  "version" => version,
19
- "tags" => keywords.to_s.split(", ").presence,
19
+ "tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
20
20
  "datePublished" => get_date(dates, "Issued"),
21
21
  "dateModified" => get_date(dates, "Updated"),
22
22
  "publisher" => publisher
@@ -10,25 +10,25 @@ module Bolognese
10
10
  "url" => url,
11
11
  "types" => types,
12
12
  "creator" => creator,
13
- "title" => title,
13
+ "titles" => titles,
14
14
  "publisher" => publisher,
15
15
  "periodical" => periodical,
16
- "keywords" => keywords,
16
+ "subjects" => subjects,
17
17
  "contributor" => contributor,
18
18
  "dates" => dates,
19
19
  "publication_year" => publication_year,
20
20
  "language" => language,
21
21
  "alternate_identifiers" => alternate_identifiers,
22
- "size" => size,
22
+ "sizes" => sizes,
23
23
  "formats" => formats,
24
24
  "version" => version,
25
- "rights" => rights,
26
- "description" => description,
25
+ "rights_list" => rights_list,
26
+ "descriptions" => descriptions,
27
27
  "volume" => volume,
28
28
  "issue" => issue,
29
29
  "first_page" => first_page,
30
30
  "last_page" => last_page,
31
- "geo_location" => geo_location,
31
+ "geo_locations" => geo_locations,
32
32
  "funding_references" => funding_references,
33
33
  "related_identifiers" => related_identifiers,
34
34
  "schema_version" => schema_version,