commonmeta-ruby 3.3.17 → 3.4.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +37 -50
  3. data/bin/commonmeta +1 -1
  4. data/lib/commonmeta/cli.rb +7 -0
  5. data/lib/commonmeta/crossref_utils.rb +20 -0
  6. data/lib/commonmeta/readers/json_feed_reader.rb +19 -1
  7. data/lib/commonmeta/schema_utils.rb +1 -1
  8. data/lib/commonmeta/utils.rb +6 -4
  9. data/lib/commonmeta/version.rb +1 -1
  10. data/resources/{commonmeta_v0.9.2.json → commonmeta_v0.9.3.json} +32 -2
  11. data/spec/cli_spec.rb +1 -1
  12. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blog_post_with_non-url_id.yml +84 -18
  13. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/blogger_post.yml +42 -14
  14. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_author_name_suffix.yml +184 -55
  15. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_doi.yml +76 -15
  16. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_institutional_author.yml +33 -12
  17. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_organizational_author.yml +44 -11
  18. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_with_related_identifiers.yml +366 -0
  19. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/ghost_post_without_doi.yml +144 -11
  20. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post.yml +42 -13
  21. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/jekyll_post_with_anonymous_author.yml +17 -13
  22. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/substack_post_with_broken_reference.yml +557 -262
  23. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/syldavia_gazette_post_with_references.yml +76 -47
  24. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/upstream_post_with_references.yml +303 -123
  25. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post.yml +108 -12
  26. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_many_references.yml +3048 -441
  27. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_references.yml +178 -31
  28. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/get_json_feed_item_metadata/wordpress_post_with_tracking_code_on_url.yml +139 -17
  29. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/another_schema_org_from_front-matter.yml +47 -48
  30. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article.yml +5 -5
  31. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/journal_article_from_datacite.yml +7 -7
  32. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_anonymous_author.yml +17 -13
  33. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_doi.yml +108 -12
  34. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_organizational_author.yml +44 -11
  35. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_rogue_scholar_with_relations.yml +366 -0
  36. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_from_upstream_blog.yml +200 -11
  37. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/json_feed_item_with_references.yml +303 -123
  38. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/posted_content.yml +16 -16
  39. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_another_science_blog.yml +17 -17
  40. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_front_matter.yml +111 -113
  41. data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/write_metadata_as_crossref/schema_org_from_upstream_blog.yml +64 -57
  42. data/spec/readers/json_feed_reader_spec.rb +85 -57
  43. data/spec/writers/crossref_xml_writer_spec.rb +76 -40
  44. metadata +6 -4
@@ -19,15 +19,15 @@ describe Commonmeta::Metadata, vcr: true do
19
19
  expect(subject.titles).to eq([{ "title" => "Ten years and a million links" }])
20
20
  expect(subject.license).to eq("id" => "CC-BY-4.0",
21
21
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
22
- expect(subject.date).to eq("published"=>"2023-05-31", "updated"=>"2023-05-31")
22
+ expect(subject.date).to eq("published" => "2023-05-31", "updated" => "2023-05-31")
23
23
  expect(subject.descriptions.first["description"]).to start_with("As trailed on a Twitter thread last week I’ve been working on a manuscript describing the efforts to map taxonomic names to their original descriptions in the taxonomic literature.")
24
24
  expect(subject.publisher).to eq("name" => "iPhylo")
25
- expect(subject.subjects).to eq([{ "subject" => "Natural sciences" },
25
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
26
26
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
27
- "subject" => "FOS: Natural sciences",
27
+ "subject" => "FOS: Computer and information sciences",
28
28
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
29
29
  expect(subject.language).to eq("en")
30
- expect(subject.container).to eq("identifier" => "https://iphylo.blogspot.com/", "identifierType" => "URL", "title" => "iPhylo", "type" => "Periodical")
30
+ expect(subject.container).to eq("identifier" => "https://iphylo.blogspot.com", "identifierType" => "URL", "title" => "iPhylo", "type" => "Periodical")
31
31
  end
32
32
 
33
33
  it "ghost post with doi" do
@@ -43,12 +43,37 @@ describe Commonmeta::Metadata, vcr: true do
43
43
  expect(subject.titles).to eq([{ "title" => "Does it compose?" }])
44
44
  expect(subject.license).to eq("id" => "CC-BY-4.0",
45
45
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
46
- expect(subject.date).to eq("published"=>"2023-05-16", "updated"=>"2023-06-18")
46
+ expect(subject.date).to eq("published" => "2023-05-16", "updated" => "2023-06-18")
47
47
  expect(subject.descriptions.first["description"]).to start_with("One question I have increasingly asked myself in the past few years. Meaning Can I run this open source software using Docker containers and a Docker Compose file?")
48
48
  expect(subject.publisher).to eq("name" => "Front Matter")
49
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
49
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
50
50
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
51
- "subject" => "FOS: Engineering and technology",
51
+ "subject" => "FOS: Computer and information sciences",
52
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
53
+ expect(subject.language).to eq("en")
54
+ expect(subject.container).to eq("identifier" => "https://blog.front-matter.io", "identifierType" => "URL", "title" => "Front Matter", "type" => "Periodical")
55
+ end
56
+
57
+ it "ghost post with related_identifiers" do
58
+ input = "https://rogue-scholar.org/api/posts/8a4de443-3347-4b82-b57d-e3c82b6485fc"
59
+ subject = described_class.new(input: input)
60
+ expect(subject.valid?).to be true
61
+ expect(subject.id).to eq("https://doi.org/10.53731/r79v4e1-97aq74v-ag578")
62
+ expect(subject.url).to eq("https://blog.front-matter.io/posts/differences-between-orcid-and-datacite-metadata")
63
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "8a4de443-3347-4b82-b57d-e3c82b6485fc", "alternateIdentifierType" => "UUID" }])
64
+ expect(subject.type).to eq("Article")
65
+ expect(subject.creators.length).to eq(1)
66
+ expect(subject.creators.first).to eq("id" => "https://orcid.org/0000-0003-1419-2405", "familyName" => "Fenner", "givenName" => "Martin", "type" => "Person")
67
+ expect(subject.titles).to eq([{ "title" => "Differences between ORCID and DataCite Metadata" }])
68
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
69
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
70
+ expect(subject.date).to eq("published" => "2015-09-18", "updated" => "2023-09-05")
71
+ expect(subject.descriptions.first["description"]).to start_with("One of the first tasks for DataCite in the European Commission-funded THOR project")
72
+ expect(subject.publisher).to eq("name" => "Front Matter")
73
+ expect(subject.related_identifiers).to eq([{ "id" => "https://doi.org/10.5438/bc11-cqw1", "type" => "IsIdenticalTo" }])
74
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
75
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
76
+ "subject" => "FOS: Computer and information sciences",
52
77
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
53
78
  expect(subject.language).to eq("en")
54
79
  expect(subject.container).to eq("identifier" => "https://blog.front-matter.io", "identifierType" => "URL", "title" => "Front Matter", "type" => "Periodical")
@@ -63,19 +88,20 @@ describe Commonmeta::Metadata, vcr: true do
63
88
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "c3095752-2af0-40a4-a229-3ceb7424bce2", "alternateIdentifierType" => "UUID" }])
64
89
  expect(subject.type).to eq("Article")
