Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gemspec
gemspec
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bolognese (2.5.0)
bolognese (2.5.1)
activesupport (= 7.2.3)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
Expand Down
5 changes: 4 additions & 1 deletion lib/bolognese/datacite_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ def insert_related_identifiers(xml)
attributes = {
'relatedIdentifierType' => related_identifier["relatedIdentifierType"],
'relationType' => related_identifier["relationType"],
'resourceTypeGeneral' => related_identifier["resourceTypeGeneral"] }.compact
'relationTypeInformation' => related_identifier["relationTypeInformation"],
'resourceTypeGeneral' => related_identifier["resourceTypeGeneral",
] }.compact

attributes.merge({ 'relatedMetadataScheme' => related_identifier["relatedMetadataSchema"],
'schemeURI' => related_identifier["schemeUri"],
Expand All @@ -228,6 +230,7 @@ def insert_related_items(xml)
attributes = {
'relatedItemType' => related_item["relatedItemType"],
'relationType' => related_item["relationType"],
'relationTypeInformation' => related_item["relationTypeInformation"],
}.compact

xml.relatedItem(related_item["relatedItem"], attributes) do
Expand Down
8 changes: 4 additions & 4 deletions lib/bolognese/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: false

require_relative 'metadata_utils'

Expand Down Expand Up @@ -76,8 +76,8 @@ def initialize(options={})
end

# make sure input is encoded as utf8
string = string.force_encoding("UTF-8") if string.present?
@string = string
string1 = string.dup.force_encoding("UTF-8") if string.present?
@string = string1

# input options for citation formatting
@style = options[:style]
Expand Down Expand Up @@ -120,7 +120,7 @@ def initialize(options={})

@regenerate = options[:regenerate] || read_options.present?
# generate name for method to call dynamically
opts = { string: string, sandbox: options[:sandbox], doi: options[:doi], id: id, ra: ra }.merge(read_options)
opts = { string: string1, sandbox: options[:sandbox], doi: options[:doi], id: id, ra: ra }.merge(read_options)
@meta = @from.present? ? send("read_" + @from, **opts) : {}
end

Expand Down
15 changes: 14 additions & 1 deletion lib/bolognese/readers/crossref_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def read_crossref(string: nil, **options)

state = meta.present? || read_options.present? ? "findable" : "not_found"

related_identifiers = Array.wrap(crossref_is_part_of(journal_metadata)) + Array.wrap(crossref_references(bibliographic_metadata)) + Array.wrap(crossref_has_translation(program_metadata)) + Array.wrap(crossref_is_translation_of(program_metadata))
related_identifiers = Array.wrap(crossref_is_part_of(journal_metadata)) + Array.wrap(crossref_references(bibliographic_metadata)) + Array.wrap(crossref_has_translation(program_metadata)) + Array.wrap(crossref_is_translation_of(program_metadata)) + Array.wrap(crossref_is_related_material(program_metadata))

container = if journal_metadata.present?
issn = normalize_issn(journal_metadata.to_h.fetch("issn", nil))
Expand Down Expand Up @@ -395,6 +395,19 @@ def crossref_is_translation_of(program_metadata)
end
end.compact.unwrap
end

def crossref_is_related_material(program_metadata)
refs = program_metadata.dig("related_item") if program_metadata.is_a?(Hash)
Array.wrap(refs).select { |a| a.dig("interwork_relation", "relationship_type") == "isRelatedMaterial" }.map do |c|
if c.dig("inter_work_relation", "identifier_type") == "doi"
{ "relatedIdentifier" => parse_attributes(c["inter_work_relation"]).downcase,
"relationType" => "Other",
"relatedIdentifierType" => "DOI" }.compact
else
nil
end
end.compact.unwrap
end
end
end
end
6 changes: 4 additions & 2 deletions lib/bolognese/readers/datacite_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def read_datacite(string: nil, **options)
"resourceTypeGeneral" => ri["resourceTypeGeneral"],
"relatedMetadataScheme" => ri["relatedMetadataScheme"],
"schemeUri" => ri["schemeURI"],
"schemeType" => ri["schemeType"]
"schemeType" => ri["schemeType"],
"relationTypeInformation" => ri["relationTypeInformation"]
}.compact
end

Expand All @@ -226,7 +227,7 @@ def read_datacite(string: nil, **options)
"relatedItemIdentifierType" => rii["relatedItemIdentifierType"],
"relatedMetadataScheme" => rii["relatedMetadataScheme"],
"schemeURI" => rii["schemeURI"],
"schemeType" => rii["schemeType"]
"schemeType" => rii["schemeType"],
}.compact
end

Expand All @@ -241,6 +242,7 @@ def read_datacite(string: nil, **options)

