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,1650 +3,1854 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Briard::Metadata, vcr: true do
|
6
|
-
|
6
|
+
subject { described_class.new(input: input) }
|
7
7
|
|
8
|
-
|
8
|
+
let(:input) { 'https://doi.org/10.5061/DRYAD.8515' }
|
9
9
|
|
10
|
-
context
|
11
|
-
it
|
12
|
-
input = fixture_path
|
13
|
-
subject =
|
14
|
-
expect(subject.raw).to eq(
|
10
|
+
context 'get datacite raw' do
|
11
|
+
it 'BlogPosting' do
|
12
|
+
input = "#{fixture_path}datacite.xml"
|
13
|
+
subject = described_class.new(input: input)
|
14
|
+
expect(subject.raw).to eq(File.read(input).strip)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
context
|
19
|
-
it
|
18
|
+
context 'get datacite metadata' do
|
19
|
+
it 'Dataset' do
|
20
20
|
expect(subject.valid?).to be true
|
21
|
-
expect(subject.url).to eq(
|
22
|
-
expect(subject.types[
|
23
|
-
expect(subject.types[
|
24
|
-
expect(subject.types[
|
25
|
-
expect(subject.types[
|
26
|
-
expect(subject.types[
|
21
|
+
expect(subject.url).to eq('http://datadryad.org/stash/dataset/doi:10.5061/dryad.8515')
|
22
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
23
|
+
expect(subject.types['resourceType']).to eq('dataset')
|
24
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
25
|
+
expect(subject.types['ris']).to eq('DATA')
|
26
|
+
expect(subject.types['citeproc']).to eq('dataset')
|
27
27
|
expect(subject.creators.length).to eq(8)
|
28
|
-
expect(subject.creators.first).to eq(
|
29
|
-
|
30
|
-
expect(subject.
|
31
|
-
expect(subject.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'name' => 'Ollomo, Benjamin',
|
29
|
+
'givenName' => 'Benjamin', 'familyName' => 'Ollomo', 'nameIdentifiers' => [], 'affiliation' => [{ 'affiliationIdentifier' => 'https://ror.org/01wyqb997', 'affiliationIdentifierScheme' => 'ROR', 'name' => 'Centre International de Recherches Médicales de Franceville' }])
|
30
|
+
expect(subject.titles).to eq([{ 'title' => 'Data from: A new malaria agent in African hominids.' }])
|
31
|
+
expect(subject.id).to eq('https://doi.org/10.5061/dryad.8515')
|
32
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Zero v1.0 Universal',
|
33
|
+
'rightsIdentifier' => 'cc0-1.0',
|
34
|
+
'rightsIdentifierScheme' => 'SPDX',
|
35
|
+
'rightsUri' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
|
36
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
37
|
+
expect(subject.publication_year).to eq('2011')
|
37
38
|
expect(subject.related_identifiers.length).to eq(1)
|
38
|
-
expect(subject.related_identifiers.last).to eq(
|
39
|
-
|
40
|
-
expect(subject.subjects).to eq([{
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
expect(subject.publisher).to eq(
|
45
|
-
expect(subject.agency).to eq(
|
46
|
-
expect(subject.schema_version).to eq(
|
47
|
-
end
|
48
|
-
|
49
|
-
it
|
50
|
-
input =
|
51
|
-
subject =
|
39
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.1371/journal.ppat.1000446',
|
40
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsCitedBy')
|
41
|
+
expect(subject.subjects).to eq([{ 'subject' => 'plasmodium' },
|
42
|
+
{ 'subject' => 'malaria' },
|
43
|
+
{ 'subject' => 'mitochondrial genome' },
|
44
|
+
{ 'subject' => 'parasites' }])
|
45
|
+
expect(subject.publisher).to eq('Dryad')
|
46
|
+
expect(subject.agency).to eq('datacite')
|
47
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'BlogPosting' do
|
51
|
+
input = 'https://doi.org/10.5438/4K3M-NYVG'
|
52
|
+
subject = described_class.new(input: input)
|
52
53
|
expect(subject.valid?).to be true
|
53
|
-
expect(subject.types[
|
54
|
-
expect(subject.types[
|
55
|
-
expect(subject.types[
|
56
|
-
expect(subject.types[
|
57
|
-
expect(subject.types[
|
58
|
-
expect(subject.types[
|
59
|
-
expect(subject.creators).to eq([{
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
expect(subject.
|
64
|
-
expect(subject.
|
54
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
55
|
+
expect(subject.types['resourceType']).to eq('BlogPosting')
|
56
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
57
|
+
expect(subject.types['ris']).to eq('RPRT')
|
58
|
+
expect(subject.types['bibtex']).to eq('article')
|
59
|
+
expect(subject.types['citeproc']).to eq('article-journal')
|
60
|
+
expect(subject.creators).to eq([{
|
61
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0003-1419-2405',
|
62
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Fenner, Martin', 'givenName' => 'Martin', 'familyName' => 'Fenner'
|
63
|
+
}])
|
64
|
+
expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
65
|
+
expect(subject.id).to eq('https://doi.org/10.5438/4k3m-nyvg')
|
66
|
+
expect(subject.descriptions.first['description']).to start_with('Eating your own dog food')
|
67
|
+
expect(subject.dates).to eq([{ 'date' => '2016-12-20', 'dateType' => 'Created' },
|
68
|
+
{ 'date' => '2016-12-20', 'dateType' => 'Issued' }, { 'date' => '2016-12-20', 'dateType' => 'Updated' }])
|
69
|
+
expect(subject.publication_year).to eq('2016')
|
65
70
|
expect(subject.related_identifiers.length).to eq(3)
|
66
|
-
expect(subject.related_identifiers.last).to eq(
|
67
|
-
|
68
|
-
expect(subject.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
expect(subject.
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5438/0000-00ss',
|
72
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf')
|
73
|
+
expect(subject.publisher).to eq('DataCite')
|
74
|
+
expect(subject.subjects).to eq([{ 'subject' => 'datacite' },
|
75
|
+
{ 'subject' => 'doi' },
|
76
|
+
{ 'subject' => 'metadata' },
|
77
|
+
{ 'schemeUri' => 'http://www.oecd.org/science/inno',
|
78
|
+
'subject' => 'FOS: Computer and information sciences',
|
79
|
+
'subjectScheme' => 'Fields of Science and Technology (FOS)',
|
80
|
+
'valueUri' => 'http://www.oecd.org/science/inno/38235147.pdf' }])
|
81
|
+
expect(subject.agency).to eq('datacite')
|
82
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'date' do
|
86
|
+
input = 'https://doi.org/10.4230/lipics.tqc.2013.93'
|
87
|
+
subject = described_class.new(input: input)
|
82
88
|
expect(subject.valid?).to be true
|
83
|
-
expect(subject.types[
|
84
|
-
expect(subject.types[
|
85
|
-
expect(subject.types[
|
86
|
-
expect(subject.creators).to eq([{
|
87
|
-
|
88
|
-
expect(subject.
|
89
|
-
expect(subject.
|
90
|
-
expect(subject.
|
91
|
-
expect(subject.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
expect(subject.
|
97
|
-
expect(subject.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
89
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
90
|
+
expect(subject.types['resourceType']).to eq('ConferencePaper')
|
91
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
92
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Johnston, Nathaniel',
|
93
|
+
'givenName' => 'Nathaniel', 'familyName' => 'Johnston', 'nameIdentifiers' => [], 'affiliation' => [] }])
|
94
|
+
expect(subject.titles).to eq([{ 'title' => 'The Minimum Size of Qubit Unextendible Product Bases' }])
|
95
|
+
expect(subject.id).to eq('https://doi.org/10.4230/lipics.tqc.2013.93')
|
96
|
+
expect(subject.descriptions.first['description']).to start_with('We investigate the problem of constructing unextendible product bases in the qubit case')
|
97
|
+
expect(subject.dates).to eq([{ 'date' => '2013-11-05', 'dateType' => 'Available' },
|
98
|
+
{ 'date' => '2013', 'dateType' => 'Issued' }])
|
99
|
+
expect(subject.subjects).to eq([{ 'subject' => 'computer science' },
|
100
|
+
{ 'subject' => '000 Computer science, knowledge, general works',
|
101
|
+
'subjectScheme' => 'DDC' }])
|
102
|
+
expect(subject.publication_year).to eq('2013')
|
103
|
+
expect(subject.publisher).to eq('Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik GmbH, Wadern/Saarbruecken, Germany')
|
104
|
+
expect(subject.agency).to eq('datacite')
|
105
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-2.1')
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'affiliation identifier' do
|
109
|
+
input = "#{fixture_path}datacite-example-affiliation.xml"
|
110
|
+
subject = described_class.new(input: input)
|
103
111
|
expect(subject.valid?).to be true
|
104
|
-
expect(subject.types[
|
105
|
-
expect(subject.types[
|
106
|
-
expect(subject.types[
|
107
|
-
expect(subject.types[
|
108
|
-
expect(subject.types[
|
112
|
+
expect(subject.types['schemaOrg']).to eq('SoftwareSourceCode')
|
113
|
+
expect(subject.types['resourceType']).to eq('XML')
|
114
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Software')
|
115
|
+
expect(subject.types['ris']).to eq('COMP')
|
116
|
+
expect(subject.types['citeproc']).to eq('article')
|
109
117
|
expect(subject.creators.length).to eq(3)
|
110
|
-
expect(subject.creators.first).to eq(
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
expect(subject.creators.dig(1,
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
expect(subject.creators.dig(2,
|
122
|
-
|
123
|
-
expect(subject.titles).to eq([{
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
expect(subject.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
118
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'affiliation' => [{ 'affiliationIdentifier' => 'https://ror.org/04wxnsj81', 'affiliationIdentifierScheme' => 'ROR', 'name' => 'DataCite' }],
|
119
|
+
'familyName' => 'Miller',
|
120
|
+
'givenName' => 'Elizabeth',
|
121
|
+
'name' => 'Miller, Elizabeth',
|
122
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0001-5000-0007', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }])
|
123
|
+
expect(subject.creators.dig(1, 'affiliation')).to eq([{ 'affiliationIdentifier' => 'https://ror.org/05gq02987',
|
124
|
+
'affiliationIdentifierScheme' => 'ROR',
|
125
|
+
'name' => 'Brown University' },
|
126
|
+
{ 'affiliationIdentifier' => 'https://grid.ac/institutes/grid.268117.b',
|
127
|
+
'affiliationIdentifierScheme' => 'GRID',
|
128
|
+
'name' => 'Wesleyan University' }])
|
129
|
+
expect(subject.creators.dig(2, 'affiliation')).to eq([{ 'affiliationIdentifier' => 'https://ror.org/05gq02987',
|
130
|
+
'affiliationIdentifierScheme' => 'ROR', 'name' => 'Brown University' }])
|
131
|
+
expect(subject.titles).to eq([{ 'lang' => 'en-US', 'title' => 'Full DataCite XML Example' },
|
132
|
+
{ 'lang' => 'en-US',
|
133
|
+
'title' => 'Demonstration of DataCite Properties.', 'titleType' => 'Subtitle' }])
|
134
|
+
expect(subject.id).to eq('https://doi.org/10.5072/example-full')
|
135
|
+
expect(subject.identifiers).to eq([{ 'identifier' =>
|
136
|
+
'https://schema.datacite.org/meta/kernel-4.2/example/datacite-example-full-v4.2.xml',
|
137
|
+
'identifierType' => 'URL' }])
|
138
|
+
expect(subject.rights_list).to eq([{ 'lang' => 'en-US',
|
139
|
+
'rights' => 'Creative Commons Zero v1.0 Universal', 'rightsIdentifier' => 'cc0-1.0', 'rightsIdentifierScheme' => 'SPDX', 'rightsUri' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode', 'schemeUri' => 'https://spdx.org/licenses/' }])
|
140
|
+
expect(subject.publication_year).to eq('2014')
|
141
|
+
expect(subject.contributors).to eq([{ 'name' => 'Starr, Joan', 'givenName' => 'Joan', 'familyName' => 'Starr', 'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0002-7285-027X', 'schemeUri' => 'https://orcid.org', 'nameIdentifierScheme' => 'ORCID' }], 'affiliation' =>
|
142
|
+
[{ 'affiliationIdentifier' => 'https://ror.org/03yrm5c26',
|
143
|
+
'affiliationIdentifierScheme' => 'ROR',
|
144
|
+
'name' => 'California Digital Library' }], 'contributorType' => 'ProjectLeader' }])
|
145
|
+
expect(subject.subjects).to eq([{ 'lang' => 'en-US', 'schemeUri' => 'http://dewey.info/',
|
146
|
+
'subject' => '000 computer science', 'subjectScheme' => 'dewey' }])
|
147
|
+
expect(subject.dates).to eq([
|
148
|
+
{ 'date' => '2017-09-13', 'dateInformation' => 'Updated with 4.2 properties',
|
149
|
+
'dateType' => 'Updated' }, { 'date' => '2014', 'dateType' => 'Issued' }
|
150
|
+
])
|
151
|
+
expect(subject.funding_references).to eq([{ 'awardNumber' => 'CBET-106',
|
152
|
+
'awardTitle' => 'Full DataCite XML Example',
|
153
|
+
'funderIdentifier' => 'https://doi.org/10.13039/100000001',
|
154
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
155
|
+
'funderName' => 'National Science Foundation' }])
|
141
156
|
expect(subject.related_identifiers.length).to eq(2)
|
142
|
-
expect(subject.related_identifiers.first).to eq(
|
143
|
-
|
144
|
-
|
145
|
-
expect(subject.
|
146
|
-
|
147
|
-
expect(subject.
|
148
|
-
expect(subject.
|
149
|
-
expect(subject.
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
157
|
+
expect(subject.related_identifiers.first).to eq(
|
158
|
+
'relatedIdentifier' => 'https://data.datacite.org/application/citeproc+json/10.5072/example-full', 'relatedIdentifierType' => 'URL', 'relationType' => 'HasMetadata', 'relatedMetadataScheme' => 'citeproc+json', 'schemeUri' => 'https://github.com/citation-style-language/schema/raw/master/csl-data.json'
|
159
|
+
)
|
160
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => 'arXiv:0706.0001',
|
161
|
+
'relatedIdentifierType' => 'arXiv', 'relationType' => 'IsReviewedBy', 'resourceTypeGeneral' => 'Text')
|
162
|
+
expect(subject.language).to eq('en-US')
|
163
|
+
expect(subject.sizes).to eq(['4 kB'])
|
164
|
+
expect(subject.formats).to eq(['application/xml'])
|
165
|
+
expect(subject.publisher).to eq('DataCite')
|
166
|
+
expect(subject.agency).to eq('datacite')
|
167
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'xs:string attributes' do
|
171
|
+
input = "#{fixture_path}pure.xml"
|
172
|
+
subject = described_class.new(input: input)
|
155
173
|
expect(subject.valid?).to be true
|
156
|
-
expect(subject.types[
|
157
|
-
expect(subject.types[
|
158
|
-
expect(subject.types[
|
174
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
175
|
+
expect(subject.types['resourceType']).to eq('Dataset')
|
176
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Audiovisual')
|
159
177
|
expect(subject.creators.length).to eq(14)
|
160
|
-
expect(subject.creators.first).to eq(
|
161
|
-
|
162
|
-
expect(subject.
|
163
|
-
|
164
|
-
expect(subject.
|
165
|
-
|
166
|
-
expect(subject.
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
178
|
+
expect(subject.creators.first).to eq('name' => 'Haywood, Raphaelle Dawn',
|
179
|
+
'givenName' => 'Raphaelle Dawn', 'familyName' => 'Haywood', 'affiliation' => [{ 'name' => 'School of Physics and Astronomy' }])
|
180
|
+
expect(subject.titles).to eq([{ 'lang' => 'en',
|
181
|
+
'title' => 'Data underpinning - The Sun as a planet-host star: Proxies from SDO images for HARPS radial-velocity variations' }])
|
182
|
+
expect(subject.dates).to eq([{ 'date' => '2016-01-20', 'dateType' => 'Available' },
|
183
|
+
{ 'date' => '2016', 'dateType' => 'Issued' }])
|
184
|
+
expect(subject.publication_year).to eq('2016')
|
185
|
+
expect(subject.publisher).to eq('University of St Andrews')
|
186
|
+
expect(subject.agency).to eq('datacite')
|
187
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'empty sizes and dates attributes' do
|
191
|
+
input = "#{fixture_path}datacite-empty-sizes.xml"
|
192
|
+
subject = described_class.new(input: input)
|
172
193
|
expect(subject.valid?).to be true
|
173
|
-
expect(subject.types[
|
174
|
-
expect(subject.types[
|
175
|
-
expect(subject.types[
|
194
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
195
|
+
expect(subject.types['resourceType'].nil?).to be(true)
|
196
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
176
197
|
expect(subject.creators.length).to eq(1)
|
177
|
-
expect(subject.creators.first).to eq(
|
178
|
-
|
179
|
-
expect(subject.
|
180
|
-
|
198
|
+
expect(subject.creators.first).to eq('affiliation' => [], 'name' => 'EvK2 CNR Committee',
|
199
|
+
'nameIdentifiers' => [])
|
200
|
+
expect(subject.titles).to eq([
|
201
|
+
{ 'title' => 'SHARE (Stations at High Altitude for Research on the Environment) Network' }, {
|
202
|
+
'title' => 'Urdukas (Baltoro Glacier, Baltistan - Pakistan)', 'titleType' => 'Subtitle'
|
203
|
+
}
|
204
|
+
])
|
205
|
+
expect(subject.dates).to eq([{ 'date' => '2011', 'dateType' => 'Issued' }])
|
206
|
+
expect(subject.publication_year).to eq('2011')
|
181
207
|
expect(subject.sizes).to eq([])
|
182
|
-
expect(subject.subjects).to eq([{
|
183
|
-
expect(subject.publisher).to eq(
|
184
|
-
expect(subject.agency).to eq(
|
185
|
-
expect(subject.schema_version).to eq(
|
208
|
+
expect(subject.subjects).to eq([{ 'subject' => 'environmental research' }])
|
209
|
+
expect(subject.publisher).to eq('EvK2 CNR Committee')
|
210
|
+
expect(subject.agency).to eq('datacite')
|
211
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-2.2')
|
186
212
|
end
|
187
213
|
|
188
|
-
it
|
189
|
-
input =
|
190
|
-
subject =
|
214
|
+
it 'multiple licenses' do
|
215
|
+
input = 'https://doi.org/10.5281/ZENODO.48440'
|
216
|
+
subject = described_class.new(input: input)
|
191
217
|
expect(subject.valid?).to be true
|
192
|
-
expect(subject.id).to eq(
|
193
|
-
expect(subject.identifiers).to eq([{
|
194
|
-
|
195
|
-
expect(subject.types[
|
196
|
-
expect(subject.types[
|
197
|
-
expect(subject.types[
|
198
|
-
expect(subject.
|
199
|
-
expect(subject.
|
200
|
-
|
201
|
-
expect(subject.
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
218
|
+
expect(subject.id).to eq('https://doi.org/10.5281/zenodo.48440')
|
219
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'https://zenodo.org/record/48440',
|
220
|
+
'identifierType' => 'URL' }])
|
221
|
+
expect(subject.types['schemaOrg']).to eq('SoftwareSourceCode')
|
222
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Software')
|
223
|
+
expect(subject.types['ris']).to eq('COMP')
|
224
|
+
expect(subject.types['citeproc']).to eq('article')
|
225
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Garza, Kristian',
|
226
|
+
'givenName' => 'Kristian', 'familyName' => 'Garza', 'nameIdentifiers' => [], 'affiliation' => [] }])
|
227
|
+
expect(subject.titles).to eq([{ 'title' => 'Analysis Tools For Crossover Experiment Of Ui Using Choice Architecture' }])
|
228
|
+
expect(subject.descriptions.first['description']).to start_with('This tools are used to analyse the data produced by the Crosssover Experiment')
|
229
|
+
expect(subject.rights_list).to eq([{ 'rights' =>
|
230
|
+
'Creative Commons Attribution Non Commercial Share Alike 4.0 International',
|
231
|
+
'rightsIdentifier' => 'cc-by-nc-sa-4.0',
|
232
|
+
'rightsIdentifierScheme' => 'SPDX',
|
233
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode',
|
234
|
+
'schemeUri' => 'https://spdx.org/licenses/' },
|
235
|
+
{ 'rights' => 'Open Access',
|
236
|
+
'rightsUri' => 'info:eu-repo/semantics/openAccess' }])
|
237
|
+
expect(subject.dates).to eq([{ 'date' => '2016-03-27', 'dateType' => 'Issued' }])
|
238
|
+
expect(subject.publication_year).to eq('2016')
|
210
239
|
expect(subject.related_identifiers.length).to eq(1)
|
211
|
-
expect(subject.related_identifiers.last).to eq(
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
expect(subject.
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
240
|
+
expect(subject.related_identifiers.last).to eq(
|
241
|
+
'relatedIdentifier' => 'https://github.com/kjgarza/frame_experiment_analysis/tree/v1.0', 'relatedIdentifierType' => 'URL', 'relationType' => 'IsSupplementTo'
|
242
|
+
)
|
243
|
+
expect(subject.subjects).to eq([{ 'subject' => 'choice architecture' },
|
244
|
+
{ 'subject' => 'crossover experiment' },
|
245
|
+
{ 'subject' => 'hci' }])
|
246
|
+
expect(subject.publisher).to eq('Zenodo')
|
247
|
+
expect(subject.agency).to eq('datacite')
|
248
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'is identical to' do
|
252
|
+
input = '10.6084/M9.FIGSHARE.4234751.V1'
|
253
|
+
subject = described_class.new(input: input)
|
223
254
|
expect(subject.valid?).to be true
|
224
|
-
expect(subject.identifiers).to
|
225
|
-
expect(subject.types[
|
226
|
-
expect(subject.types[
|
227
|
-
expect(subject.types[
|
255
|
+
expect(subject.identifiers.empty?).to be(true)
|
256
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
257
|
+
expect(subject.types['resourceType']).to eq('Dataset')
|
258
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
228
259
|
expect(subject.creators.count).to eq(11)
|
229
|
-
expect(subject.creators.first).to eq(
|
230
|
-
|
231
|
-
expect(subject.
|
232
|
-
expect(subject.
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
expect(subject.
|
260
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal',
|
261
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0002-2410-9671', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Junge, Alexander', 'givenName' => 'Alexander', 'familyName' => 'Junge', 'affiliation' => [])
|
262
|
+
expect(subject.titles).to eq([{ 'title' => 'RAIN v1' }])
|
263
|
+
expect(subject.descriptions.first['description']).to start_with('<b>RAIN: RNA–protein Association and Interaction Networks')
|
264
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Attribution 4.0 International',
|
265
|
+
'rightsIdentifier' => 'cc-by-4.0',
|
266
|
+
'rightsIdentifierScheme' => 'SPDX',
|
267
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
|
268
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
269
|
+
expect(subject.dates).to eq([{ 'date' => '2016-11-16', 'dateType' => 'Created' },
|
270
|
+
{ 'date' => '2016-11-16', 'dateType' => 'Updated' }, { 'date' => '2016', 'dateType' => 'Issued' }])
|
271
|
+
expect(subject.publication_year).to eq('2016')
|
239
272
|
expect(subject.related_identifiers.length).to eq(1)
|
240
|
-
expect(subject.related_identifiers.last).to eq(
|
241
|
-
|
273
|
+
expect(subject.related_identifiers.last).to eq(
|
274
|
+
'relatedIdentifier' => '10.6084/m9.figshare.4234751', 'relatedIdentifierType' => 'DOI', 'relationType' => 'IsIdenticalTo'
|
275
|
+
)
|
276
|
+
expect(subject.publisher).to eq('figshare')
|
242
277
|
expect(subject.subjects).to eq([
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
expect(subject.
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
278
|
+
{ 'schemeUri' =>
|
279
|
+
'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E',
|
280
|
+
'subject' => '60102 Bioinformatics',
|
281
|
+
'subjectScheme' => 'FOR' },
|
282
|
+
{ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf',
|
283
|
+
'subject' => 'FOS: Computer and information sciences',
|
284
|
+
'subjectScheme' => 'Fields of Science and Technology (FOS)' },
|
285
|
+
{ 'subject' => 'computational biology' },
|
286
|
+
{ 'schemeUri' =>
|
287
|
+
'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E',
|
288
|
+
'subject' => '60114 Systems Biology',
|
289
|
+
'subjectScheme' => 'FOR' },
|
290
|
+
{ 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf',
|
291
|
+
'subject' => 'FOS: Biological sciences',
|
292
|
+
'subjectScheme' => 'Fields of Science and Technology (FOS)' }
|
293
|
+
])
|
294
|
+
expect(subject.agency).to eq('datacite')
|
295
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
296
|
+
end
|
297
|
+
|
298
|
+
it 'subject scheme FOR' do
|
299
|
+
input = '10.6084/m9.figshare.1449060'
|
300
|
+
subject = described_class.new(input: input)
|
265
301
|
expect(subject.valid?).to be true
|
266
|
-
expect(subject.id).to eq(
|
267
|
-
expect(subject.types[
|
268
|
-
expect(subject.types[
|
269
|
-
expect(subject.types[
|
302
|
+
expect(subject.id).to eq('https://doi.org/10.6084/m9.figshare.1449060')
|
303
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
304
|
+
expect(subject.types['resourceType']).to eq('Dataset')
|
305
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
270
306
|
expect(subject.creators.count).to eq(4)
|
271
|
-
expect(subject.creators.first).to eq(
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
expect(subject.titles).to eq([{
|
276
|
-
expect(subject.descriptions.first[
|
277
|
-
expect(subject.rights_list).to eq([{
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
expect(subject.dates).to eq([{
|
283
|
-
|
284
|
-
expect(subject.
|
285
|
-
expect(subject.
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
307
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'familyName' => 'Dworkin',
|
308
|
+
'givenName' => 'Ian',
|
309
|
+
'name' => 'Dworkin, Ian',
|
310
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0002-2874-287X', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'affiliation' => [])
|
311
|
+
expect(subject.titles).to eq([{ 'title' => 'Drosophila melanogaster wing images from low and high altitude populations in Ethiopia and Zambia.' }])
|
312
|
+
expect(subject.descriptions.first['description']).to start_with('These are raw wing images from <i>Drosophila melanogaster</i>')
|
313
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Attribution 4.0 International',
|
314
|
+
'rightsIdentifier' => 'cc-by-4.0',
|
315
|
+
'rightsIdentifierScheme' => 'SPDX',
|
316
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
|
317
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
318
|
+
expect(subject.dates).to eq([{ 'date' => '2015-06-14', 'dateType' => 'Created' },
|
319
|
+
{ 'date' => '2020-06-02', 'dateType' => 'Updated' }, { 'date' => '2020', 'dateType' => 'Issued' }])
|
320
|
+
expect(subject.publication_year).to eq('2020')
|
321
|
+
expect(subject.publisher).to eq('figshare')
|
322
|
+
expect(subject.subjects).to eq([{ 'subject' => 'evolutionary biology' },
|
323
|
+
{ 'subject' => 'FOS: Biological sciences',
|
324
|
+
'subjectScheme' => 'Fields of Science and Technology (FOS)', 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf' },
|
325
|
+
{ 'subject' => '60412 Quantitative Genetics (incl. Disease and Trait Mapping Genetics)',
|
326
|
+
'subjectScheme' => 'FOR', 'schemeUri' => 'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E' }])
|
327
|
+
expect(subject.agency).to eq('datacite')
|
328
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'more subject scheme FOR' do
|
332
|
+
input = '10.4225/03/5a6931f57c654'
|
333
|
+
subject = described_class.new(input: input)
|
295
334
|
expect(subject.valid?).to be true
|
296
|
-
expect(subject.subjects).to eq([{
|
297
|
-
|
335
|
+
expect(subject.subjects).to eq([{ 'subject' => '90301 Biomaterials', 'subjectScheme' => 'FOR', 'schemeUri' => 'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E' },
|
336
|
+
{ 'subject' => 'FOS: Medical engineering',
|
337
|
+
'subjectScheme' => 'Fields of Science and Technology (FOS)', 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf' }])
|
298
338
|
end
|
299
339
|
|
300
|
-
it
|
301
|
-
input =
|
302
|
-
subject =
|
340
|
+
it 'even more subject scheme FOR' do
|
341
|
+
input = '10.4225/03/5a31ec65634ef'
|
342
|
+
subject = described_class.new(input: input)
|
303
343
|
expect(subject.valid?).to be true
|
304
|
-
expect(subject.subjects).to eq([{
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
344
|
+
expect(subject.subjects).to eq([{ 'subject' => '130103 Higher Education', 'subjectScheme' => 'FOR', 'schemeUri' => 'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E' },
|
345
|
+
{ 'subject' => 'FOS: Educational sciences', 'subjectScheme' => 'Fields of Science and Technology (FOS)', 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf' },
|
346
|
+
{ 'subject' => '130313 Teacher Education and Professional Development of Educators', 'subjectScheme' => 'FOR', 'schemeUri' => 'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E' },
|
347
|
+
{ 'subject' => '80799 Library and Information Studies not elsewhere classified', 'subjectScheme' => 'FOR', 'schemeUri' => 'http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E' },
|
348
|
+
{ 'subject' => 'FOS: Media and communications', 'subjectScheme' => 'Fields of Science and Technology (FOS)', 'schemeUri' => 'http://www.oecd.org/science/inno/38235147.pdf' }, { 'subject' => 'library and information studies' }])
|
309
349
|
end
|
310
350
|
|
311
|
-
it
|
312
|
-
input =
|
313
|
-
subject =
|
351
|
+
it 'cc-by 3.0 us' do
|
352
|
+
input = '10.6084/m9.figshare.1286826.v1'
|
353
|
+
subject = described_class.new(input: input)
|
314
354
|
expect(subject.valid?).to be true
|
315
|
-
expect(subject.rights_list).to eq([{
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
355
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Attribution 4.0 International',
|
356
|
+
'rightsIdentifier' => 'cc-by-4.0',
|
357
|
+
'rightsIdentifierScheme' => 'SPDX',
|
358
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by/4.0/legalcode',
|
359
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
320
360
|
end
|
321
361
|
|
322
|
-
it
|
323
|
-
input =
|
324
|
-
subject =
|
362
|
+
it 'funding schema version 3' do
|
363
|
+
input = 'https://doi.org/10.5281/ZENODO.1239'
|
364
|
+
subject = described_class.new(input: input)
|
325
365
|
expect(subject.valid?).to be true
|
326
|
-
expect(subject.id).to eq(
|
327
|
-
expect(subject.identifiers).to eq([{
|
328
|
-
|
329
|
-
expect(subject.types[
|
366
|
+
expect(subject.id).to eq('https://doi.org/10.5281/zenodo.1239')
|
367
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'https://zenodo.org/record/1239',
|
368
|
+
'identifierType' => 'URL' }])
|
369
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
370
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
330
371
|
expect(subject.creators.length).to eq(4)
|
331
|
-
expect(subject.creators.first).to eq(
|
332
|
-
|
333
|
-
expect(subject.
|
334
|
-
expect(subject.
|
335
|
-
expect(subject.
|
336
|
-
expect(subject.
|
337
|
-
expect(subject.
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
expect(subject.
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
372
|
+
expect(subject.creators.first).to eq('name' => 'Jahn, Najko', 'givenName' => 'Najko',
|
373
|
+
'familyName' => 'Jahn', 'affiliation' => [{ 'name' => 'Bielefeld University Library' }])
|
374
|
+
expect(subject.titles).to eq([{ 'title' => 'Publication Fp7 Funding Acknowledgment - Plos Openaire' }])
|
375
|
+
expect(subject.descriptions.first['description']).to start_with('The dataset contains a sample of metadata describing papers')
|
376
|
+
expect(subject.dates).to eq([{ 'date' => '2013-04-03', 'dateType' => 'Issued' }])
|
377
|
+
expect(subject.publication_year).to eq('2013')
|
378
|
+
expect(subject.publisher).to eq('Zenodo')
|
379
|
+
expect(subject.funding_references).to eq([{ 'awardNumber' => '246686',
|
380
|
+
'awardTitle' => 'Open Access Infrastructure for Research in Europe',
|
381
|
+
'awardUri' => 'info:eu-repo/grantAgreement/EC/FP7/246686/',
|
382
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000780',
|
383
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
384
|
+
'funderName' => 'European Commission' }])
|
385
|
+
expect(subject.subjects).to eq([{ 'subject' => 'article-level metrics' },
|
386
|
+
{ 'subject' => 'data mining' },
|
387
|
+
{ 'subject' => 'statistical computing language r' },
|
388
|
+
{ 'subject' => 'funded research publications' }])
|
389
|
+
expect(subject.agency).to eq('datacite')
|
390
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'from attributes' do
|
394
|
+
subject = described_class.new(input: nil,
|
395
|
+
from: 'datacite',
|
396
|
+
doi: '10.5281/zenodo.1239',
|
397
|
+
creators: [{ 'nameType' => 'Personal', 'name' => 'Jahn, Najko', 'givenName' => 'Najko',
|
398
|
+
'familyName' => 'Jahn' }],
|
399
|
+
titles: [{ 'title' => 'Publication Fp7 Funding Acknowledgment - Plos Openaire' }],
|
400
|
+
descriptions: [{ 'description' => 'The dataset contains a sample of metadata describing papers' }],
|
401
|
+
publisher: 'Zenodo',
|
402
|
+
publication_year: '2013',
|
403
|
+
dates: [{ 'date' => '2013-04-03',
|
404
|
+
'dateType' => 'Issued' }],
|
405
|
+
funding_references: [{ 'awardNumber' => '246686',
|
406
|
+
'awardTitle' => 'Open Access Infrastructure for Research in Europe',
|
407
|
+
'awardUri' => 'info:eu-repo/grantAgreement/EC/FP7/246686/',
|
408
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000780',
|
409
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
410
|
+
'funderName' => 'European Commission' }],
|
411
|
+
types: {
|
412
|
+
'resourceTypeGeneral' => 'Dataset', 'schemaOrg' => 'Dataset'
|
413
|
+
},
|
414
|
+
'identifiers' => [{
|
415
|
+
'identifierType' => 'Repository ID', 'identifier' => '123'
|
416
|
+
}])
|
369
417
|
|
370
418
|
expect(subject.valid?).to be true
|
371
|
-
expect(subject.doi).to eq(
|
372
|
-
expect(subject.id).to eq(
|
373
|
-
expect(subject.types[
|
374
|
-
expect(subject.types[
|
375
|
-
expect(subject.creators).to eq([{
|
376
|
-
|
377
|
-
expect(subject.
|
378
|
-
expect(subject.
|
379
|
-
expect(subject.
|
380
|
-
expect(subject.
|
381
|
-
expect(subject.
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
expect(subject.
|
389
|
-
|
390
|
-
expect(subject.
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
419
|
+
expect(subject.doi).to eq('10.5281/zenodo.1239')
|
420
|
+
expect(subject.id).to eq('https://doi.org/10.5281/zenodo.1239')
|
421
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
422
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
423
|
+
expect(subject.creators).to eq([{ 'familyName' => 'Jahn', 'givenName' => 'Najko',
|
424
|
+
'name' => 'Jahn, Najko', 'nameType' => 'Personal' }])
|
425
|
+
expect(subject.titles).to eq([{ 'title' => 'Publication Fp7 Funding Acknowledgment - Plos Openaire' }])
|
426
|
+
expect(subject.descriptions.first['description']).to start_with('The dataset contains a sample of metadata describing papers')
|
427
|
+
expect(subject.dates).to eq([{ 'date' => '2013-04-03', 'dateType' => 'Issued' }])
|
428
|
+
expect(subject.publication_year).to eq('2013')
|
429
|
+
expect(subject.publisher).to eq('Zenodo')
|
430
|
+
expect(subject.funding_references).to eq([{ 'awardNumber' => '246686',
|
431
|
+
'awardTitle' => 'Open Access Infrastructure for Research in Europe',
|
432
|
+
'awardUri' => 'info:eu-repo/grantAgreement/EC/FP7/246686/',
|
433
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000780',
|
434
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
435
|
+
'funderName' => 'European Commission' }])
|
436
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '123',
|
437
|
+
'identifierType' => 'Repository ID' }])
|
438
|
+
expect(subject.agency).to eq('datacite')
|
439
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
440
|
+
expect(subject.state).to eq('findable')
|
441
|
+
end
|
442
|
+
|
443
|
+
it 'missing resource_type_general' do
|
444
|
+
input = "#{fixture_path}vivli.xml"
|
445
|
+
subject = described_class.new(input: input)
|
446
|
+
expect(subject.types['schemaOrg']).to eq('CreativeWork')
|
447
|
+
expect(subject.types['resourceTypeGeneral'].nil?).to be(true)
|
398
448
|
expect(subject.valid?).to be false
|
399
449
|
expect(subject.errors).to eq("2:0: ERROR: Element '{http://datacite.org/schema/kernel-4}resource': Missing child element(s). Expected is one of ( {http://datacite.org/schema/kernel-4}resourceType, {http://datacite.org/schema/kernel-4}subjects, {http://datacite.org/schema/kernel-4}contributors, {http://datacite.org/schema/kernel-4}language, {http://datacite.org/schema/kernel-4}alternateIdentifiers, {http://datacite.org/schema/kernel-4}relatedIdentifiers, {http://datacite.org/schema/kernel-4}sizes, {http://datacite.org/schema/kernel-4}formats, {http://datacite.org/schema/kernel-4}rightsList, {http://datacite.org/schema/kernel-4}descriptions ).")
|
400
450
|
end
|
401
451
|
|
402
|
-
it
|
403
|
-
input = fixture_path
|
404
|
-
subject =
|
405
|
-
expect(subject.types[
|
406
|
-
expect(subject.language).to eq(
|
407
|
-
expect(subject.publisher).to eq(
|
408
|
-
expect(subject.publication_year).to eq(
|
452
|
+
it 'multiple languages' do
|
453
|
+
input = "#{fixture_path}datacite-multiple-language.xml"
|
454
|
+
subject = described_class.new(input: input)
|
455
|
+
expect(subject.types['schemaOrg']).to eq('Collection')
|
456
|
+
expect(subject.language).to eq('de')
|
457
|
+
expect(subject.publisher).to eq('Universitätsbibliothek Tübingen')
|
458
|
+
expect(subject.publication_year).to eq('2015')
|
409
459
|
expect(subject.valid?).to be false
|
410
460
|
expect(subject.errors).to eq("13:0: ERROR: Element '{http://datacite.org/schema/kernel-2.2}publisher': This element is not expected. Expected is ( {http://datacite.org/schema/kernel-2.2}publicationYear ).")
|
411
461
|
end
|
412
462
|
|
413
|
-
it
|
414
|
-
input = fixture_path
|
415
|
-
subject =
|
463
|
+
it 'funder identifier with different http scheme' do
|
464
|
+
input = "#{fixture_path}datacite-funderIdentifier.xml"
|
465
|
+
subject = described_class.new(input: input)
|
416
466
|
expect(subject.funding_references.first).to eq({
|
417
|
-
|
418
|
-
|
419
|
-
|
467
|
+
'funderIdentifier' => 'http://www.isni.org/isni/0000000119587073',
|
468
|
+
'funderIdentifierType' => 'ISNI',
|
469
|
+
'funderName' => 'National Science Foundation (NSF)'
|
470
|
+
})
|
420
471
|
expect(subject.funding_references.last).to eq({
|
421
|
-
|
422
|
-
|
423
|
-
|
472
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000780',
|
473
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
474
|
+
'funderName' => 'European Commission'
|
475
|
+
})
|
424
476
|
expect(subject.funding_references[1]).to eq({
|
425
|
-
|
426
|
-
|
427
|
-
|
477
|
+
'funderIdentifier' => '1234',
|
478
|
+
'funderIdentifierType' => 'Other',
|
479
|
+
'funderName' => 'Acme Inc'
|
480
|
+
})
|
428
481
|
end
|
429
482
|
|
430
|
-
it
|
431
|
-
input = fixture_path
|
432
|
-
subject =
|
483
|
+
it 'geo_location empty' do
|
484
|
+
input = "#{fixture_path}datacite-geolocation-empty.xml"
|
485
|
+
subject = described_class.new(input: input)
|
433
486
|
expect(subject.valid?).to be true
|
434
|
-
expect(subject.types[
|
435
|
-
expect(subject.geo_locations).to eq([{
|
487
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
488
|
+
expect(subject.geo_locations).to eq([{ 'geoLocationPoint' => { 'pointLatitude' => '-11.64583333',
|
489
|
+
'pointLongitude' => '-68.2975' } }])
|
436
490
|
end
|
437
491
|
|
438
|
-
it
|
439
|
-
input = fixture_path
|
440
|
-
geo_locations = [{
|
441
|
-
|
492
|
+
it 'geo_location in separate input' do
|
493
|
+
input = "#{fixture_path}datacite-geolocation-empty.xml"
|
494
|
+
geo_locations = [{ 'geoLocationPoint' => { 'pointLatitude' => '49.0850736',
|
495
|
+
'pointLongitude' => '-123.3300992' } }]
|
496
|
+
subject = described_class.new(input: input, geo_locations: geo_locations)
|
442
497
|
expect(subject.valid?).to be true
|
443
|
-
expect(subject.types[
|
498
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
444
499
|
expect(subject.geo_locations).to eq(geo_locations)
|
445
500
|
|
446
|
-
datacite = Maremma.from_xml(subject.datacite).fetch(
|
447
|
-
expect(datacite
|
501
|
+
datacite = Maremma.from_xml(subject.datacite).fetch('resource', {})
|
502
|
+
expect(datacite['geoLocations']).to eq('geoLocation' => { 'geoLocationPoint' => {
|
503
|
+
'pointLatitude' => '49.0850736', 'pointLongitude' => '-123.3300992'
|
504
|
+
} })
|
448
505
|
end
|
449
506
|
|
450
|
-
it
|
451
|
-
input = fixture_path
|
452
|
-
subject =
|
507
|
+
it 'xml:lang attribute' do
|
508
|
+
input = "#{fixture_path}datacite-xml-lang.xml"
|
509
|
+
subject = described_class.new(input: input)
|
453
510
|
expect(subject.valid?).to be true
|
454
|
-
expect(subject.types[
|
455
|
-
expect(subject.titles).to eq([{
|
456
|
-
|
457
|
-
expect(subject.
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
511
|
+
expect(subject.types['schemaOrg']).to eq('Collection')
|
512
|
+
expect(subject.titles).to eq([{ 'lang' => 'en', 'title' => 'DOI Test 2 title content' },
|
513
|
+
{ 'lang' => 'en', 'title' => 'AAPP' }])
|
514
|
+
expect(subject.descriptions).to eq([{
|
515
|
+
'description' => 'This is the DOI TEST 2 product where this is the description field content.', 'descriptionType' => 'Methods', 'lang' => 'en'
|
516
|
+
}])
|
517
|
+
expect(subject.geo_locations).to eq([
|
518
|
+
{ 'geoLocationBox' => { 'eastBoundLongitude' => '70.0', 'northBoundLatitude' => '70.0',
|
519
|
+
'southBoundLatitude' => '-70.0', 'westBoundLongitude' => '-70.0' } }, { 'geoLocationPlace' => 'Regional' }
|
520
|
+
])
|
521
|
+
end
|
522
|
+
|
523
|
+
it 'wrong attributes' do
|
524
|
+
input = "#{fixture_path}nist.xml"
|
525
|
+
subject = described_class.new(input: input)
|
526
|
+
expect(subject.id).to eq('https://doi.org/10.5072/m32163')
|
527
|
+
expect(subject.titles).to eq([{ 'title' => 'Peter Auto Dataset 501' }])
|
528
|
+
expect(subject.descriptions).to eq([{
|
529
|
+
'description' => "This is to overturn Einstein's Relativity Theory.", 'descriptionType' => 'Abstract'
|
530
|
+
}])
|
466
531
|
expect(subject.valid?).to be false
|
467
532
|
expect(subject.errors.length).to eq(4)
|
468
533
|
expect(subject.errors.last).to eq("32:0: ERROR: Element '{http://datacite.org/schema/kernel-3}alternateIdentifier': The attribute 'alternateIdentifierType' is required but missing.")
|
469
534
|
end
|
470
535
|
|
471
|
-
it
|
472
|
-
input = fixture_path
|
473
|
-
subject =
|
536
|
+
it 'schema 4.0' do
|
537
|
+
input = "#{fixture_path}schema_4.0.xml"
|
538
|
+
subject = described_class.new(input: input)
|
474
539
|
expect(subject.valid?).to be true
|
475
|
-
expect(subject.id).to eq(
|
476
|
-
expect(subject.types[
|
477
|
-
expect(subject.types[
|
478
|
-
expect(subject.types[
|
540
|
+
expect(subject.id).to eq('https://doi.org/10.6071/z7wc73')
|
541
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
542
|
+
expect(subject.types['resourceType']).to eq('dataset')
|
543
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
479
544
|
expect(subject.creators.length).to eq(6)
|
480
|
-
expect(subject.creators.first).to eq(
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
545
|
+
expect(subject.creators.first).to eq('familyName' => 'Bales', 'givenName' => 'Roger',
|
546
|
+
'name' => 'Bales, Roger', 'nameType' => 'Personal', 'affiliation' => [{ 'name' => 'UC Merced' }], 'nameIdentifiers' => [])
|
547
|
+
expect(subject.subjects).to eq([{ 'subject' => 'earth sciences' },
|
548
|
+
{ 'subject' => 'soil moisture' },
|
549
|
+
{ 'subject' => 'soil temperature' },
|
550
|
+
{ 'subject' => 'snow depth' },
|
551
|
+
{ 'subject' => 'air temperature' },
|
552
|
+
{ 'subject' => 'water balance' },
|
553
|
+
{ 'subject' => 'nevada, sierra (mountain range)' }])
|
554
|
+
end
|
555
|
+
|
556
|
+
it 'series_information' do
|
557
|
+
input = "#{fixture_path}datacite-seriesinformation.xml"
|
558
|
+
subject = described_class.new(input: input)
|
493
559
|
expect(subject.valid?).to be true
|
494
|
-
expect(subject.id).to eq(
|
495
|
-
expect(subject.identifiers).to eq([{
|
560
|
+
expect(subject.id).to eq('https://doi.org/10.5438/4k3m-nyvg')
|
561
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'MS-49-3632-5083',
|
562
|
+
'identifierType' => 'Local accession number' }])
|
496
563
|
expect(subject.creators.length).to eq(1)
|
497
|
-
expect(subject.creators.first).to eq(
|
498
|
-
|
499
|
-
expect(subject.
|
500
|
-
expect(subject.
|
501
|
-
expect(subject.
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
564
|
+
expect(subject.creators.first).to eq('familyName' => 'Fenner', 'givenName' => 'Martin',
|
565
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0003-1419-2405', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Fenner, Martin')
|
566
|
+
expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
567
|
+
expect(subject.publisher).to eq('DataCite')
|
568
|
+
expect(subject.publication_year).to eq('2016')
|
569
|
+
expect(subject.related_identifiers).to eq([{ 'relatedIdentifier' => '10.5438/0012',
|
570
|
+
'relatedIdentifierType' => 'DOI',
|
571
|
+
'relationType' => 'References' },
|
572
|
+
{ 'relatedIdentifier' => '10.5438/55e5-t5c0',
|
573
|
+
'relatedIdentifierType' => 'DOI',
|
574
|
+
'relationType' => 'References' },
|
575
|
+
{ 'relatedIdentifier' => '10.5438/0000-00ss',
|
576
|
+
'relatedIdentifierType' => 'DOI',
|
577
|
+
'relationType' => 'IsPartOf' }])
|
578
|
+
expect(subject.descriptions).to eq([{ 'description' => 'DataCite Blog, 2(9), 3-4',
|
579
|
+
'descriptionType' => 'SeriesInformation',
|
580
|
+
'lang' => 'en' },
|
581
|
+
{ 'description' =>
|
582
|
+
'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...',
|
583
|
+
'descriptionType' => 'Abstract' }])
|
584
|
+
expect(subject.container).to eq('firstPage' => '3', 'identifier' => '10.5438/0000-00SS',
|
585
|
+
'identifierType' => 'DOI', 'issue' => '9', 'lastPage' => '4', 'title' => 'DataCite Blog', 'type' => 'Series', 'volume' => '2')
|
586
|
+
end
|
587
|
+
|
588
|
+
it 'geo_location' do
|
589
|
+
input = "#{fixture_path}datacite-example-geolocation.xml"
|
590
|
+
doi = '10.5072/geoPointExample'
|
591
|
+
subject = described_class.new(input: input, doi: doi)
|
523
592
|
expect(subject.valid?).to be true
|
524
|
-
expect(subject.id).to eq(
|
525
|
-
expect(subject.doi).to eq(
|
593
|
+
expect(subject.id).to eq('https://doi.org/10.5072/geopointexample')
|
594
|
+
expect(subject.doi).to eq('10.5072/geopointexample')
|
526
595
|
expect(subject.creators.length).to eq(3)
|
527
|
-
expect(subject.creators.first).to eq(
|
528
|
-
|
529
|
-
expect(subject.
|
530
|
-
expect(subject.
|
531
|
-
expect(subject.
|
532
|
-
expect(subject.
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
596
|
+
expect(subject.creators.first).to eq('familyName' => 'Schumann', 'givenName' => 'Kai',
|
597
|
+
'name' => 'Schumann, Kai', 'nameType' => 'Personal', 'nameIdentifiers' => [], 'affiliation' => [])
|
598
|
+
expect(subject.titles).to eq([{ 'title' => 'Gridded results of swath bathymetric mapping of Disko Bay, Western Greenland, 2007-2008' }])
|
599
|
+
expect(subject.publisher).to eq('PANGAEA - Data Publisher for Earth & Environmental Science')
|
600
|
+
expect(subject.publication_year).to eq('2011')
|
601
|
+
expect(subject.related_identifiers).to eq([{ 'relatedIdentifier' => '10.5072/timeseries',
|
602
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'Continues' }])
|
603
|
+
expect(subject.geo_locations).to eq([{ 'geoLocationPlace' => 'Disko Bay',
|
604
|
+
'geoLocationPoint' => { 'pointLatitude' => '69.000000',
|
605
|
+
'pointLongitude' => '-52.000000' } }])
|
606
|
+
expect(subject.subjects).to eq([{ 'subject' => '551 Geology, hydrology, meteorology',
|
607
|
+
'subjectScheme' => 'DDC' }])
|
608
|
+
end
|
609
|
+
|
610
|
+
it 'geo_location_box' do
|
611
|
+
input = "#{fixture_path}datacite-example-geolocation-2.xml"
|
612
|
+
doi = '10.6071/Z7WC73'
|
613
|
+
subject = described_class.new(input: input, doi: doi)
|
540
614
|
expect(subject.valid?).to be true
|
541
|
-
expect(subject.id).to eq(
|
542
|
-
expect(subject.doi).to eq(
|
615
|
+
expect(subject.id).to eq('https://doi.org/10.6071/z7wc73')
|
616
|
+
expect(subject.doi).to eq('10.6071/z7wc73')
|
543
617
|
expect(subject.creators.length).to eq(6)
|
544
|
-
expect(subject.creators.first).to eq(
|
545
|
-
|
546
|
-
expect(subject.
|
547
|
-
expect(subject.
|
548
|
-
expect(subject.
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
618
|
+
expect(subject.creators.first).to eq('familyName' => 'Bales', 'givenName' => 'Roger',
|
619
|
+
'name' => 'Bales, Roger', 'nameType' => 'Personal', 'affiliation' => [{ 'name' => 'UC Merced' }, { 'name' => 'NSF' }], 'nameIdentifiers' => [])
|
620
|
+
expect(subject.titles).to eq([{ 'title' => 'Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature' }])
|
621
|
+
expect(subject.publisher).to eq('UC Merced')
|
622
|
+
expect(subject.dates).to eq([{ 'date' => '2014-10-17', 'dateType' => 'Updated' },
|
623
|
+
{ 'date' => '2016-03-14T17:02:02Z', 'dateType' => 'Available' }, { 'date' => '2013', 'dateType' => 'Issued' }])
|
624
|
+
expect(subject.publication_year).to eq('2013')
|
625
|
+
expect(subject.subjects).to eq([{ 'subject' => 'earth sciences' },
|
626
|
+
{ 'subject' => 'soil moisture' },
|
627
|
+
{ 'subject' => 'soil temperature' },
|
628
|
+
{ 'subject' => 'snow depth' },
|
629
|
+
{ 'subject' => 'air temperature' },
|
630
|
+
{ 'subject' => 'water balance' },
|
631
|
+
{ 'subject' => 'nevada, sierra (mountain range)' }])
|
632
|
+
expect(subject.geo_locations).to eq([{ 'geoLocationBox' =>
|
633
|
+
{ 'eastBoundLongitude' => '-119.182',
|
634
|
+
'northBoundLatitude' => '37.075',
|
635
|
+
'southBoundLatitude' => '37.046',
|
636
|
+
'westBoundLongitude' => '-119.211' },
|
637
|
+
'geoLocationPlace' => 'Providence Creek (Lower, Upper and P301)',
|
638
|
+
'geoLocationPoint' => { 'pointLatitude' => '37.047756',
|
639
|
+
'pointLongitude' => '-119.221094' } }])
|
640
|
+
end
|
641
|
+
|
642
|
+
it 'author only full name' do
|
643
|
+
input = 'https://doi.org/10.14457/KMITL.RES.2006.17'
|
644
|
+
subject = described_class.new(input: input)
|
568
645
|
expect(subject.valid?).to be true
|
569
|
-
expect(subject.id).to eq(
|
570
|
-
expect(subject.types[
|
646
|
+
expect(subject.id).to eq('https://doi.org/10.14457/kmitl.res.2006.17')
|
647
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
571
648
|
expect(subject.creators.length).to eq(1)
|
572
|
-
expect(subject.creators.first).to eq(
|
649
|
+
expect(subject.creators.first).to eq('name' => 'กัญจนา แซ่เตียว', 'nameIdentifiers' => [],
|
650
|
+
'affiliation' => [])
|
573
651
|
end
|
574
652
|
|
575
|
-
it
|
576
|
-
input =
|
577
|
-
subject =
|
653
|
+
it 'multiple author names in one creatorsName' do
|
654
|
+
input = 'https://doi.org/10.7910/DVN/EQTQYO'
|
655
|
+
subject = described_class.new(input: input)
|
578
656
|
expect(subject.valid?).to be true
|
579
|
-
expect(subject.id).to eq(
|
580
|
-
expect(subject.types[
|
581
|
-
expect(subject.creators).to eq([{
|
657
|
+
expect(subject.id).to eq('https://doi.org/10.7910/dvn/eqtqyo')
|
658
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
659
|
+
expect(subject.creators).to eq([{
|
660
|
+
'name' => 'Enos, Ryan (Harvard University); Fowler, Anthony (University Of Chicago); Vavreck, Lynn (UCLA)', 'nameIdentifiers' => [], 'affiliation' => []
|
661
|
+
}])
|
582
662
|
end
|
583
663
|
|
584
|
-
it
|
585
|
-
input =
|
586
|
-
subject =
|
664
|
+
it 'author with scheme' do
|
665
|
+
input = 'https://doi.org/10.18429/JACOW-IPAC2016-TUPMY003'
|
666
|
+
subject = described_class.new(input: input)
|
587
667
|
expect(subject.valid?).to be true
|
588
|
-
expect(subject.id).to eq(
|
589
|
-
expect(subject.types[
|
668
|
+
expect(subject.id).to eq('https://doi.org/10.18429/jacow-ipac2016-tupmy003')
|
669
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
590
670
|
expect(subject.creators.length).to eq(12)
|
591
|
-
expect(subject.creators.first).to eq(
|
671
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal',
|
672
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'http://jacow.org/JACoW-00077389', 'nameIdentifierScheme' => 'JACoW-ID', 'schemeUri' => 'http://jacow.org/' }], 'name' => 'Otani, Masashi', 'givenName' => 'Masashi', 'familyName' => 'Otani', 'affiliation' => [{ 'name' => 'KEK, Tsukuba, Japan' }])
|
592
673
|
end
|
593
674
|
|
594
|
-
it
|
595
|
-
input =
|
596
|
-
subject =
|
675
|
+
it 'author with wrong orcid scheme' do
|
676
|
+
input = 'https://doi.org/10.2314/COSCV1'
|
677
|
+
subject = described_class.new(input: input)
|
597
678
|
expect(subject.valid?).to be true
|
598
|
-
expect(subject.id).to eq(
|
599
|
-
expect(subject.types[
|
679
|
+
expect(subject.id).to eq('https://doi.org/10.2314/coscv1')
|
680
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
600
681
|
expect(subject.creators.length).to eq(14)
|
601
|
-
expect(subject.creators.first).to include(
|
682
|
+
expect(subject.creators.first).to include('nameType' => 'Personal',
|
683
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0003-0232-7085', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Heller, Lambert', 'givenName' => 'Lambert', 'familyName' => 'Heller')
|
602
684
|
end
|
603
685
|
|
604
|
-
it
|
605
|
-
input =
|
606
|
-
subject =
|
686
|
+
it 'keywords with attributes' do
|
687
|
+
input = 'https://doi.org/10.21233/n34n5q'
|
688
|
+
subject = described_class.new(input: input)
|
607
689
|
expect(subject.valid?).to be true
|
608
|
-
expect(subject.id).to eq(
|
609
|
-
expect(subject.subjects).to eq([{
|
690
|
+
expect(subject.id).to eq('https://doi.org/10.21233/n34n5q')
|
691
|
+
expect(subject.subjects).to eq([{ 'schemeUri' => 'http://id.loc.gov/authorities/subjects',
|
692
|
+
'subject' => 'Paleoecology', 'subjectScheme' => 'Library of Congress' }])
|
610
693
|
end
|
611
694
|
|
612
|
-
it
|
613
|
-
input =
|
614
|
-
subject =
|
695
|
+
it 'Funding' do
|
696
|
+
input = 'https://doi.org/10.15125/BATH-00114'
|
697
|
+
subject = described_class.new(input: input)
|
615
698
|
expect(subject.valid?).to be true
|
616
|
-
expect(subject.id).to eq(
|
617
|
-
expect(subject.identifiers).to eq([{
|
618
|
-
|
619
|
-
expect(subject.types[
|
620
|
-
expect(subject.types[
|
699
|
+
expect(subject.id).to eq('https://doi.org/10.15125/bath-00114')
|
700
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'http://researchdata.bath.ac.uk/114/',
|
701
|
+
'identifierType' => 'URL' }])
|
702
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
703
|
+
expect(subject.types['resourceType']).to eq('Dataset')
|
704
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
621
705
|
expect(subject.creators.length).to eq(2)
|
622
|
-
expect(subject.creators.first).to eq(
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
expect(subject.
|
706
|
+
expect(subject.creators.first).to eq(
|
707
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0001-8740-8284',
|
708
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Bimbo, Nuno', 'givenName' => 'Nuno', 'familyName' => 'Bimbo'
|
709
|
+
)
|
710
|
+
expect(subject.titles).to eq([{ 'title' => 'Dataset for "Direct Evidence for Solid-Like Hydrogen in a Nanoporous Carbon Hydrogen Storage Material at Supercritical Temperatures"' }])
|
711
|
+
expect(subject.descriptions.first['description']).to start_with('Dataset for Direct Evidence for Solid-Like Hydrogen')
|
712
|
+
expect(subject.publication_year).to eq('2015')
|
713
|
+
expect(subject.publisher).to eq('University of Bath')
|
627
714
|
expect(subject.funding_references.length).to eq(5)
|
628
|
-
expect(subject.funding_references.first).to eq(
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
expect(subject.subjects).to eq([{
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
expect(subject.agency).to eq(
|
642
|
-
expect(subject.schema_version).to eq(
|
643
|
-
end
|
644
|
-
|
645
|
-
it
|
646
|
-
input =
|
647
|
-
subject =
|
715
|
+
expect(subject.funding_references.first).to eq('awardNumber' => 'EP/J016454/1',
|
716
|
+
'awardTitle' => 'SUPERGEN Hub Funding',
|
717
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000266',
|
718
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
719
|
+
'funderName' => 'Engineering and Physical Sciences Research Council (EPSRC)')
|
720
|
+
expect(subject.subjects).to eq([{ 'schemeUri' =>
|
721
|
+
'http://www.rcuk.ac.uk/research/efficiency/researchadmin/harmonisation/',
|
722
|
+
'subject' => 'Energy Storage',
|
723
|
+
'subjectScheme' => 'RCUK Research Classifications' },
|
724
|
+
{ 'schemeUri' =>
|
725
|
+
'http://www.rcuk.ac.uk/research/efficiency/researchadmin/harmonisation/',
|
726
|
+
'subject' => 'Materials Characterisation',
|
727
|
+
'subjectScheme' => 'RCUK Research Classifications' }])
|
728
|
+
expect(subject.agency).to eq('datacite')
|
729
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
730
|
+
end
|
731
|
+
|
732
|
+
it 'Funding schema version 4' do
|
733
|
+
input = 'https://doi.org/10.5438/6423'
|
734
|
+
subject = described_class.new(input: input)
|
648
735
|
expect(subject.valid?).to be true
|
649
|
-
expect(subject.id).to eq(
|
650
|
-
expect(subject.types[
|
651
|
-
expect(subject.types[
|
652
|
-
expect(subject.types[
|
653
|
-
expect(subject.types[
|
654
|
-
expect(subject.types[
|
736
|
+
expect(subject.id).to eq('https://doi.org/10.5438/6423')
|
737
|
+
expect(subject.types['schemaOrg']).to eq('Collection')
|
738
|
+
expect(subject.types['resourceType']).to eq('Project')
|
739
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Collection')
|
740
|
+
expect(subject.types['ris']).to eq('GEN')
|
741
|
+
expect(subject.types['citeproc']).to eq('article')
|
655
742
|
expect(subject.creators.length).to eq(24)
|
656
|
-
expect(subject.creators.first).to eq(
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
expect(subject.
|
661
|
-
expect(subject.
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
743
|
+
expect(subject.creators.first).to eq(
|
744
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0001-5331-6592',
|
745
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Farquhar, Adam', 'givenName' => 'Adam', 'familyName' => 'Farquhar', 'affiliation' => [{ 'name' => 'British Library' }]
|
746
|
+
)
|
747
|
+
expect(subject.titles).to eq([{ 'title' => 'Technical and Human Infrastructure for Open Research (THOR)' }])
|
748
|
+
expect(subject.descriptions.first['description']).to start_with('Five years ago, a global infrastructure')
|
749
|
+
expect(subject.publication_year).to eq('2015')
|
750
|
+
expect(subject.publisher).to eq('DataCite')
|
751
|
+
expect(subject.funding_references).to eq([{ 'awardNumber' => '654039',
|
752
|
+
'awardTitle' => 'THOR – Technical and Human Infrastructure for Open Research',
|
753
|
+
'awardUri' => 'http://cordis.europa.eu/project/rcn/194927_en.html',
|
754
|
+
'funderIdentifier' => 'https://doi.org/10.13039/501100000780',
|
755
|
+
'funderIdentifierType' => 'Crossref Funder ID',
|
756
|
+
'funderName' => 'European Commission' }])
|
757
|
+
expect(subject.agency).to eq('datacite')
|
758
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
759
|
+
end
|
760
|
+
|
761
|
+
it 'Funding empty awardTitle' do
|
762
|
+
input = 'https://doi.org/10.26102/2310-6018/2019.24.1.006'
|
763
|
+
subject = described_class.new(input: input)
|
674
764
|
expect(subject.valid?).to be true
|
675
|
-
expect(subject.id).to eq(
|
676
|
-
expect(subject.types[
|
677
|
-
expect(subject.types[
|
678
|
-
expect(subject.types[
|
765
|
+
expect(subject.id).to eq('https://doi.org/10.26102/2310-6018/2019.24.1.006')
|
766
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
767
|
+
expect(subject.types['resourceType']).to eq('Journal Article')
|
768
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
679
769
|
expect(subject.creators.length).to eq(2)
|
680
|
-
expect(subject.creators.first).to eq(
|
681
|
-
|
682
|
-
|
683
|
-
expect(subject.
|
684
|
-
|
770
|
+
expect(subject.creators.first).to eq(
|
771
|
+
'affiliation' => [{ 'name' => 'Тверская государственная сельскохозяйственная академия' }], 'familyName' => 'Ганичева', 'givenName' => 'А.В.', 'name' => 'Ганичева, А.В.', 'nameType' => 'Personal', 'nameIdentifiers' => []
|
772
|
+
)
|
773
|
+
expect(subject.titles).to eq([{ 'title' => 'МОДЕЛЬ СИСТЕМНОЙ ДИНАМИКИ ПРОЦЕССА ОБУЧЕНИЯ' },
|
774
|
+
{ 'title' => 'MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING',
|
775
|
+
'titleType' => 'TranslatedTitle' }])
|
776
|
+
expect(subject.descriptions.first['description']).to start_with('Актуальность данной работы обусловлена важностью учета в учебном процессе личностных качеств обучаем')
|
777
|
+
expect(subject.publication_year).to eq('2019')
|
778
|
+
expect(subject.publisher).to eq('МОДЕЛИРОВАНИЕ, ОПТИМИЗАЦИЯ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ')
|
685
779
|
expect(subject.funding_references.length).to eq(1)
|
686
|
-
expect(subject.funding_references.first).to eq(
|
687
|
-
|
688
|
-
expect(subject.
|
780
|
+
expect(subject.funding_references.first).to eq('awardNumber' => 'проект № 170100728',
|
781
|
+
'funderName' => 'РФФИ')
|
782
|
+
expect(subject.agency).to eq('datacite')
|
783
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
689
784
|
end
|
690
785
|
|
691
|
-
it
|
692
|
-
input = fixture_path
|
693
|
-
subject =
|
786
|
+
it 'BlogPosting from string' do
|
787
|
+
input = "#{fixture_path}datacite.xml"
|
788
|
+
subject = described_class.new(input: input)
|
694
789
|
expect(subject.valid?).to be true
|
695
|
-
expect(subject.types[
|
696
|
-
expect(subject.types[
|
697
|
-
expect(subject.types[
|
698
|
-
expect(subject.types[
|
699
|
-
expect(subject.types[
|
700
|
-
expect(subject.creators).to eq([{
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
expect(subject.
|
705
|
-
expect(subject.
|
790
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
791
|
+
expect(subject.types['resourceType']).to eq('BlogPosting')
|
792
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
793
|
+
expect(subject.types['ris']).to eq('RPRT')
|
794
|
+
expect(subject.types['citeproc']).to eq('article-journal')
|
795
|
+
expect(subject.creators).to eq([{
|
796
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0003-1419-2405',
|
797
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Fenner, Martin', 'givenName' => 'Martin', 'familyName' => 'Fenner'
|
798
|
+
}])
|
799
|
+
expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
800
|
+
expect(subject.id).to eq('https://doi.org/10.5438/4k3m-nyvg')
|
801
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'MS-49-3632-5083',
|
802
|
+
'identifierType' => 'Local accession number' }])
|
803
|
+
expect(subject.dates).to eq([{ 'date' => '2016-12-20', 'dateType' => 'Created' },
|
804
|
+
{ 'date' => '2016-12-20', 'dateType' => 'Issued' }, { 'date' => '2016-12-20', 'dateType' => 'Updated' }])
|
805
|
+
expect(subject.publication_year).to eq('2016')
|
706
806
|
expect(subject.related_identifiers.length).to eq(3)
|
707
|
-
expect(subject.related_identifiers.last).to eq(
|
708
|
-
|
807
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5438/0000-00ss',
|
808
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf')
|
809
|
+
expect(subject.agency).to eq('datacite')
|
709
810
|
end
|
710
811
|
|
711
|
-
it
|
712
|
-
input = fixture_path
|
713
|
-
subject =
|
812
|
+
it 'Schema 4.1 from string' do
|
813
|
+
input = "#{fixture_path}datacite-example-complicated-v4.1.xml"
|
814
|
+
subject = described_class.new(input: input)
|
714
815
|
expect(subject.valid?).to be true
|
715
|
-
expect(subject.types[
|
716
|
-
expect(subject.types[
|
717
|
-
expect(subject.types[
|
718
|
-
expect(subject.types[
|
719
|
-
expect(subject.types[
|
720
|
-
expect(subject.creators).to eq([{
|
721
|
-
[{
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
expect(subject.titles).to eq([{
|
726
|
-
|
727
|
-
|
728
|
-
expect(subject.
|
816
|
+
expect(subject.types['schemaOrg']).to eq('Book')
|
817
|
+
expect(subject.types['resourceType']).to eq('Monograph')
|
818
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
819
|
+
expect(subject.types['ris']).to eq('BOOK')
|
820
|
+
expect(subject.types['citeproc']).to eq('book')
|
821
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John', 'familyName' => 'Smith', 'nameIdentifiers' => [], 'affiliation' => [] }, { 'name' => 'つまらないものですが', 'nameIdentifiers' =>
|
822
|
+
[{ 'nameIdentifier' => 'http://isni.org/isni/0000000134596520',
|
823
|
+
'nameIdentifierScheme' => 'ISNI',
|
824
|
+
'schemeUri' => 'http://isni.org/isni/' }],
|
825
|
+
'affiliation' => [] }])
|
826
|
+
expect(subject.titles).to eq([{ 'title' => 'Właściwości rzutowań podprzestrzeniowych' },
|
827
|
+
{ 'title' => 'Translation of Polish titles',
|
828
|
+
'titleType' => 'TranslatedTitle' }])
|
829
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '937-0-4523-12357-6',
|
830
|
+
'identifierType' => 'ISBN' }])
|
831
|
+
expect(subject.dates).to eq([
|
832
|
+
{ 'date' => '2012-12-13', 'dateInformation' => 'Correction',
|
833
|
+
'dateType' => 'Other' }, { 'date' => '2010', 'dateType' => 'Issued' }
|
834
|
+
])
|
835
|
+
expect(subject.publication_year).to eq('2010')
|
729
836
|
expect(subject.related_identifiers.length).to eq(1)
|
730
|
-
expect(subject.related_identifiers.last).to eq(
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
expect(subject.
|
739
|
-
expect(subject.
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
837
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5272/oldertestpub',
|
838
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf', 'resourceTypeGeneral' => 'Text')
|
839
|
+
expect(subject.rights_list).to eq([{ 'lang' => 'eng',
|
840
|
+
'rights' => 'Creative Commons Attribution No Derivatives 2.0 Generic',
|
841
|
+
'rightsIdentifier' => 'cc-by-nd-2.0',
|
842
|
+
'rightsIdentifierScheme' => 'SPDX',
|
843
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
|
844
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
845
|
+
expect(subject.publisher).to eq('Springer')
|
846
|
+
expect(subject.agency).to eq('datacite')
|
847
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
848
|
+
end
|
849
|
+
|
850
|
+
it 'Schema 4.0 from string' do
|
851
|
+
input = "#{fixture_path}datacite-example-complicated-v4.0.xml"
|
852
|
+
subject = described_class.new(input: input)
|
745
853
|
expect(subject.valid?).to be true
|
746
|
-
expect(subject.types[
|
747
|
-
expect(subject.types[
|
748
|
-
expect(subject.types[
|
749
|
-
expect(subject.types[
|
750
|
-
expect(subject.types[
|
751
|
-
expect(subject.creators).to eq([{
|
752
|
-
[{
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
expect(subject.titles).to eq([{
|
757
|
-
|
758
|
-
|
759
|
-
expect(subject.
|
854
|
+
expect(subject.types['schemaOrg']).to eq('Book')
|
855
|
+
expect(subject.types['resourceType']).to eq('Monograph')
|
856
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
857
|
+
expect(subject.types['ris']).to eq('BOOK')
|
858
|
+
expect(subject.types['citeproc']).to eq('book')
|
859
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John', 'familyName' => 'Smith', 'nameIdentifiers' => [], 'affiliation' => [] }, { 'name' => 'つまらないものですが', 'nameIdentifiers' =>
|
860
|
+
[{ 'nameIdentifier' => 'http://isni.org/isni/0000000134596520',
|
861
|
+
'nameIdentifierScheme' => 'ISNI',
|
862
|
+
'schemeUri' => 'http://isni.org/isni/' }],
|
863
|
+
'affiliation' => [] }])
|
864
|
+
expect(subject.titles).to eq([{ 'title' => 'Właściwości rzutowań podprzestrzeniowych' },
|
865
|
+
{ 'title' => 'Translation of Polish titles',
|
866
|
+
'titleType' => 'TranslatedTitle' }])
|
867
|
+
expect(subject.id).to eq('https://doi.org/10.5072/testpub')
|
868
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '937-0-4523-12357-6',
|
869
|
+
'identifierType' => 'ISBN' }])
|
870
|
+
expect(subject.publication_year).to eq('2010')
|
760
871
|
expect(subject.related_identifiers.length).to eq(1)
|
761
|
-
expect(subject.related_identifiers.last).to eq(
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
expect(subject.
|
769
|
-
expect(subject.
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
872
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5272/oldertestpub',
|
873
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf')
|
874
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Attribution No Derivatives 2.0 Generic',
|
875
|
+
'rightsIdentifier' => 'cc-by-nd-2.0',
|
876
|
+
'rightsIdentifierScheme' => 'SPDX',
|
877
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
|
878
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
879
|
+
expect(subject.publisher).to eq('Springer')
|
880
|
+
expect(subject.agency).to eq('datacite')
|
881
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4.0')
|
882
|
+
end
|
883
|
+
|
884
|
+
it 'Schema 3 from string' do
|
885
|
+
input = "#{fixture_path}datacite_schema_3.xml"
|
886
|
+
subject = described_class.new(input: input)
|
775
887
|
expect(subject.valid?).to be true
|
776
|
-
expect(subject.types[
|
777
|
-
expect(subject.types[
|
778
|
-
expect(subject.types[
|
779
|
-
expect(subject.types[
|
780
|
-
expect(subject.types[
|
888
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
889
|
+
expect(subject.types['resourceType']).to eq('DataPackage')
|
890
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
891
|
+
expect(subject.types['ris']).to eq('DATA')
|
892
|
+
expect(subject.types['citeproc']).to eq('dataset')
|
781
893
|
expect(subject.creators.length).to eq(8)
|
782
|
-
expect(subject.creators.last).to eq(
|
783
|
-
|
784
|
-
expect(subject.
|
785
|
-
expect(subject.
|
786
|
-
|
787
|
-
|
788
|
-
|
894
|
+
expect(subject.creators.last).to eq('familyName' => 'Renaud', 'givenName' => 'François',
|
895
|
+
'name' => 'Renaud, François', 'nameType' => 'Personal', 'nameIdentifiers' => [], 'affiliation' => [])
|
896
|
+
expect(subject.titles).to eq([{ 'title' => 'Data from: A new malaria agent in African hominids.' }])
|
897
|
+
expect(subject.id).to eq('https://doi.org/10.5061/dryad.8515')
|
898
|
+
expect(subject.identifiers).to eq([{ 'identifier' =>
|
899
|
+
'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.',
|
900
|
+
'identifierType' => 'citation' }])
|
901
|
+
expect(subject.publication_year).to eq('2011')
|
789
902
|
expect(subject.related_identifiers.length).to eq(4)
|
790
|
-
expect(subject.related_identifiers.last).to eq(
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
expect(subject.
|
798
|
-
expect(subject.
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
903
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '19478877',
|
904
|
+
'relatedIdentifierType' => 'PMID', 'relationType' => 'IsReferencedBy')
|
905
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Zero v1.0 Universal',
|
906
|
+
'rightsIdentifier' => 'cc0-1.0',
|
907
|
+
'rightsIdentifierScheme' => 'SPDX',
|
908
|
+
'rightsUri' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
|
909
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
910
|
+
expect(subject.publisher).to eq('Dryad Digital Repository')
|
911
|
+
expect(subject.agency).to eq('datacite')
|
912
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3')
|
913
|
+
end
|
914
|
+
|
915
|
+
it 'Schema 3.0 from string' do
|
916
|
+
input = "#{fixture_path}datacite-example-complicated-v3.0.xml"
|
917
|
+
subject = described_class.new(input: input)
|
804
918
|
expect(subject.valid?).to be true
|
805
|
-
expect(subject.types[
|
806
|
-
expect(subject.types[
|
807
|
-
expect(subject.types[
|
808
|
-
expect(subject.types[
|
809
|
-
expect(subject.types[
|
810
|
-
expect(subject.creators).to eq([{
|
811
|
-
[{
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
expect(subject.titles).to eq([{
|
816
|
-
|
817
|
-
|
818
|
-
expect(subject.
|
919
|
+
expect(subject.types['schemaOrg']).to eq('Book')
|
920
|
+
expect(subject.types['resourceType']).to eq('Monograph')
|
921
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
922
|
+
expect(subject.types['ris']).to eq('BOOK')
|
923
|
+
expect(subject.types['citeproc']).to eq('book')
|
924
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John', 'familyName' => 'Smith', 'nameIdentifiers' => [], 'affiliation' => [] }, { 'name' => 'つまらないものですが', 'nameIdentifiers' =>
|
925
|
+
[{ 'nameIdentifier' => 'http://isni.org/isni/0000000134596520',
|
926
|
+
'nameIdentifierScheme' => 'ISNI',
|
927
|
+
'schemeUri' => 'http://isni.org/isni/' }],
|
928
|
+
'affiliation' => [] }])
|
929
|
+
expect(subject.titles).to eq([{ 'title' => 'Właściwości rzutowań podprzestrzeniowych' },
|
930
|
+
{ 'title' => 'Translation of Polish titles',
|
931
|
+
'titleType' => 'TranslatedTitle' }])
|
932
|
+
expect(subject.id).to eq('https://doi.org/10.5072/testpub')
|
933
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '937-0-4523-12357-6',
|
934
|
+
'identifierType' => 'ISBN' }])
|
935
|
+
expect(subject.publication_year).to eq('2010')
|
819
936
|
expect(subject.related_identifiers.length).to eq(1)
|
820
|
-
expect(subject.related_identifiers.last).to eq(
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
expect(subject.
|
828
|
-
expect(subject.
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
937
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5272/oldertestpub',
|
938
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf')
|
939
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'Creative Commons Attribution No Derivatives 2.0 Generic',
|
940
|
+
'rightsIdentifier' => 'cc-by-nd-2.0',
|
941
|
+
'rightsIdentifierScheme' => 'SPDX',
|
942
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
|
943
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
944
|
+
expect(subject.publisher).to eq('Springer')
|
945
|
+
expect(subject.agency).to eq('datacite')
|
946
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3.0')
|
947
|
+
end
|
948
|
+
|
949
|
+
it 'Schema 2.2 from string' do
|
950
|
+
input = "#{fixture_path}datacite-metadata-sample-complicated-v2.2.xml"
|
951
|
+
subject = described_class.new(input: input)
|
834
952
|
expect(subject.valid?).to be true
|
835
|
-
expect(subject.types[
|
836
|
-
expect(subject.types[
|
837
|
-
expect(subject.types[
|
838
|
-
expect(subject.types[
|
839
|
-
expect(subject.types[
|
840
|
-
expect(subject.creators).to eq([{
|
841
|
-
[{
|
842
|
-
|
843
|
-
|
844
|
-
expect(subject.titles).to eq([{
|
845
|
-
|
846
|
-
|
847
|
-
expect(subject.
|
953
|
+
expect(subject.types['schemaOrg']).to eq('Book')
|
954
|
+
expect(subject.types['resourceType']).to eq('Monograph')
|
955
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
956
|
+
expect(subject.types['ris']).to eq('BOOK')
|
957
|
+
expect(subject.types['citeproc']).to eq('book')
|
958
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John', 'familyName' => 'Smith', 'nameIdentifiers' => [], 'affiliation' => [] }, { 'name' => 'つまらないものですが', 'nameIdentifiers' =>
|
959
|
+
[{ 'nameIdentifier' => 'abc123',
|
960
|
+
'nameIdentifierScheme' => 'ISNI' }],
|
961
|
+
'affiliation' => [] }])
|
962
|
+
expect(subject.titles).to eq([{ 'title' => 'Właściwości rzutowań podprzestrzeniowych' },
|
963
|
+
{ 'title' => 'Translation of Polish titles',
|
964
|
+
'titleType' => 'TranslatedTitle' }])
|
965
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '937-0-4523-12357-6',
|
966
|
+
'identifierType' => 'ISBN' }])
|
967
|
+
expect(subject.dates).to eq([{ 'date' => '2009-04-29', 'dateType' => 'StartDate' },
|
968
|
+
{ 'date' => '2010-01-05', 'dateType' => 'EndDate' }, { 'date' => '2010', 'dateType' => 'Issued' }])
|
969
|
+
expect(subject.publication_year).to eq('2010')
|
848
970
|
expect(subject.related_identifiers.length).to eq(1)
|
849
|
-
expect(subject.related_identifiers.last).to eq(
|
850
|
-
|
851
|
-
expect(subject.
|
852
|
-
expect(subject.
|
971
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5272/oldertestpub',
|
972
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf')
|
973
|
+
expect(subject.publisher).to eq('Springer')
|
974
|
+
expect(subject.agency).to eq('datacite')
|
975
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-2.2')
|
853
976
|
end
|
854
977
|
|
855
|
-
it
|
856
|
-
input = fixture_path
|
857
|
-
subject =
|
978
|
+
it 'Schema 4.1 from string with doi in options' do
|
979
|
+
input = "#{fixture_path}datacite-example-complicated-v4.1.xml"
|
980
|
+
subject = described_class.new(input: input, doi: '10.5072/testpub2', content_url: 'https://example.org/report.pdf')
|
858
981
|
expect(subject.valid?).to be true
|
859
|
-
expect(subject.types[
|
860
|
-
expect(subject.types[
|
861
|
-
expect(subject.types[
|
862
|
-
expect(subject.creators).to eq([{
|
863
|
-
[{
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
expect(subject.titles).to eq([{
|
868
|
-
|
869
|
-
|
870
|
-
expect(subject.
|
871
|
-
expect(subject.
|
872
|
-
|
873
|
-
expect(subject.
|
874
|
-
|
875
|
-
|
982
|
+
expect(subject.types['schemaOrg']).to eq('Book')
|
983
|
+
expect(subject.types['resourceType']).to eq('Monograph')
|
984
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
985
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John', 'familyName' => 'Smith', 'nameIdentifiers' => [], 'affiliation' => [] }, { 'name' => 'つまらないものですが', 'nameIdentifiers' =>
|
986
|
+
[{ 'nameIdentifier' => 'http://isni.org/isni/0000000134596520',
|
987
|
+
'nameIdentifierScheme' => 'ISNI',
|
988
|
+
'schemeUri' => 'http://isni.org/isni/' }],
|
989
|
+
'affiliation' => [] }])
|
990
|
+
expect(subject.titles).to eq([{ 'title' => 'Właściwości rzutowań podprzestrzeniowych' },
|
991
|
+
{ 'title' => 'Translation of Polish titles',
|
992
|
+
'titleType' => 'TranslatedTitle' }])
|
993
|
+
expect(subject.id).to eq('https://doi.org/10.5072/testpub2')
|
994
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '937-0-4523-12357-6',
|
995
|
+
'identifierType' => 'ISBN' }])
|
996
|
+
expect(subject.dates).to eq([
|
997
|
+
{ 'date' => '2012-12-13', 'dateInformation' => 'Correction',
|
998
|
+
'dateType' => 'Other' }, { 'date' => '2010', 'dateType' => 'Issued' }
|
999
|
+
])
|
1000
|
+
expect(subject.publication_year).to eq('2010')
|
1001
|
+
expect(subject.sizes).to eq(['256 pages'])
|
1002
|
+
expect(subject.formats).to eq(['pdf'])
|
1003
|
+
expect(subject.content_url).to eq('https://example.org/report.pdf')
|
1004
|
+
expect(subject.publication_year).to eq('2010')
|
876
1005
|
expect(subject.related_identifiers.length).to eq(1)
|
877
|
-
expect(subject.related_identifiers.last).to eq(
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
expect(subject.
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
1006
|
+
expect(subject.related_identifiers.last).to eq('relatedIdentifier' => '10.5272/oldertestpub',
|
1007
|
+
'relatedIdentifierType' => 'DOI', 'relationType' => 'IsPartOf', 'resourceTypeGeneral' => 'Text')
|
1008
|
+
expect(subject.rights_list).to eq([{ 'lang' => 'eng',
|
1009
|
+
'rights' => 'Creative Commons Attribution No Derivatives 2.0 Generic',
|
1010
|
+
'rightsIdentifier' => 'cc-by-nd-2.0',
|
1011
|
+
'rightsIdentifierScheme' => 'SPDX',
|
1012
|
+
'rightsUri' => 'https://creativecommons.org/licenses/by-nd/2.0/legalcode',
|
1013
|
+
'schemeUri' => 'https://spdx.org/licenses/' }])
|
1014
|
+
expect(subject.publisher).to eq('Springer')
|
1015
|
+
expect(subject.agency).to eq('datacite')
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
it 'namespaced xml from string' do
|
1019
|
+
input = "#{fixture_path}ns0.xml"
|
1020
|
+
subject = described_class.new(input: input)
|
891
1021
|
expect(subject.valid?).to be true
|
892
|
-
expect(subject.id).to eq(
|
893
|
-
expect(subject.types[
|
894
|
-
expect(subject.types[
|
895
|
-
expect(subject.types[
|
1022
|
+
expect(subject.id).to eq('https://doi.org/10.4231/d38g8fk8b')
|
1023
|
+
expect(subject.types['schemaOrg']).to eq('SoftwareSourceCode')
|
1024
|
+
expect(subject.types['resourceType']).to eq('Simulation Tool')
|
1025
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Software')
|
896
1026
|
expect(subject.creators.length).to eq(5)
|
897
|
-
expect(subject.creators.first).to eq(
|
898
|
-
|
899
|
-
expect(subject.
|
900
|
-
expect(subject.
|
901
|
-
|
902
|
-
expect(subject.
|
903
|
-
expect(subject.
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
1027
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'name' => 'PatiñO, Carlos',
|
1028
|
+
'givenName' => 'Carlos', 'familyName' => 'PatiñO', 'nameIdentifiers' => [], 'affiliation' => [])
|
1029
|
+
expect(subject.titles).to eq([{ 'title' => 'LAMMPS Data-File Generator' }])
|
1030
|
+
expect(subject.dates).to eq([{ 'date' => '2018-07-18', 'dateType' => 'Valid' },
|
1031
|
+
{ 'date' => '2018-07-18', 'dateType' => 'Accepted' }, { 'date' => '2018', 'dateType' => 'Issued' }])
|
1032
|
+
expect(subject.publication_year).to eq('2018')
|
1033
|
+
expect(subject.publisher).to eq('nanoHUB')
|
1034
|
+
expect(subject.agency).to eq('datacite')
|
1035
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-2.2')
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
it 'Schema.org type' do
|
1039
|
+
input = 'https://doi.org/10.25318/3410014001-fra'
|
1040
|
+
subject = described_class.new(input: input)
|
909
1041
|
expect(subject.valid?).to be true
|
910
|
-
expect(subject.id).to eq(
|
911
|
-
expect(subject.types[
|
912
|
-
expect(subject.types[
|
913
|
-
expect(subject.types[
|
914
|
-
expect(subject.types[
|
915
|
-
expect(subject.types[
|
1042
|
+
expect(subject.id).to eq('https://doi.org/10.25318/3410014001-fra')
|
1043
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1044
|
+
expect(subject.types['resourceType'].nil?).to be(true)
|
1045
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1046
|
+
expect(subject.types['ris']).to eq('DATA')
|
1047
|
+
expect(subject.types['bibtex']).to eq('misc')
|
916
1048
|
expect(subject.creators.length).to eq(1)
|
917
|
-
expect(subject.creators.first).to eq(
|
918
|
-
|
919
|
-
|
920
|
-
|
1049
|
+
expect(subject.creators.first).to eq('affiliation' => [{ 'affiliationIdentifier' => 'https://ror.org/04zt3wx35', 'affiliationIdentifierScheme' => 'ROR', 'name' => 'Canada Mortgage and Housing Corporation' }],
|
1050
|
+
'name' => 'Statistique Canada',
|
1051
|
+
'nameIdentifiers' => [],
|
1052
|
+
'nameType' => 'Organizational')
|
921
1053
|
end
|
922
1054
|
|
923
|
-
it
|
924
|
-
input =
|
925
|
-
subject =
|
1055
|
+
it 'doi with + sign' do
|
1056
|
+
input = '10.5067/terra+aqua/ceres/cldtyphist_l3.004'
|
1057
|
+
subject = described_class.new(input: input)
|
926
1058
|
expect(subject.valid?).to be true
|
927
|
-
expect(subject.id).to eq(
|
928
|
-
expect(subject.types[
|
929
|
-
expect(subject.types[
|
930
|
-
expect(subject.creators).to eq([{
|
931
|
-
|
932
|
-
expect(subject.
|
933
|
-
expect(subject.
|
934
|
-
expect(subject.
|
935
|
-
expect(subject.
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
1059
|
+
expect(subject.id).to eq('https://doi.org/10.5067/terra+aqua/ceres/cldtyphist_l3.004')
|
1060
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1061
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1062
|
+
expect(subject.creators).to eq([{ 'familyName' => 'Wong', 'givenName' => 'Takmeng',
|
1063
|
+
'name' => 'Wong, Takmeng' }])
|
1064
|
+
expect(subject.titles).to eq([{ 'title' => 'CERES Level 3 Cloud Type Historgram Terra+Aqua HDF file - Edition4' }])
|
1065
|
+
expect(subject.publication_year).to eq('2016')
|
1066
|
+
expect(subject.publisher).to eq('NASA Langley Atmospheric Science Data Center DAAC')
|
1067
|
+
expect(subject.agency).to eq('datacite')
|
1068
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
it 'subject scheme' do
|
1072
|
+
input = 'https://doi.org/10.4232/1.2745'
|
1073
|
+
subject = described_class.new(input: input)
|
941
1074
|
expect(subject.valid?).to be true
|
942
|
-
expect(subject.id).to eq(
|
943
|
-
expect(subject.identifiers).to eq([{
|
944
|
-
|
945
|
-
|
946
|
-
expect(subject.types[
|
947
|
-
expect(subject.
|
1075
|
+
expect(subject.id).to eq('https://doi.org/10.4232/1.2745')
|
1076
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'ZA2745', 'identifierType' => 'ZA-No.' },
|
1077
|
+
{ 'identifier' => 'Internationale Umfrageprogramme',
|
1078
|
+
'identifierType' => 'FDZ' }])
|
1079
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1080
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1081
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Organizational',
|
1082
|
+
'name' => 'Europäische Kommission', 'nameIdentifiers' => [], 'affiliation' => [] }])
|
948
1083
|
expect(subject.contributors.length).to eq(18)
|
949
|
-
expect(subject.contributors.first).to eq(
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
subject
|
1084
|
+
expect(subject.contributors.first).to eq(
|
1085
|
+
'affiliation' => [{ 'name' => 'Europäische Kommission, Brüssel' }], 'contributorType' => 'Researcher', 'familyName' => 'Reif', 'givenName' => 'Karlheinz', 'name' => 'Reif, Karlheinz', 'nameType' => 'Personal', 'nameIdentifiers' => []
|
1086
|
+
)
|
1087
|
+
expect(subject.titles).to eq([
|
1088
|
+
{ 'lang' => 'de',
|
1089
|
+
'title' => 'Flash Eurobarometer 54 (Madrid Summit)' }, { 'lang' => 'en', 'title' => 'Flash Eurobarometer 54 (Madrid Summit)' }, { 'titleType' => 'Subtitle', 'lang' => 'de', 'title' => 'The Common European Currency' }, { 'titleType' => 'Subtitle', 'lang' => 'en', 'title' => 'The Common European Currency' }
|
1090
|
+
])
|
1091
|
+
expect(subject.subjects).to eq([{ 'lang' => 'en',
|
1092
|
+
'subject' => 'KAT12 International Institutions, Relations, Conditions',
|
1093
|
+
'subjectScheme' => 'ZA' },
|
1094
|
+
{ 'lang' => 'de',
|
1095
|
+
'subject' => 'Internationale Politik und Institutionen',
|
1096
|
+
'subjectScheme' => 'CESSDA Topic Classification' },
|
1097
|
+
{ 'lang' => 'de',
|
1098
|
+
'subject' => 'Regierung, politische Systeme, Parteien und Verbände',
|
1099
|
+
'subjectScheme' => 'CESSDA Topic Classification' },
|
1100
|
+
{ 'lang' => 'de',
|
1101
|
+
'subject' => 'Wirtschaftssysteme und wirtschaftliche Entwicklung',
|
1102
|
+
'subjectScheme' => 'CESSDA Topic Classification' },
|
1103
|
+
{ 'lang' => 'en',
|
1104
|
+
'subject' => 'International politics and organisation',
|
1105
|
+
'subjectScheme' => 'CESSDA Topic Classification' },
|
1106
|
+
{ 'lang' => 'en',
|
1107
|
+
'subject' => 'Government, political systems and organisation',
|
1108
|
+
'subjectScheme' => 'CESSDA Topic Classification' },
|
1109
|
+
{ 'lang' => 'en',
|
1110
|
+
'subject' => 'Economic systems and development',
|
1111
|
+
'subjectScheme' => 'CESSDA Topic Classification' }])
|
1112
|
+
expect(subject.dates).to eq([{ 'date' => '1995-12', 'dateType' => 'Collected' },
|
1113
|
+
{ 'date' => '1996', 'dateType' => 'Issued' }])
|
1114
|
+
expect(subject.publication_year).to eq('1996')
|
1115
|
+
expect(subject.publisher).to eq('GESIS Data Archive')
|
1116
|
+
expect(subject.agency).to eq('datacite')
|
1117
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
it 'series-information' do
|
1121
|
+
input = 'https://doi.org/10.4229/23RDEUPVSEC2008-5CO.8.3'
|
1122
|
+
subject = described_class.new(input: input)
|
982
1123
|
expect(subject.valid?).to be true
|
983
|
-
expect(subject.id).to eq(
|
984
|
-
expect(subject.identifiers).to eq([{
|
985
|
-
|
986
|
-
expect(subject.types[
|
987
|
-
expect(subject.types[
|
1124
|
+
expect(subject.id).to eq('https://doi.org/10.4229/23rdeupvsec2008-5co.8.3')
|
1125
|
+
expect(subject.identifiers).to eq([{ 'identifier' => '3-936338-24-8',
|
1126
|
+
'identifierType' => 'ISBN' }])
|
1127
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
1128
|
+
expect(subject.types['resourceType']).to eq('Article')
|
1129
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
988
1130
|
expect(subject.creators.length).to eq(3)
|
989
|
-
expect(subject.creators.first).to eq(
|
990
|
-
|
991
|
-
expect(subject.
|
992
|
-
expect(subject.
|
993
|
-
|
994
|
-
expect(subject.
|
995
|
-
expect(subject.
|
996
|
-
|
997
|
-
expect(subject.
|
998
|
-
expect(subject.
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1131
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'name' => 'Llamas, P.',
|
1132
|
+
'givenName' => 'P.', 'familyName' => 'Llamas', 'nameIdentifiers' => [], 'affiliation' => [])
|
1133
|
+
expect(subject.titles).to eq([{ 'title' => 'Rural Electrification With Hybrid Power Systems Based on Renewables - Technical System Configurations From the Point of View of the European Industry' }])
|
1134
|
+
expect(subject.dates).to eq([{ 'date' => '2008-11-01', 'dateType' => 'Valid' },
|
1135
|
+
{ 'date' => '2008', 'dateType' => 'Issued' }])
|
1136
|
+
expect(subject.publication_year).to eq('2008')
|
1137
|
+
expect(subject.container).to eq('firstPage' => 'Spain; 3353', 'lastPage' => '3356',
|
1138
|
+
'title' => '23rd European Photovoltaic Solar Energy Conference and Exhibition', 'type' => 'Series', 'volume' => '1-5 September 2008')
|
1139
|
+
expect(subject.descriptions[1]['description']).to start_with('Aim of this paper is the presentation')
|
1140
|
+
expect(subject.subjects).to eq([{ 'subject' => 'pv systems' },
|
1141
|
+
{ 'subject' => 'off-grid applications' }])
|
1142
|
+
expect(subject.publisher).to eq('WIP-Munich')
|
1143
|
+
expect(subject.agency).to eq('datacite')
|
1144
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-2.2')
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
it 'content url' do
|
1148
|
+
input = '10.23725/8na3-9s47'
|
1149
|
+
subject = described_class.new(input: input)
|
1004
1150
|
expect(subject.valid?).to be true
|
1005
|
-
expect(subject.doi).to eq(
|
1006
|
-
expect(subject.id).to eq(
|
1007
|
-
expect(subject.identifiers).to eq([{
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1151
|
+
expect(subject.doi).to eq('10.23725/8na3-9s47')
|
1152
|
+
expect(subject.id).to eq('https://doi.org/10.23725/8na3-9s47')
|
1153
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'ark:/99999/fk41CrU4eszeLUDe', 'identifierType' => 'minid' },
|
1154
|
+
{ 'identifier' => 'dg.4503/c3d66dc9-58da-411c-83c4-dd656aa3c4b7',
|
1155
|
+
'identifierType' => 'dataguid' },
|
1156
|
+
{ 'identifier' => '3b33f6b9338fccab0901b7d317577ea3',
|
1157
|
+
'identifierType' => 'md5' }])
|
1158
|
+
expect(subject.content_url).to include(
|
1159
|
+
's3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram', 'gs://topmed-irc-share/public/NWD165827.recab.cram'
|
1160
|
+
)
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
it 'empty subject' do
|
1164
|
+
input = 'https://doi.org/10.18169/PAPDEOTTX00502'
|
1165
|
+
subject = described_class.new(input: input)
|
1017
1166
|
expect(subject.valid?).to be true
|
1018
|
-
expect(subject.id).to eq(
|
1019
|
-
expect(subject.identifiers).to eq([{
|
1020
|
-
|
1021
|
-
|
1022
|
-
expect(subject.types[
|
1023
|
-
expect(subject.
|
1024
|
-
expect(subject.
|
1025
|
-
expect(subject.
|
1026
|
-
|
1027
|
-
expect(subject.
|
1028
|
-
expect(subject.
|
1029
|
-
expect(subject.
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1167
|
+
expect(subject.id).to eq('https://doi.org/10.18169/papdeottx00502')
|
1168
|
+
expect(subject.identifiers).to eq([{
|
1169
|
+
'identifier' => 'http://www.priorartregister.com/resolve.php?disclosure=OTTX00502', 'identifierType' => 'URL'
|
1170
|
+
}])
|
1171
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1172
|
+
expect(subject.types['resourceType']).to eq('Disclosure')
|
1173
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1174
|
+
expect(subject.creators).to eq([{ 'name' => 'Anonymous', 'nameIdentifiers' => [],
|
1175
|
+
'affiliation' => [] }])
|
1176
|
+
expect(subject.titles).to eq([{ 'title' => 'Messung der Bildunschaerfe in H.264-codierten Bildern und Videosequenzen' }])
|
1177
|
+
expect(subject.dates).to eq([{ 'date' => '2017', 'dateType' => 'Issued' }])
|
1178
|
+
expect(subject.publication_year).to eq('2017')
|
1179
|
+
expect(subject.publisher).to eq('Siemens AG')
|
1180
|
+
expect(subject.agency).to eq('datacite')
|
1181
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3')
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
it 'leading and trailing whitespace' do
|
1185
|
+
input = 'https://doi.org/10.21944/temis-OZONE-MSR2'
|
1186
|
+
subject = described_class.new(input: input)
|
1035
1187
|
|
1036
1188
|
expect(subject.valid?).to be true
|
1037
|
-
#expect(subject.errors.length).to eq(2)
|
1038
|
-
#expect(subject.errors.last).to eq("33:0: ERROR: Element '{http://datacite.org/schema/kernel-4}date': '1970-04-01 / (:tba)' is not a valid value of the atomic type '{http://datacite.org/schema/kernel-4}edtf'.")
|
1039
|
-
expect(subject.id).to eq(
|
1040
|
-
expect(subject.types[
|
1041
|
-
expect(subject.types[
|
1042
|
-
expect(subject.types[
|
1043
|
-
expect(subject.creators).to eq([{
|
1044
|
-
|
1045
|
-
[{
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
expect(subject.
|
1066
|
-
expect(subject.
|
1067
|
-
expect(subject.
|
1068
|
-
|
1069
|
-
expect(subject.
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1189
|
+
# expect(subject.errors.length).to eq(2)
|
1190
|
+
# expect(subject.errors.last).to eq("33:0: ERROR: Element '{http://datacite.org/schema/kernel-4}date': '1970-04-01 / (:tba)' is not a valid value of the atomic type '{http://datacite.org/schema/kernel-4}edtf'.")
|
1191
|
+
expect(subject.id).to eq('https://doi.org/10.21944/temis-ozone-msr2')
|
1192
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1193
|
+
expect(subject.types['resourceType']).to eq('Satellite data')
|
1194
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1195
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal',
|
1196
|
+
'nameIdentifiers' =>
|
1197
|
+
[{ 'nameIdentifier' => 'https://orcid.org/0000-0002-0077-5338',
|
1198
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }],
|
1199
|
+
'name' => 'Van Der A, Ronald',
|
1200
|
+
'givenName' => 'Ronald',
|
1201
|
+
'familyName' => 'Van Der A',
|
1202
|
+
'affiliation' => [{ 'name' => 'Royal Netherlands Meteorological Institute (KNMI)' }] },
|
1203
|
+
{ 'nameType' => 'Personal',
|
1204
|
+
'name' => 'Allaart, Marc',
|
1205
|
+
'givenName' => 'Marc',
|
1206
|
+
'familyName' => 'Allaart',
|
1207
|
+
'affiliation' => [{ 'name' => 'Royal Netherlands Meteorological Institute (KNMI)' }],
|
1208
|
+
'nameIdentifiers' => [] },
|
1209
|
+
{ 'nameType' => 'Personal',
|
1210
|
+
'name' => 'Eskes, Henk',
|
1211
|
+
'givenName' => 'Henk',
|
1212
|
+
'familyName' => 'Eskes',
|
1213
|
+
'nameIdentifiers' => [{
|
1214
|
+
'nameIdentifier' => 'https://orcid.org/0000-0002-8743-4455', 'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org'
|
1215
|
+
}],
|
1216
|
+
'affiliation' => [{ 'name' => 'Royal Netherlands Meteorological Institute (KNMI)' }] }])
|
1217
|
+
expect(subject.titles).to eq([{ 'title' => 'Multi-Sensor Reanalysis (MSR) of total ozone, version 2' }])
|
1218
|
+
expect(subject.version_info).to eq('2')
|
1219
|
+
expect(subject.dates).to eq([{ 'date' => '2014-04-25', 'dateType' => 'Available' },
|
1220
|
+
{ 'date' => '2015', 'dateType' => 'Issued' }])
|
1221
|
+
expect(subject.publication_year).to eq('2015')
|
1222
|
+
expect(subject.publisher).to eq('Royal Netherlands Meteorological Institute (KNMI)')
|
1223
|
+
expect(subject.agency).to eq('datacite')
|
1224
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
it 'DOI not found' do
|
1228
|
+
input = 'https://doi.org/10.4124/05F6C379-DD68-4CDB-880D-33D3E9576D52/1'
|
1229
|
+
subject = described_class.new(input: input)
|
1075
1230
|
expect(subject.valid?).to be false
|
1076
|
-
expect(subject.id).to eq(
|
1077
|
-
expect(subject.doi).to eq(
|
1078
|
-
expect(subject.agency).to eq(
|
1079
|
-
expect(subject.state).to eq(
|
1231
|
+
expect(subject.id).to eq('https://doi.org/10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1')
|
1232
|
+
expect(subject.doi).to eq('10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1')
|
1233
|
+
expect(subject.agency).to eq('datacite')
|
1234
|
+
expect(subject.state).to eq('not_found')
|
1080
1235
|
end
|
1081
1236
|
|
1082
|
-
it
|
1083
|
-
input =
|
1084
|
-
subject =
|
1237
|
+
it 'DOI in staging system' do
|
1238
|
+
input = 'https://handle.stage.datacite.org/10.22002/d1.694'
|
1239
|
+
subject = described_class.new(input: input, sandbox: true)
|
1085
1240
|
expect(subject.valid?).to be true
|
1086
|
-
expect(subject.id).to eq(
|
1087
|
-
expect(subject.types[
|
1088
|
-
expect(subject.types[
|
1089
|
-
expect(subject.creators).to eq([{
|
1090
|
-
|
1091
|
-
expect(subject.
|
1092
|
-
expect(subject.
|
1093
|
-
expect(subject.
|
1094
|
-
expect(subject.
|
1095
|
-
expect(subject.
|
1096
|
-
expect(subject.
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1241
|
+
expect(subject.id).to eq('https://handle.stage.datacite.org/10.22002/d1.694')
|
1242
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1243
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1244
|
+
expect(subject.creators).to eq([{ 'affiliation' => [{ 'name' => 'Caltech' }], 'name' => 'Tester',
|
1245
|
+
'nameIdentifiers' => [] }])
|
1246
|
+
expect(subject.titles).to eq([{ 'title' => 'Test license' }])
|
1247
|
+
expect(subject.dates).to eq([{ 'date' => '2018-01-12', 'dateType' => 'Issued' }])
|
1248
|
+
expect(subject.publication_year).to eq('2018')
|
1249
|
+
expect(subject.publisher).to eq('CaltechDATA')
|
1250
|
+
expect(subject.agency).to eq('datacite')
|
1251
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1252
|
+
expect(subject.state).to eq('findable')
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
it 'DOI in staging system schema 3' do
|
1256
|
+
input = '10.21956/wellcomeopenres.25947.r17364'
|
1257
|
+
subject = described_class.new(input: input, doi: input, sandbox: true)
|
1102
1258
|
expect(subject.valid?).to be true
|
1103
|
-
expect(subject.id).to eq(
|
1104
|
-
expect(subject.types[
|
1105
|
-
expect(subject.types[
|
1106
|
-
expect(subject.creators).to eq([{
|
1107
|
-
|
1108
|
-
expect(subject.
|
1109
|
-
expect(subject.
|
1110
|
-
expect(subject.
|
1111
|
-
expect(subject.
|
1112
|
-
expect(subject.
|
1113
|
-
expect(subject.
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1259
|
+
expect(subject.id).to eq('https://handle.stage.datacite.org/10.21956/wellcomeopenres.25947.r17364')
|
1260
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
1261
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
1262
|
+
expect(subject.creators).to eq([{ 'name' => 'Fran2 Levy', 'nameIdentifiers' => [],
|
1263
|
+
'affiliation' => [] }])
|
1264
|
+
expect(subject.titles).to eq([{ 'title' => 'Referee report. For: FL Regression Wellcome [version 1; referees: retracted]' }])
|
1265
|
+
expect(subject.dates).to eq([{ 'date' => '2018', 'dateType' => 'Issued' }])
|
1266
|
+
expect(subject.publication_year).to eq('2018')
|
1267
|
+
expect(subject.publisher).to eq('F1000 Research Limited')
|
1268
|
+
expect(subject.agency).to eq('datacite')
|
1269
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3')
|
1270
|
+
expect(subject.state).to eq('findable')
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
it 'Referee report in staging system' do
|
1274
|
+
input = '10.21956/gatesopenres.530.r190'
|
1275
|
+
subject = described_class.new(input: input, sandbox: true)
|
1119
1276
|
expect(subject.valid?).to be true
|
1120
|
-
expect(subject.id).to eq(
|
1121
|
-
expect(subject.types[
|
1122
|
-
expect(subject.types[
|
1123
|
-
expect(subject.types[
|
1124
|
-
expect(subject.types[
|
1277
|
+
expect(subject.id).to eq('https://handle.stage.datacite.org/10.21956/gatesopenres.530.r190')
|
1278
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
1279
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
1280
|
+
expect(subject.types['ris']).to eq('RPRT')
|
1281
|
+
expect(subject.types['citeproc']).to eq('article-journal')
|
1125
1282
|
expect(subject.creators.length).to eq(5)
|
1126
|
-
expect(subject.creators.first).to eq(
|
1127
|
-
|
1128
|
-
expect(subject.
|
1129
|
-
expect(subject.
|
1130
|
-
expect(subject.
|
1131
|
-
expect(subject.
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1283
|
+
expect(subject.creators.first).to eq('nameType' => 'Personal', 'name' => 'Patel, Lina',
|
1284
|
+
'givenName' => 'Lina', 'familyName' => 'Patel', 'nameIdentifiers' => [], 'affiliation' => [])
|
1285
|
+
expect(subject.titles).to eq([{ 'title' => 'Referee report. For: Gates - add article keywords to the metatags [version 2; referees: 1 approved]' }])
|
1286
|
+
expect(subject.publication_year).to eq('2018')
|
1287
|
+
expect(subject.publisher).to eq('Gates Open Research')
|
1288
|
+
expect(subject.agency).to eq('datacite')
|
1289
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3')
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
it 'multiple rights' do
|
1293
|
+
input = "#{fixture_path}datacite-multiple-rights.xml"
|
1294
|
+
subject = described_class.new(input: input)
|
1137
1295
|
expect(subject.valid?).to be true
|
1138
|
-
expect(subject.rights_list).to eq([{
|
1296
|
+
expect(subject.rights_list).to eq([{ 'rights' => 'info:eu-repo/semantics/openAccess' },
|
1297
|
+
{ 'rights' => 'Open Access',
|
1298
|
+
'rightsUri' => 'info:eu-repo/semantics/openAccess' }])
|
1139
1299
|
end
|
1140
1300
|
|
1141
|
-
it
|
1142
|
-
input = fixture_path
|
1143
|
-
subject =
|
1301
|
+
it ':tba' do
|
1302
|
+
input = "#{fixture_path}datacite-example-complicated-tba.xml"
|
1303
|
+
subject = described_class.new(input: input)
|
1144
1304
|
expect(subject.valid?).to be true
|
1145
|
-
expect(subject.titles).to eq([{
|
1146
|
-
expect(subject.formats).to eq([
|
1147
|
-
expect(subject.dates).to eq([
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1305
|
+
expect(subject.titles).to eq([{ 'title' => ':unav' }])
|
1306
|
+
expect(subject.formats).to eq([':null'])
|
1307
|
+
expect(subject.dates).to eq([
|
1308
|
+
{ 'date' => ':tba', 'dateInformation' => 'Correction',
|
1309
|
+
'dateType' => 'Other' }, { 'date' => '2010', 'dateType' => 'Issued' }
|
1310
|
+
])
|
1311
|
+
end
|
1312
|
+
|
1313
|
+
it 'ancient-dates' do
|
1314
|
+
input = "#{fixture_path}datacite-example-ancientdates-v4.3.xml"
|
1315
|
+
subject = described_class.new(input: input)
|
1316
|
+
# expect(subject.valid?).to be true
|
1317
|
+
expect(subject.dates).to eq([
|
1318
|
+
{ 'date' => '-0024/-0022', 'dateInformation' => 'from 25 BC to 23 BC',
|
1319
|
+
'dateType' => 'Created' }, { 'date' => '2010', 'dateType' => 'Issued' }
|
1320
|
+
])
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
# TODO: properly handle escaped text
|
1324
|
+
it 'escaped text' do
|
1325
|
+
input = "#{fixture_path}datacite-example-escaped-text.xml"
|
1326
|
+
subject = described_class.new(input: input)
|
1161
1327
|
expect(subject.valid?).to be true
|
1162
|
-
expect(subject.titles).to eq([{
|
1328
|
+
expect(subject.titles).to eq([{ 'title' => 'Some initial text' }])
|
1163
1329
|
end
|
1164
1330
|
|
1165
|
-
it
|
1166
|
-
input = fixture_path
|
1167
|
-
subject =
|
1168
|
-
expect(subject.creators).to
|
1331
|
+
it 'missing creators' do
|
1332
|
+
input = "#{fixture_path}datacite_missing_creator.xml"
|
1333
|
+
subject = described_class.new(input: input, regenerate: true)
|
1334
|
+
expect(subject.creators.blank?).to be(true)
|
1169
1335
|
expect(subject.valid?).to be false
|
1170
1336
|
expect(subject.errors).to eq("4:0: ERROR: Element '{http://datacite.org/schema/kernel-4}creators': Missing child element(s). Expected is ( {http://datacite.org/schema/kernel-4}creator ).")
|
1171
1337
|
end
|
1172
1338
|
|
1173
|
-
it
|
1174
|
-
input = fixture_path
|
1175
|
-
subject =
|
1176
|
-
expect(subject.creators).to
|
1339
|
+
it 'malformed creators' do
|
1340
|
+
input = "#{fixture_path}datacite_malformed_creator.xml"
|
1341
|
+
subject = described_class.new(input: input, regenerate: false)
|
1342
|
+
expect(subject.creators.blank?).to be(true)
|
1177
1343
|
expect(subject.valid?).to be false
|
1178
1344
|
expect(subject.errors).to eq("16:0: ERROR: Element '{http://datacite.org/schema/kernel-4}creatorName': This element is not expected. Expected is ( {http://datacite.org/schema/kernel-4}affiliation ).")
|
1179
1345
|
end
|
1180
1346
|
|
1181
|
-
it
|
1182
|
-
input = fixture_path
|
1183
|
-
subject =
|
1347
|
+
it 'empty funding references' do
|
1348
|
+
input = "#{fixture_path}funding_reference.xml"
|
1349
|
+
subject = described_class.new(input: input, regenerate: false)
|
1184
1350
|
expect(subject.valid?).to be false
|
1185
|
-
expect(subject.funding_references).to eq([{
|
1351
|
+
expect(subject.funding_references).to eq([{ 'funderName' => 'Agency for Science, Technology and Research (Singapore)' }])
|
1186
1352
|
expect(subject.errors.first).to eq("31:0: ERROR: Element '{http://datacite.org/schema/kernel-4}fundingReference': Missing child element(s). Expected is one of ( {http://datacite.org/schema/kernel-4}funderName, {http://datacite.org/schema/kernel-4}funderIdentifier, {http://datacite.org/schema/kernel-4}awardNumber, {http://datacite.org/schema/kernel-4}awardTitle ).")
|
1187
1353
|
end
|
1188
1354
|
|
1189
|
-
it
|
1190
|
-
input = fixture_path
|
1191
|
-
subject =
|
1355
|
+
it 'space in sizes' do
|
1356
|
+
input = "#{fixture_path}datacite-space-in-sizes.xml"
|
1357
|
+
subject = described_class.new(input: input, regenerate: false)
|
1192
1358
|
expect(subject.valid?).to be true
|
1193
|
-
expect(subject.sizes).to
|
1194
|
-
expect(subject.related_identifiers).to eq([{
|
1195
|
-
|
1196
|
-
|
1359
|
+
expect(subject.sizes.empty?).to be(true)
|
1360
|
+
expect(subject.related_identifiers).to eq([{ 'relatedIdentifier' => '10.1016/s0040-1951(03)00197-5',
|
1361
|
+
'relatedIdentifierType' => 'DOI',
|
1362
|
+
'relationType' => 'IsCitedBy' }])
|
1197
1363
|
end
|
1198
1364
|
|
1199
|
-
it
|
1200
|
-
input = fixture_path
|
1201
|
-
subject =
|
1365
|
+
it 'formats with xs' do
|
1366
|
+
input = "#{fixture_path}datacite-formats-with-xs.xml"
|
1367
|
+
subject = described_class.new(input: input, regenerate: false)
|
1202
1368
|
expect(subject.valid?).to be true
|
1203
|
-
expect(subject.formats).to eq([
|
1369
|
+
expect(subject.formats).to eq(['PDF'])
|
1204
1370
|
end
|
1205
1371
|
|
1206
|
-
it
|
1207
|
-
input =
|
1208
|
-
subject =
|
1372
|
+
it 'dissertation' do
|
1373
|
+
input = '10.3204/desy-2014-01645'
|
1374
|
+
subject = described_class.new(input: input)
|
1209
1375
|
expect(subject.valid?).to be true
|
1210
|
-
expect(subject.id).to eq(
|
1211
|
-
expect(subject.types[
|
1212
|
-
expect(subject.types[
|
1213
|
-
expect(subject.types[
|
1214
|
-
expect(subject.types[
|
1215
|
-
expect(subject.types[
|
1216
|
-
expect(subject.creators).to eq([{
|
1217
|
-
|
1218
|
-
expect(subject.
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
expect(subject.
|
1223
|
-
expect(subject.
|
1224
|
-
expect(subject.
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1376
|
+
expect(subject.id).to eq('https://doi.org/10.3204/desy-2014-01645')
|
1377
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
1378
|
+
expect(subject.types['resourceType']).to eq('Dissertation')
|
1379
|
+
expect(subject.types['schemaOrg']).to eq('Thesis')
|
1380
|
+
expect(subject.types['bibtex']).to eq('phdthesis')
|
1381
|
+
expect(subject.types['citeproc']).to eq('thesis')
|
1382
|
+
expect(subject.creators).to eq([{ 'nameType' => 'Personal', 'name' => 'Conrad, Heiko',
|
1383
|
+
'givenName' => 'Heiko', 'familyName' => 'Conrad', 'nameIdentifiers' => [], 'affiliation' => [] }])
|
1384
|
+
expect(subject.titles).to eq([{ 'title' => 'Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy' }])
|
1385
|
+
expect(subject.dates).to eq([{ 'date' => '2014', 'dateType' => 'Issued' },
|
1386
|
+
{ 'date' => '2014', 'dateType' => 'Copyrighted' },
|
1387
|
+
{ 'date' => '2009-10-01/2014-01-23', 'dateType' => 'Created' }])
|
1388
|
+
expect(subject.publication_year).to eq('2014')
|
1389
|
+
expect(subject.publisher).to eq('Deutsches Elektronen-Synchrotron, DESY, Hamburg')
|
1390
|
+
expect(subject.agency).to eq('datacite')
|
1391
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-3')
|
1392
|
+
end
|
1393
|
+
|
1394
|
+
it 'funding references' do
|
1395
|
+
input = '10.26102/2310-6018/2019.24.1.006'
|
1396
|
+
subject = described_class.new(input: input)
|
1230
1397
|
expect(subject.valid?).to be true
|
1231
|
-
expect(subject.id).to eq(
|
1232
|
-
expect(subject.types[
|
1233
|
-
expect(subject.types[
|
1234
|
-
expect(subject.types[
|
1235
|
-
expect(subject.types[
|
1236
|
-
expect(subject.types[
|
1398
|
+
expect(subject.id).to eq('https://doi.org/10.26102/2310-6018/2019.24.1.006')
|
1399
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Text')
|
1400
|
+
expect(subject.types['resourceType']).to eq('Journal Article')
|
1401
|
+
expect(subject.types['schemaOrg']).to eq('ScholarlyArticle')
|
1402
|
+
expect(subject.types['bibtex']).to eq('article')
|
1403
|
+
expect(subject.types['citeproc']).to eq('article-journal')
|
1237
1404
|
expect(subject.creators.length).to eq(2)
|
1238
|
-
expect(subject.creators.first).to eq(
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
expect(subject.titles.last).to eq(
|
1245
|
-
|
1246
|
-
expect(subject.
|
1247
|
-
expect(subject.
|
1405
|
+
expect(subject.creators.first).to eq('affiliation' => [{ 'name' => 'Тверская государственная сельскохозяйственная академия' }],
|
1406
|
+
'familyName' => 'Ганичева',
|
1407
|
+
'givenName' => 'А.В.',
|
1408
|
+
'name' => 'Ганичева, А.В.',
|
1409
|
+
'nameIdentifiers' => [],
|
1410
|
+
'nameType' => 'Personal')
|
1411
|
+
expect(subject.titles.last).to eq('title' => 'MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING',
|
1412
|
+
'titleType' => 'TranslatedTitle')
|
1413
|
+
expect(subject.dates).to eq([{ 'date' => '2019-02-09', 'dateType' => 'Issued' }])
|
1414
|
+
expect(subject.publication_year).to eq('2019')
|
1415
|
+
expect(subject.publisher).to eq('МОДЕЛИРОВАНИЕ, ОПТИМИЗАЦИЯ И ИНФОРМАЦИОННЫЕ ТЕХНОЛОГИИ')
|
1248
1416
|
expect(subject.funding_references.count).to eq(1)
|
1249
|
-
expect(subject.funding_references.first).to eq(
|
1250
|
-
|
1251
|
-
expect(subject.
|
1417
|
+
expect(subject.funding_references.first).to eq('awardNumber' => 'проект № 170100728',
|
1418
|
+
'funderName' => 'РФФИ')
|
1419
|
+
expect(subject.agency).to eq('datacite')
|
1420
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1252
1421
|
end
|
1253
1422
|
|
1254
|
-
it
|
1255
|
-
input =
|
1256
|
-
subject =
|
1423
|
+
it 'DOI in with related id system' do
|
1424
|
+
input = 'https://doi.org/10.4121/uuid:3926db30-f712-4394-aebc-75976070e91f'
|
1425
|
+
subject = described_class.new(input: input)
|
1257
1426
|
expect(subject.valid?).to be true
|
1258
|
-
expect(subject.id).to eq(
|
1259
|
-
expect(subject.types[
|
1260
|
-
expect(subject.types[
|
1261
|
-
expect(subject.titles).to eq([{
|
1262
|
-
expect(subject.dates).to eq([{
|
1263
|
-
expect(subject.publication_year).to eq(
|
1264
|
-
expect(subject.state).to eq(
|
1427
|
+
expect(subject.id).to eq('https://doi.org/10.4121/uuid:3926db30-f712-4394-aebc-75976070e91f')
|
1428
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1429
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1430
|
+
expect(subject.titles).to eq([{ 'title' => 'BPI Challenge 2012' }])
|
1431
|
+
expect(subject.dates).to eq([{ 'date' => '2012-04-23', 'dateType' => 'Issued' }])
|
1432
|
+
expect(subject.publication_year).to eq('2012')
|
1433
|
+
expect(subject.state).to eq('findable')
|
1265
1434
|
end
|
1266
1435
|
end
|
1267
1436
|
|
1268
|
-
context
|
1269
|
-
it
|
1270
|
-
subject.titles = [{
|
1437
|
+
context 'change datacite metadata' do
|
1438
|
+
it 'change title' do
|
1439
|
+
subject.titles = [{ 'title' => 'A new malaria agent in African hominids.' }]
|
1271
1440
|
expect(subject.valid?).to be true
|
1272
|
-
expect(subject.id).to eq(
|
1273
|
-
expect(subject.doi).to eq(
|
1274
|
-
expect(subject.url).to eq(
|
1275
|
-
expect(subject.types[
|
1276
|
-
expect(subject.titles).to eq([{
|
1441
|
+
expect(subject.id).to eq('https://doi.org/10.5061/dryad.8515')
|
1442
|
+
expect(subject.doi).to eq('10.5061/dryad.8515')
|
1443
|
+
expect(subject.url).to eq('http://datadryad.org/stash/dataset/doi:10.5061/dryad.8515')
|
1444
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1445
|
+
expect(subject.titles).to eq([{ 'title' => 'A new malaria agent in African hominids.' }])
|
1277
1446
|
end
|
1278
1447
|
|
1279
|
-
it
|
1280
|
-
subject.state =
|
1448
|
+
it 'change state' do
|
1449
|
+
subject.state = 'registered'
|
1281
1450
|
expect(subject.valid?).to be true
|
1282
|
-
expect(subject.id).to eq(
|
1283
|
-
expect(subject.doi).to eq(
|
1284
|
-
expect(subject.url).to eq(
|
1285
|
-
expect(subject.types[
|
1286
|
-
expect(subject.titles).to eq([{
|
1287
|
-
expect(subject.state).to eq(
|
1451
|
+
expect(subject.id).to eq('https://doi.org/10.5061/dryad.8515')
|
1452
|
+
expect(subject.doi).to eq('10.5061/dryad.8515')
|
1453
|
+
expect(subject.url).to eq('http://datadryad.org/stash/dataset/doi:10.5061/dryad.8515')
|
1454
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1455
|
+
expect(subject.titles).to eq([{ 'title' => 'Data from: A new malaria agent in African hominids.' }])
|
1456
|
+
expect(subject.state).to eq('registered')
|
1288
1457
|
end
|
1289
1458
|
end
|
1290
1459
|
|
1291
|
-
context
|
1292
|
-
it
|
1293
|
-
input = fixture_path
|
1294
|
-
doi =
|
1295
|
-
subject =
|
1460
|
+
context 'change datacite metadata on input' do
|
1461
|
+
it 'change doi' do
|
1462
|
+
input = "#{fixture_path}datacite.xml"
|
1463
|
+
doi = '10.5061/dryad.8515'
|
1464
|
+
subject = described_class.new(input: input, doi: doi)
|
1296
1465
|
expect(subject.valid?).to be true
|
1297
|
-
expect(subject.id).to eq(
|
1298
|
-
expect(subject.identifiers).to eq([{
|
1299
|
-
|
1300
|
-
expect(subject.
|
1301
|
-
expect(subject.
|
1302
|
-
|
1303
|
-
|
1466
|
+
expect(subject.id).to eq('https://doi.org/10.5061/dryad.8515')
|
1467
|
+
expect(subject.identifiers).to eq([{ 'identifier' => 'MS-49-3632-5083',
|
1468
|
+
'identifierType' => 'Local accession number' }])
|
1469
|
+
expect(subject.doi).to eq('10.5061/dryad.8515')
|
1470
|
+
expect(subject.creators).to eq([{
|
1471
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0003-1419-2405',
|
1472
|
+
'nameIdentifierScheme' => 'ORCID', 'schemeUri' => 'https://orcid.org' }], 'name' => 'Fenner, Martin', 'givenName' => 'Martin', 'familyName' => 'Fenner'
|
1473
|
+
}])
|
1474
|
+
expect(subject.titles).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
1475
|
+
expect(subject.publisher).to eq('DataCite')
|
1476
|
+
expect(subject.publication_year).to eq('2016')
|
1304
1477
|
end
|
1305
1478
|
end
|
1306
1479
|
|
1307
|
-
it
|
1308
|
-
input = fixture_path
|
1309
|
-
url =
|
1310
|
-
content_url =
|
1311
|
-
subject =
|
1480
|
+
it 'GTEx dataset' do
|
1481
|
+
input = "#{fixture_path}gtex.xml"
|
1482
|
+
url = 'https://ors.datacite.org/doi:/10.25491/9hx8-ke93'
|
1483
|
+
content_url = 'https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz'
|
1484
|
+
subject = described_class.new(input: input, from: 'datacite', url: url,
|
1485
|
+
content_url: content_url)
|
1312
1486
|
|
1313
1487
|
expect(subject.valid?).to be true
|
1314
|
-
expect(subject.id).to eq(
|
1315
|
-
expect(subject.url).to eq(
|
1316
|
-
expect(subject.content_url).to eq(
|
1317
|
-
expect(subject.types[
|
1318
|
-
expect(subject.types[
|
1319
|
-
expect(subject.creators).to eq([{
|
1320
|
-
|
1321
|
-
expect(subject.
|
1322
|
-
expect(subject.
|
1323
|
-
|
1488
|
+
expect(subject.id).to eq('https://doi.org/10.25491/9hx8-ke93')
|
1489
|
+
expect(subject.url).to eq('https://ors.datacite.org/doi:/10.25491/9hx8-ke93')
|
1490
|
+
expect(subject.content_url).to eq('https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz')
|
1491
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1492
|
+
expect(subject.types['resourceType']).to eq('DroNc-seq data')
|
1493
|
+
expect(subject.creators).to eq([{ 'name' => 'The GTEx Consortium', 'nameType' => 'Organizational',
|
1494
|
+
'nameIdentifiers' => [], 'affiliation' => [] }])
|
1495
|
+
expect(subject.titles).to eq([{ 'title' => 'DroNc-seq data' }])
|
1496
|
+
expect(subject.subjects).to eq([{ 'subject' => 'gtex' }, { 'subject' => 'annotation' },
|
1497
|
+
{ 'subject' => 'phenotype' }, { 'subject' => 'gene regulation' }, { 'subject' => 'transcriptomics' }])
|
1498
|
+
expect(subject.dates).to eq([{ 'date' => '2017', 'dateType' => 'Issued' }])
|
1499
|
+
expect(subject.publication_year).to eq('2017')
|
1324
1500
|
expect(subject.related_identifiers.length).to eq(4)
|
1325
|
-
expect(subject.related_identifiers.last).to eq(
|
1326
|
-
|
1327
|
-
|
1328
|
-
expect(subject.
|
1329
|
-
expect(subject.
|
1501
|
+
expect(subject.related_identifiers.last).to eq(
|
1502
|
+
'relatedIdentifier' => 'https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663', 'relatedIdentifierType' => 'URL', 'relationType' => 'IsPartOf'
|
1503
|
+
)
|
1504
|
+
expect(subject.formats).to eq(['application/tar'])
|
1505
|
+
expect(subject.sizes).to eq(['15.7M'])
|
1506
|
+
expect(subject.container).to eq(
|
1507
|
+
'identifier' => 'https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663', 'identifierType' => 'URL', 'title' => 'GTEx', 'type' => 'DataRepository'
|
1508
|
+
)
|
1509
|
+
expect(subject.publisher).to eq('GTEx')
|
1330
1510
|
expect(subject.funding_references.count).to eq(7)
|
1331
|
-
expect(subject.funding_references.first).to eq(
|
1511
|
+
expect(subject.funding_references.first).to eq(
|
1512
|
+
'funderIdentifier' => 'https://doi.org/10.13039/100000052', 'funderIdentifierType' => 'Crossref Funder ID', 'funderName' => 'Common Fund of the Office of the Director of the NIH'
|
1513
|
+
)
|
1332
1514
|
end
|
1333
1515
|
|
1334
|
-
it
|
1335
|
-
input = fixture_path
|
1336
|
-
subject =
|
1337
|
-
expect(subject.id).to eq(
|
1338
|
-
expect(subject.types[
|
1339
|
-
expect(subject.types[
|
1340
|
-
expect(subject.types[
|
1341
|
-
expect(subject.types[
|
1342
|
-
expect(subject.types[
|
1343
|
-
expect(subject.creators.first).to eq(
|
1344
|
-
|
1345
|
-
expect(subject.
|
1346
|
-
|
1347
|
-
expect(subject.
|
1348
|
-
expect(subject.
|
1349
|
-
expect(subject.
|
1350
|
-
expect(subject.
|
1516
|
+
it 'geo_location_polygon' do
|
1517
|
+
input = "#{fixture_path}datacite-example-polygon-v4.1.xml"
|
1518
|
+
subject = described_class.new(input: input)
|
1519
|
+
expect(subject.id).to eq('https://doi.org/10.5072/example-polygon')
|
1520
|
+
expect(subject.types['schemaOrg']).to eq('Dataset')
|
1521
|
+
expect(subject.types['resourceType']).to eq('Dataset')
|
1522
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dataset')
|
1523
|
+
expect(subject.types['ris']).to eq('DATA')
|
1524
|
+
expect(subject.types['citeproc']).to eq('dataset')
|
1525
|
+
expect(subject.creators.first).to eq('familyName' => 'Den Heijer', 'givenName' => 'C',
|
1526
|
+
'name' => 'Den Heijer, C', 'nameType' => 'Personal', 'nameIdentifiers' => [], 'affiliation' => [])
|
1527
|
+
expect(subject.titles).to eq([{ 'lang' => 'en',
|
1528
|
+
'title' => 'Meteo measurements at the Sand Motor' }])
|
1529
|
+
expect(subject.publication_year).to eq('2017')
|
1530
|
+
expect(subject.publisher).to eq('4TU.Centre for Research Data')
|
1531
|
+
expect(subject.agency).to eq('datacite')
|
1532
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1533
|
+
expect(subject.geo_locations.first['geoLocationPlace']).to eq('Zandmotor, sand suppletion area on the Dutch coast.')
|
1534
|
+
expect(subject.geo_locations.first['geoLocationPolygon'].first).to eq('polygonPoint' => {
|
1535
|
+
'pointLatitude' => '52.03913926329928', 'pointLongitude' => '4.1738852605822'
|
1536
|
+
})
|
1351
1537
|
end
|
1352
1538
|
|
1353
|
-
it
|
1354
|
-
input = fixture_path
|
1355
|
-
subject =
|
1539
|
+
it 'Schema 4.4 from string' do
|
1540
|
+
input = "#{fixture_path}datacite-example-full-v4.4.xml"
|
1541
|
+
subject = described_class.new(input: input)
|
1356
1542
|
expect(subject.valid?).to be true
|
1357
|
-
expect(subject.types[
|
1358
|
-
expect(subject.types[
|
1359
|
-
expect(subject.types[
|
1543
|
+
expect(subject.types['schemaOrg']).to eq('SoftwareSourceCode')
|
1544
|
+
expect(subject.types['resourceType']).to eq('XML')
|
1545
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Software')
|
1360
1546
|
expect(subject.creators).to eq(
|
1361
1547
|
[
|
1362
1548
|
{
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1549
|
+
'name' => 'Miller, Elizabeth', 'givenName' => 'Elizabeth', 'familyName' => 'Miller',
|
1550
|
+
'nameType' => 'Personal',
|
1551
|
+
'nameIdentifiers' => [{ 'nameIdentifier' => 'https://orcid.org/0000-0001-5000-0007',
|
1552
|
+
'schemeUri' => 'https://orcid.org',
|
1553
|
+
'nameIdentifierScheme' => 'ORCID' }],
|
1554
|
+
'affiliation' => [{ 'name' => 'DataCite' }]
|
1369
1555
|
}
|
1370
1556
|
]
|
1371
1557
|
)
|
1372
1558
|
expect(subject.titles).to eq(
|
1373
1559
|
[
|
1374
|
-
{
|
1375
|
-
{
|
1560
|
+
{ 'title' => 'Full DataCite XML Example', 'lang' => 'en-US' },
|
1561
|
+
{ 'title' => 'Demonstration of DataCite Properties.', 'titleType' => 'Subtitle',
|
1562
|
+
'lang' => 'en-US' }
|
1376
1563
|
]
|
1377
1564
|
)
|
1378
|
-
expect(subject.identifiers).to eq([{
|
1565
|
+
expect(subject.identifiers).to eq([{
|
1566
|
+
'identifier' => 'https://schema.datacite.org/meta/kernel-4.4/example/datacite-example-full-v4.4.xml', 'identifierType' => 'URL'
|
1567
|
+
}])
|
1379
1568
|
expect(subject.dates).to eq(
|
1380
1569
|
[
|
1381
|
-
{
|
1382
|
-
|
1570
|
+
{ 'date' => '2021-01-26', 'dateInformation' => 'Updated with 4.4 properties',
|
1571
|
+
'dateType' => 'Updated' },
|
1572
|
+
{ 'date' => '2014', 'dateType' => 'Issued' }
|
1383
1573
|
]
|
1384
1574
|
)
|
1385
|
-
expect(subject.publication_year).to eq(
|
1575
|
+
expect(subject.publication_year).to eq('2014')
|
1386
1576
|
expect(subject.subjects).to eq(
|
1387
1577
|
[{
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1578
|
+
'subject' => 'computer science',
|
1579
|
+
'subjectScheme' => 'dewey',
|
1580
|
+
'schemeUri' => 'http://dewey.info/',
|
1581
|
+
'lang' => 'en-US',
|
1582
|
+
'classificationCode' => '000'
|
1393
1583
|
}]
|
1394
1584
|
)
|
1395
1585
|
expect(subject.related_identifiers.length).to eq(2)
|
1396
1586
|
expect(subject.related_identifiers.last).to eq(
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1587
|
+
'relatedIdentifier' => 'arXiv:0706.0001',
|
1588
|
+
'relatedIdentifierType' => 'arXiv',
|
1589
|
+
'relationType' => 'IsReviewedBy',
|
1590
|
+
'resourceTypeGeneral' => 'Text'
|
1401
1591
|
)
|
1402
1592
|
expect(subject.rights_list).to eq([
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
expect(subject.publisher).to eq(
|
1413
|
-
expect(subject.agency).to eq(
|
1414
|
-
expect(subject.schema_version).to eq(
|
1593
|
+
{
|
1594
|
+
'lang' => 'en-US',
|
1595
|
+
'rights' => 'Creative Commons Zero v1.0 Universal',
|
1596
|
+
'rightsIdentifier' => 'cc0-1.0',
|
1597
|
+
'rightsIdentifierScheme' => 'SPDX',
|
1598
|
+
'rightsUri' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
|
1599
|
+
'schemeUri' => 'https://spdx.org/licenses/'
|
1600
|
+
}
|
1601
|
+
])
|
1602
|
+
expect(subject.publisher).to eq('DataCite')
|
1603
|
+
expect(subject.agency).to eq('datacite')
|
1604
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1415
1605
|
expect(subject.related_items.last).to eq(
|
1416
1606
|
{
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1607
|
+
'relatedItemType' => 'Journal',
|
1608
|
+
'relationType' => 'IsPublishedIn',
|
1609
|
+
'relatedItemIdentifier' =>
|
1420
1610
|
{
|
1421
|
-
|
1422
|
-
|
1611
|
+
'relatedItemIdentifier' => '10.1016/j.physletb.2017.11.044',
|
1612
|
+
'relatedItemIdentifierType' => 'DOI'
|
1423
1613
|
},
|
1424
|
-
|
1614
|
+
'titles' =>
|
1425
1615
|
[
|
1426
|
-
{
|
1616
|
+
{ 'title' => 'Physics letters / B' }
|
1427
1617
|
],
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1618
|
+
'volume' => '776',
|
1619
|
+
'firstPage' => '249',
|
1620
|
+
'lastPage' => '264',
|
1621
|
+
'publicationYear' => '2018',
|
1622
|
+
'contributors' => [],
|
1623
|
+
'creators' => []
|
1434
1624
|
}
|
1435
1625
|
)
|
1436
1626
|
end
|
1437
1627
|
|
1438
|
-
it
|
1439
|
-
input = fixture_path
|
1440
|
-
subject =
|
1628
|
+
it 'Schema 4.4 related items from string' do
|
1629
|
+
input = "#{fixture_path}datacite-example-relateditems.xml"
|
1630
|
+
subject = described_class.new(input: input)
|
1441
1631
|
expect(subject.valid?).to be true
|
1442
1632
|
|
1443
1633
|
expect(subject.related_items.last).to eq(
|
1444
1634
|
{
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1635
|
+
'relatedItemType' => 'Journal',
|
1636
|
+
'relationType' => 'IsPublishedIn',
|
1637
|
+
'relatedItemIdentifier' =>
|
1448
1638
|
{
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1639
|
+
'relatedItemIdentifier' => '10.5072/john-smiths-1234',
|
1640
|
+
'relatedItemIdentifierType' => 'DOI',
|
1641
|
+
'relatedMetadataScheme' => 'citeproc+json',
|
1642
|
+
'schemeURI' => 'https://github.com/citation-style-language/schema/raw/master/csl-data.json',
|
1643
|
+
'schemeType' => 'URL'
|
1454
1644
|
},
|
1455
|
-
|
1645
|
+
'creators' =>
|
1456
1646
|
[
|
1457
|
-
{
|
1647
|
+
{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John',
|
1648
|
+
'familyName' => 'Smith' }
|
1458
1649
|
],
|
1459
|
-
|
1650
|
+
'titles' =>
|
1460
1651
|
[
|
1461
|
-
{
|
1462
|
-
{
|
1652
|
+
{ 'title' => 'Understanding the fictional John Smith' },
|
1653
|
+
{ 'title' => 'A detailed look', 'titleType' => 'Subtitle' }
|
1463
1654
|
],
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1655
|
+
'volume' => '776',
|
1656
|
+
'issue' => '1',
|
1657
|
+
'number' => '1',
|
1658
|
+
'numberType' => 'Chapter',
|
1659
|
+
'firstPage' => '50',
|
1660
|
+
'lastPage' => '60',
|
1661
|
+
'publisher' => 'Example Inc',
|
1662
|
+
'publicationYear' => '1776',
|
1663
|
+
'edition' => '1',
|
1664
|
+
'contributors' =>
|
1474
1665
|
[
|
1475
|
-
{
|
1666
|
+
{ 'name' => 'Hallett, Richard', 'givenName' => 'Richard', 'familyName' => 'Hallett',
|
1667
|
+
'contributorType' => 'ProjectLeader' }
|
1476
1668
|
]
|
1477
1669
|
}
|
1478
1670
|
)
|
1479
1671
|
end
|
1480
1672
|
|
1481
|
-
|
1482
|
-
|
1483
|
-
input = fixture_path + "datacite-example-relateditems.xml"
|
1673
|
+
it 'Schema 4.4 related items from string minus relatedIdentifier' do
|
1674
|
+
input = "#{fixture_path}datacite-example-relateditems.xml"
|
1484
1675
|
|
1485
1676
|
# Remove relatedItemIdentifier from raw input
|
1486
1677
|
@doc = File.open(input) { |f| Nokogiri::XML(f) }
|
1487
|
-
@doc.xpath(
|
1678
|
+
@doc.xpath('//xmlns:relatedItemIdentifier').each(&:remove)
|
1488
1679
|
|
1489
|
-
subject =
|
1680
|
+
subject = described_class.new(input: @doc.to_s)
|
1490
1681
|
expect(subject.valid?).to be true
|
1491
1682
|
|
1492
1683
|
expect(subject.related_items.last).to eq(
|
1493
1684
|
{
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1685
|
+
'relatedItemType' => 'Journal',
|
1686
|
+
'relationType' => 'IsPublishedIn',
|
1687
|
+
'creators' =>
|
1497
1688
|
[
|
1498
|
-
{
|
1689
|
+
{ 'nameType' => 'Personal', 'name' => 'Smith, John', 'givenName' => 'John',
|
1690
|
+
'familyName' => 'Smith' }
|
1499
1691
|
],
|
1500
|
-
|
1692
|
+
'titles' =>
|
1501
1693
|
[
|
1502
|
-
{
|
1503
|
-
{
|
1694
|
+
{ 'title' => 'Understanding the fictional John Smith' },
|
1695
|
+
{ 'title' => 'A detailed look', 'titleType' => 'Subtitle' }
|
1504
1696
|
],
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1697
|
+
'volume' => '776',
|
1698
|
+
'issue' => '1',
|
1699
|
+
'number' => '1',
|
1700
|
+
'numberType' => 'Chapter',
|
1701
|
+
'firstPage' => '50',
|
1702
|
+
'lastPage' => '60',
|
1703
|
+
'publisher' => 'Example Inc',
|
1704
|
+
'publicationYear' => '1776',
|
1705
|
+
'edition' => '1',
|
1706
|
+
'contributors' =>
|
1515
1707
|
[
|
1516
|
-
{
|
1708
|
+
{ 'name' => 'Hallett, Richard', 'givenName' => 'Richard', 'familyName' => 'Hallett',
|
1709
|
+
'contributorType' => 'ProjectLeader' }
|
1517
1710
|
]
|
1518
1711
|
}
|
1519
1712
|
)
|
1520
1713
|
end
|
1521
1714
|
|
1522
|
-
it
|
1523
|
-
input = fixture_path
|
1524
|
-
subject =
|
1715
|
+
it 'Schema 4.4 dissertation from string' do
|
1716
|
+
input = "#{fixture_path}datacite-example-dissertation-v4.4.xml"
|
1717
|
+
subject = described_class.new(input: input)
|
1525
1718
|
expect(subject.valid?).to be true
|
1526
|
-
expect(subject.types[
|
1527
|
-
expect(subject.types[
|
1528
|
-
expect(subject.types[
|
1529
|
-
expect(subject.types[
|
1530
|
-
expect(subject.types[
|
1719
|
+
expect(subject.types['resourceType'].nil?).to be(true)
|
1720
|
+
expect(subject.types['resourceTypeGeneral']).to eq('Dissertation')
|
1721
|
+
expect(subject.types['schemaOrg']).to eq('Thesis')
|
1722
|
+
expect(subject.types['ris']).to eq('THES')
|
1723
|
+
expect(subject.types['citeproc']).to eq('thesis')
|
1531
1724
|
expect(subject.creators).to eq(
|
1532
1725
|
[
|
1533
1726
|
{
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1727
|
+
'name' => 'Luo, R',
|
1728
|
+
'familyName' => 'Luo',
|
1729
|
+
'givenName' => 'R',
|
1730
|
+
'nameIdentifiers' => [],
|
1731
|
+
'affiliation' => [],
|
1732
|
+
'nameType' => 'Personal'
|
1540
1733
|
},
|
1541
1734
|
{
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1735
|
+
'name' => 'Liu, B',
|
1736
|
+
'familyName' => 'Liu',
|
1737
|
+
'givenName' => 'B',
|
1738
|
+
'nameIdentifiers' => [],
|
1739
|
+
'affiliation' => [],
|
1740
|
+
'nameType' => 'Personal'
|
1548
1741
|
},
|
1549
1742
|
{
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1743
|
+
'name' => 'Xie, Y',
|
1744
|
+
'familyName' => 'Xie',
|
1745
|
+
'givenName' => 'Y',
|
1746
|
+
'nameIdentifiers' => [],
|
1747
|
+
'affiliation' => [],
|
1748
|
+
'nameType' => 'Personal'
|
1556
1749
|
},
|
1557
1750
|
{
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1751
|
+
'name' => 'Li, Z',
|
1752
|
+
'familyName' => 'Li',
|
1753
|
+
'givenName' => 'Z',
|
1754
|
+
'nameIdentifiers' => [],
|
1755
|
+
'affiliation' => [],
|
1756
|
+
'nameType' => 'Personal'
|
1564
1757
|
}
|
1565
1758
|
]
|
1566
1759
|
)
|
1567
1760
|
expect(subject.titles).to eq(
|
1568
1761
|
[
|
1569
|
-
{
|
1762
|
+
{
|
1763
|
+
'title' => 'Software and supporting material for "SOAPdenovo2: An empirically improved memory-efficient short read de novo assembly"', 'lang' => 'en'
|
1764
|
+
}
|
1570
1765
|
]
|
1571
1766
|
)
|
1572
1767
|
expect(subject.dates).to eq(
|
1573
1768
|
[
|
1574
|
-
{
|
1575
|
-
{
|
1769
|
+
{ 'date' => '2012-12-13', 'dateType' => 'Available' },
|
1770
|
+
{ 'date' => '2012', 'dateType' => 'Issued' }
|
1576
1771
|
]
|
1577
1772
|
)
|
1578
|
-
expect(subject.publication_year).to eq(
|
1773
|
+
expect(subject.publication_year).to eq('2012')
|
1579
1774
|
expect(subject.subjects).to eq(
|
1580
1775
|
[
|
1581
1776
|
{
|
1582
|
-
|
1583
|
-
|
1777
|
+
'subject' => 'DNA (Genetics)',
|
1778
|
+
'lang' => 'en'
|
1584
1779
|
},
|
1585
1780
|
{
|
1586
|
-
|
1587
|
-
|
1781
|
+
'subject' => 'Computer Program',
|
1782
|
+
'lang' => 'en'
|
1588
1783
|
}
|
1589
1784
|
]
|
1590
1785
|
)
|
1591
1786
|
expect(subject.related_identifiers).to eq(
|
1592
1787
|
[
|
1593
|
-
{
|
1594
|
-
|
1788
|
+
{ 'relatedIdentifier' => '10.5072/2047-217x-1-1', 'relatedIdentifierType' => 'DOI',
|
1789
|
+
'relationType' => 'IsReferencedBy' },
|
1790
|
+
{ 'relatedIdentifier' => '10.5072/100038', 'relatedIdentifierType' => 'DOI',
|
1791
|
+
'relationType' => 'Compiles' }
|
1595
1792
|
]
|
1596
1793
|
)
|
1597
1794
|
expect(subject.rights_list).to eq([
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
expect(subject.publisher).to eq(
|
1608
|
-
expect(subject.agency).to eq(
|
1609
|
-
expect(subject.schema_version).to eq(
|
1795
|
+
{
|
1796
|
+
'lang' => 'en-US',
|
1797
|
+
'rights' => 'Creative Commons Zero v1.0 Universal',
|
1798
|
+
'rightsIdentifier' => 'cc0-1.0',
|
1799
|
+
'rightsIdentifierScheme' => 'SPDX',
|
1800
|
+
'rightsUri' => 'https://creativecommons.org/publicdomain/zero/1.0/legalcode',
|
1801
|
+
'schemeUri' => 'https://spdx.org/licenses/'
|
1802
|
+
}
|
1803
|
+
])
|
1804
|
+
expect(subject.publisher).to eq('GigaScience Database')
|
1805
|
+
expect(subject.agency).to eq('datacite')
|
1806
|
+
expect(subject.schema_version).to eq('http://datacite.org/schema/kernel-4')
|
1610
1807
|
end
|
1611
1808
|
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
subject = Briard::Metadata.new(input: input)
|
1809
|
+
it 'Parsing xs-string attribute correctly' do
|
1810
|
+
input = "#{fixture_path}datacite-example-xs-string.xml"
|
1811
|
+
subject = described_class.new(input: input)
|
1616
1812
|
expect(subject.valid?).to be true
|
1617
|
-
expect(subject.id).to eq(
|
1618
|
-
expect(subject.sizes.first).to eq(
|
1619
|
-
expect(subject.formats.first).to eq(
|
1813
|
+
expect(subject.id).to eq('https://doi.org/10.4225/13/511c71f8612c3')
|
1814
|
+
expect(subject.sizes.first).to eq('1.7 GB')
|
1815
|
+
expect(subject.formats.first).to eq('application/xml')
|
1620
1816
|
end
|
1621
1817
|
|
1622
|
-
it
|
1623
|
-
input = fixture_path
|
1624
|
-
subject =
|
1818
|
+
it 'Parsing multiple geolocationpolygon elements' do
|
1819
|
+
input = "#{fixture_path}datacite-geolocationpolygons-multiple.xml"
|
1820
|
+
subject = described_class.new(input: input)
|
1625
1821
|
expect(subject.valid?).to be true
|
1626
|
-
expect(subject.id).to eq(
|
1822
|
+
expect(subject.id).to eq('https://doi.org/10.5072/multiplegeopolygons')
|
1627
1823
|
expect(subject.geo_locations).to eq([
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1824
|
+
{ 'geoLocationPolygon' => [
|
1825
|
+
[{ 'polygonPoint' => { 'pointLatitude' => '71', 'pointLongitude' => '41' } },
|
1826
|
+
{ 'polygonPoint' => { 'pointLatitude' => '75',
|
1827
|
+
'pointLongitude' => '45' } },
|
1828
|
+
{ 'polygonPoint' => { 'pointLatitude' => '85',
|
1829
|
+
'pointLongitude' => '55' } },
|
1830
|
+
{ 'polygonPoint' => { 'pointLatitude' => '71',
|
1831
|
+
'pointLongitude' => '41' } }],
|
1832
|
+
[
|
1833
|
+
{ 'polygonPoint' => { 'pointLatitude' => '80',
|
1834
|
+
'pointLongitude' => '65' } },
|
1835
|
+
{ 'polygonPoint' => { 'pointLatitude' => '75',
|
1836
|
+
'pointLongitude' => '55' } },
|
1837
|
+
{ 'polygonPoint' => { 'pointLatitude' => '73',
|
1838
|
+
'pointLongitude' => '45' } },
|
1839
|
+
{ 'polygonPoint' => { 'pointLatitude' => '80',
|
1840
|
+
'pointLongitude' => '65' } }
|
1841
|
+
]
|
1842
|
+
] },
|
1843
|
+
{ 'geoLocationPolygon' =>
|
1844
|
+
[
|
1845
|
+
{ 'polygonPoint' => { 'pointLatitude' => '80',
|
1846
|
+
'pointLongitude' => '65' } },
|
1847
|
+
{ 'polygonPoint' => { 'pointLatitude' => '75',
|
1848
|
+
'pointLongitude' => '55' } },
|
1849
|
+
{ 'polygonPoint' => { 'pointLatitude' => '73',
|
1850
|
+
'pointLongitude' => '45' } },
|
1851
|
+
{ 'polygonPoint' => { 'pointLatitude' => '80',
|
1852
|
+
'pointLongitude' => '65' } }
|
1853
|
+
] }
|
1854
|
+
])
|
1650
1855
|
end
|
1651
|
-
|
1652
1856
|
end
|