briard 2.4.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +72 -0
- data/.github/workflows/rubocop.yml +50 -0
- data/.rubocop.yml +144 -620
- data/.rubocop_todo.yml +76 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +40 -6
- data/Rakefile +1 -1
- data/{bolognese.gemspec → briard.gemspec} +46 -39
- data/lib/briard/array.rb +2 -2
- data/lib/briard/author_utils.rb +79 -71
- data/lib/briard/cli.rb +12 -13
- data/lib/briard/crossref_utils.rb +73 -61
- data/lib/briard/datacite_utils.rb +132 -106
- data/lib/briard/doi_utils.rb +10 -10
- data/lib/briard/metadata.rb +96 -106
- data/lib/briard/metadata_utils.rb +87 -78
- data/lib/briard/readers/bibtex_reader.rb +65 -65
- data/lib/briard/readers/cff_reader.rb +88 -70
- data/lib/briard/readers/citeproc_reader.rb +90 -84
- data/lib/briard/readers/codemeta_reader.rb +68 -50
- data/lib/briard/readers/crosscite_reader.rb +2 -2
- data/lib/briard/readers/crossref_reader.rb +249 -210
- data/lib/briard/readers/datacite_json_reader.rb +3 -3
- data/lib/briard/readers/datacite_reader.rb +225 -189
- data/lib/briard/readers/npm_reader.rb +49 -42
- data/lib/briard/readers/ris_reader.rb +82 -80
- data/lib/briard/readers/schema_org_reader.rb +182 -159
- data/lib/briard/string.rb +1 -1
- data/lib/briard/utils.rb +4 -4
- data/lib/briard/version.rb +3 -1
- data/lib/briard/whitelist_scrubber.rb +11 -4
- data/lib/briard/writers/bibtex_writer.rb +14 -8
- data/lib/briard/writers/cff_writer.rb +33 -26
- data/lib/briard/writers/codemeta_writer.rb +19 -15
- data/lib/briard/writers/csv_writer.rb +6 -4
- data/lib/briard/writers/datacite_json_writer.rb +8 -2
- data/lib/briard/writers/jats_writer.rb +33 -28
- data/lib/briard/writers/rdf_xml_writer.rb +1 -1
- data/lib/briard/writers/ris_writer.rb +30 -18
- data/lib/briard/writers/turtle_writer.rb +1 -1
- data/lib/briard.rb +6 -6
- data/rubocop.sarif +0 -0
- data/spec/array_spec.rb +5 -5
- data/spec/author_utils_spec.rb +151 -132
- data/spec/datacite_utils_spec.rb +135 -83
- data/spec/doi_utils_spec.rb +168 -164
- data/spec/find_from_format_spec.rb +69 -69
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +65 -0
- data/spec/metadata_spec.rb +91 -90
- data/spec/readers/bibtex_reader_spec.rb +43 -38
- data/spec/readers/cff_reader_spec.rb +165 -153
- data/spec/readers/citeproc_reader_spec.rb +45 -40
- data/spec/readers/codemeta_reader_spec.rb +128 -115
- data/spec/readers/crosscite_reader_spec.rb +34 -24
- data/spec/readers/crossref_reader_spec.rb +1098 -939
- data/spec/readers/datacite_json_reader_spec.rb +53 -40
- data/spec/readers/datacite_reader_spec.rb +1541 -1337
- data/spec/readers/npm_reader_spec.rb +48 -43
- data/spec/readers/ris_reader_spec.rb +53 -47
- data/spec/readers/schema_org_reader_spec.rb +329 -267
- data/spec/spec_helper.rb +6 -5
- data/spec/utils_spec.rb +371 -347
- data/spec/writers/bibtex_writer_spec.rb +143 -143
- data/spec/writers/cff_writer_spec.rb +96 -90
- data/spec/writers/citation_writer_spec.rb +34 -33
- data/spec/writers/citeproc_writer_spec.rb +226 -224
- data/spec/writers/codemeta_writer_spec.rb +18 -16
- data/spec/writers/crosscite_writer_spec.rb +91 -73
- data/spec/writers/crossref_writer_spec.rb +99 -91
- data/spec/writers/csv_writer_spec.rb +70 -70
- data/spec/writers/datacite_json_writer_spec.rb +78 -68
- data/spec/writers/datacite_writer_spec.rb +417 -322
- data/spec/writers/jats_writer_spec.rb +177 -161
- data/spec/writers/rdf_xml_writer_spec.rb +68 -63
- data/spec/writers/ris_writer_spec.rb +162 -162
- data/spec/writers/turtle_writer_spec.rb +47 -47
- metadata +242 -166
- data/.github/workflows/release.yml +0 -47
@@ -3,205 +3,205 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Briard::Metadata, vcr: true do
|
6
|
-
context
|
7
|
-
it
|
8
|
-
input =
|
9
|
-
subject =
|
6
|
+
context 'write metadata as ris' do
|
7
|
+
it 'journal article' do
|
8
|
+
input = '10.7554/eLife.01567'
|
9
|
+
subject = described_class.new(input: input, from: 'crossref')
|
10
10
|
expect(subject.valid?).to be true
|
11
11
|
ris = subject.ris.split("\r\n")
|
12
|
-
expect(ris[0]).to eq(
|
13
|
-
expect(ris[1]).to eq(
|
14
|
-
expect(ris[2]).to eq(
|
15
|
-
expect(ris[3]).to eq(
|
16
|
-
expect(ris[8]).to eq(
|
17
|
-
expect(ris[9]).to eq(
|
18
|
-
expect(ris[10]).to
|
19
|
-
expect(ris[11]).to eq(
|
20
|
-
expect(ris[12]).to eq(
|
21
|
-
expect(ris[13]).to eq(
|
22
|
-
expect(ris[14]).to eq(
|
23
|
-
expect(ris[15]).to eq(
|
24
|
-
expect(ris[16]).to eq(
|
12
|
+
expect(ris[0]).to eq('TY - JOUR')
|
13
|
+
expect(ris[1]).to eq('T1 - Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth')
|
14
|
+
expect(ris[2]).to eq('T2 - eLife')
|
15
|
+
expect(ris[3]).to eq('AU - Sankar, Martial')
|
16
|
+
expect(ris[8]).to eq('DO - 10.7554/elife.01567')
|
17
|
+
expect(ris[9]).to eq('UR - https://elifesciences.org/articles/01567')
|
18
|
+
expect(ris[10]).to start_with('AB - Among various advantages')
|
19
|
+
expect(ris[11]).to eq('PY - 2014')
|
20
|
+
expect(ris[12]).to eq('PB - eLife Sciences Publications, Ltd')
|
21
|
+
expect(ris[13]).to eq('VL - 3')
|
22
|
+
expect(ris[14]).to eq('SP - e01567')
|
23
|
+
expect(ris[15]).to eq('SN - 2050-084X')
|
24
|
+
expect(ris[16]).to eq('ER - ')
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
28
|
-
input =
|
29
|
-
subject =
|
27
|
+
it 'with pages' do
|
28
|
+
input = 'https://doi.org/10.1155/2012/291294'
|
29
|
+
subject = described_class.new(input: input, from: 'crossref')
|
30
30
|
# expect(subject.valid?).to be true
|
31
31
|
ris = subject.ris.split("\r\n")
|
32
|
-
expect(ris[0]).to eq(
|
33
|
-
expect(ris[1]).to eq(
|
34
|
-
expect(ris[2]).to eq(
|
35
|
-
expect(ris[3]).to eq(
|
36
|
-
expect(ris[10]).to eq(
|
37
|
-
expect(ris[11]).to eq(
|
38
|
-
expect(ris[12]).to start_with(
|
39
|
-
expect(ris[13]).to eq(
|
40
|
-
expect(ris[14]).to eq(
|
41
|
-
expect(ris[15]).to eq(
|
42
|
-
expect(ris[16]).to eq(
|
43
|
-
expect(ris[17]).to eq(
|
44
|
-
expect(ris[18]).to eq(
|
45
|
-
expect(ris[19]).to eq(
|
32
|
+
expect(ris[0]).to eq('TY - JOUR')
|
33
|
+
expect(ris[1]).to eq('T1 - Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers')
|
34
|
+
expect(ris[2]).to eq('T2 - Pulmonary Medicine')
|
35
|
+
expect(ris[3]).to eq('AU - Thanassi, Wendy')
|
36
|
+
expect(ris[10]).to eq('DO - 10.1155/2012/291294')
|
37
|
+
expect(ris[11]).to eq('UR - http://www.hindawi.com/journals/pm/2012/291294/')
|
38
|
+
expect(ris[12]).to start_with('AB - . To find a statistically significant separation point for the QuantiFERON')
|
39
|
+
expect(ris[13]).to eq('PY - 2012')
|
40
|
+
expect(ris[14]).to eq('PB - Hindawi Limited')
|
41
|
+
expect(ris[15]).to eq('VL - 2012')
|
42
|
+
expect(ris[16]).to eq('SP - 1')
|
43
|
+
expect(ris[17]).to eq('EP - 7')
|
44
|
+
expect(ris[18]).to eq('SN - 2090-1844')
|
45
|
+
expect(ris[19]).to eq('ER - ')
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
49
|
-
input =
|
50
|
-
subject =
|
48
|
+
it 'alternate name' do
|
49
|
+
input = 'https://doi.org/10.3205/ZMA001102'
|
50
|
+
subject = described_class.new(input: input, from: 'datacite')
|
51
51
|
expect(subject.valid?).to be true
|
52
52
|
ris = subject.ris.split("\r\n")
|
53
|
-
expect(ris[0]).to eq(
|
54
|
-
expect(ris[1]).to eq(
|
55
|
-
expect(ris[2]).to eq(
|
56
|
-
expect(ris[3]).to eq(
|
57
|
-
expect(ris[9]).to eq(
|
58
|
-
expect(ris[10]).to eq(
|
59
|
-
expect(ris[11]).to start_with(
|
60
|
-
expect(ris[12]).to eq(
|
61
|
-
expect(ris[21]).to eq(
|
62
|
-
expect(ris[22]).to eq(
|
63
|
-
expect(ris[23]).to eq(
|
64
|
-
expect(ris[24]).to eq(
|
65
|
-
expect(ris[25]).to eq(
|
53
|
+
expect(ris[0]).to eq('TY - RPRT')
|
54
|
+
expect(ris[1]).to eq('T1 - Visions and reality: the idea of competence-oriented assessment for German medical students is not yet realised in licensing examinations')
|
55
|
+
expect(ris[2]).to eq('T2 - GMS Journal for Medical Education; 34(2):Doc25')
|
56
|
+
expect(ris[3]).to eq('AU - Huber-Lang, Markus')
|
57
|
+
expect(ris[9]).to eq('DO - 10.3205/zma001102')
|
58
|
+
expect(ris[10]).to eq('UR - http://www.egms.de/en/journals/zma/2017-34/zma001102.shtml')
|
59
|
+
expect(ris[11]).to start_with('AB - Objective: Competence orientation')
|
60
|
+
expect(ris[12]).to eq('KW - medical competence')
|
61
|
+
expect(ris[21]).to eq('PY - 2017')
|
62
|
+
expect(ris[22]).to eq('PB - German Medical Science GMS Publishing House')
|
63
|
+
expect(ris[23]).to eq('LA - en')
|
64
|
+
expect(ris[24]).to eq('SN - 2366-5017')
|
65
|
+
expect(ris[25]).to eq('ER - ')
|
66
66
|
end
|
67
67
|
|
68
|
-
it
|
69
|
-
input = fixture_path
|
70
|
-
subject =
|
68
|
+
it 'Crossref DOI' do
|
69
|
+
input = "#{fixture_path}crossref.bib"
|
70
|
+
subject = described_class.new(input: input, from: 'bibtex')
|
71
71
|
|
72
72
|
ris = subject.ris.split("\r\n")
|
73
|
-
expect(ris[0]).to eq(
|
74
|
-
expect(ris[1]).to eq(
|
75
|
-
expect(ris[2]).to eq(
|
76
|
-
expect(ris[3]).to eq(
|
77
|
-
expect(ris[8]).to eq(
|
78
|
-
expect(ris[9]).to eq(
|
79
|
-
expect(ris[10]).to eq(
|
80
|
-
expect(ris[11]).to eq(
|
81
|
-
expect(ris[12]).to eq(
|
82
|
-
expect(ris[13]).to eq(
|
83
|
-
expect(ris[14]).to eq(
|
84
|
-
expect(ris[15]).to eq(
|
73
|
+
expect(ris[0]).to eq('TY - JOUR')
|
74
|
+
expect(ris[1]).to eq('T1 - Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth')
|
75
|
+
expect(ris[2]).to eq('T2 - eLife')
|
76
|
+
expect(ris[3]).to eq('AU - Sankar, Martial')
|
77
|
+
expect(ris[8]).to eq('DO - 10.7554/elife.01567')
|
78
|
+
expect(ris[9]).to eq('UR - http://elifesciences.org/lookup/doi/10.7554/eLife.01567')
|
79
|
+
expect(ris[10]).to eq('AB - Among various advantages, their small size makes model organisms preferred subjects of investigation. Yet, even in model systems detailed analysis of numerous developmental processes at cellular level is severely hampered by their scale.')
|
80
|
+
expect(ris[11]).to eq('PY - 2014')
|
81
|
+
expect(ris[12]).to eq('PB - {eLife} Sciences Organisation, Ltd.')
|
82
|
+
expect(ris[13]).to eq('VL - 3')
|
83
|
+
expect(ris[14]).to eq('SN - 2050-084X')
|
84
|
+
expect(ris[15]).to eq('ER - ')
|
85
85
|
end
|
86
86
|
|
87
|
-
it
|
88
|
-
input =
|
89
|
-
subject =
|
87
|
+
it 'BlogPosting' do
|
88
|
+
input = 'https://doi.org/10.5438/4K3M-NYVG'
|
89
|
+
subject = described_class.new(input: input, from: 'datacite')
|
90
90
|
expect(subject.valid?).to be true
|
91
91
|
ris = subject.ris.split("\r\n")
|
92
|
-
expect(ris[0]).to eq(
|
93
|
-
expect(ris[1]).to eq(
|
94
|
-
expect(ris[2]).to eq(
|
95
|
-
expect(ris[3]).to eq(
|
96
|
-
expect(ris[4]).to eq(
|
97
|
-
expect(ris[5]).to eq(
|
98
|
-
expect(ris[6]).to eq(
|
99
|
-
expect(ris[9]).to eq(
|
100
|
-
expect(ris[10]).to eq(
|
101
|
-
expect(ris[11]).to eq(
|
102
|
-
expect(ris[12]).to eq(
|
103
|
-
expect(ris[13]).to eq(
|
104
|
-
expect(ris[14]).to eq(
|
92
|
+
expect(ris[0]).to eq('TY - RPRT')
|
93
|
+
expect(ris[1]).to eq('T1 - Eating your own Dog Food')
|
94
|
+
expect(ris[2]).to eq('AU - Fenner, Martin')
|
95
|
+
expect(ris[3]).to eq('DO - 10.5438/4k3m-nyvg')
|
96
|
+
expect(ris[4]).to eq('UR - https://blog.datacite.org/eating-your-own-dog-food/')
|
97
|
+
expect(ris[5]).to eq('AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...')
|
98
|
+
expect(ris[6]).to eq('KW - datacite')
|
99
|
+
expect(ris[9]).to eq('KW - FOS: Computer and information sciences')
|
100
|
+
expect(ris[10]).to eq('PY - 2016')
|
101
|
+
expect(ris[11]).to eq('PB - DataCite')
|
102
|
+
expect(ris[12]).to eq('LA - en')
|
103
|
+
expect(ris[13]).to eq('SN - 10.5438/0000-00ss')
|
104
|
+
expect(ris[14]).to eq('ER - ')
|
105
105
|
end
|
106
106
|
|
107
|
-
it
|
108
|
-
input = fixture_path
|
109
|
-
subject =
|
107
|
+
it 'BlogPosting Citeproc JSON' do
|
108
|
+
input = "#{fixture_path}citeproc.json"
|
109
|
+
subject = described_class.new(input: input, from: 'citeproc')
|
110
110
|
ris = subject.ris.split("\r\n")
|
111
|
-
expect(ris[0]).to eq(
|
112
|
-
expect(ris[1]).to eq(
|
113
|
-
expect(ris[2]).to eq(
|
114
|
-
expect(ris[3]).to eq(
|
115
|
-
expect(ris[4]).to eq(
|
116
|
-
expect(ris[5]).to eq(
|
117
|
-
expect(ris[6]).to eq(
|
118
|
-
expect(ris[7]).to eq(
|
119
|
-
expect(ris[14]).to eq(
|
120
|
-
expect(ris[15]).to eq(
|
121
|
-
expect(ris[16]).to eq(
|
111
|
+
expect(ris[0]).to eq('TY - GEN')
|
112
|
+
expect(ris[1]).to eq('T1 - Eating your own Dog Food')
|
113
|
+
expect(ris[2]).to eq('T2 - DataCite Blog')
|
114
|
+
expect(ris[3]).to eq('AU - Fenner, Martin')
|
115
|
+
expect(ris[4]).to eq('DO - 10.5438/4k3m-nyvg')
|
116
|
+
expect(ris[5]).to eq('UR - https://blog.datacite.org/eating-your-own-dog-food')
|
117
|
+
expect(ris[6]).to eq('AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...')
|
118
|
+
expect(ris[7]).to eq('KW - phylogeny')
|
119
|
+
expect(ris[14]).to eq('PY - 2016')
|
120
|
+
expect(ris[15]).to eq('PB - DataCite')
|
121
|
+
expect(ris[16]).to eq('ER - ')
|
122
122
|
end
|
123
123
|
|
124
|
-
it
|
125
|
-
input = fixture_path
|
126
|
-
subject =
|
124
|
+
it 'BlogPosting DataCite JSON' do
|
125
|
+
input = "#{fixture_path}datacite.json"
|
126
|
+
subject = described_class.new(input: input, from: 'datacite_json')
|
127
127
|
ris = subject.ris.split("\r\n")
|
128
|
-
expect(ris[0]).to eq(
|
129
|
-
expect(ris[1]).to eq(
|
130
|
-
expect(ris[2]).to eq(
|
131
|
-
expect(ris[3]).to eq(
|
132
|
-
expect(ris[4]).to eq(
|
133
|
-
expect(ris[5]).to eq(
|
134
|
-
expect(ris[8]).to eq(
|
135
|
-
expect(ris[9]).to eq(
|
136
|
-
expect(ris[10]).to eq(
|
137
|
-
expect(ris[11]).to eq(
|
128
|
+
expect(ris[0]).to eq('TY - RPRT')
|
129
|
+
expect(ris[1]).to eq('T1 - Eating your own Dog Food')
|
130
|
+
expect(ris[2]).to eq('AU - Fenner, Martin')
|
131
|
+
expect(ris[3]).to eq('DO - 10.5438/4k3m-nyvg')
|
132
|
+
expect(ris[4]).to eq('AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...')
|
133
|
+
expect(ris[5]).to eq('KW - datacite')
|
134
|
+
expect(ris[8]).to eq('PY - 2016')
|
135
|
+
expect(ris[9]).to eq('PB - DataCite')
|
136
|
+
expect(ris[10]).to eq('SN - 10.5438/0000-00ss')
|
137
|
+
expect(ris[11]).to eq('ER - ')
|
138
138
|
end
|
139
139
|
|
140
|
-
it
|
141
|
-
input =
|
142
|
-
subject =
|
140
|
+
it 'BlogPosting schema.org' do
|
141
|
+
input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food/'
|
142
|
+
subject = described_class.new(input: input, from: 'schema_org')
|
143
143
|
ris = subject.ris.split("\r\n")
|
144
|
-
expect(ris[0]).to eq(
|
145
|
-
expect(ris[1]).to eq(
|
146
|
-
expect(ris[2]).to eq(
|
147
|
-
expect(ris[3]).to eq(
|
148
|
-
expect(ris[4]).to eq(
|
149
|
-
expect(ris[5]).to eq(
|
150
|
-
expect(ris[6]).to eq(
|
151
|
-
expect(ris[7]).to eq(
|
152
|
-
expect(ris[8]).to eq(
|
153
|
-
expect(ris[9]).to eq(
|
154
|
-
expect(ris[10]).to eq(
|
155
|
-
expect(ris[11]).to eq(
|
144
|
+
expect(ris[0]).to eq('TY - GEN')
|
145
|
+
expect(ris[1]).to eq('T1 - Eating your own Dog Food')
|
146
|
+
expect(ris[2]).to eq('T2 - Front Matter')
|
147
|
+
expect(ris[3]).to eq('AU - Fenner, Martin')
|
148
|
+
expect(ris[4]).to eq('DO - 10.53731/r79vxn1-97aq74v-ag58n')
|
149
|
+
expect(ris[5]).to eq('UR - https://blog.front-matter.io/posts/eating-your-own-dog-food')
|
150
|
+
expect(ris[6]).to eq('AB - Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for the scholarly outputs we produce. For the most part this is not research data, but rather technical documents such as the DataCite Schema and its documentation (2016). These outputs also include the posts on this blog, where we discuss topics relev')
|
151
|
+
expect(ris[7]).to eq('KW - feature')
|
152
|
+
expect(ris[8]).to eq('PY - 2016')
|
153
|
+
expect(ris[9]).to eq('PB - Front Matter')
|
154
|
+
expect(ris[10]).to eq('LA - en')
|
155
|
+
expect(ris[11]).to eq('ER - ')
|
156
156
|
end
|
157
157
|
|
158
|
-
it
|
159
|
-
input =
|
160
|
-
subject =
|
158
|
+
it 'Dataset' do
|
159
|
+
input = '10.5061/DRYAD.8515'
|
160
|
+
subject = described_class.new(input: input, from: 'datacite')
|
161
161
|
expect(subject.valid?).to be true
|
162
162
|
ris = subject.ris.split("\r\n")
|
163
|
-
expect(ris[0]).to eq(
|
164
|
-
expect(ris[1]).to eq(
|
165
|
-
expect(ris[2]).to eq(
|
166
|
-
expect(ris[10]).to eq(
|
167
|
-
expect(ris[11]).to eq(
|
168
|
-
expect(ris[13]).to eq(
|
169
|
-
expect(ris[18]).to eq(
|
170
|
-
expect(ris[19]).to eq(
|
171
|
-
expect(ris[20]).to eq(
|
163
|
+
expect(ris[0]).to eq('TY - DATA')
|
164
|
+
expect(ris[1]).to eq('T1 - Data from: A new malaria agent in African hominids.')
|
165
|
+
expect(ris[2]).to eq('AU - Ollomo, Benjamin')
|
166
|
+
expect(ris[10]).to eq('DO - 10.5061/dryad.8515')
|
167
|
+
expect(ris[11]).to eq('UR - http://datadryad.org/stash/dataset/doi:10.5061/dryad.8515')
|
168
|
+
expect(ris[13]).to eq('KW - plasmodium')
|
169
|
+
expect(ris[18]).to eq('PB - Dryad')
|
170
|
+
expect(ris[19]).to eq('LA - en')
|
171
|
+
expect(ris[20]).to eq('ER - ')
|
172
172
|
end
|
173
173
|
|
174
|
-
it
|
175
|
-
input =
|
176
|
-
subject =
|
174
|
+
it 'maremma' do
|
175
|
+
input = 'https://github.com/datacite/maremma'
|
176
|
+
subject = described_class.new(input: input, from: 'codemeta')
|
177
177
|
ris = subject.ris.split("\r\n")
|
178
|
-
expect(ris[0]).to eq(
|
179
|
-
expect(ris[1]).to eq(
|
180
|
-
expect(ris[2]).to eq(
|
181
|
-
expect(ris[3]).to eq(
|
182
|
-
expect(ris[4]).to eq(
|
183
|
-
expect(ris[5]).to eq(
|
184
|
-
expect(ris[6]).to eq(
|
185
|
-
expect(ris[9]).to eq(
|
186
|
-
expect(ris[10]).to eq(
|
187
|
-
expect(ris[11]).to eq(
|
178
|
+
expect(ris[0]).to eq('TY - COMP')
|
179
|
+
expect(ris[1]).to eq('T1 - Maremma: a Ruby library for simplified network calls')
|
180
|
+
expect(ris[2]).to eq('AU - Fenner, Martin')
|
181
|
+
expect(ris[3]).to eq('DO - 10.5438/qeg0-3gm3')
|
182
|
+
expect(ris[4]).to eq('UR - https://github.com/datacite/maremma')
|
183
|
+
expect(ris[5]).to eq('AB - Ruby utility library for network requests. Based on Faraday and Excon, provides a wrapper for XML/JSON parsing and error handling. All successful responses are returned as hash with key data, all errors in a JSONAPI-friendly hash with key errors.')
|
184
|
+
expect(ris[6]).to eq('KW - faraday')
|
185
|
+
expect(ris[9]).to eq('PY - 2017')
|
186
|
+
expect(ris[10]).to eq('PB - DataCite')
|
187
|
+
expect(ris[11]).to eq('ER - ')
|
188
188
|
end
|
189
189
|
|
190
|
-
it
|
191
|
-
input =
|
192
|
-
subject =
|
190
|
+
it 'keywords with subject scheme' do
|
191
|
+
input = 'https://doi.org/10.1594/pangaea.721193'
|
192
|
+
subject = described_class.new(input: input, from: 'datacite')
|
193
193
|
ris = subject.ris.split("\r\n")
|
194
|
-
expect(ris.first).to eq(
|
195
|
-
expect(ris).to include(
|
196
|
-
expect(ris).to include(
|
197
|
-
expect(ris).to include(
|
198
|
-
expect(ris).to include(
|
199
|
-
expect(ris).to include(
|
200
|
-
expect(ris).to include(
|
201
|
-
expect(ris).to include(
|
202
|
-
expect(ris).to include(
|
203
|
-
expect(ris).to include(
|
204
|
-
expect(ris.last).to eq(
|
194
|
+
expect(ris.first).to eq('TY - DATA')
|
195
|
+
expect(ris).to include('T1 - Seawater carbonate chemistry and processes during experiments with Crassostrea gigas, 2007, supplement to: Kurihara, Haruko; Kato, Shoji; Ishimatsu, Atsushi (2007): Effects of increased seawater pCO2 on early development of the oyster Crassostrea gigas. Aquatic Biology, 1(1), 91-98')
|
196
|
+
expect(ris).to include('AU - Kurihara, Haruko')
|
197
|
+
expect(ris).to include('DO - 10.1594/pangaea.721193')
|
198
|
+
expect(ris).to include('UR - https://doi.pangaea.de/10.1594/PANGAEA.721193')
|
199
|
+
expect(ris).to include('KW - animalia')
|
200
|
+
expect(ris).to include('KW - bottles or small containers/aquaria (<20 l)')
|
201
|
+
expect(ris).to include('PY - 2007')
|
202
|
+
expect(ris).to include('PB - PANGAEA - Data Publisher for Earth & Environmental Science')
|
203
|
+
expect(ris).to include('LA - en')
|
204
|
+
expect(ris.last).to eq('ER - ')
|
205
205
|
end
|
206
206
|
end
|
207
207
|
end
|
@@ -3,83 +3,83 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Briard::Metadata, vcr: true do
|
6
|
-
context
|
7
|
-
it
|
8
|
-
input = fixture_path
|
9
|
-
subject =
|
6
|
+
context 'write metadata as turtle' do
|
7
|
+
it 'Crossref DOI' do
|
8
|
+
input = "#{fixture_path}crossref.bib"
|
9
|
+
subject = described_class.new(input: input, from: 'bibtex')
|
10
10
|
ttl = subject.turtle.split("\n")
|
11
|
-
expect(ttl[0]).to eq(
|
12
|
-
expect(ttl[2]).to eq(
|
11
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
12
|
+
expect(ttl[2]).to eq('<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;')
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
16
|
-
input =
|
17
|
-
subject =
|
15
|
+
it 'Dataset' do
|
16
|
+
input = 'https://doi.org/10.5061/DRYAD.8515'
|
17
|
+
subject = described_class.new(input: input, from: 'datacite')
|
18
18
|
expect(subject.valid?).to be true
|
19
19
|
ttl = subject.turtle.split("\n")
|
20
|
-
expect(ttl[0]).to eq(
|
21
|
-
expect(ttl[2]).to eq(
|
20
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
21
|
+
expect(ttl[2]).to eq('<https://doi.org/10.5061/dryad.8515> a schema:Dataset;')
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
25
|
-
input=
|
26
|
-
subject =
|
24
|
+
it 'BlogPosting' do
|
25
|
+
input = 'https://doi.org/10.5438/4K3M-NYVG'
|
26
|
+
subject = described_class.new(input: input, from: 'datacite')
|
27
27
|
expect(subject.valid?).to be true
|
28
28
|
ttl = subject.turtle.split("\n")
|
29
|
-
expect(ttl[0]).to eq(
|
30
|
-
expect(ttl[2]).to eq(
|
29
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
30
|
+
expect(ttl[2]).to eq('<https://doi.org/10.5438/4k3m-nyvg> a schema:ScholarlyArticle;')
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
34
|
-
input = fixture_path
|
35
|
-
subject =
|
33
|
+
it 'BlogPosting Citeproc JSON' do
|
34
|
+
input = "#{fixture_path}citeproc.json"
|
35
|
+
subject = described_class.new(input: input, from: 'citeproc')
|
36
36
|
ttl = subject.turtle.split("\n")
|
37
|
-
expect(ttl[0]).to eq(
|
38
|
-
expect(ttl[2]).to eq(
|
37
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
38
|
+
expect(ttl[2]).to eq('<https://doi.org/10.5438/4k3m-nyvg> a schema:BlogPosting;')
|
39
39
|
end
|
40
40
|
|
41
|
-
it
|
42
|
-
input = fixture_path
|
43
|
-
subject =
|
41
|
+
it 'BlogPosting DataCite JSON' do
|
42
|
+
input = "#{fixture_path}datacite.json"
|
43
|
+
subject = described_class.new(input: input, from: 'datacite_json')
|
44
44
|
ttl = subject.turtle.split("\n")
|
45
|
-
expect(ttl[0]).to eq(
|
46
|
-
expect(ttl[2]).to eq(
|
45
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
46
|
+
expect(ttl[2]).to eq('<https://doi.org/10.5438/4k3m-nyvg> a schema:ScholarlyArticle;')
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
50
|
-
input =
|
51
|
-
subject =
|
49
|
+
it 'BlogPosting schema.org' do
|
50
|
+
input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food//'
|
51
|
+
subject = described_class.new(input: input, from: 'schema_org')
|
52
52
|
expect(subject.valid?).to be true
|
53
53
|
ttl = subject.turtle.split("\n")
|
54
|
-
expect(ttl[0]).to eq(
|
55
|
-
expect(ttl[2]).to eq(
|
56
|
-
expect(ttl[3]).to eq(
|
54
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
55
|
+
expect(ttl[2]).to eq('<https://doi.org/10.53731/r79vxn1-97aq74v-ag58n> a schema:Article;')
|
56
|
+
expect(ttl[3]).to eq(' schema:author <https://orcid.org/0000-0003-1419-2405>;')
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
60
|
-
input = fixture_path
|
61
|
-
subject =
|
59
|
+
it 'DataONE' do
|
60
|
+
input = "#{fixture_path}codemeta.json"
|
61
|
+
subject = described_class.new(input: input, from: 'codemeta')
|
62
62
|
ttl = subject.turtle.split("\n")
|
63
|
-
expect(ttl[0]).to eq(
|
64
|
-
expect(ttl[2]).to eq(
|
63
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
64
|
+
expect(ttl[2]).to eq('<https://doi.org/10.5063/f1m61h5x> a schema:SoftwareSourceCode;')
|
65
65
|
end
|
66
66
|
|
67
|
-
it
|
68
|
-
input =
|
69
|
-
subject =
|
67
|
+
it 'journal article' do
|
68
|
+
input = '10.7554/eLife.01567'
|
69
|
+
subject = described_class.new(input: input, from: 'crossref')
|
70
70
|
expect(subject.valid?).to be true
|
71
71
|
ttl = subject.turtle.split("\n")
|
72
|
-
expect(ttl[0]).to eq(
|
73
|
-
expect(ttl[2]).to eq(
|
72
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
73
|
+
expect(ttl[2]).to eq('<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;')
|
74
74
|
end
|
75
75
|
|
76
|
-
it
|
77
|
-
input =
|
78
|
-
subject =
|
76
|
+
it 'with pages' do
|
77
|
+
input = 'https://doi.org/10.1155/2012/291294'
|
78
|
+
subject = described_class.new(input: input, from: 'crossref')
|
79
79
|
expect(subject.valid?).to be true
|
80
80
|
ttl = subject.turtle.split("\n")
|
81
|
-
expect(ttl[0]).to eq(
|
82
|
-
expect(ttl[2]).to eq(
|
81
|
+
expect(ttl[0]).to eq('@prefix schema: <http://schema.org/> .')
|
82
|
+
expect(ttl[2]).to eq('<https://doi.org/10.1155/2012/291294> a schema:ScholarlyArticle;')
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|