bolognese 1.0.20 → 1.0.21
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/readers/bibtex_reader.rb +1 -1
- data/lib/bolognese/readers/datacite_reader.rb +6 -2
- data/lib/bolognese/version.rb +1 -1
- data/spec/readers/bibtex_reader_spec.rb +2 -2
- data/spec/writers/crosscite_writer_spec.rb +1 -1
- data/spec/writers/datacite_json_writer_spec.rb +1 -1
- data/spec/writers/datacite_writer_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f0e15fffb108ad3df33fbc6e975cbefe42a2c60baf7f2d5514607dcb2547951
|
4
|
+
data.tar.gz: c936de8f51aa9d5c0070f284fbada6fe713da4f2e827021a0b663c22f7742688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f0c1a6adaacdfb4fb2155dea5215f351633efced879408f07f4bb9cb2cb28edc4c9dad890817547cab7ae2d375d713477fd8765f05d32d877d6d9a6001cb83b
|
7
|
+
data.tar.gz: 002b0ba55541605373b07591d717359688a032b087a76fc7f5e6c31ba2f9bc7ab49f3a633d4f87ea1315d65764bcf4835993d802ec75e45b0c8d8804f74a90b4
|
data/Gemfile.lock
CHANGED
@@ -100,7 +100,7 @@ module Bolognese
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def insert_resource_type(xml)
|
103
|
-
return xml unless types["schemaOrg"].present?
|
103
|
+
return xml unless types.is_a?(Hash) && (types["schemaOrg"].present? || types["resourceTypeGeneral"])
|
104
104
|
|
105
105
|
xml.resourceType(types["resourceType"] || types["schemaOrg"],
|
106
106
|
'resourceTypeGeneral' => types["resourceTypeGeneral"] || Metadata::SO_TO_DC_TRANSLATIONS[types["schemaOrg"]] || "Other")
|
@@ -34,7 +34,7 @@ module Bolognese
|
|
34
34
|
schema_org = BIB_TO_SO_TRANSLATIONS[meta.try(:type).to_s] || "ScholarlyArticle"
|
35
35
|
types = {
|
36
36
|
"resourceTypeGeneral" => Metadata::SO_TO_DC_TRANSLATIONS[schema_org],
|
37
|
-
"
|
37
|
+
"resourceType" => Bolognese::Utils::BIB_TO_CR_TRANSLATIONS[meta.try(:type).to_s] || meta.try(:type).to_s,
|
38
38
|
"schemaOrg" => schema_org,
|
39
39
|
"bibtex" => meta.type.to_s,
|
40
40
|
"citeproc" => BIB_TO_CP_TRANSLATIONS[meta.try(:type).to_s] || "misc",
|
@@ -52,8 +52,12 @@ module Bolognese
|
|
52
52
|
read_options = ActiveSupport::HashWithIndifferentAccess.new(options.except(:string, :sandbox))
|
53
53
|
|
54
54
|
doc = Nokogiri::XML(string, nil, 'UTF-8', &:noblanks)
|
55
|
-
|
56
|
-
|
55
|
+
if read_options.present?
|
56
|
+
schema_version = "http://datacite.org/schema/kernel-4"
|
57
|
+
else
|
58
|
+
ns = doc.collect_namespaces.find { |k, v| v.start_with?("http://datacite.org/schema/kernel") }
|
59
|
+
schema_version = Array.wrap(ns).last || "http://datacite.org/schema/kernel-4"
|
60
|
+
end
|
57
61
|
doc.remove_namespaces!
|
58
62
|
string = doc.to_xml(:indent => 2)
|
59
63
|
|
data/lib/bolognese/version.rb
CHANGED
@@ -29,7 +29,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
29
29
|
it "Crossref DOI" do
|
30
30
|
expect(subject.valid?).to be true
|
31
31
|
expect(subject.identifier).to eq("https://doi.org/10.7554/elife.01567")
|
32
|
-
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "
|
32
|
+
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "resourceType"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
33
33
|
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
|
34
34
|
expect(subject.creator.length).to eq(5)
|
35
35
|
expect(subject.creator.first).to eq("type"=>"Person", "name"=>"Martial Sankar", "givenName"=>"Martial", "familyName"=>"Sankar")
|
@@ -48,7 +48,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
48
48
|
expect(subject.valid?).to be false
|
49
49
|
expect(subject.state).to eq("not_found")
|
50
50
|
expect(subject.identifier).to eq("https://doi.org/10.7554/elife.01567")
|
51
|
-
expect(subject.types).to eq("bibtex"=>"phdthesis", "citeproc"=>"thesis", "resourceTypeGeneral"=>"Text", "
|
51
|
+
expect(subject.types).to eq("bibtex"=>"phdthesis", "citeproc"=>"thesis", "resourceTypeGeneral"=>"Text", "resourceType"=>"Dissertation", "ris"=>"THES", "schemaOrg"=>"Thesis")
|
52
52
|
expect(subject.creator).to eq([{"type"=>"Person", "name"=>"Y. Toparlar", "givenName"=>"Y.", "familyName"=>"Toparlar"}])
|
53
53
|
expect(subject.titles).to eq([{"title"=>"A multiscale analysis of the urban heat island effect: from city averaged temperatures to the energy demand of individual buildings"}])
|
54
54
|
expect(subject.descriptions.first["description"]).to start_with("Designing the climates of cities")
|
@@ -37,7 +37,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
37
37
|
input = fixture_path + "crossref.bib"
|
38
38
|
subject = Bolognese::Metadata.new(input: input, from: "bibtex")
|
39
39
|
crosscite = JSON.parse(subject.crosscite)
|
40
|
-
expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "
|
40
|
+
expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "resourceType"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
41
41
|
expect(crosscite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
|
42
42
|
expect(crosscite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
43
43
|
expect(crosscite.fetch("creator").count).to eq(5)
|
@@ -30,7 +30,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
30
30
|
input = fixture_path + "crossref.bib"
|
31
31
|
subject = Bolognese::Metadata.new(input: input, from: "bibtex")
|
32
32
|
datacite = JSON.parse(subject.datacite_json)
|
33
|
-
expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "
|
33
|
+
expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle")
|
34
34
|
expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}])
|
35
35
|
expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
|
36
36
|
expect(datacite.fetch("creator").length).to eq(5)
|
@@ -287,7 +287,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
287
287
|
subject = Bolognese::Metadata.new(input: input, from: "crossref")
|
288
288
|
subject.doi = "123"
|
289
289
|
subject.titles = "Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"
|
290
|
-
subject.types = "Dataset"
|
290
|
+
subject.types = { "schemaOrg" => "Dataset", "resourceTypeGeneral" => "Dataset" }
|
291
291
|
expect(subject.doi).to eq("123")
|
292
292
|
expect(subject.valid?).to be false
|
293
293
|
expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'")
|