commonmeta-ruby 3.4.5 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/csl-data.json +538 -0
- data/lib/commonmeta/author_utils.rb +103 -71
- data/lib/commonmeta/crossref_utils.rb +31 -25
- data/lib/commonmeta/metadata.rb +8 -14
- data/lib/commonmeta/metadata_utils.rb +4 -3
- data/lib/commonmeta/readers/bibtex_reader.rb +3 -3
- data/lib/commonmeta/readers/cff_reader.rb +7 -6
- data/lib/commonmeta/readers/codemeta_reader.rb +3 -3
- data/lib/commonmeta/readers/crossref_reader.rb +131 -124
- data/lib/commonmeta/readers/crossref_xml_reader.rb +7 -6
- data/lib/commonmeta/readers/csl_reader.rb +3 -4
- data/lib/commonmeta/readers/datacite_reader.rb +5 -5
- data/lib/commonmeta/readers/json_feed_reader.rb +8 -4
- data/lib/commonmeta/readers/npm_reader.rb +2 -2
- data/lib/commonmeta/readers/ris_reader.rb +1 -1
- data/lib/commonmeta/readers/schema_org_reader.rb +6 -4
- data/lib/commonmeta/schema_utils.rb +1 -1
- data/lib/commonmeta/utils.rb +4 -2
- data/lib/commonmeta/version.rb +1 -1
- data/lib/commonmeta/writers/bibtex_writer.rb +1 -1
- data/lib/commonmeta/writers/cff_writer.rb +5 -4
- data/lib/commonmeta/writers/codemeta_writer.rb +4 -2
- data/lib/commonmeta/writers/csv_writer.rb +4 -2
- data/lib/commonmeta/writers/datacite_writer.rb +1 -1
- data/lib/commonmeta/writers/jats_writer.rb +9 -5
- data/lib/commonmeta/writers/ris_writer.rb +2 -1
- data/lib/commonmeta/writers/schema_org_writer.rb +7 -4
- data/resources/{commonmeta_v0.9.3.json → commonmeta_v0.10.3.json} +138 -55
- data/resources/csl-citation.json +99 -0
- data/spec/author_utils_spec.rb +16 -16
- data/spec/cli_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/missing_contributor.yml +307 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/SoftwareSourceCode.yml +76 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/archived_wordpress_post.yml +119 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/book_oup.yml +107 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_plos.yml +407 -0
- data/spec/metadata_spec.rb +2 -2
- data/spec/readers/bibtex_reader_spec.rb +5 -5
- data/spec/readers/cff_reader_spec.rb +127 -127
- data/spec/readers/codemeta_reader_spec.rb +11 -11
- data/spec/readers/crossref_reader_spec.rb +844 -835
- data/spec/readers/crossref_xml_reader_spec.rb +899 -901
- data/spec/readers/csl_reader_spec.rb +33 -33
- data/spec/readers/datacite_reader_spec.rb +106 -103
- data/spec/readers/json_feed_reader_spec.rb +68 -40
- data/spec/readers/npm_reader_spec.rb +32 -33
- data/spec/readers/ris_reader_spec.rb +36 -36
- data/spec/readers/schema_org_reader_spec.rb +289 -288
- data/spec/writers/codemeta_writer_spec.rb +19 -20
- data/spec/writers/crossref_xml_writer_spec.rb +73 -37
- data/spec/writers/datacite_writer_spec.rb +2 -1
- metadata +10 -3
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Commonmeta::Metadata, vcr: true do
|
6
|
-
context
|
6
|
+
context "write metadata as codemeta" do
|
7
7
|
# it "SoftwareSourceCode DataCite JSON" do
|
8
8
|
# input = fixture_path + "datacite_software.json"
|
9
9
|
# subject = Commonmeta::Metadata.new(input: input, from: "datacite")
|
@@ -19,29 +19,28 @@ describe Commonmeta::Metadata, vcr: true do
|
|
19
19
|
# expect(json["publisher"]).to eq("KNB Data Repository")
|
20
20
|
# end
|
21
21
|
|
22
|
-
it
|
23
|
-
input =
|
24
|
-
subject = described_class.new(input: input, from:
|
25
|
-
expect(subject.valid?).to be true
|
22
|
+
it "SoftwareSourceCode DataCite" do
|
23
|
+
input = "https://doi.org/10.5063/f1m61h5x"
|
24
|
+
subject = described_class.new(input: input, from: "datacite")
|
25
|
+
# expect(subject.valid?).to be true
|
26
26
|
json = JSON.parse(subject.codemeta)
|
27
|
-
expect(json[
|
28
|
-
expect(json[
|
29
|
-
expect(json[
|
30
|
-
expect(json[
|
31
|
-
|
32
|
-
|
33
|
-
expect(json[
|
34
|
-
expect(json[
|
35
|
-
expect(json['publisher']).to eq('KNB Data Repository')
|
27
|
+
expect(json["@context"]).to eq("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
|
28
|
+
expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x")
|
29
|
+
expect(json["@type"]).to eq("SoftwareSourceCode")
|
30
|
+
expect(json["authors"]).to eq("@type" => "Organization",
|
31
|
+
"name" => "Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott")
|
32
|
+
expect(json["name"]).to eq("dataone: R interface to the DataONE network of data repositories")
|
33
|
+
expect(json["datePublished"]).to eq("2016")
|
34
|
+
expect(json["publisher"]).to eq("KNB Data Repository")
|
36
35
|
end
|
37
36
|
|
38
|
-
it
|
39
|
-
input =
|
40
|
-
subject = described_class.new(input: input, from:
|
37
|
+
it "SoftwareSourceCode DataCite check codemeta v2" do
|
38
|
+
input = "https://doi.org/10.5063/f1m61h5x"
|
39
|
+
subject = described_class.new(input: input, from: "datacite")
|
41
40
|
expect(subject.valid?).to be true
|
42
41
|
json = JSON.parse(subject.codemeta)
|
43
|
-
expect(json[
|
44
|
-
expect(json[
|
42
|
+
expect(json["agents"].nil?).to be(true)
|
43
|
+
expect(json["title"].nil?).to be(true)
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
@@ -26,6 +26,42 @@ describe Commonmeta::Metadata, vcr: true do
|
|
26
26
|
"volume" => "426")
|
27
27
|
end
|
28
28
|
|
29
|
+
it "journal article plos" do
|
30
|
+
input = "https://doi.org/10.1371/journal.pone.0000030"
|
31
|
+
subject = described_class.new(input: input)
|
32
|
+
expect(subject.valid?).to be true
|
33
|
+
expect(subject.id).to eq("https://doi.org/10.1371/journal.pone.0000030")
|
34
|
+
expect(subject.url).to eq("https://dx.plos.org/10.1371/journal.pone.0000030")
|
35
|
+
expect(subject.type).to eq("JournalArticle")
|
36
|
+
expect(subject.contributors.length).to eq(6)
|
37
|
+
expect(subject.contributors.first).to eq("type" => "Person", "contributorRoles" => ["Author"],
|
38
|
+
"givenName" => "Markus", "familyName" => "Ralser")
|
39
|
+
expect(subject.contributors.last).to eq({ "familyName" => "Janbon",
|
40
|
+
"givenName" => "Guilhem", "type" => "Person", "contributorRoles" => ["Editor"] })
|
41
|
+
expect(subject.titles).to eq([{ "title" => "Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes" }])
|
42
|
+
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
43
|
+
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
44
|
+
expect(subject.date).to eq("published" => "2006-12-20", "updated" => "2021-08-06")
|
45
|
+
expect(subject.publisher).to eq("id" => "https://api.crossref.org/members/340",
|
46
|
+
"name" => "Public Library of Science (PLoS)")
|
47
|
+
expect(subject.references.length).to eq(73)
|
48
|
+
expect(subject.references.last).to eq("containerTitle" => "N Engl J Med", "contributor" => "KB Hammond",
|
49
|
+
"doi" => "https://doi.org/10.1056/nejm199109123251104",
|
50
|
+
"firstPage" => "769",
|
51
|
+
"key" => "ref73",
|
52
|
+
"publicationYear" => "1991",
|
53
|
+
"title" => "Efficacy of statewide neonatal screening for cystic fibrosis by assay of trypsinogen concentrations.", "volume" => "325")
|
54
|
+
expect(subject.container).to eq("firstPage" => "e30", "identifier" => "1932-6203",
|
55
|
+
"identifierType" => "ISSN", "issue" => "1", "title" => "PLoS ONE", "type" => "Journal", "volume" => "1")
|
56
|
+
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "journal",
|
57
|
+
"journal_article")
|
58
|
+
expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(6)
|
59
|
+
expect(Array.wrap(crossref_xml.dig("contributors",
|
60
|
+
"person_name")).first).to eq("contributor_role"=>"author", "given_name"=>"Markus", "sequence"=>"first", "surname"=>"Ralser")
|
61
|
+
expect(crossref_xml.dig("titles",
|
62
|
+
"title")).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes")
|
63
|
+
end
|
64
|
+
|
29
65
|
it "posted_content" do
|
30
66
|
subject = described_class.new(input: "10.1101/2020.12.01.406702", depositor: "test", email: "info@example.org", registrant: "test")
|
31
67
|
expect(subject.valid?).to be true
|
@@ -64,10 +100,10 @@ describe Commonmeta::Metadata, vcr: true do
|
|
64
100
|
expect(subject.url).to eq("https://blog.front-matter.io/posts/editorial-by-more-than-200-call-for-emergency-action-to-limit-global-temperature-increases-restore-biodiversity-and-protect-health")
|
65
101
|
expect(subject.type).to eq("Article")
|
66
102
|
expect(subject.titles).to eq([{ "title" => "Editorial by more than 200 health journals: Call for emergency action to limit global temperature increases, restore biodiversity, and protect health" }])
|
67
|
-
expect(subject.
|
68
|
-
|
69
|
-
|
70
|
-
|
103
|
+
expect(subject.contributors).to eq([{ "familyName" => "Fenner",
|
104
|
+
"givenName" => "Martin",
|
105
|
+
"id" => "https://orcid.org/0000-0003-1419-2405",
|
106
|
+
"type" => "Person", "contributorRoles" => ["Author"] }])
|
71
107
|
expect(subject.subjects).to eq([{ "subject" => "News" }])
|
72
108
|
expect(subject.language).to eq("en")
|
73
109
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
@@ -85,10 +121,10 @@ describe Commonmeta::Metadata, vcr: true do
|
|
85
121
|
expect(subject.url).to eq("https://blog.front-matter.io/posts/dryad-interview-jen-gibson")
|
86
122
|
expect(subject.type).to eq("Article")
|
87
123
|
expect(subject.titles).to eq([{ "title" => "Dryad: Interview with Jen Gibson" }])
|
88
|
-
expect(subject.
|
89
|
-
|
90
|
-
|
91
|
-
|
124
|
+
expect(subject.contributors).to eq([{ "familyName" => "Fenner",
|
125
|
+
"givenName" => "Martin",
|
126
|
+
"id" => "https://orcid.org/0000-0003-1419-2405",
|
127
|
+
"type" => "Person", "contributorRoles" => ["Author"] }])
|
92
128
|
expect(subject.subjects).to eq([{ "subject" => "Interview" }])
|
93
129
|
expect(subject.container).to eq("identifier" => "https://blog.front-matter.io/", "identifierType" => "URL",
|
94
130
|
"title" => "Front Matter", "type" => "Periodical")
|
@@ -126,10 +162,10 @@ describe Commonmeta::Metadata, vcr: true do
|
|
126
162
|
expect(subject.url).to eq("https://donnywinston.com/posts/implementing-the-fair-principles-through-fair-enabling-artifacts-and-services")
|
127
163
|
expect(subject.type).to eq("Article")
|
128
164
|
expect(subject.titles).to eq([{ "title" => "Implementing the FAIR Principles Through FAIR-Enabling Artifacts and Services" }])
|
129
|
-
expect(subject.
|
130
|
-
|
131
|
-
|
132
|
-
|
165
|
+
expect(subject.contributors).to eq([{ "familyName" => "Winston",
|
166
|
+
"givenName" => "Donny",
|
167
|
+
"id" => "https://orcid.org/0000-0002-8424-0604",
|
168
|
+
"type" => "Person", "contributorRoles" => ["Author"] }])
|
133
169
|
expect(subject.subjects).to eq([])
|
134
170
|
expect(subject.container).to eq("identifier" => "https://www.polyneme.xyz",
|
135
171
|
"identifierType" => "URL", "type" => "Periodical")
|
@@ -153,10 +189,10 @@ describe Commonmeta::Metadata, vcr: true do
|
|
153
189
|
expect(subject.url).to eq("https://upstream.force11.org/deep-dive-into-ethics-of-contributor-roles")
|
154
190
|
expect(subject.type).to eq("Article")
|
155
191
|
expect(subject.titles).to eq([{ "title" => "Deep dive into ethics of Contributor Roles: report of a FORCE11 workshop" }])
|
156
|
-
expect(subject.
|
157
|
-
expect(subject.
|
158
|
-
|
159
|
-
|
192
|
+
expect(subject.contributors.length).to eq(4)
|
193
|
+
expect(subject.contributors.first).to eq("familyName" => "Hosseini",
|
194
|
+
"givenName" => "Mohammad",
|
195
|
+
"type" => "Person", "contributorRoles" => ["Author"])
|
160
196
|
expect(subject.subjects).to eq([{ "subject" => "News" }])
|
161
197
|
expect(subject.language).to eq("en")
|
162
198
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
@@ -179,8 +215,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
179
215
|
expect(subject.url).to eq("https://upstream.force11.org/attempts-at-automating-journal-subject-classification")
|
180
216
|
expect(subject.type).to eq("Article")
|
181
217
|
expect(subject.titles).to eq([{ "title" => "Attempts at automating journal subject classification" }])
|
182
|
-
expect(subject.
|
183
|
-
expect(subject.
|
218
|
+
expect(subject.contributors.length).to eq(1)
|
219
|
+
expect(subject.contributors.first).to eq("familyName" => "Datta", "givenName" => "Esha", "id" => "https://orcid.org/0000-0001-9165-2757", "type" => "Person", "contributorRoles" => ["Author"])
|
184
220
|
expect(subject.subjects).to eq([{ "subject" => "Humanities" },
|
185
221
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
186
222
|
"subject" => "FOS: Humanities",
|
@@ -208,8 +244,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
208
244
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "954f8138-0ecd-4090-87c5-cef1297f1470", "alternateIdentifierType" => "UUID" }])
|
209
245
|
expect(subject.type).to eq("Article")
|
210
246
|
expect(subject.titles).to eq([{ "title" => "The Research Software Alliance (ReSA)" }])
|
211
|
-
expect(subject.
|
212
|
-
expect(subject.
|
247
|
+
expect(subject.contributors.length).to eq(2)
|
248
|
+
expect(subject.contributors.first).to eq("familyName" => "Katz", "givenName" => "Daniel S.", "id" => "https://orcid.org/0000-0001-5934-7525", "type" => "Person", "contributorRoles" => ["Author"])
|
213
249
|
expect(subject.subjects).to eq([{ "subject" => "Humanities" },
|
214
250
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
215
251
|
"subject" => "FOS: Humanities",
|
@@ -239,8 +275,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
239
275
|
expect(subject.url).to eq("https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs")
|
240
276
|
expect(subject.type).to eq("Article")
|
241
277
|
expect(subject.titles).to eq([{ "title" => "EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs" }])
|
242
|
-
expect(subject.
|
243
|
-
expect(subject.
|
278
|
+
expect(subject.contributors.length).to eq(1)
|
279
|
+
expect(subject.contributors.first).to eq("familyName" => "Pampel", "givenName" => "Heinz", "id" => "https://orcid.org/0000-0003-3334-2771", "type" => "Person", "contributorRoles" => ["Author"])
|
244
280
|
expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
|
245
281
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
246
282
|
"subject" => "FOS: Social sciences",
|
@@ -267,8 +303,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
267
303
|
expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
|
268
304
|
expect(subject.type).to eq("Article")
|
269
305
|
expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
|
270
|
-
expect(subject.
|
271
|
-
expect(subject.
|
306
|
+
expect(subject.contributors.length).to eq(1)
|
307
|
+
expect(subject.contributors.first).to eq("id" => "https://ror.org/0342dzm54", "name" => "Liberate Science", "type" => "Organization", "contributorRoles" => ["Author"])
|
272
308
|
expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
|
273
309
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
274
310
|
"subject" => "FOS: Social sciences",
|
@@ -294,10 +330,10 @@ describe Commonmeta::Metadata, vcr: true do
|
|
294
330
|
expect(subject.url).to eq("https://blog.front-matter.io/posts/differences-between-orcid-and-datacite-metadata")
|
295
331
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "8a4de443-3347-4b82-b57d-e3c82b6485fc", "alternateIdentifierType" => "UUID" }])
|
296
332
|
expect(subject.type).to eq("Article")
|
297
|
-
expect(subject.
|
298
|
-
expect(subject.
|
299
|
-
|
300
|
-
|
333
|
+
expect(subject.contributors.length).to eq(1)
|
334
|
+
expect(subject.contributors.first).to eq("familyName" => "Fenner",
|
335
|
+
"givenName" => "Martin",
|
336
|
+
"id" => "https://orcid.org/0000-0003-1419-2405", "type" => "Person", "contributorRoles" => ["Author"])
|
301
337
|
expect(subject.titles).to eq([{ "title" => "Differences between ORCID and DataCite Metadata" }])
|
302
338
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
303
339
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
@@ -310,13 +346,13 @@ describe Commonmeta::Metadata, vcr: true do
|
|
310
346
|
"subjectScheme" => "Fields of Science and Technology (FOS)" }])
|
311
347
|
expect(subject.language).to eq("en")
|
312
348
|
expect(subject.container).to eq("identifier" => "https://blog.front-matter.io", "identifierType" => "URL", "title" => "Front Matter", "type" => "Periodical")
|
313
|
-
expect(subject.references).to eq([{"doi"=>"https://doi.org/10.5281/ZENODO.30799", "key"=>"ref1", "publicationYear"=>"2015", "title"=>"D2.1: Artefact, Contributor, And Organisation Relationship Data Schema"}])
|
314
|
-
expect(subject.related_identifiers).to eq([{"id"=>"https://doi.org/10.5438/bc11-cqw1", "type"=>"IsIdenticalTo"}])
|
349
|
+
expect(subject.references).to eq([{ "doi" => "https://doi.org/10.5281/ZENODO.30799", "key" => "ref1", "publicationYear" => "2015", "title" => "D2.1: Artefact, Contributor, And Organisation Relationship Data Schema" }])
|
350
|
+
expect(subject.related_identifiers).to eq([{ "id" => "https://doi.org/10.5438/bc11-cqw1", "type" => "IsIdenticalTo" }])
|
315
351
|
# puts subject.crossref_xml
|
316
352
|
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
|
317
353
|
expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
|
318
354
|
expect(Array.wrap(crossref_xml.dig("contributors",
|
319
|
-
"person_name")).first).to eq({"ORCID"=>"https://orcid.org/0000-0003-1419-2405", "contributor_role"=>"author", "given_name"=>"Martin", "sequence"=>"first", "surname"=>"Fenner"})
|
355
|
+
"person_name")).first).to eq({ "ORCID" => "https://orcid.org/0000-0003-1419-2405", "contributor_role" => "author", "given_name" => "Martin", "sequence" => "first", "surname" => "Fenner" })
|
320
356
|
expect(crossref_xml.dig("titles",
|
321
357
|
"title")).to eq("Differences between ORCID and DataCite Metadata")
|
322
358
|
expect(crossref_xml.dig("item_number")).to eq("__content__" => "8a4de44333474b82b57de3c82b6485fc", "item_number_type" => "uuid")
|
@@ -332,15 +368,15 @@ describe Commonmeta::Metadata, vcr: true do
|
|
332
368
|
expect(subject.url).to eq("https://blog.front-matter.io/posts/tracking-the-growth-of-the-pid-graph")
|
333
369
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "e58dc9c8-b870-4db2-8896-238b3246c551", "alternateIdentifierType" => "UUID" }])
|
334
370
|
expect(subject.type).to eq("Article")
|
335
|
-
expect(subject.
|
336
|
-
expect(subject.
|
371
|
+
expect(subject.contributors.length).to eq(1)
|
372
|
+
expect(subject.contributors.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName" => "Fenner", "givenName" => "Martin", "type" => "Person", "contributorRoles" => ["Author"])
|
337
373
|
expect(subject.titles).to eq([{ "title" => "Tracking the Growth of the PID Graph" }])
|
338
374
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
339
375
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
340
376
|
expect(subject.date).to eq("published" => "2019-07-01", "updated" => "2023-09-07")
|
341
377
|
expect(subject.descriptions.first["description"]).to start_with("The connections between scholarly resources generated by persistent identifiers (PIDs)")
|
342
378
|
expect(subject.publisher).to eq("name" => "Front Matter")
|
343
|
-
expect(subject.funding_references).to eq([{ "awardNumber" => "777523", "funderIdentifier"=>"http://doi.org/10.13039/501100000780", "funderName" => "European Commission" }])
|
379
|
+
expect(subject.funding_references).to eq([{ "awardNumber" => "777523", "funderIdentifier" => "http://doi.org/10.13039/501100000780", "funderName" => "European Commission" }])
|
344
380
|
expect(subject.related_identifiers).to eq([{ "id" => "https://doi.org/10.5438/bv9z-dc66", "type" => "IsIdenticalTo" }])
|
345
381
|
expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
|
346
382
|
{ "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
|
@@ -352,7 +388,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
352
388
|
crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
|
353
389
|
expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
|
354
390
|
expect(Array.wrap(crossref_xml.dig("contributors",
|
355
|
-
"person_name")).first).to eq({"ORCID"=>"https://orcid.org/0000-0003-1419-2405", "contributor_role"=>"author", "given_name"=>"Martin", "sequence"=>"first", "surname"=>"Fenner"})
|
391
|
+
"person_name")).first).to eq({ "ORCID" => "https://orcid.org/0000-0003-1419-2405", "contributor_role" => "author", "given_name" => "Martin", "sequence" => "first", "surname" => "Fenner" })
|
356
392
|
expect(crossref_xml.dig("titles",
|
357
393
|
"title")).to eq("Tracking the Growth of the PID Graph")
|
358
394
|
expect(crossref_xml.dig("item_number")).to eq("__content__" => "e58dc9c8b8704db28896238b3246c551", "item_number_type" => "uuid")
|
@@ -367,8 +403,8 @@ describe Commonmeta::Metadata, vcr: true do
|
|
367
403
|
expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
|
368
404
|
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
|
369
405
|
expect(subject.type).to eq("Article")
|
370
|
-
expect(subject.
|
371
|
-
expect(subject.
|
406
|
+
expect(subject.contributors.length).to eq(1)
|
407
|
+
expect(subject.contributors.first).to eq("familyName" => "Göbel", "givenName" => "Mathias", "type" => "Person", "contributorRoles" => ["Author"])
|
372
408
|
expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
|
373
409
|
expect(subject.license).to eq("id" => "CC-BY-4.0",
|
374
410
|
"url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
|
@@ -116,7 +116,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
116
116
|
expect(subject.valid?).to be true
|
117
117
|
datacite = JSON.parse(subject.datacite)
|
118
118
|
expect(datacite.fetch('titles')).to eq([{ 'title' => 'Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes' }])
|
119
|
-
expect(datacite.fetch('creators').length).to eq(
|
119
|
+
expect(datacite.fetch('creators').length).to eq(6)
|
120
120
|
expect(datacite.fetch('creators').first).to eq('familyName' => 'Ralser',
|
121
121
|
'givenName' => 'Markus',
|
122
122
|
'name' => 'Ralser, Markus',
|
@@ -136,6 +136,7 @@ describe Commonmeta::Metadata, vcr: true do
|
|
136
136
|
it 'from schema.org' do
|
137
137
|
input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food/'
|
138
138
|
subject = described_class.new(input: input, from: 'schema_org')
|
139
|
+
puts subject.errors
|
139
140
|
expect(subject.valid?).to be true
|
140
141
|
datacite = JSON.parse(subject.datacite)
|
141
142
|
expect(datacite.fetch('titles')).to eq([{ 'title' => 'Eating your own Dog Food' }])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmeta-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -614,6 +614,7 @@ files:
|
|
614
614
|
- Rakefile
|
615
615
|
- bin/commonmeta
|
616
616
|
- commonmeta.gemspec
|
617
|
+
- csl-data.json
|
617
618
|
- lib/commonmeta.rb
|
618
619
|
- lib/commonmeta/array.rb
|
619
620
|
- lib/commonmeta/author_utils.rb
|
@@ -655,7 +656,7 @@ files:
|
|
655
656
|
- lib/commonmeta/xml_converter.rb
|
656
657
|
- resources/2008/09/xsd.xsl
|
657
658
|
- resources/cff.json
|
658
|
-
- resources/commonmeta_v0.
|
659
|
+
- resources/commonmeta_v0.10.3.json
|
659
660
|
- resources/crossref/AccessIndicators.xsd
|
660
661
|
- resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd
|
661
662
|
- resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd
|
@@ -670,6 +671,7 @@ files:
|
|
670
671
|
- resources/crossref/fundref.xsd
|
671
672
|
- resources/crossref/module-ali.xsd
|
672
673
|
- resources/crossref/relations.xsd
|
674
|
+
- resources/csl-citation.json
|
673
675
|
- resources/datacite-contributorType-v4.xsd
|
674
676
|
- resources/datacite-dateType-v4.xsd
|
675
677
|
- resources/datacite-descriptionType-v4.xsd
|
@@ -843,6 +845,7 @@ files:
|
|
843
845
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/journal_issue.yml
|
844
846
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/mEDRA.yml
|
845
847
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/markup.yml
|
848
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/missing_contributor.yml
|
846
849
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/missing_creator.yml
|
847
850
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/multiple_issn.yml
|
848
851
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/multiple_titles.yml
|
@@ -856,6 +859,7 @@ files:
|
|
856
859
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/yet_another_book.yml
|
857
860
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_metadata/yet_another_book_chapter.yml
|
858
861
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_crossref_raw/journal_article.yml
|
862
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/SoftwareSourceCode.yml
|
859
863
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/dissertation.yml
|
860
864
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/funding_references.yml
|
861
865
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_datacite_metadata/subject_scheme.yml
|
@@ -867,6 +871,7 @@ files:
|
|
867
871
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/by_blog_id.yml
|
868
872
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/not_indexed_posts.yml
|
869
873
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed/unregistered_posts.yml
|
874
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/archived_wordpress_post.yml
|
870
875
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml
|
871
876
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml
|
872
877
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml
|
@@ -924,8 +929,10 @@ files:
|
|
924
929
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml
|
925
930
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite_check_codemeta_v2.yml
|
926
931
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml
|
932
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/book_oup.yml
|
927
933
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml
|
928
934
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml
|
935
|
+
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_plos.yml
|
929
936
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_anonymous_author.yml
|
930
937
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml
|
931
938
|
- spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml
|