65
90
  expect(subject.creators.length).to eq(1)
66
- expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person")
91
+ expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.",
92
+ "id" => "https://orcid.org/0000-0003-0449-4469", "type" => "Person")
67
93
  expect(subject.titles).to eq([{ "title" => "The Residency Visual Abstract" }])
68
94
  expect(subject.license).to eq("id" => "CC-BY-4.0",
69
95
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
70
- expect(subject.date).to eq("published"=>"2023-04-08", "updated"=>"2023-04-08")
96
+ expect(subject.date).to eq("published" => "2023-04-08", "updated" => "2023-04-08")
71
97
  expect(subject.descriptions.first["description"]).to start_with("My prototype for a Residency Visual Abstract")
72
98
  expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
73
- expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
99
+ expect(subject.subjects).to eq([{ "subject" => "Clinical medicine" },
74
100
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
75
- "subject" => "FOS: Medical and health sciences",
101
+ "subject" => "FOS: Clinical medicine",
76
102
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
77
103
  expect(subject.language).to eq("en")
78
- expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub/", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
104
+ expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
79
105
  end
80
106
 
81
107
  it "ghost post with author name suffix" do
@@ -87,19 +113,20 @@ describe Commonmeta::Metadata, vcr: true do
87
113
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "153d65e1-f0e4-49a6-a969-33d2129800ba", "alternateIdentifierType" => "UUID" }])
88
114
  expect(subject.type).to eq("Article")
89
115
  expect(subject.creators.length).to eq(1)
90
- expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person")
116
+ expect(subject.creators.first).to eq("familyName" => "Sathe", "givenName" => "Tejas S.", "type" => "Person",
117
+ "id" => "https://orcid.org/0000-0003-0449-4469")
91
118
  expect(subject.titles).to eq([{ "title" => "How to Build an Academic Powerhouse: Let's Study Who's Doing it" }])
