bolognese 0.10.19 → 0.10.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/author_utils.rb +8 -1
- data/lib/bolognese/version.rb +1 -1
- data/spec/author_utils_spec.rb +9 -1
- data/spec/fixtures/gtex.xml +67 -0
- data/spec/readers/datacite_reader_spec.rb +1 -1
- data/spec/writers/bibtex_writer_spec.rb +9 -0
- data/spec/writers/citeproc_writer_spec.rb +8 -0
- data/spec/writers/schema_org_writer_spec.rb +8 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31db4f5d8e8f78c81d0fda3744f2eb4340d281c5e2ddcdc3c261fe5a8481da63
|
4
|
+
data.tar.gz: f417e060447bc674b83e12e4bed8c0116d83d85a0618ec3d2ab9638933407b44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25610719fa9fe5a1b211335656879ad6e70379b167c5a9dd6ee5830bb57c18d59c3a1b58261809474edeb630b4c2a9967ca87e42ebde7495cb241fe8f7c53c9
|
7
|
+
data.tar.gz: 1e00542610634fca09fce0e78c0c8593c71b8b5b87c8930d303d5e1b8bf9643b9b01d5906c02d196a7a04cecc184ddeb363a498618a28f3a91c44e3a04bfaf1a
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,14 @@ module Bolognese
|
|
11
11
|
}
|
12
12
|
|
13
13
|
def get_one_author(author)
|
14
|
-
|
14
|
+
if author.fetch("type", nil).present?
|
15
|
+
type = author.fetch("type").titleize
|
16
|
+
elsif author.fetch("creatorName", nil).is_a?(Hash)
|
17
|
+
type = author.dig("creatorName", "nameType") == "Organizational" ? "Organization" : "Person"
|
18
|
+
else
|
19
|
+
type = nil
|
20
|
+
end
|
21
|
+
|
15
22
|
name_identifiers = get_name_identifiers(author)
|
16
23
|
id = author.fetch("id", nil).presence || name_identifiers.first
|
17
24
|
identifier = name_identifiers.length > 1 ? name_identifiers.unwrap : nil
|
data/lib/bolognese/version.rb
CHANGED
data/spec/author_utils_spec.rb
CHANGED
@@ -106,7 +106,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
106
106
|
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
107
107
|
meta = Maremma.from_xml(subject.raw).fetch("resource", {})
|
108
108
|
response = subject.get_one_author(meta.dig("creators", "creator"))
|
109
|
-
expect(response).to eq("type"=>"
|
109
|
+
expect(response).to eq("type"=>"Organization", "name"=>"Dr. Störi, Kunstsalon")
|
110
110
|
end
|
111
111
|
|
112
112
|
it "name with affiliation and country" do
|
@@ -133,6 +133,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
133
133
|
expect(response).to eq("type"=>"Person", "id"=>"https://orcid.org/0000-0003-4514-4211", "name"=>"Thomas Dubos", "givenName"=>"Thomas", "familyName"=>"Dubos", "identifier"=>["https://orcid.org/0000-0003-4514-4211", "http://isni.org/isni/0000-0003-5752-6882"])
|
134
134
|
end
|
135
135
|
|
136
|
+
it "nameType organizational" do
|
137
|
+
input = fixture_path + 'gtex.xml'
|
138
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
139
|
+
meta = Maremma.from_xml(subject.raw).fetch("resource", {})
|
140
|
+
response = subject.get_one_author(meta.dig("creators", "creator"))
|
141
|
+
expect(response).to eq("type"=>"Organization", "name"=>"The GTEx Consortium")
|
142
|
+
end
|
143
|
+
|
136
144
|
it "only familyName and givenName" do
|
137
145
|
input = "https://doi.pangaea.de/10.1594/PANGAEA.836178"
|
138
146
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
|
3
|
+
<resource xmlns="http://datacite.org/schema/kernel-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
4
|
+
<identifier identifierType="DOI">10.25491/9HX8-KE93</identifier>
|
5
|
+
<creators>
|
6
|
+
<creator>
|
7
|
+
<creatorName nameType="Organizational">The GTEx Consortium</creatorName>
|
8
|
+
</creator>
|
9
|
+
</creators>
|
10
|
+
<titles>
|
11
|
+
<title>DroNc-seq data</title>
|
12
|
+
</titles>
|
13
|
+
<publisher>GTEx</publisher>
|
14
|
+
<publicationYear>2017</publicationYear>
|
15
|
+
<subjects>
|
16
|
+
<subject>gtex</subject>
|
17
|
+
<subject>annotation</subject>
|
18
|
+
<subject>phenotype</subject>
|
19
|
+
<subject>gene regulation</subject>
|
20
|
+
<subject>transcriptomics</subject>
|
21
|
+
</subjects>
|
22
|
+
<fundingReferences>
|
23
|
+
<fundingReference>
|
24
|
+
<funderName>Common Fund of the Office of the Director of the NIH</funderName>
|
25
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000052</funderIdentifier>
|
26
|
+
</fundingReference>
|
27
|
+
<fundingReference>
|
28
|
+
<funderName>National Cancer Institute (NCI)</funderName>
|
29
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000054</funderIdentifier>
|
30
|
+
</fundingReference>
|
31
|
+
<fundingReference>
|
32
|
+
<funderName>National Human Genome Research Institute (NHGRI)</funderName>
|
33
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000051</funderIdentifier>
|
34
|
+
</fundingReference>
|
35
|
+
<fundingReference>
|
36
|
+
<funderName>National Heart, Lung, and Blood Institute (NHLBI)</funderName>
|
37
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000050</funderIdentifier>
|
38
|
+
</fundingReference>
|
39
|
+
<fundingReference>
|
40
|
+
<funderName>National Institute on Drug Abuse (NIDA)</funderName>
|
41
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000026</funderIdentifier>
|
42
|
+
</fundingReference>
|
43
|
+
<fundingReference>
|
44
|
+
<funderName>National Institute of Mental Health (NIMH)</funderName>
|
45
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000025</funderIdentifier>
|
46
|
+
</fundingReference>
|
47
|
+
<fundingReference>
|
48
|
+
<funderName>National Institute of Neurological Disorders and Stroke (NINDS)</funderName>
|
49
|
+
<funderIdentifier funderIdentifierType="Crossref Funder ID">http://doi.org/10.13039/100000065</funderIdentifier>
|
50
|
+
</fundingReference>
|
51
|
+
</fundingReferences>
|
52
|
+
<resourceType resourceTypeGeneral="Dataset">DroNc-seq data</resourceType>
|
53
|
+
<dates>
|
54
|
+
<date dateType="Issued">2017</date>
|
55
|
+
</dates>
|
56
|
+
<relatedIdentifiers>
|
57
|
+
<relatedIdentifier relationType="Documents" relatedIdentifierType="URL">http://identifiers.org/dbgap:phs000424.v7.p2</relatedIdentifier>
|
58
|
+
<relatedIdentifier relationType="IsDocumentedBy" relatedIdentifierType="DOI">https://doi.org/10.1038/nature24277</relatedIdentifier>
|
59
|
+
<relatedIdentifier relationType="IsSupplementTo" relatedIdentifierType="DOI">https://doi.org/10.1038/nmeth.4407</relatedIdentifier>
|
60
|
+
</relatedIdentifiers>
|
61
|
+
<sizes>
|
62
|
+
<size>15.7M</size>
|
63
|
+
</sizes>
|
64
|
+
<descriptions>
|
65
|
+
<description descriptionType="SeriesInformation">GTEx</description>
|
66
|
+
</descriptions>
|
67
|
+
</resource>
|
@@ -308,7 +308,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
308
308
|
expect(subject.identifier).to eq("https://doi.org/10.4232/1.2745")
|
309
309
|
expect(subject.type).to eq("Dataset")
|
310
310
|
expect(subject.resource_type_general).to eq("Dataset")
|
311
|
-
expect(subject.author).to eq("name"=>"Europäische Kommission")
|
311
|
+
expect(subject.author).to eq("type"=>"Organization", "name"=>"Europäische Kommission")
|
312
312
|
expect(subject.title).to eq([{"lang"=>"de", "text"=>"Flash Eurobarometer 54 (Madrid Summit)"}, {"lang"=>"en", "text"=>"Flash Eurobarometer 54 (Madrid Summit)"}, {"title_type"=>"Subtitle","lang"=>"de", "text"=>"The Common European Currency"}, {"title_type"=>"Subtitle", "lang"=>"en", "text"=>"The Common European Currency"}])
|
313
313
|
expect(subject.keywords).to eq([{"subject_scheme"=>"ZA", "text"=>"KAT12 International Institutions, Relations, Conditions"}])
|
314
314
|
expect(subject.date_published).to eq("1996")
|
@@ -135,5 +135,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
135
135
|
expect(bibtex[:keywords]).to eq("GetInfo, Animalia, Bottles or small containers/Aquaria ( 20 L), Calcification/Dissolution, Coast and continental shelf, Development, Growth/Morphology, Laboratory experiment, Mollusca, Pelagos, Single species, Temperate, Zooplankton, Experimental treatment, Carbonate system computation flag, Temperature, water, Salinity, pH, Alkalinity, total, Carbon, inorganic, dissolved, Carbon dioxide, Bicarbonate ion, Carbonate ion, Partial pressure of carbon dioxide (water) at sea surface temperature (wet air), Fugacity of carbon dioxide (water) at sea surface temperature (wet air), Aragonite saturation state, Calcite saturation state, Proportion, Crassostrea gigas, larvae length, Crassostrea gigas, larvae height, Crassostrea gigas, non mineralized, Crassostrea gigas, partially mineralized, Crassostrea gigas, fully mineralized, Calculated using seacarb after Nisumaa et al. (2010), Refractometer (Atago 100-S), pH meter (Mettler Toledo), pH meter (PHM290, Radiometer), Measured, European Project on Ocean Acidification (EPOCA), European network of excellence for Ocean Ecosystems Analysis (EUR-OCEANS), Ocean Acidification International Coordination Centre (OA-ICC)")
|
136
136
|
expect(bibtex[:year]).to eq("2007")
|
137
137
|
end
|
138
|
+
|
139
|
+
it "author is organization" do
|
140
|
+
input = fixture_path + 'gtex.xml'
|
141
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
142
|
+
bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
|
143
|
+
expect(bibtex[:bibtex_type].to_s).to eq("misc")
|
144
|
+
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.25491/9hx8-ke93")
|
145
|
+
expect(bibtex[:author]).to eq("{The GTEx Consortium}")
|
146
|
+
end
|
138
147
|
end
|
139
148
|
end
|
@@ -155,6 +155,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
155
155
|
expect(json["issued"]).to eq("date-parts" => [[2014]])
|
156
156
|
end
|
157
157
|
|
158
|
+
it "author is organization" do
|
159
|
+
input = fixture_path + 'gtex.xml'
|
160
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
161
|
+
json = JSON.parse(subject.citeproc)
|
162
|
+
expect(json["id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
|
163
|
+
expect(json["author"]).to eq([{"literal"=>"The GTEx Consortium"}])
|
164
|
+
end
|
165
|
+
|
158
166
|
it "maremma" do
|
159
167
|
input = "https://github.com/datacite/maremma"
|
160
168
|
subject = Bolognese::Metadata.new(input: input, from: "codemeta")
|
@@ -121,6 +121,14 @@ describe Bolognese::Metadata, vcr: true do
|
|
121
121
|
expect(json["keywords"]).to eq("GetInfo, Animalia, Bottles or small containers/Aquaria ( 20 L), Calcification/Dissolution, Coast and continental shelf, Development, Growth/Morphology, Laboratory experiment, Mollusca, Pelagos, Single species, Temperate, Zooplankton, Experimental treatment, Carbonate system computation flag, Temperature, water, Salinity, pH, Alkalinity, total, Carbon, inorganic, dissolved, Carbon dioxide, Bicarbonate ion, Carbonate ion, Partial pressure of carbon dioxide (water) at sea surface temperature (wet air), Fugacity of carbon dioxide (water) at sea surface temperature (wet air), Aragonite saturation state, Calcite saturation state, Proportion, Crassostrea gigas, larvae length, Crassostrea gigas, larvae height, Crassostrea gigas, non mineralized, Crassostrea gigas, partially mineralized, Crassostrea gigas, fully mineralized, Calculated using seacarb after Nisumaa et al. (2010), Refractometer (Atago 100-S), pH meter (Mettler Toledo), pH meter (PHM290, Radiometer), Measured, European Project on Ocean Acidification (EPOCA), European network of excellence for Ocean Ecosystems Analysis (EUR-OCEANS), Ocean Acidification International Coordination Centre (OA-ICC)")
|
122
122
|
end
|
123
123
|
|
124
|
+
it "author is organization" do
|
125
|
+
input = fixture_path + 'gtex.xml'
|
126
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
127
|
+
json = JSON.parse(subject.schema_org)
|
128
|
+
expect(json["@id"]).to eq("https://doi.org/10.25491/9hx8-ke93")
|
129
|
+
expect(json["author"]).to eq("@type"=>"Organization", "name"=>"The GTEx Consortium")
|
130
|
+
end
|
131
|
+
|
124
132
|
it "series information" do
|
125
133
|
input = "10.4229/23RDEUPVSEC2008-5CO.8.3"
|
126
134
|
subject = Bolognese::Metadata.new(input: input, from: "datacite")
|
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: 0.10.
|
4
|
+
version: 0.10.20
|
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-06-
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -559,6 +559,7 @@ files:
|
|
559
559
|
- spec/fixtures/datacite_software.json
|
560
560
|
- spec/fixtures/datacite_software_missing_comma.json
|
561
561
|
- spec/fixtures/datacite_software_overlapping_keys.json
|
562
|
+
- spec/fixtures/gtex.xml
|
562
563
|
- spec/fixtures/maremma/codemeta.json
|
563
564
|
- spec/fixtures/pure.bib
|
564
565
|
- spec/fixtures/pure.ris
|