a = {
"relationType" => ri["relationType"],
"relationTypeInformation" => ri["relationTypeInformation"],
"relatedItemType" => ri["relatedItemType"],
"relatedItemIdentifier" => relatedItemIdentifier,
"creators" => get_authors(Array.wrap(ri.dig("creators", "creator"))),
Expand Down
25 changes: 21 additions & 4 deletions lib/bolognese/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class << self
"OutputManagementPlan" => nil,
"PeerReview" => "Review",
"PhysicalObject" => nil,
"Poster" => "Poster",
"Preprint" => nil,
"Presentation" => "PresentationDigitalDocument",
"Report" => "Report",
"Service" => "Service",
"Software" => "SoftwareSourceCode",
Expand Down Expand Up @@ -103,7 +105,9 @@ class << self
"OutputManagementPlan" => nil,
"PeerReview" => "review",
"PhysicalObject" => nil,
"Poster" => "document",
"Preprint" => nil,
"Presentation" => "presentation",
"Report" => "report",
"Service" => nil,
"Sound" => "song",
Expand Down Expand Up @@ -280,6 +284,8 @@ class << self
"Event" => "Event",
"ImageObject" => "Image",
"Movie" => "Audiovisual",
"Poster" => "Poster",
"PresentationDigitalDocument" => "Presentation",
"PublicationIssue" => "Text",
"Report" => "Report",
"ScholarlyArticle" => "Text",
Expand Down Expand Up @@ -326,6 +332,8 @@ class << self
"Event" => nil,
"ImageObject" => "graphic",
"Movie" => "motion_picture",
"Poster" => "document",
"PresentationDigitalDocument" => "presentation",
"PublicationIssue" => nil,
"Report" => "report",
"ScholarlyArticle" => "article-journal",
Expand All @@ -348,8 +356,10 @@ class << self
"Event" => nil,
"ImageObject" => "FIGURE",
"Movie" => "MPCT",
"Report" => "RPRT",
"Poster" => "GEN",
"PresentationDigitalDocument" => "SLIDE",
"PublicationIssue" => nil,
"Report" => "RPRT",
"ScholarlyArticle" => "JOUR",
"Service" => nil,
"SoftwareSourceCode" => "COMP",
Expand Down Expand Up @@ -406,7 +416,9 @@ class << self
"OutputManagementPlan" => nil,
"PeerReview" => nil,
"PhysicalObject" => nil,
"Poster" => "GEN",
"Preprint" => nil,
"Presentation" => "SLIDE",
"Report" => "RRPT",
"Service" => nil,
"Software" => "COMP",
Expand All @@ -419,7 +431,7 @@ class << self

RIS_TO_DC_TRANSLATIONS = {
"BLOG" => "Text",
"GEN" => "Text",
"GEN" => "Poster",
"CTLG" => "Collection",
"DATA" => "Dataset",
"FIGURE" => "Image",
Expand All @@ -428,7 +440,8 @@ class << self
"JOUR" => "JournalArticle",
"COMP" => "Software",
"VIDEO" => "Audiovisual",
"ELEC" => "Text"
"ELEC" => "Text",
"SLIDE" => "Presentation"
}

BIB_TO_DC_TRANSLATIONS = {
Expand All @@ -452,7 +465,9 @@ class << self
"motion_picture" => "Audiovisual",
"article-journal" => "JournalArticle",
"broadcast" => "Audiovisual",
"webpage" => "Text"
"webpage" => "Text",
"document" => "Poster",
"presentation" => "Presentation"
}

SO_TO_BIB_TRANSLATIONS = {
Expand All @@ -468,6 +483,8 @@ class << self
"Event" => "misc",
"ImageObject" => "misc",
"Movie" => "misc",
"Poster" => "misc",
"PresentationDigitalDocument" => "misc",
"PublicationIssue" => "misc",
"ScholarlyArticle" => "article",
"Service" => "misc",
Expand Down
2 changes: 1 addition & 1 deletion lib/bolognese/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bolognese
VERSION = "2.5.0"
VERSION = "2.5.1"
end
37 changes: 37 additions & 0 deletions resources/kernel-4.7/include/datacite-contributorType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0 - Created 2011-01-13 - FZ, TIB, Germany
2013-05 v3.0: Addition of ID to simpleType element, added values "ResearchGroup" & "Other"
2014-08-20 v3.1: Addition of value "DataCurator"
2015-05-14 v4.0 dropped value "Funder", use new "funderReference"
2024-12-05 v4.6: Addition of value "Translator" -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="contributorType" id="contributorType">
<xs:annotation>
<xs:documentation>The type of contributor of the resource.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="ContactPerson" />
<xs:enumeration value="DataCollector" />
<xs:enumeration value="DataCurator" />
<xs:enumeration value="DataManager" />
<xs:enumeration value="Distributor" />
<xs:enumeration value="Editor" />
<xs:enumeration value="HostingInstitution" />
<xs:enumeration value="Other" />
<xs:enumeration value="Producer" />
<xs:enumeration value="ProjectLeader" />
<xs:enumeration value="ProjectManager" />
<xs:enumeration value="ProjectMember" />
<xs:enumeration value="RegistrationAgency" />
<xs:enumeration value="RegistrationAuthority" />
<xs:enumeration value="RelatedPerson" />
<xs:enumeration value="ResearchGroup" />
<xs:enumeration value="RightsHolder" />
<xs:enumeration value="Researcher" />
<xs:enumeration value="Sponsor" />
<xs:enumeration value="Supervisor" />
<xs:enumeration value="Translator" />
<xs:enumeration value="WorkPackageLeader" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
27 changes: 27 additions & 0 deletions resources/kernel-4.7/include/datacite-dateType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0 - Created 2011-01-13 - FZ, TIB, Germany
2013-05 v3.0: Addition of ID to simpleType element; addition of value "Collected"; deleted "StartDate" & "EndDate"
2017-10-23 v4.1: Addition of value "Other"
2019-02-14 v4.2: Addition of value "Withdrawn"
2024-12-05 v4.6: Addition of value "Coverage"-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="dateType" id="dateType">
<xs:annotation>
<xs:documentation>The type of date. Use RKMS‐ISO8601 standard for depicting date ranges.To indicate the end of an embargo period, use Available. To indicate the start of an embargo period, use Submitted or Accepted, as appropriate.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="Accepted" />
<xs:enumeration value="Available" />
<xs:enumeration value="Collected" />
<xs:enumeration value="Copyrighted" />
<xs:enumeration value="Coverage" />
<xs:enumeration value="Created" />
<xs:enumeration value="Issued" />
<xs:enumeration value="Other" />
<xs:enumeration value="Submitted" />
<xs:enumeration value="Updated" />
<xs:enumeration value="Valid" />
<xs:enumeration value="Withdrawn" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
19 changes: 19 additions & 0 deletions resources/kernel-4.7/include/datacite-descriptionType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0 - Created 2011-01-13 - FZ, TIB, Germany
2013-05 v3.0: Addition of ID to simpleType element, addition of value "Methods"
2015-02-12 v4.0: Addition of value "TechnicalInfo"-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="descriptionType" id="descriptionType">
<xs:annotation>
<xs:documentation>The type of the description.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="Abstract" />
<xs:enumeration value="Methods" />
<xs:enumeration value="SeriesInformation" />
<xs:enumeration value="TableOfContents" />
<xs:enumeration value="TechnicalInfo" />
<xs:enumeration value="Other" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
16 changes: 16 additions & 0 deletions resources/kernel-4.7/include/datacite-funderIdentifierType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0 - Created 2016-05-14 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="funderIdentifierType" id="funderIdentifierType">
<xs:annotation>
<xs:documentation>The type of the funderIdentifier.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="ISNI" />
<xs:enumeration value="GRID" />
<xs:enumeration value="ROR" />
<xs:enumeration value="Crossref Funder ID" />
<xs:enumeration value="Other" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
10 changes: 10 additions & 0 deletions resources/kernel-4.7/include/datacite-nameType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 4.1 - Created 2017-10-23 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="nameType" id="nameType">
<xs:restriction base="xs:string">
<xs:enumeration value="Organizational" />
<xs:enumeration value="Personal" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
12 changes: 12 additions & 0 deletions resources/kernel-4.7/include/datacite-numberType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 4.4 - Created 2021-03-05 -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="numberType" id="numberType">
<xs:restriction base="xs:string">
<xs:enumeration value="Article" />
<xs:enumeration value="Chapter" />
<xs:enumeration value="Report" />
<xs:enumeration value="Other" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
39 changes: 39 additions & 0 deletions resources/kernel-4.7/include/datacite-relatedIdentifierType-v4.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Version 1.0 - Created 2011-01-13 - FZ, TIB, Germany
2013-05 v3.0: Addition of ID to simpleType element; addition of value "PMID"
2014-08-20 v3.1: Addition of values "arxiv" and "bibcode"
2015-02-12 v4.0: Addition of value "IGSN"
2019-02-14 v4.2: Addition of value "w3id"
2024-12-05 v4.5: Addition of values "CSTR", "RRID" -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified">
<xs:simpleType name="relatedIdentifierType" id="relatedIdentifierType">
<xs:annotation>
<xs:documentation>The type of the RelatedIdentifier.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="ARK" />
<xs:enumeration value="arXiv" />
<xs:enumeration value="bibcode" />
<xs:enumeration value="CSTR" />
<xs:enumeration value="DOI" />
<xs:enumeration value="EAN13" />
<xs:enumeration value="EISSN" />
<xs:enumeration value="Handle" />
<xs:enumeration value="IGSN" />
<xs:enumeration value="ISBN" />
<xs:enumeration value="ISSN" />
<xs:enumeration value="ISTC" />
<xs:enumeration value="LISSN" />
<xs:enumeration value="LSID" />
<xs:enumeration value="PMID" />
<xs:enumeration value="PURL" />
<xs:enumeration value="RAiD" />
<xs:enumeration value="RRID" />
<xs:enumeration value="SWHID" />
<xs:enumeration value="UPC" />
<xs:enumeration value="URL" />
<xs:enumeration value="URN" />
<xs:enumeration value="w3id" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
Loading