92
119
  expect(subject.license).to eq("id" => "CC-BY-4.0",
93
120
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
94
- expect(subject.date).to eq("published"=>"2023-06-03", "updated"=>"2023-06-03")
121
+ expect(subject.date).to eq("published" => "2023-06-03", "updated" => "2023-06-03")
95
122
  expect(subject.descriptions.first["description"]).to start_with("Students and residents aspiring for a career in academic surgery")
96
123
  expect(subject.publisher).to eq("name" => "I.D.E.A.S.")
97
- expect(subject.subjects).to eq([{ "subject" => "Medical and health sciences" },
124
+ expect(subject.subjects).to eq([{ "subject" => "Clinical medicine" },
98
125
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
99
- "subject" => "FOS: Medical and health sciences",
126
+ "subject" => "FOS: Clinical medicine",
100
127
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
101
128
  expect(subject.language).to eq("en")
102
- expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub/", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
129
+ expect(subject.container).to eq("identifier" => "https://www.ideasurg.pub", "identifierType" => "URL", "title" => "I.D.E.A.S.", "type" => "Periodical")
103
130
  expect(subject.references).to be_nil
104
131
  end
105
132
 
@@ -117,13 +144,13 @@ describe Commonmeta::Metadata, vcr: true do
117
144
  expect(subject.license).to eq("id" => "CC-BY-4.0",
118
145
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
119
146
  expect(subject.date).to eq("published" => "2023-02-01", "updated" => "2023-04-13")
120
- expect(subject.descriptions.first["description"]).to start_with("Guinea worm disease reaches all-time low: only 13* human cases reported in 2022")
147
+ expect(subject.descriptions.first["description"]).to start_with("<strong>Guinea worm disease reaches all-time low: only 13* human cases")
121
148
  expect(subject.publisher).to eq("name" => "Syldavia Gazette")
122
149
  expect(subject.subjects).to eq([{ "subject" => "Humanities" }, { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf", "subject" => "FOS: Humanities", "subjectScheme" => "Fields of Science and Technology (FOS)" }])
123
150
  expect(subject.language).to eq("en")
124
151
  expect(subject.container).to eq("identifier" => "https://syldavia-gazette.org", "identifierType" => "URL", "title" => "Syldavia Gazette", "type" => "Periodical")
125
152
  expect(subject.references.length).to eq(5)
126
- expect(subject.references[1]).to eq("doi"=>"https://doi.org/10.1126/science.adg7879", "key"=>"ref2", "publicationYear"=>"2023", "title"=>"ChatGPT is fun, but not an author")
153
+ expect(subject.references[1]).to eq("doi" => "https://doi.org/10.1126/science.adg7879", "key" => "ref2", "publicationYear" => "2023", "title" => "ChatGPT is fun, but not an author")
127
154
  end
128
155
 
129
156
  it "wordpress post" do
@@ -142,9 +169,9 @@ describe Commonmeta::Metadata, vcr: true do
142
169
  expect(subject.date).to eq("published" => "2023-05-23", "updated" => "2023-05-23")
143
170
  expect(subject.descriptions.first["description"]).to start_with("Die EU-Wissenschaftsministerien haben sich auf ihrer heutigen Sitzung in Brüssel unter dem Titel “Council conclusions on high-quality, transparent, open, trustworthy and equitable scholarly publishing”")
144
171
  expect(subject.publisher).to eq("name" => "wisspub.net")
145
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
172
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
146
173
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
147
- "subject" => "FOS: Engineering and technology",
174
+ "subject" => "FOS: Social sciences",
148
175
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
149
176
  expect(subject.language).to eq("de")
150
177
  expect(subject.container).to eq("identifier" => "https://wisspub.net", "identifierType" => "URL", "title" => "wisspub.net", "type" => "Periodical")
@@ -163,18 +190,18 @@ describe Commonmeta::Metadata, vcr: true do
163
190
  expect(subject.license).to eq("id" => "CC-BY-4.0",
164
191
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
165
192
  expect(subject.date).to eq("published" => "2023-06-09", "updated" => "2023-06-09")
166
- expect(subject.descriptions.first["description"]).to start_with("Haplocanthosaurus tibiae and dorsal vertebrae.")
193
+ expect(subject.descriptions.first["description"]).to start_with("<em>Haplocanthosaurus</em> tibiae and dorsal vertebrae.")
167
194
  expect(subject.publisher).to eq("name" => "Sauropod Vertebra Picture of the Week")
168
- expect(subject.subjects).to eq([{ "subject" => "Natural sciences" },
195
+ expect(subject.subjects).to eq([{ "subject" => "Earth and related environmental sciences" },
169
196
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
170
- "subject" => "FOS: Natural sciences",
197
+ "subject" => "FOS: Earth and related environmental sciences",
171
198
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
172
199
  expect(subject.language).to eq("en")
173
200
  expect(subject.container).to eq("identifier" => "https://svpow.com", "identifierType" => "URL", "title" => "Sauropod Vertebra Picture of the Week", "type" => "Periodical")
174
201
  expect(subject.references.length).to eq(3)
175
202
  expect(subject.references.first).to eq("key" => "ref1", "url" => "https://sauroposeidon.files.wordpress.com/2010/04/foster-and-wedel-2014-haplocanthosaurus-from-snowmass-colorado.pdf")
176
203
  end
177
-
204
+
178
205
  it "wordpress post with tracking code on url" do
179
206
  input = "https://rogue-scholar.org/api/posts/5d95d90d-ff59-4c8b-b7f8-44e6b45fd593"
180
207
  subject = described_class.new(input: input)
@@ -183,19 +210,19 @@ describe Commonmeta::Metadata, vcr: true do
183
210
  expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
184
211
  expect(subject.type).to eq("Article")
185
212
  expect(subject.creators.length).to eq(1)
186
- expect(subject.creators.first).to eq("familyName"=>"Moore", "givenName"=>"Samuel", "id"=>"https://orcid.org/0000-0002-0504-2897", "type"=>"Person")
213
+ expect(subject.creators.first).to eq("familyName" => "Moore", "givenName" => "Samuel", "id" => "https://orcid.org/0000-0002-0504-2897", "type" => "Person")
187
214
  expect(subject.titles).to eq([{ "title" => "How to cultivate good closures: ‘scaling small’ and the limits of openness" }])
188
215
  expect(subject.license).to eq("id" => "CC-BY-4.0",
189
216
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
190
- expect(subject.date).to eq("published"=>"2023-04-20", "updated"=>"2023-06-19")
191
- expect(subject.descriptions.first["description"]).to start_with("Text of a talk given to the COPIM end-of-project conference")
217
+ expect(subject.date).to eq("published" => "2023-04-20", "updated" => "2023-06-19")
218
+ expect(subject.descriptions.first["description"]).to start_with("<em>Text of a talk given to the COPIM end-of-project conference:")
192
219
  expect(subject.publisher).to eq("name" => "Samuel Moore")
193
220
  expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
194
221
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
195
222
  "subject" => "FOS: Social sciences",
196
223
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
197
224
  expect(subject.language).to eq("en")
198
- expect(subject.container).to eq("identifier" => "https://www.samuelmoore.org/", "identifierType" => "URL", "title" => "Samuel Moore", "type" => "Periodical")
225
+ expect(subject.container).to eq("identifier" => "https://www.samuelmoore.org", "identifierType" => "URL", "title" => "Samuel Moore", "type" => "Periodical")
199
226
  expect(subject.references).to be_nil
200
227
  end
201
228
 
@@ -207,19 +234,19 @@ describe Commonmeta::Metadata, vcr: true do
207
234
  expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
208
235
  expect(subject.type).to eq("Article")
209
236
  expect(subject.creators.length).to eq(1)
210
- expect(subject.creators.first).to eq("name"=>"OA.Works", "type"=>"Organization")
237
+ expect(subject.creators.first).to eq("name" => "OA.Works", "type" => "Organization")
211
238
  expect(subject.titles).to eq([{ "title" => "Nature features OA.Report's work putting OA policy into practice!" }])
212
239
  expect(subject.license).to eq("id" => "CC-BY-4.0",
213
240
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
214
- expect(subject.date).to eq("published"=>"2023-01-24", "updated"=>"2023-01-24")
241
+ expect(subject.date).to eq("published" => "2023-01-24", "updated" => "2023-01-24")
215
242
  expect(subject.descriptions.first["description"]).to start_with("After a couple of years of working to support institutions implementing their OA policies")
216
243
  expect(subject.publisher).to eq("name" => "OA.Works Blog")
217
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
244
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
218
245
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
219
- "subject" => "FOS: Engineering and technology",
246
+ "subject" => "FOS: Computer and information sciences",
220
247
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
221
248
  expect(subject.language).to eq("en")
222
- expect(subject.container).to eq("identifier" => "https://blog.oa.works/", "identifierType" => "URL", "title" => "OA.Works Blog", "type" => "Periodical")
249
+ expect(subject.container).to eq("identifier" => "https://blog.oa.works", "identifierType" => "URL", "title" => "OA.Works Blog", "type" => "Periodical")
223
250
  end
224
251
 
225
252
  it "upstream post with references" do
@@ -236,7 +263,7 @@ describe Commonmeta::Metadata, vcr: true do
236
263
  expect(subject.license).to eq("id" => "CC-BY-4.0",
237
264
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
238
265
  expect(subject.date).to eq("published" => "2023-04-18", "updated" => "2023-04-18")
239
- expect(subject.descriptions.first["description"]).to start_with("Research software is a key part of most research today. As University of Manchester Professor Carole Goble has said, \"software is the ubiquitous instrument of science.\"")
266
+ expect(subject.descriptions.first["description"]).to start_with("Research software is a key part of most research today.")
240
267
  expect(subject.publisher).to eq("name" => "Upstream")
241
268
  expect(subject.subjects).to eq([{ "subject" => "Humanities" },
242
269
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
@@ -257,19 +284,20 @@ describe Commonmeta::Metadata, vcr: true do
257
284
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "efdacb04-bcec-49d7-b689-ab3eab0634bf", "alternateIdentifierType" => "UUID" }])
258
285
  expect(subject.type).to eq("Article")
259
286
  expect(subject.creators.length).to eq(1)
260
- expect(subject.creators.first).to eq("familyName" => "Karcher", "givenName" => "Sebastian", "type" => "Person")
287
+ expect(subject.creators.first).to eq("familyName" => "Karcher", "givenName" => "Sebastian",
288
+ "id" => "https://orcid.org/0000-0001-8249-7388", "type" => "Person")
261
289
  expect(subject.titles).to eq([{ "title" => "Seeking Public Comment on CSL 1.0.2 Release" }])
262
290
  expect(subject.license).to eq("id" => "CC-BY-4.0",
263
291
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
264
292
  expect(subject.date).to eq("published" => "2020-07-11", "updated" => "2020-07-11")
265
293
  expect(subject.descriptions.first["description"]).to start_with("Over the past few months, Citation Style Language developers have worked to address a backlog of feature requests. This work will be reflected in two upcoming releases.")
266
294
  expect(subject.publisher).to eq("name" => "Citation Style Language")
267
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
295
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
268
296
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
269
- "subject" => "FOS: Engineering and technology",
297
+ "subject" => "FOS: Computer and information sciences",
270
298
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
271
299
  expect(subject.language).to eq("en")
272
- expect(subject.container).to eq("identifier" => "https://citationstyles.org/", "identifierType" => "URL", "title" => "Citation Style Language", "type" => "Periodical")
300
+ expect(subject.container).to eq("identifier" => "https://citationstyles.org", "identifierType" => "URL", "title" => "Citation Style Language", "type" => "Periodical")
273
301
  end
274
302
 
275
303
  it "ghost post with organizational author" do
@@ -281,11 +309,11 @@ describe Commonmeta::Metadata, vcr: true do
281
309
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
282
310
  expect(subject.type).to eq("Article")
283
311
  expect(subject.creators.length).to eq(1)
284
- expect(subject.creators.first).to eq("id"=>"https://ror.org/0342dzm54", "name"=>"Liberate Science", "type"=>"Organization")
312
+ expect(subject.creators.first).to eq("id" => "https://ror.org/0342dzm54", "name" => "Liberate Science", "type" => "Organization")
285
313
  expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
286
314
  expect(subject.license).to eq("id" => "CC-BY-4.0",
287
315
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
288
- expect(subject.date).to eq("published"=>"2023-05-09", "updated"=>"2023-05-09")
316
+ expect(subject.date).to eq("published" => "2023-05-09", "updated" => "2023-05-09")
289
317
  expect(subject.descriptions.first["description"]).to start_with("KU Leuven is now an inaugural supporting member of ResearchEquals")
290
318
  expect(subject.publisher).to eq("name" => "Liberate Science")
291
319
  expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
@@ -293,7 +321,7 @@ describe Commonmeta::Metadata, vcr: true do
293
321
  "subject" => "FOS: Social sciences",
294
322
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
295
323
  expect(subject.language).to eq("en")
296
- expect(subject.container).to eq("identifier" => "https://libscie.org/", "identifierType" => "URL", "title" => "Liberate Science", "type" => "Periodical")
324
+ expect(subject.container).to eq("identifier" => "https://libscie.org", "identifierType" => "URL", "title" => "Liberate Science", "type" => "Periodical")
297
325
  expect(subject.references).to be_nil
298
326
  end
299
327
 
@@ -306,19 +334,19 @@ describe Commonmeta::Metadata, vcr: true do
306
334
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
307
335
  expect(subject.type).to eq("Article")
308
336
  expect(subject.creators.length).to eq(1)
309
- expect(subject.creators.first).to eq("familyName"=>"Göbel", "givenName"=>"Mathias", "type"=>"Person")
337
+ expect(subject.creators.first).to eq("familyName" => "Göbel", "givenName" => "Mathias", "type" => "Person")
310
338
  expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
311
339
  expect(subject.license).to eq("id" => "CC-BY-4.0",
312
340
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
313
- expect(subject.date).to eq("published"=>"2017-01-01", "updated"=>"2017-01-01")
341
+ expect(subject.date).to eq("published" => "2017-01-01", "updated" => "2017-01-01")
314
342
  expect(subject.descriptions.first["description"]).to start_with("Welcome everyone!")
315
343
  expect(subject.publisher).to eq("name" => "lab.sub - Articles")
316
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
344
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
317
345
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
318
- "subject" => "FOS: Engineering and technology",
346
+ "subject" => "FOS: Computer and information sciences",
319
347
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
320
348
  expect(subject.language).to eq("en")
321
- expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de/", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
349
+ expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
322
350
  expect(subject.references).to be_nil
323
351
  end
324
352
 
@@ -331,11 +359,11 @@ describe Commonmeta::Metadata, vcr: true do
331
359
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1898d2d7-4d87-4487-96c4-3073cf99e9a5", "alternateIdentifierType" => "UUID" }])
332
360
  expect(subject.type).to eq("Article")
333
361
  expect(subject.creators.length).to eq(1)
334
- expect(subject.creators.first).to eq("familyName"=>"Matheson", "givenName"=>"Stephen", "type"=>"Person")
362
+ expect(subject.creators.first).to eq("familyName" => "Matheson", "givenName" => "Stephen", "type" => "Person")
335
363
  expect(subject.titles).to eq([{ "title" => "Quintessence of Dust 2023 restart: the why" }])
336
364
  expect(subject.license).to eq("id" => "CC-BY-4.0",
337
365
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
338
- expect(subject.date).to eq("published"=>"2023-01-09", "updated"=>"2023-04-02")
366
+ expect(subject.date).to eq("published" => "2023-01-09", "updated" => "2023-04-02")
339
367
  expect(subject.descriptions.first["description"]).to start_with("It's early January 2023, a little before sunset in Tucson.")
340
368
  expect(subject.publisher).to eq("name" => "Quintessence of Dust")
341
369
  expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
@@ -343,7 +371,7 @@ describe Commonmeta::Metadata, vcr: true do
343
371
  "subject" => "FOS: Social sciences",
344
372
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
345
373
  expect(subject.language).to eq("en")
346
- expect(subject.container).to eq("identifier" => "http://sfmatheson.blogspot.com/", "identifierType" => "URL", "title" => "Quintessence of Dust", "type" => "Periodical")
374
+ expect(subject.container).to eq("identifier" => "http://sfmatheson.blogspot.com", "identifierType" => "URL", "title" => "Quintessence of Dust", "type" => "Periodical")
347
375
  expect(subject.references).to be_nil
348
376
  end
349
377
 
@@ -356,12 +384,12 @@ describe Commonmeta::Metadata, vcr: true do
356
384
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3dc29da-0481-4f3b-8110-4c07260fca67", "alternateIdentifierType" => "UUID" }])
357
385
  expect(subject.type).to eq("Article")
358
386
  expect(subject.creators.length).to eq(1)
359
- expect(subject.creators.first).to eq("familyName"=>"Steiner", "givenName"=>"Tobias", "id"=>"https://orcid.org/0000-0002-3158-3136", "type"=>"Person")
387
+ expect(subject.creators.first).to eq("familyName" => "Steiner", "givenName" => "Tobias", "id" => "https://orcid.org/0000-0002-3158-3136", "type" => "Person")
360
388
  expect(subject.titles).to eq([{ "title" => "Grundlagen für die Entwicklung einer Open Scholarship-Strategie" }])
361
389
  expect(subject.license).to eq("id" => "CC-BY-4.0",
362
390
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
363
- expect(subject.date).to eq("published"=>"2019-01-31", "updated"=>"2023-06-19")
364
- expect(subject.descriptions.first["description"]).to start_with("Versionshistorie Version 1.0 — 16. Oktober 2017 – Erste Version des Dokuments")
391
+ expect(subject.date).to eq("published" => "2019-01-31", "updated" => "2023-07-08")
392
+ expect(subject.descriptions.first["description"]).to start_with("<strong>Versionshistorie</strong> Version 1.0 — 16. Oktober 2017")
365
393
  expect(subject.publisher).to eq("name" => "Flavours of Open")
366
394
  expect(subject.subjects).to eq([{ "subject" => "Humanities" },
367
395
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
@@ -369,7 +397,7 @@ describe Commonmeta::Metadata, vcr: true do
369
397
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
370
398
  expect(subject.language).to eq("de")
371
399
  expect(subject.container).to eq("identifier" => "https://flavoursofopen.science", "identifierType" => "URL", "title" => "Flavours of Open", "type" => "Periodical")
372
- expect(subject.references.length).to eq(55)
400
+ expect(subject.references.length).to eq(56)
373
401
  expect(subject.references.first).to eq("key" => "ref1", "url" => "http://oerstrategy.org/home/read-the-doc")
374
402
  end
375
403
 
@@ -386,8 +414,8 @@ describe Commonmeta::Metadata, vcr: true do
386
414
  expect(subject.titles).to eq([{ "title" => "The Preregistration Prescriptiveness Trade-Off and Unknown Unknowns in Science" }])
387
415
  expect(subject.license).to eq("id" => "CC-BY-4.0",
388
416
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
389
- expect(subject.date).to eq("published"=>"2023-06-06", "updated"=>"2023-06-06")
390
- expect(subject.descriptions.first["description"]).to start_with("AbstractI discuss Van Drimmelen’s (2023) Metascience2023 presentation")
417
+ expect(subject.date).to eq("published" => "2023-06-06", "updated" => "2023-06-06")
418
+ expect(subject.descriptions.first["description"]).to start_with("<strong>Abstract</strong> I discuss Van Drimmelen’s (2023) Metascience2023")
391
419
  expect(subject.publisher).to eq("name" => "Critical Metascience")
392
420
  expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
393
421
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
@@ -396,7 +424,7 @@ describe Commonmeta::Metadata, vcr: true do
396
424
  expect(subject.language).to eq("en")
397
425
  expect(subject.container).to eq("identifier" => "https://markrubin.substack.com", "identifierType" => "URL", "title" => "Critical Metascience", "type" => "Periodical")
398
426
  expect(subject.references.length).to eq(16)
399
- expect(subject.references.first).to eq("doi"=>"https://doi.org/10.3386/w27250", "key"=>"ref1", "publicationYear"=>"2020", "title"=>"Research Registries: Facts, Myths, and Possible Improvements")
427
+ expect(subject.references.first).to eq("doi" => "https://doi.org/10.3386/w27250", "key" => "ref1", "publicationYear" => "2020", "title" => "Research Registries: Facts, Myths, and Possible Improvements")
400
428
  end
401
429
  end
402
430
 
@@ -181,10 +181,10 @@ describe Commonmeta::Metadata, vcr: true do
181
181
  expect(subject.titles).to eq([{ "title" => "Attempts at automating journal subject classification" }])
182
182
  expect(subject.creators.length).to eq(1)
183
183
  expect(subject.creators.first).to eq("familyName" => "Datta", "givenName" => "Esha", "id" => "https://orcid.org/0000-0001-9165-2757", "type" => "Person")
184
- expect(subject.subjects).to eq([{"subject"=>"Humanities"},
185
- {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
186
- "subject"=>"FOS: Humanities",
187
- "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
184
+ expect(subject.subjects).to eq([{ "subject" => "Humanities" },
185
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
186
+ "subject" => "FOS: Humanities",
187
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
188
188
  expect(subject.language).to eq("en")
189
189
  expect(subject.license).to eq("id" => "CC-BY-4.0",
190
190
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
@@ -194,8 +194,8 @@ describe Commonmeta::Metadata, vcr: true do
194
194
  "person_name")).first).to eq("ORCID" => "https://orcid.org/0000-0001-9165-2757", "contributor_role" => "author", "given_name" => "Esha", "sequence" => "first", "surname" => "Datta")
195
195
  expect(crossref_xml.dig("titles",
196
196
  "title")).to eq("Attempts at automating journal subject classification")
197
- expect(crossref_xml.dig('item_number')).to eq("__content__"=>"5d14ffacb9ac4e20bdc0d9248df4e80d", "item_number_type"=>"uuid")
198
- expect(crossref_xml.dig('group_title')).to eq('Humanities')
197
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "5d14ffacb9ac4e20bdc0d9248df4e80d", "item_number_type" => "uuid")
198
+ expect(crossref_xml.dig("group_title")).to eq("Humanities")
199
199
  end
200
200
 
201
201
  it "json_feed_item with references" do
@@ -205,15 +205,15 @@ describe Commonmeta::Metadata, vcr: true do
205
205
  expect(subject.valid?).to be true
206
206
  expect(subject.id).to eq("https://doi.org/10.54900/zwm7q-vet94")
207
207
  expect(subject.url).to eq("https://upstream.force11.org/the-research-software-alliance-resa")
208
- expect(subject.alternate_identifiers).to eq([{"alternateIdentifier"=>"954f8138-0ecd-4090-87c5-cef1297f1470", "alternateIdentifierType"=>"UUID"}])
208
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "954f8138-0ecd-4090-87c5-cef1297f1470", "alternateIdentifierType" => "UUID" }])
209
209
  expect(subject.type).to eq("Article")
210
210
  expect(subject.titles).to eq([{ "title" => "The Research Software Alliance (ReSA)" }])
211
211
  expect(subject.creators.length).to eq(2)
212
- expect(subject.creators.first).to eq("familyName"=>"Katz", "givenName"=>"Daniel S.", "id"=>"https://orcid.org/0000-0001-5934-7525", "type"=>"Person")
213
- expect(subject.subjects).to eq([{"subject"=>"Humanities"},
214
- {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
215
- "subject"=>"FOS: Humanities",
216
- "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
212
+ expect(subject.creators.first).to eq("familyName" => "Katz", "givenName" => "Daniel S.", "id" => "https://orcid.org/0000-0001-5934-7525", "type" => "Person")
213
+ expect(subject.subjects).to eq([{ "subject" => "Humanities" },
214
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
215
+ "subject" => "FOS: Humanities",
216
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
217
217
  expect(subject.language).to eq("en")
218
218
  expect(subject.license).to eq("id" => "CC-BY-4.0",
219
219
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
@@ -224,10 +224,10 @@ describe Commonmeta::Metadata, vcr: true do
224
224
  "person_name")).first).to eq("ORCID" => "https://orcid.org/0000-0001-5934-7525", "contributor_role" => "author", "given_name" => "Daniel S.", "sequence" => "first", "surname" => "Katz")
225
225
  expect(crossref_xml.dig("titles",
226
226
  "title")).to eq("The Research Software Alliance (ReSA)")
227
- expect(crossref_xml.dig("citation_list", "citation").length).to eq(11)
228
- expect(crossref_xml.dig("citation_list", "citation").last).to eq("article_title"=>"The Research Software Alliance (ReSA) and the community landscape", "cYear"=>"2020", "doi"=>"10.5281/zenodo.3699950", "key"=>"ref11")
229
- expect(crossref_xml.dig('item_number')).to eq("__content__"=>"954f81380ecd409087c5cef1297f1470", "item_number_type"=>"uuid")
230
- expect(crossref_xml.dig('group_title')).to eq('Humanities')
227
+ expect(crossref_xml.dig("citation_list", "citation").last).to eq("article_title" => "The Research Software Alliance (ReSA) and the community landscape", "cYear" => "2020", "doi" => "10.5281/zenodo.3699950", "key" => "ref11")
228
+ expect(crossref_xml.dig("citation_list", "citation").last).to eq("article_title" => "The Research Software Alliance (ReSA) and the community landscape", "cYear" => "2020", "doi" => "10.5281/zenodo.3699950", "key" => "ref11")
229
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "954f81380ecd409087c5cef1297f1470", "item_number_type" => "uuid")
230
+ expect(crossref_xml.dig("group_title")).to eq("Humanities")
231
231
  end
232
232
 
233
233
  it "json_feed_item from rogue scholar with doi" do
@@ -240,22 +240,22 @@ describe Commonmeta::Metadata, vcr: true do
240
240
  expect(subject.type).to eq("Article")
241
241
  expect(subject.titles).to eq([{ "title" => "EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs" }])
242
242
  expect(subject.creators.length).to eq(1)
243
- expect(subject.creators.first).to eq("familyName"=>"Pampel", "givenName"=>"Heinz", "id"=>"https://orcid.org/0000-0003-3334-2771", "type"=>"Person")
244
- expect(subject.subjects).to eq([{"subject"=>"Engineering and technology"},
245
- {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
246
- "subject"=>"FOS: Engineering and technology",
247
- "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
243
+ expect(subject.creators.first).to eq("familyName" => "Pampel", "givenName" => "Heinz", "id" => "https://orcid.org/0000-0003-3334-2771", "type" => "Person")
244
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
245
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
246
+ "subject" => "FOS: Social sciences",
247
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
248
248
  expect(subject.language).to eq("de")
249
249
  expect(subject.license).to eq("id" => "CC-BY-4.0",
250
250
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
251
251
  crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
252
252
  expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
253
253
  expect(Array.wrap(crossref_xml.dig("contributors",
254
- "person_name")).first).to eq("ORCID"=>"https://orcid.org/0000-0003-3334-2771", "contributor_role"=>"author", "given_name"=>"Heinz", "sequence"=>"first", "surname"=>"Pampel")
254
+ "person_name")).first).to eq("ORCID" => "https://orcid.org/0000-0003-3334-2771", "contributor_role" => "author", "given_name" => "Heinz", "sequence" => "first", "surname" => "Pampel")
255
255
  expect(crossref_xml.dig("titles",
256
256
  "title")).to eq("EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs")
257
- expect(crossref_xml.dig('item_number')).to eq("__content__"=>"1c57855813244493b8af84c49eabc52f", "item_number_type"=>"uuid")
258
- expect(crossref_xml.dig('group_title')).to eq('Engineering and technology')
257
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "1c57855813244493b8af84c49eabc52f", "item_number_type" => "uuid")
258
+ expect(crossref_xml.dig("group_title")).to eq("Social sciences")
259
259
  end
260
260
 
261
261
  it "json_feed_item from rogue scholar with organizational author" do
@@ -268,22 +268,58 @@ describe Commonmeta::Metadata, vcr: true do
268
268
  expect(subject.type).to eq("Article")
269
269
  expect(subject.titles).to eq([{ "title" => "KU Leuven supports ResearchEquals" }])
270
270
  expect(subject.creators.length).to eq(1)
271
- expect(subject.creators.first).to eq("id"=>"https://ror.org/0342dzm54", "name"=>"Liberate Science", "type"=>"Organization")
272
- expect(subject.subjects).to eq([{"subject"=>"Social sciences"},
273
- {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf",
274
- "subject"=>"FOS: Social sciences",
275
- "subjectScheme"=>"Fields of Science and Technology (FOS)"}])
271
+ expect(subject.creators.first).to eq("id" => "https://ror.org/0342dzm54", "name" => "Liberate Science", "type" => "Organization")
272
+ expect(subject.subjects).to eq([{ "subject" => "Social sciences" },
273
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
274
+ "subject" => "FOS: Social sciences",
275
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
276
276
  expect(subject.language).to eq("en")
277
277
  expect(subject.license).to eq("id" => "CC-BY-4.0",
278
278
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
279
279
  crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
280
280
  expect(Array.wrap(crossref_xml.dig("contributors", "organization")).length).to eq(1)
281
281
  expect(Array.wrap(crossref_xml.dig("contributors",
282
- "organization")).first).to eq("__content__"=>"Liberate Science", "contributor_role"=>"author", "sequence"=>"first")
282
+ "organization")).first).to eq("__content__" => "Liberate Science", "contributor_role" => "author", "sequence" => "first")
283
283
  expect(crossref_xml.dig("titles",
284
284
  "title")).to eq("KU Leuven supports ResearchEquals")
285
- expect(crossref_xml.dig('item_number')).to eq("__content__"=>"5561f8e42ff14186a8d58dacb3afe414", "item_number_type"=>"uuid")
286
- expect(crossref_xml.dig('group_title')).to eq('Social sciences')
285
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "5561f8e42ff14186a8d58dacb3afe414", "item_number_type" => "uuid")
286
+ expect(crossref_xml.dig("group_title")).to eq("Social sciences")
287
+ end
288
+
289
+ it "json_feed_item from rogue scholar with relations" do
290
+ input = "https://rogue-scholar.org/api/posts/8a4de443-3347-4b82-b57d-e3c82b6485fc"
291
+ subject = described_class.new(input: input, doi: "10.53731/r79v4e1-97aq74v-ag578")
292
+
293
+ expect(subject.id).to eq("https://doi.org/10.53731/r79v4e1-97aq74v-ag578")
294
+ expect(subject.url).to eq("https://blog.front-matter.io/posts/differences-between-orcid-and-datacite-metadata")
295
+ expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "8a4de443-3347-4b82-b57d-e3c82b6485fc", "alternateIdentifierType" => "UUID" }])
296
+ expect(subject.type).to eq("Article")
297
+ expect(subject.creators.length).to eq(1)
298
+ expect(subject.creators.first).to eq("familyName" => "Fenner",
299
+ "givenName" => "Martin",
300
+ "id" => "https://orcid.org/0000-0003-1419-2405", "type" => "Person")
301
+ expect(subject.titles).to eq([{ "title" => "Differences between ORCID and DataCite Metadata" }])
302
+ expect(subject.license).to eq("id" => "CC-BY-4.0",
303
+ "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
304
+ expect(subject.date).to eq("published" => "2015-09-18", "updated" => "2023-09-05")
305
+ expect(subject.descriptions.first["description"]).to start_with("One of the first tasks for DataCite in the European Commission-funded THOR project")
306
+ expect(subject.publisher).to eq("name" => "Front Matter")
307
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
308
+ { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
309
+ "subject" => "FOS: Computer and information sciences",
310
+ "subjectScheme" => "Fields of Science and Technology (FOS)" }])
311
+ expect(subject.language).to eq("en")
312
+ 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"}])
315
+ crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
316
+ expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
317
+ expect(Array.wrap(crossref_xml.dig("contributors",
318
+ "person_name")).first).to eq({"ORCID"=>"https://orcid.org/0000-0003-1419-2405", "contributor_role"=>"author", "given_name"=>"Martin", "sequence"=>"first", "surname"=>"Fenner"})
319
+ expect(crossref_xml.dig("titles",
320
+ "title")).to eq("Differences between ORCID and DataCite Metadata")
321
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "8a4de44333474b82b57de3c82b6485fc", "item_number_type" => "uuid")
322
+ expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
287
323
  end
288
324
 
289
325
  it "json_feed_item from rogue scholar with anonymous author" do
@@ -295,28 +331,28 @@ describe Commonmeta::Metadata, vcr: true do
295
331
  expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
296
332
  expect(subject.type).to eq("Article")
297
333
  expect(subject.creators.length).to eq(1)
298
- expect(subject.creators.first).to eq("familyName"=>"Göbel", "givenName"=>"Mathias", "type"=>"Person")
334
+ expect(subject.creators.first).to eq("familyName" => "Göbel", "givenName" => "Mathias", "type" => "Person")
299
335
  expect(subject.titles).to eq([{ "title" => "Welcome to the Lab" }])
300
336
  expect(subject.license).to eq("id" => "CC-BY-4.0",
301
337
  "url" => "https://creativecommons.org/licenses/by/4.0/legalcode")
302
- expect(subject.date).to eq("published"=>"2017-01-01", "updated"=>"2017-01-01")
338
+ expect(subject.date).to eq("published" => "2017-01-01", "updated" => "2017-01-01")
303
339
  expect(subject.descriptions.first["description"]).to start_with("Welcome everyone!")
304
340
  expect(subject.publisher).to eq("name" => "lab.sub - Articles")
305
- expect(subject.subjects).to eq([{ "subject" => "Engineering and technology" },
341
+ expect(subject.subjects).to eq([{ "subject" => "Computer and information sciences" },
306
342
  { "schemeUri" => "http://www.oecd.org/science/inno/38235147.pdf",
307
- "subject" => "FOS: Engineering and technology",
343
+ "subject" => "FOS: Computer and information sciences",
308
344
  "subjectScheme" => "Fields of Science and Technology (FOS)" }])
309
345
  expect(subject.language).to eq("en")
310
- expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de/", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
346
+ expect(subject.container).to eq("identifier" => "https://lab.sub.uni-goettingen.de", "identifierType" => "URL", "title" => "lab.sub - Articles", "type" => "Periodical")
311
347
  expect(subject.references).to be_nil
312
348
  crossref_xml = Hash.from_xml(subject.crossref_xml).dig("doi_batch", "body", "posted_content")
313
349
  expect(Array.wrap(crossref_xml.dig("contributors", "person_name")).length).to eq(1)
314
350
  expect(Array.wrap(crossref_xml.dig("contributors",
315
- "person_name")).first).to eq("contributor_role"=>"author", "given_name"=>"Mathias", "sequence"=>"first", "surname"=>"Göbel")
351
+ "person_name")).first).to eq("contributor_role" => "author", "given_name" => "Mathias", "sequence" => "first", "surname" => "Göbel")
316
352
  expect(crossref_xml.dig("titles",
317
353
  "title")).to eq("Welcome to the Lab")
318
- expect(crossref_xml.dig('item_number')).to eq("__content__"=>"a163e3405b3c47369ab08c54fdff6a3c", "item_number_type"=>"uuid")
319
- expect(crossref_xml.dig('group_title')).to eq('Engineering and technology')
354
+ expect(crossref_xml.dig("item_number")).to eq("__content__" => "a163e3405b3c47369ab08c54fdff6a3c", "item_number_type" => "uuid")
355
+ expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
320
356
  end
321
357
  end
322
358
  end