lib/bolognese/readers/datacite_reader.rb in bolognese-0.11.7 vs lib/bolognese/readers/datacite_reader.rb in bolognese-0.12
- old
+ new
@@ -33,17 +33,22 @@
end
end
string = doc.to_xml(:indent => 2)
end
+ content_url = Array.wrap(attributes.fetch("media", nil)).map do |media|
+ media.split(":", 2).last
+ end.compact
+
{ "string" => string,
"b_url" => attributes.fetch("url", nil),
"state" => attributes.fetch("state", nil),
"date_registered" => attributes.fetch("minted", nil),
"date_updated" => attributes.fetch("updated", nil),
"provider_id" => attributes.fetch("allocator_symbol", nil),
- "client_id" => attributes.fetch("datacentre_symbol", nil) }
+ "client_id" => attributes.fetch("datacentre_symbol", nil),
+ "content_url" => content_url }
end
def read_datacite(string: nil, **options)
doc = Nokogiri::XML(string, nil, 'UTF-8', &:noblanks)
ns = doc.collect_namespaces.find { |k, v| v.start_with?("http://datacite.org/schema/kernel") }
@@ -78,12 +83,12 @@
end
end.unwrap
container_title = Array.wrap(meta.dig("descriptions", "description")).find { |r| r["descriptionType"] == "SeriesInformation" }.to_h.fetch("__content__", nil)
- alternate_name = Array.wrap(meta.dig("alternateIdentifiers", "alternateIdentifier")).map do |r|
- { "type" => r["alternateIdentifierType"], "name" => r["__content__"] }.compact
+ alternate_identifier = Array.wrap(meta.dig("alternateIdentifiers", "alternateIdentifier")).map do |r|
+ { "type" => r["alternateIdentifierType"], "name" => r["__content__"] }
end.unwrap
description = Array.wrap(meta.dig("descriptions", "description")).select { |r| r["descriptionType"] != "SeriesInformation" }.map do |r|
{ "type" => r["descriptionType"], "text" => sanitize(r["__content__"]) }.compact
end.unwrap
license = Array.wrap(meta.dig("rightsList", "rights")).map do |r|
@@ -111,13 +116,13 @@
"citeproc_type" => Bolognese::Utils::CR_TO_CP_TRANSLATIONS[additional_type.to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_CP_TRANSLATIONS[type] || "article",
"bibtex_type" => Bolognese::Utils::CR_TO_BIB_TRANSLATIONS[additional_type.to_s.underscore.camelcase] || Bolognese::Utils::SO_TO_BIB_TRANSLATIONS[type] || "misc",
"ris_type" => Bolognese::Utils::CR_TO_RIS_TRANSLATIONS[additional_type.to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN",
"resource_type_general" => resource_type_general,
"doi" => doi,
+ "alternate_identifier" => alternate_identifier,
"url" => options.fetch(:url, nil),
"title" => title,
- "alternate_name" => alternate_name,
"author" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
"editor" => get_authors(Array.wrap(meta.dig("contributors", "contributor")).select { |r| r["contributorType"] == "Editor" }),
"container_title" => container_title,
"publisher" => meta.fetch("publisher", nil),
"service_provider" => "DataCite",
@@ -130,10 +135,10 @@
"is_supplement_to" => datacite_is_supplement_to(meta),
"is_supplemented_by" => datacite_is_supplemented_by(meta),
"date_created" => datacite_date(dates, "Created"),
"date_accepted" => datacite_date(dates, "Accepted"),
"date_available" => datacite_date(dates, "Available"),
- "date_copyrighted" => datacite_date(dates, "Copyrightes"),
+ "date_copyrighted" => datacite_date(dates, "Copyrights"),
"date_collected" => datacite_date(dates, "Collected"),
"date_submitted" => datacite_date(dates, "Submitted"),
"date_valid" => datacite_date(dates, "Valid"),
"date_published" => datacite_date(dates, "Issued") || meta.fetch("publicationYear", nil),
"date_modified" => datacite_date(dates, "Updated"),