Skip to content

Commit

Permalink
add jats xml output files to json_feed
Browse files Browse the repository at this point in the history
  • Loading branch information
mfenner committed Jan 10, 2024
1 parent 18c8904 commit 811e8ad
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
commonmeta-ruby (3.8.2)
commonmeta-ruby (3.8.3)
activesupport (>= 4.2.5, < 8.0)
addressable (~> 2.8.1, < 2.8.2)
base32-url (>= 0.7.0, < 1)
Expand Down
3 changes: 2 additions & 1 deletion lib/commonmeta/readers/json_feed_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def get_files(id)

[{ "mimeType" => "text/markdown", "url" => "https://api.rogue-scholar.org/posts/#{doi}.md" },
{ "mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/#{doi}.pdf" },
{ "mimeType" => "application/epub+zip", "url" => "https://api.rogue-scholar.org/posts/#{doi}.epub" }]
{ "mimeType" => "application/epub+zip", "url" => "https://api.rogue-scholar.org/posts/#{doi}.epub" },
{ "mimeType" => "application/xml", "url" => "https://api.rogue-scholar.org/posts/#{doi}.xml" }]
end

def get_references(meta)
Expand Down
2 changes: 1 addition & 1 deletion lib/commonmeta/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Commonmeta
VERSION = '3.8.2'
VERSION = '3.8.3'
end
32 changes: 16 additions & 16 deletions spec/readers/json_feed_reader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.53731/4nwxn-frt36")
expect(subject.url).to eq("https://blog.front-matter.io/posts/does-it-compose")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/4nwxn-frt36.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5bb66e92-5cb9-4659-8aca-20e486b695c9", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -62,7 +62,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.53731/r79v4e1-97aq74v-ag578")
expect(subject.url).to eq("https://blog.front-matter.io/posts/differences-between-orcid-and-datacite-metadata")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r79v4e1-97aq74v-ag578.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "8a4de443-3347-4b82-b57d-e3c82b6485fc", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -89,7 +89,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.53731/r294649-6f79289-8cw18")
expect(subject.url).to eq("https://blog.front-matter.io/posts/nine-simple-ways-to-make-it-easier-to-re-use-your-data")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r294649-6f79289-8cw18.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "2bdebfc5-e02e-42c2-90c5-e873e2d0435d", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -116,7 +116,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.53731/r79s4nh-97aq74v-ag4t1")
expect(subject.url).to eq("https://blog.front-matter.io/posts/tracking-the-growth-of-the-pid-graph")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/r79s4nh-97aq74v-ag4t1.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "e58dc9c8-b870-4db2-8896-238b3246c551", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand Down Expand Up @@ -195,7 +195,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.53731/ffbx660-083tnag")
expect(subject.url).to eq("https://syldavia-gazette.org/guinea-worms-chatgpt-neanderthals")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.53731/ffbx660-083tnag.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "0022b9ef-525a-4a79-81ad-13411697f58a", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -220,7 +220,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/kz04m-s8z58")
expect(subject.url).to eq("https://wisspub.net/2023/05/23/eu-mitgliedstaaten-betonen-die-rolle-von-wissenschaftsgeleiteten-open-access-modellen-jenseits-von-apcs")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/kz04m-s8z58.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1c578558-1324-4493-b8af-84c49eabc52f", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -246,7 +246,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/faeph-x4x84")
expect(subject.url).to eq("https://wayback.archive-it.org/22143/20231103191454/https://project-thor.eu/2016/08/10/orcid-integration-in-pangaea")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/faeph-x4x84.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "570c8129-e867-49e6-8517-bd783627e76e", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand Down Expand Up @@ -278,7 +278,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/hke8v-d1e66")
expect(subject.url).to eq("https://svpow.com/2023/06/09/new-paper-curtice-et-al-2023-on-the-first-haplocanthosaurus-from-dry-mesa")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/hke8v-d1e66.pdf")
expect(subject.type).to eq("Article")
expect(subject.contributors.length).to eq(1)
Expand All @@ -305,7 +305,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/tpa8t-j6292")
expect(subject.url).to eq("https://www.samuelmoore.org/2023/04/20/how-to-cultivate-good-closures-scaling-small-and-the-limits-of-openness")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/tpa8t-j6292.pdf")
expect(subject.type).to eq("Article")
expect(subject.contributors.length).to eq(1)
Expand All @@ -331,7 +331,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/tfahc-rp566")
expect(subject.url).to eq("https://blog.oa.works/nature-features-oa-reports-work-putting-oa-policy-into-practice")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/tfahc-rp566.pdf")
expect(subject.type).to eq("Article")
expect(subject.contributors.length).to eq(1)
Expand Down Expand Up @@ -382,7 +382,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/zwdq7-waa43")
expect(subject.url).to eq("https://citationstyles.org/2020/07/11/seeking-public-comment-on-CSL-1-0-2")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/zwdq7-waa43.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "efdacb04-bcec-49d7-b689-ab3eab0634bf", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -409,7 +409,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/2shz7-ehx26")
expect(subject.url).to eq("https://libscie.org/ku-leuven-supports-researchequals")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/2shz7-ehx26.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "5561f8e4-2ff1-4186-a8d5-8dacb3afe414", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -436,7 +436,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/33es7-fqz31")
expect(subject.url).to eq("https://lab.sub.uni-goettingen.de/welcome.html")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/33es7-fqz31.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "a163e340-5b3c-4736-9ab0-8c54fdff6a3c", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -463,7 +463,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/63055-a8604")
expect(subject.url).to eq("http://sfmatheson.blogspot.com/2023/01/quintessence-of-dust-2023-restart-why.html")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/63055-a8604.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "1898d2d7-4d87-4487-96c4-3073cf99e9a5", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand All @@ -490,7 +490,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/9gfjs-pey70")
expect(subject.url).to eq("https://flavoursofopen.science/grundlagen-fur-die-entwicklung-einer-open-scholarship-strategie")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/9gfjs-pey70.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "f3dc29da-0481-4f3b-8110-4c07260fca67", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand Down Expand Up @@ -518,7 +518,7 @@
# expect(subject.valid?).to be true
expect(subject.id).to eq("https://doi.org/10.59350/bbcsr-r4b59")
expect(subject.url).to eq("https://markrubin.substack.com/p/the-preregistration-prescriptiveness")
expect(subject.files.length).to eq(3)
expect(subject.files.length).to eq(4)
expect(subject.files[1]).to eq("mimeType" => "application/pdf", "url" => "https://api.rogue-scholar.org/posts/10.59350/bbcsr-r4b59.pdf")
expect(subject.alternate_identifiers).to eq([{ "alternateIdentifier" => "2b105b29-acbc-4eae-9ff1-368803f36a4d", "alternateIdentifierType" => "UUID" }])
expect(subject.type).to eq("Article")
Expand Down
16 changes: 8 additions & 8 deletions spec/writers/crossref_xml_writer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"title")).to eq("Attempts at automating journal subject classification")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "5d14ffacb9ac4e20bdc0d9248df4e80d", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Humanities")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.54900/n6dnt-xpq48.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -266,7 +266,7 @@
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")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "954f81380ecd409087c5cef1297f1470", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Humanities")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.54900/zwm7q-vet94.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -297,7 +297,7 @@
"title")).to eq("EU-Mitgliedstaaten betonen die Rolle von wissenschaftsgeleiteten Open-Access-Modellen jenseits von APCs")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "1c57855813244493b8af84c49eabc52f", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Social sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -327,7 +327,7 @@
"title")).to eq("KU Leuven supports ResearchEquals")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "5561f8e42ff14186a8d58dacb3afe414", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Social sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -368,7 +368,7 @@
"title")).to eq("ORCID Integration Series: PANGAEA")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "570c8129e86749e68517bd783627e76e", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/faeph-x4x84.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -407,7 +407,7 @@
"title")).to eq("Differences between ORCID and DataCite Metadata")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "8a4de44333474b82b57de3c82b6485fc", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.53731/r79v4e1-97aq74v-ag578.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -445,7 +445,7 @@
"title")).to eq("Tracking the Growth of the PID Graph")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "e58dc9c8b8704db28896238b3246c551", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.53731/r79s4nh-97aq74v-ag4t1.pdf", "mime_type" => "application/pdf")
end

Expand Down Expand Up @@ -480,7 +480,7 @@
"title")).to eq("Welcome to the Lab")
expect(crossref_xml.dig("item_number")).to eq("__content__" => "a163e3405b3c47369ab08c54fdff6a3c", "item_number_type" => "uuid")
expect(crossref_xml.dig("group_title")).to eq("Computer and information sciences")
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(4)
expect(crossref_xml.dig("doi_data", "collection", "item").length).to eq(5)
expect(crossref_xml.dig("doi_data", "collection", "item", 2, "resource")).to eq("__content__" => "https://api.rogue-scholar.org/posts/10.59350/9ry27-7cz42.pdf", "mime_type" => "application/pdf")
end
end
Expand Down

0 comments on commit 811e8ad

Please sign in to comment.