lib/bolognese/readers/datacite_reader.rb in bolognese-0.10.7 vs lib/bolognese/readers/datacite_reader.rb in bolognese-0.10.8
- old
+ new
@@ -55,11 +55,12 @@
id = normalize_doi(meta.dig("identifier", "__content__") || options[:id], sandbox: options[:sandbox])
end
doi = doi_from_url(id)
resource_type_general = meta.dig("resourceType", "resourceTypeGeneral")
- type = Bolognese::Utils::DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || "CreativeWork"
+ additional_type = meta.fetch("resourceType", {}).fetch("__content__", nil)
+ type = Bolognese::Utils::CR_TO_SO_TRANSLATIONS[additional_type.to_s.underscore.camelcase] || Bolognese::Utils::DC_TO_SO_TRANSLATIONS[resource_type_general.to_s.dasherize] || "CreativeWork"
title = Array.wrap(meta.dig("titles", "title")).map do |r|
if r.is_a?(String)
sanitize(r)
else
{ "title_type" => r["titleType"], "lang" => r["xml:lang"], "text" => sanitize(r["__content__"]) }.compact
@@ -90,11 +91,11 @@
end
state = doi.present? ? "findable" : "not_found"
{ "id" => id,
"type" => type,
- "additional_type" => meta.fetch("resourceType", {}).fetch("__content__", nil),
- "citeproc_type" => Bolognese::Utils::DC_TO_CP_TRANSLATIONS[resource_type_general.to_s.dasherize] || "article",
+ "additional_type" => additional_type,
+ "citeproc_type" => Bolognese::Utils::SO_TO_CP_TRANSLATIONS[type] || "article",
"bibtex_type" => Bolognese::Utils::SO_TO_BIB_TRANSLATIONS[type] || "misc",
"ris_type" => Bolognese::Utils::DC_TO_RIS_TRANSLATIONS[resource_type_general.to_s.dasherize] || "GEN",
"resource_type_general" => resource_type_general,
"doi" => doi,
"url" => options.fetch(:url, nil),