bolognese 1.0.12 → 1.0.13
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/readers/datacite_reader.rb +23 -9
- data/lib/bolognese/utils.rb +5 -1
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/datacite-multiple-rights.xml +59 -0
- data/spec/fixtures/datacite_schema_3.xml +58 -0
- data/spec/readers/datacite_reader_spec.rb +34 -2
- data/spec/utils_spec.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1bc5619b1c9dc7435a062e1e9e143c190594087d80e7cb7dac27df816804cd88
|
|
4
|
+
data.tar.gz: 0bc05be427ae2be8b3e9adcebd2eb25d2660409425da9d15c98c319f936fa3a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9115ce5569d2d3a3e2a9b189fa0e2901bb72837704ff8174b742ed05cd4cbb8ad84a7a79e8f0e7635469f0aec480e750d823a80f8f0fe57750dc69de27db54cd
|
|
7
|
+
data.tar.gz: 9238067f30a00dba50cd61a22b4c64b9d3e04f155a2531a3edb2b58cda1d906741bf664f019e4029dbe9e221f881c21e2d0a8e9d6dcc1ceb8a1f59fff6c4abbc
|
data/Gemfile.lock
CHANGED
|
@@ -85,24 +85,38 @@ module Bolognese
|
|
|
85
85
|
}.compact
|
|
86
86
|
|
|
87
87
|
titles = Array.wrap(meta.dig("titles", "title")).map do |r|
|
|
88
|
-
if r.
|
|
88
|
+
if r.blank?
|
|
89
|
+
nil
|
|
90
|
+
elsif r.is_a?(String)
|
|
89
91
|
{ "title" => sanitize(r) }
|
|
90
92
|
else
|
|
91
93
|
{ "title" => sanitize(r["__content__"]), "titleType" => r["titleType"], "lang" => r["lang"] }.compact
|
|
92
94
|
end
|
|
93
|
-
end
|
|
95
|
+
end.compact
|
|
94
96
|
|
|
95
97
|
alternate_identifiers = Array.wrap(meta.dig("alternateIdentifiers", "alternateIdentifier")).map do |r|
|
|
96
98
|
{ "alternateIdentifierType" => r["alternateIdentifierType"], "alternateIdentifier" => r["__content__"].presence }.compact
|
|
97
99
|
end.compact
|
|
98
|
-
descriptions = Array.wrap(meta.dig("descriptions", "description")).
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
descriptions = Array.wrap(meta.dig("descriptions", "description")).map do |r|
|
|
101
|
+
if r.blank?
|
|
102
|
+
nil
|
|
103
|
+
elsif r.is_a?(String)
|
|
104
|
+
{ "description" => sanitize(r), "descriptionType" => "Abstract" }
|
|
105
|
+
elsif r.is_a?(Hash)
|
|
106
|
+
{ "description" => sanitize(r["__content__"]), "descriptionType" => r["descriptionType"], "lang" => r["lang"] }.compact
|
|
107
|
+
end
|
|
108
|
+
end.compact
|
|
101
109
|
rights_list = Array.wrap(meta.dig("rightsList", "rights")).map do |r|
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
if r.blank?
|
|
111
|
+
nil
|
|
112
|
+
elsif r.is_a?(String)
|
|
113
|
+
{ "rights" => r }
|
|
114
|
+
elsif r.is_a?(Hash)
|
|
115
|
+
{ "rights" => r["__content__"], "rightsUri" => normalize_url(r["rightsURI"]), "lang" => r["lang"] }.compact
|
|
116
|
+
end
|
|
117
|
+
end.compact
|
|
104
118
|
subjects = Array.wrap(meta.dig("subjects", "subject")).map do |k|
|
|
105
|
-
if k.
|
|
119
|
+
if k.blank?
|
|
106
120
|
nil
|
|
107
121
|
elsif k.is_a?(String)
|
|
108
122
|
{ "subject" => sanitize(k) }
|
|
@@ -116,7 +130,7 @@ module Bolognese
|
|
|
116
130
|
"dateType" => parse_attributes(d, content: "dateType"),
|
|
117
131
|
"dateInformation" => parse_attributes(d, content: "dateInformation")
|
|
118
132
|
}.compact
|
|
119
|
-
end
|
|
133
|
+
end.compact
|
|
120
134
|
dates << { "date" => meta.fetch("publicationYear", nil), "dateType" => "Issued" } if meta.fetch("publicationYear", nil).present? && get_date(dates, "Issued").blank?
|
|
121
135
|
sizes = Array.wrap(meta.dig("sizes", "size"))
|
|
122
136
|
formats = Array.wrap(meta.dig("formats", "format"))
|
data/lib/bolognese/utils.rb
CHANGED
|
@@ -455,9 +455,13 @@ module Bolognese
|
|
|
455
455
|
def normalize_url(id)
|
|
456
456
|
return nil unless id.present?
|
|
457
457
|
|
|
458
|
+
# handle info URIs
|
|
459
|
+
return id if id.to_s.start_with?("info")
|
|
460
|
+
|
|
458
461
|
# check for valid HTTP uri
|
|
459
462
|
uri = Addressable::URI.parse(id)
|
|
460
|
-
|
|
463
|
+
|
|
464
|
+
return nil unless uri && uri.host && %w(http https ftp).include?(uri.scheme)
|
|
461
465
|
|
|
462
466
|
# clean up URL
|
|
463
467
|
PostRank::URI.clean(id)
|
data/lib/bolognese/version.rb
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<resource xmlns="http://datacite.org/schema/kernel-3" xmlns:dim="http://www.dspace.org/xmlns/dspace/dim" xmlns:dryad="http://purl.org/dryad/terms/" xmlns:dspace="http://www.dspace.org/xmlns/dspace/dim" xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
|
|
3
|
+
<identifier identifierType="DOI">10.5061/DRYAD.8515</identifier>
|
|
4
|
+
<version>1</version>
|
|
5
|
+
<creators>
|
|
6
|
+
<creator>
|
|
7
|
+
<creatorName>Ollomo, Benjamin</creatorName>
|
|
8
|
+
</creator>
|
|
9
|
+
<creator>
|
|
10
|
+
<creatorName>Durand, Patrick</creatorName>
|
|
11
|
+
</creator>
|
|
12
|
+
<creator>
|
|
13
|
+
<creatorName>Prugnolle, Franck</creatorName>
|
|
14
|
+
</creator>
|
|
15
|
+
<creator>
|
|
16
|
+
<creatorName>Douzery, Emmanuel J. P.</creatorName>
|
|
17
|
+
</creator>
|
|
18
|
+
<creator>
|
|
19
|
+
<creatorName>Arnathau, Céline</creatorName>
|
|
20
|
+
</creator>
|
|
21
|
+
<creator>
|
|
22
|
+
<creatorName>Nkoghe, Dieudonné</creatorName>
|
|
23
|
+
</creator>
|
|
24
|
+
<creator>
|
|
25
|
+
<creatorName>Leroy, Eric</creatorName>
|
|
26
|
+
</creator>
|
|
27
|
+
<creator>
|
|
28
|
+
<creatorName>Renaud, François</creatorName>
|
|
29
|
+
</creator>
|
|
30
|
+
</creators>
|
|
31
|
+
<titles>
|
|
32
|
+
<title>Data from: A new malaria agent in African hominids.</title>
|
|
33
|
+
</titles>
|
|
34
|
+
<publisher>Dryad Digital Repository</publisher>
|
|
35
|
+
<publicationYear>2011</publicationYear>
|
|
36
|
+
<subjects>
|
|
37
|
+
<subject>Phylogeny</subject>
|
|
38
|
+
<subject>Malaria</subject>
|
|
39
|
+
<subject>Parasites</subject>
|
|
40
|
+
<subject>Taxonomy</subject>
|
|
41
|
+
<subject>Mitochondrial genome</subject>
|
|
42
|
+
<subject>Africa</subject>
|
|
43
|
+
<subject>Plasmodium</subject>
|
|
44
|
+
</subjects>
|
|
45
|
+
<resourceType resourceTypeGeneral="Dataset">DataPackage</resourceType>
|
|
46
|
+
<alternateIdentifiers>
|
|
47
|
+
<alternateIdentifier alternateIdentifierType="citation">Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.</alternateIdentifier>
|
|
48
|
+
</alternateIdentifiers>
|
|
49
|
+
<relatedIdentifiers>
|
|
50
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="HasPart">10.5061/DRYAD.8515/1</relatedIdentifier>
|
|
51
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="HasPart">10.5061/DRYAD.8515/2</relatedIdentifier>
|
|
52
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsReferencedBy">10.1371/JOURNAL.PPAT.1000446</relatedIdentifier>
|
|
53
|
+
<relatedIdentifier relatedIdentifierType="PMID" relationType="IsReferencedBy">19478877</relatedIdentifier>
|
|
54
|
+
</relatedIdentifiers>
|
|
55
|
+
<rightsList>
|
|
56
|
+
<rights>info:eu-repo/semantics/openAccess</rights>
|
|
57
|
+
<rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights>
|
|
58
|
+
</rightsList>
|
|
59
|
+
</resource>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<resource xmlns="http://datacite.org/schema/kernel-3" xmlns:dim="http://www.dspace.org/xmlns/dspace/dim" xmlns:dryad="http://purl.org/dryad/terms/" xmlns:dspace="http://www.dspace.org/xmlns/dspace/dim" xmlns:mets="http://www.loc.gov/METS/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
|
|
3
|
+
<identifier identifierType="DOI">10.5061/DRYAD.8515</identifier>
|
|
4
|
+
<version>1</version>
|
|
5
|
+
<creators>
|
|
6
|
+
<creator>
|
|
7
|
+
<creatorName>Ollomo, Benjamin</creatorName>
|
|
8
|
+
</creator>
|
|
9
|
+
<creator>
|
|
10
|
+
<creatorName>Durand, Patrick</creatorName>
|
|
11
|
+
</creator>
|
|
12
|
+
<creator>
|
|
13
|
+
<creatorName>Prugnolle, Franck</creatorName>
|
|
14
|
+
</creator>
|
|
15
|
+
<creator>
|
|
16
|
+
<creatorName>Douzery, Emmanuel J. P.</creatorName>
|
|
17
|
+
</creator>
|
|
18
|
+
<creator>
|
|
19
|
+
<creatorName>Arnathau, Céline</creatorName>
|
|
20
|
+
</creator>
|
|
21
|
+
<creator>
|
|
22
|
+
<creatorName>Nkoghe, Dieudonné</creatorName>
|
|
23
|
+
</creator>
|
|
24
|
+
<creator>
|
|
25
|
+
<creatorName>Leroy, Eric</creatorName>
|
|
26
|
+
</creator>
|
|
27
|
+
<creator>
|
|
28
|
+
<creatorName>Renaud, François</creatorName>
|
|
29
|
+
</creator>
|
|
30
|
+
</creators>
|
|
31
|
+
<titles>
|
|
32
|
+
<title>Data from: A new malaria agent in African hominids.</title>
|
|
33
|
+
</titles>
|
|
34
|
+
<publisher>Dryad Digital Repository</publisher>
|
|
35
|
+
<publicationYear>2011</publicationYear>
|
|
36
|
+
<subjects>
|
|
37
|
+
<subject>Phylogeny</subject>
|
|
38
|
+
<subject>Malaria</subject>
|
|
39
|
+
<subject>Parasites</subject>
|
|
40
|
+
<subject>Taxonomy</subject>
|
|
41
|
+
<subject>Mitochondrial genome</subject>
|
|
42
|
+
<subject>Africa</subject>
|
|
43
|
+
<subject>Plasmodium</subject>
|
|
44
|
+
</subjects>
|
|
45
|
+
<resourceType resourceTypeGeneral="Dataset">DataPackage</resourceType>
|
|
46
|
+
<alternateIdentifiers>
|
|
47
|
+
<alternateIdentifier alternateIdentifierType="citation">Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.</alternateIdentifier>
|
|
48
|
+
</alternateIdentifiers>
|
|
49
|
+
<relatedIdentifiers>
|
|
50
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="HasPart">10.5061/DRYAD.8515/1</relatedIdentifier>
|
|
51
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="HasPart">10.5061/DRYAD.8515/2</relatedIdentifier>
|
|
52
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsReferencedBy">10.1371/JOURNAL.PPAT.1000446</relatedIdentifier>
|
|
53
|
+
<relatedIdentifier relatedIdentifierType="PMID" relationType="IsReferencedBy">19478877</relatedIdentifier>
|
|
54
|
+
</relatedIdentifiers>
|
|
55
|
+
<rightsList>
|
|
56
|
+
<rights rightsURI="http://creativecommons.org/publicdomain/zero/1.0/" />
|
|
57
|
+
</rightsList>
|
|
58
|
+
</resource>
|
|
@@ -111,7 +111,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
111
111
|
expect(subject.creator).to eq([{"type"=>"Person", "name"=>"Kristian Garza", "givenName"=>"Kristian", "familyName"=>"Garza"}])
|
|
112
112
|
expect(subject.titles).to eq([{"title"=>"Analysis Tools For Crossover Experiment Of Ui Using Choice Architecture"}])
|
|
113
113
|
expect(subject.descriptions.first["description"]).to start_with("This tools are used to analyse the data produced by the Crosssover Experiment")
|
|
114
|
-
expect(subject.rights_list).to eq([{"rightsUri"=>"https://creativecommons.org/licenses/by-nc-sa/4.0",
|
|
114
|
+
expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution-NonCommercial-ShareAlike", "rightsUri"=>"https://creativecommons.org/licenses/by-nc-sa/4.0"},{"rights"=>"Open Access", "rightsUri"=>"info:eu-repo/semantics/openAccess"}])
|
|
115
115
|
expect(subject.dates).to eq([{"date"=>"2016-03-27", "dateType"=>"Issued"}])
|
|
116
116
|
expect(subject.publication_year).to eq("2016")
|
|
117
117
|
expect(subject.related_identifiers.length).to eq(1)
|
|
@@ -418,6 +418,31 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
418
418
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4.0")
|
|
419
419
|
end
|
|
420
420
|
|
|
421
|
+
it "Schema 3 from string" do
|
|
422
|
+
input = fixture_path + "datacite_schema_3.xml"
|
|
423
|
+
subject = Bolognese::Metadata.new(input: input)
|
|
424
|
+
expect(subject.valid?).to be true
|
|
425
|
+
expect(subject.identifier).to eq("https://doi.org/10.5061/dryad.8515")
|
|
426
|
+
expect(subject.types["schemaOrg"]).to eq("Dataset")
|
|
427
|
+
expect(subject.types["resourceType"]).to eq("DataPackage")
|
|
428
|
+
expect(subject.types["resourceTypeGeneral"]).to eq("Dataset")
|
|
429
|
+
expect(subject.types["ris"]).to eq("DATA")
|
|
430
|
+
expect(subject.types["citeproc"]).to eq("dataset")
|
|
431
|
+
expect(subject.creator.length).to eq(8)
|
|
432
|
+
expect(subject.creator.last).to eq("familyName"=>"Renaud", "givenName"=>"François", "name"=>"François Renaud", "type"=>"Person")
|
|
433
|
+
expect(subject.titles).to eq([{"title"=>"Data from: A new malaria agent in African hominids."}])
|
|
434
|
+
expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>
|
|
435
|
+
"Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.",
|
|
436
|
+
"alternateIdentifierType"=>"citation"}])
|
|
437
|
+
expect(subject.publication_year).to eq("2011")
|
|
438
|
+
expect(subject.related_identifiers.length).to eq(4)
|
|
439
|
+
expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"19478877", "relatedIdentifierType"=>"PMID", "relationType"=>"IsReferencedBy")
|
|
440
|
+
expect(subject.rights_list).to eq([{"rightsUri"=>"http://creativecommons.org/publicdomain/zero/1.0"}])
|
|
441
|
+
expect(subject.publisher).to eq("Dryad Digital Repository")
|
|
442
|
+
expect(subject.source).to eq("DataCite")
|
|
443
|
+
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
|
|
444
|
+
end
|
|
445
|
+
|
|
421
446
|
it "Schema 3.0 from string" do
|
|
422
447
|
input = fixture_path + "datacite-example-complicated-v3.0.xml"
|
|
423
448
|
subject = Bolognese::Metadata.new(input: input)
|
|
@@ -550,7 +575,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
550
575
|
expect(subject.dates).to eq([{"date"=>"2008-11-01", "dateType"=>"Valid"}, {"date"=>"2008", "dateType"=>"Issued"}])
|
|
551
576
|
expect(subject.publication_year).to eq("2008")
|
|
552
577
|
expect(subject.periodical).to eq("title"=>"23rd European Photovoltaic Solar Energy Conference and Exhibition, 1-5 September 2008, Valencia, Spain; 3353-3356", "type"=>"Periodical")
|
|
553
|
-
expect(subject.descriptions
|
|
578
|
+
expect(subject.descriptions[1]["description"]).to start_with("Aim of this paper is the presentation")
|
|
554
579
|
expect(subject.publisher).to eq("WIP-Munich")
|
|
555
580
|
expect(subject.source).to eq("DataCite")
|
|
556
581
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.2")
|
|
@@ -660,6 +685,13 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
660
685
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3")
|
|
661
686
|
end
|
|
662
687
|
|
|
688
|
+
it "multiple rights" do
|
|
689
|
+
input = fixture_path + "datacite-multiple-rights.xml"
|
|
690
|
+
subject = Bolognese::Metadata.new(input: input)
|
|
691
|
+
expect(subject.valid?).to be true
|
|
692
|
+
expect(subject.rights_list).to eq([{"rights"=>"info:eu-repo/semantics/openAccess"}, {"rights"=>"Open Access", "rightsUri"=>"info:eu-repo/semantics/openAccess"}])
|
|
693
|
+
end
|
|
694
|
+
|
|
663
695
|
it "missing creator" do
|
|
664
696
|
input = fixture_path + "datacite_missing_creator.xml"
|
|
665
697
|
subject = Bolognese::Metadata.new(input: input, regenerate: true)
|
data/spec/utils_spec.rb
CHANGED
|
@@ -215,7 +215,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
|
215
215
|
it "uri" do
|
|
216
216
|
url = "info:eu-repo/semantics/openAccess"
|
|
217
217
|
response = subject.normalize_url(url)
|
|
218
|
-
expect(response).to
|
|
218
|
+
expect(response).to eq("info:eu-repo/semantics/openAccess")
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
|
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: 1.0.
|
|
4
|
+
version: 1.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-11-
|
|
11
|
+
date: 2018-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: maremma
|
|
@@ -674,12 +674,14 @@ files:
|
|
|
674
674
|
- spec/fixtures/datacite-geolocation-empty.xml
|
|
675
675
|
- spec/fixtures/datacite-metadata-sample-complicated-v2.2.xml
|
|
676
676
|
- spec/fixtures/datacite-multiple-language.xml
|
|
677
|
+
- spec/fixtures/datacite-multiple-rights.xml
|
|
677
678
|
- spec/fixtures/datacite-xml-lang.xml
|
|
678
679
|
- spec/fixtures/datacite.json
|
|
679
680
|
- spec/fixtures/datacite.xml
|
|
680
681
|
- spec/fixtures/datacite_dataset.xml
|
|
681
682
|
- spec/fixtures/datacite_malformed_creator.xml
|
|
682
683
|
- spec/fixtures/datacite_missing_creator.xml
|
|
684
|
+
- spec/fixtures/datacite_schema_3.xml
|
|
683
685
|
- spec/fixtures/datacite_software.json
|
|
684
686
|
- spec/fixtures/datacite_software_missing_comma.json
|
|
685
687
|
- spec/fixtures/datacite_software_overlapping_keys.json
|