bolognese 2.3.9 → 2.4.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/datacite_utils.rb +1 -1
- data/lib/bolognese/metadata.rb +4 -1
- data/lib/bolognese/metadata_utils.rb +6 -0
- data/lib/bolognese/readers/datacite_reader.rb +0 -23
- data/lib/bolognese/utils.rb +42 -0
- data/lib/bolognese/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 529234397625f866f410ff4fb56265a027a27dd3f75f819f8942f79b1b6045f2
|
|
4
|
+
data.tar.gz: f78ee05cdcfb3a9f8a69421329a7068a8b132926d41995ccbcd67c5af7600f30
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7d2d01f5f663c456537a27f8384c65d4dc9b7c7e7a27b53e2c523510a81a3b6b93116f6ead857aedde24a37ff4a1aacebbd24663f570dd83cd035a9c1982fd6
|
|
7
|
+
data.tar.gz: 3f575a7e8a46c73fa8ac6264abe2a360fab340c79189abcd9ab0c8498bb0a20ec8ba482a4c059ff85ec608069007addefe76b8f3dfcd808d81f864aff073e98d
|
data/Gemfile.lock
CHANGED
|
@@ -337,7 +337,7 @@ module Bolognese
|
|
|
337
337
|
return xml unless descriptions.present? || container && container["title"].present?
|
|
338
338
|
|
|
339
339
|
xml.descriptions do
|
|
340
|
-
if container && container["title"].present?
|
|
340
|
+
if (respond_to?(:from) && !from.to_s.include?("datacite")) && container && container["title"].present?
|
|
341
341
|
issue = container["issue"].present? ? "(#{container["issue"]})" : nil
|
|
342
342
|
volume_issue = container["volume"].present? ? [container["volume"], issue].join("") : nil
|
|
343
343
|
pages = [container["firstPage"], container["lastPage"]].compact.join("-") if container["firstPage"].present?
|
data/lib/bolognese/metadata.rb
CHANGED
|
@@ -5,6 +5,7 @@ require_relative 'metadata_utils'
|
|
|
5
5
|
module Bolognese
|
|
6
6
|
class Metadata
|
|
7
7
|
include Bolognese::MetadataUtils
|
|
8
|
+
include Bolognese::Utils
|
|
8
9
|
|
|
9
10
|
attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :show_errors
|
|
10
11
|
attr_reader :doc, :page_start, :page_end
|
|
@@ -205,7 +206,9 @@ module Bolognese
|
|
|
205
206
|
end
|
|
206
207
|
|
|
207
208
|
def container
|
|
208
|
-
@container ||=
|
|
209
|
+
@container ||= begin
|
|
210
|
+
generate_container(types, related_items, related_identifiers, descriptions) || meta.fetch("container", nil)
|
|
211
|
+
end
|
|
209
212
|
end
|
|
210
213
|
|
|
211
214
|
def geo_locations
|
|
@@ -153,15 +153,21 @@ module Bolognese
|
|
|
153
153
|
"language" => language,
|
|
154
154
|
"author" => author,
|
|
155
155
|
"contributor" => to_citeproc(contributors),
|
|
156
|
+
"editor" => contributors ? to_citeproc(contributors.select { |c| c["contributorType"] == "Editor" }) : nil,
|
|
156
157
|
"translator" => contributors ? to_citeproc(contributors.select { |c| c["contributorType"] == "Translator" }) : nil,
|
|
157
158
|
"issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year.to_s),
|
|
158
159
|
"submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
|
|
160
|
+
"available-date" => Array.wrap(dates).find { |d| d["dateType"] == "Available" }.to_h.fetch("__content__", nil),
|
|
159
161
|
"abstract" => parse_attributes(descriptions, content: "description", first: true),
|
|
160
162
|
"container-title" => container_title,
|
|
161
163
|
"DOI" => doi,
|
|
162
164
|
"volume" => container.to_h["volume"],
|
|
163
165
|
"issue" => container.to_h["issue"],
|
|
166
|
+
"number" => container.to_h["number"],
|
|
167
|
+
"chapter-number" => container.to_h["chapterNumber"],
|
|
168
|
+
"edition" => container.to_h["edition"],
|
|
164
169
|
"page" => page,
|
|
170
|
+
"page-first" => container.to_h["firstPage"],
|
|
165
171
|
"publisher" => publisher["name"],
|
|
166
172
|
"title" => parse_attributes(titles, content: "title", first: true),
|
|
167
173
|
"URL" => url,
|
|
@@ -298,7 +298,6 @@ module Bolognese
|
|
|
298
298
|
"titles" => titles,
|
|
299
299
|
"creators" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
|
|
300
300
|
"contributors" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))),
|
|
301
|
-
"container" => set_container(meta),
|
|
302
301
|
"publisher" => publisher,
|
|
303
302
|
"agency" => "datacite",
|
|
304
303
|
"funding_references" => funding_references,
|
|
@@ -319,28 +318,6 @@ module Bolognese
|
|
|
319
318
|
}.merge(read_options)
|
|
320
319
|
end
|
|
321
320
|
|
|
322
|
-
def set_container(meta)
|
|
323
|
-
series_information = Array.wrap(meta.dig("descriptions", "description")).find { |r| r["descriptionType"] == "SeriesInformation" }.to_h.fetch("__content__", nil)
|
|
324
|
-
si = get_series_information(series_information)
|
|
325
|
-
|
|
326
|
-
is_part_of = Array.wrap(meta.dig("relatedIdentifiers", "relatedIdentifier")).find { |ri| ri["relationType"] == "IsPartOf" }.to_h
|
|
327
|
-
|
|
328
|
-
if si["title"].present? || is_part_of.present?
|
|
329
|
-
{
|
|
330
|
-
"type" => meta.dig("resourceType", "resourceTypeGeneral") == "Dataset" ? "DataRepository" : "Series",
|
|
331
|
-
"identifier" => is_part_of["__content__"],
|
|
332
|
-
"identifierType" => is_part_of["relatedIdentifierType"],
|
|
333
|
-
"title" => si["title"],
|
|
334
|
-
"volume" => si["volume"],
|
|
335
|
-
"issue" => si["issue"],
|
|
336
|
-
"firstPage" => si["firstPage"],
|
|
337
|
-
"lastPage" => si["lastPage"]
|
|
338
|
-
}.compact
|
|
339
|
-
else
|
|
340
|
-
{}
|
|
341
|
-
end
|
|
342
|
-
end
|
|
343
|
-
|
|
344
321
|
def get_titles(meta)
|
|
345
322
|
titles = Array.wrap(meta.dig("titles", "title")).map do |r|
|
|
346
323
|
if r.blank?
|
data/lib/bolognese/utils.rb
CHANGED
|
@@ -1434,5 +1434,47 @@ module Bolognese
|
|
|
1434
1434
|
# Fetch the first description with descriptionType "Abstract"
|
|
1435
1435
|
Array.wrap(descriptions)&.find { |d| d["descriptionType"] == "Abstract" }
|
|
1436
1436
|
end
|
|
1437
|
+
|
|
1438
|
+
def generate_container(types, related_items, related_identifiers, descriptions)
|
|
1439
|
+
container_type = (types.respond_to?(:dig) && types&.dig("resourceTypeGeneral")) == "Dataset" ? "DataRepository" : "Series"
|
|
1440
|
+
|
|
1441
|
+
# relatedItem container
|
|
1442
|
+
related_item = Array.wrap(related_items).find { |ri| ri["relationType"] == "IsPublishedIn" }.to_h
|
|
1443
|
+
|
|
1444
|
+
if related_item.present?
|
|
1445
|
+
return {
|
|
1446
|
+
"type" => container_type,
|
|
1447
|
+
"identifier" => related_item.dig("relatedItemIdentifier", "relatedItemIdentifier"),
|
|
1448
|
+
"identifierType" => related_item.dig("relatedItemIdentifier", "relatedItemIdentifierType"),
|
|
1449
|
+
"title" => related_item.dig("titles", 0).then { |t| t ? parse_attributes(t, content: "title", first: true) : nil },
|
|
1450
|
+
"volume" => related_item["volume"],
|
|
1451
|
+
"issue" => related_item["issue"],
|
|
1452
|
+
"edition" => related_item["edition"],
|
|
1453
|
+
"number" => related_item["number"],
|
|
1454
|
+
"chapterNumber" => related_item["numberType"] == "Chapter" ? related_item["number"] : nil,
|
|
1455
|
+
"firstPage" => related_item["firstPage"],
|
|
1456
|
+
"lastPage" => related_item["lastPage"]
|
|
1457
|
+
}.compact
|
|
1458
|
+
end
|
|
1459
|
+
|
|
1460
|
+
# Legacy SeriesInformation/relatedIdentifier container fallback
|
|
1461
|
+
series_information = Array.wrap(descriptions).find { |r| r["descriptionType"] == "SeriesInformation" }.to_h.fetch("description", nil)
|
|
1462
|
+
si = get_series_information(series_information)
|
|
1463
|
+
|
|
1464
|
+
is_part_of = Array.wrap(related_identifiers).find { |ri| ri["relationType"] == "IsPartOf" }.to_h
|
|
1465
|
+
|
|
1466
|
+
if si["title"].present?
|
|
1467
|
+
return {
|
|
1468
|
+
"type" => container_type,
|
|
1469
|
+
"identifier" => is_part_of["relatedIdentifier"],
|
|
1470
|
+
"identifierType" => is_part_of["relatedIdentifierType"],
|
|
1471
|
+
"title" => si["title"],
|
|
1472
|
+
"volume" => si["volume"],
|
|
1473
|
+
"issue" => si["issue"],
|
|
1474
|
+
"firstPage" => si["firstPage"],
|
|
1475
|
+
"lastPage" => si["lastPage"]
|
|
1476
|
+
}.compact
|
|
1477
|
+
end
|
|
1478
|
+
end
|
|
1437
1479
|
end
|
|
1438
1480
|
end
|
data/lib/bolognese/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bolognese
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: maremma
|