From 5756dee5d2f823b83077ed576bd1638007a842a8 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 14 Jul 2020 18:48:05 +0200 Subject: [PATCH] don't use keyboard arguments with hashwithindifferentkey --- lib/bolognese/cli.rb | 2 +- lib/bolognese/metadata.rb | 2 +- spec/author_utils_spec.rb | 28 ++--- spec/datacite_utils_spec.rb | 6 +- spec/doi_utils_spec.rb | 2 +- spec/metadata_spec.rb | 6 +- spec/readers/bibtex_reader_spec.rb | 6 +- spec/readers/citeproc_reader_spec.rb | 6 +- spec/readers/codemeta_reader_spec.rb | 10 +- spec/readers/crosscite_reader_spec.rb | 4 +- spec/readers/crossref_reader_spec.rb | 68 +++++------ spec/readers/datacite_json_reader_spec.rb | 10 +- spec/readers/datacite_reader_spec.rb | 134 +++++++++++----------- spec/readers/npm_reader_spec.rb | 6 +- spec/readers/ris_reader_spec.rb | 8 +- spec/readers/schema_org_reader_spec.rb | 36 +++--- spec/utils_spec.rb | 2 +- spec/writers/bibtex_writer_spec.rb | 26 ++--- spec/writers/citation_writer_spec.rb | 12 +- spec/writers/citeproc_writer_spec.rb | 38 +++--- spec/writers/codemeta_writer_spec.rb | 6 +- spec/writers/crosscite_writer_spec.rb | 20 ++-- spec/writers/crossref_writer_spec.rb | 4 +- spec/writers/csv_writer_spec.rb | 10 +- spec/writers/datacite_json_writer_spec.rb | 14 +-- spec/writers/datacite_writer_spec.rb | 54 ++++----- spec/writers/jats_writer_spec.rb | 26 ++--- spec/writers/rdf_xml_writer_spec.rb | 14 +-- spec/writers/ris_writer_spec.rb | 22 ++-- spec/writers/schema_org_writer_spec.rb | 44 +++---- spec/writers/turtle_writer_spec.rb | 18 +-- 31 files changed, 322 insertions(+), 322 deletions(-) diff --git a/lib/bolognese/cli.rb b/lib/bolognese/cli.rb index 8f2a899b..7047105a 100644 --- a/lib/bolognese/cli.rb +++ b/lib/bolognese/cli.rb @@ -31,7 +31,7 @@ def __print_version method_option :locale, aliases: "-l", default: "en-US" method_option :show_errors, :type => :boolean, :force => false def convert(input) - metadata = Metadata.new(input: input, + metadata = Metadata.new(input, from: options[:from], regenerate: options[:regenerate], style: options[:style], diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index 021edc21..08f77d49 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -15,7 +15,7 @@ class Metadata :format, :funding_references, :state, :geo_locations, :types, :content_url, :related_identifiers, :style, :locale, :date_registered - def initialize(input: nil, **opts) + def initialize(input, **opts) options = HashWithIndifferentAccess.new(opts) id = normalize_id(input, options) ra = nil diff --git a/spec/author_utils_spec.rb b/spec/author_utils_spec.rb index 115675ea..3d3f0532 100644 --- a/spec/author_utils_spec.rb +++ b/spec/author_utils_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://doi.org/10.1101/097196" } - subject { Bolognese::Metadata.new(input: input, from: "crossref") } + subject { Bolognese::Metadata.new(input, from: "crossref") } context "is_personal_name?" do it "has type organization" do @@ -46,7 +46,7 @@ context "get_one_author" do it "has familyName" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner") @@ -54,7 +54,7 @@ it "has name in sort-order" do input = "https://doi.org/10.5061/dryad.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator").first) expect(response).to eq("nameType"=>"Personal", "name"=>"Ollomo, Benjamin", "givenName"=>"Benjamin", "familyName"=>"Ollomo", "nameIdentifiers" => [], "affiliation" => [{"affiliationIdentifier"=>"https://ror.org/01wyqb997", "affiliationIdentifierScheme"=>"ROR", "name"=>"Centre International de Recherches Médicales de Franceville"}]) @@ -62,7 +62,7 @@ it "has name in display-order" do input = "https://doi.org/10.5281/ZENODO.48440" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameType"=>"Personal", "name"=>"Garza, Kristian", "givenName"=>"Kristian", "familyName"=>"Garza", "nameIdentifiers" => [], "affiliation" => []) @@ -70,7 +70,7 @@ it "has name in display-order with ORCID" do input = "https://doi.org/10.6084/M9.FIGSHARE.4700788" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameType"=>"Personal", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-4881-1606", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Bedini, Andrea", "givenName"=>"Andrea", "familyName"=>"Bedini", "affiliation" => []) @@ -78,7 +78,7 @@ it "has name in Thai" do input = "https://doi.org/10.14457/KMITL.res.2006.17" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("name"=>"กัญจนา แซ่เตียว", "nameIdentifiers" => [], "affiliation" => []) @@ -86,7 +86,7 @@ it "multiple author names in one field" do input = "https://doi.org/10.7910/dvn/eqtqyo" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_authors(meta.dig("creators", "creator")) expect(response).to eq([{"name" => "Enos, Ryan (Harvard University); Fowler, Anthony (University Of Chicago); Vavreck, Lynn (UCLA)", "nameIdentifiers" => [], "affiliation" => []}]) @@ -94,7 +94,7 @@ it "hyper-authorship" do input = "https://doi.org/10.17182/HEPDATA.77274.V1" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_authors(meta.dig("creators", "creator")) expect(response.length).to eq(1000) @@ -109,7 +109,7 @@ it "name with affiliation" do input = "10.11588/DIGLIT.6130" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameType"=>"Organizational", "name"=>"Dr. Störi, Kunstsalon", "nameIdentifiers" => [], "affiliation" => []) @@ -117,7 +117,7 @@ it "name with affiliation and country" do input = "10.16910/jemr.9.1.2" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator").first) expect(response).to eq("name"=>"Eraslan, Sukru; University Of Manchester, UK, & Middle East Technical University, Northern Cyprus Campus, Kalkanli, Guzelyurt, Turkey", "nameIdentifiers" => [], "affiliation" => []) @@ -125,7 +125,7 @@ it "name with role" do input = "10.14463/GBV:873056442" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator").first) expect(response).to eq("nameType"=>"Personal", "name"=>"Schumacher, H. C.", "givenName"=>"H. C.", "familyName"=>"Schumacher", "nameIdentifiers" => [], "affiliation" => []) @@ -133,7 +133,7 @@ it "multiple name_identifier" do input = "10.24350/CIRM.V.19028803" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameType"=>"Personal", "name"=>"Dubos, Thomas", "givenName"=>"Thomas", "familyName"=>"Dubos", "affiliation" => [{"name"=>"École Polytechnique Laboratoire de Météorologie Dynamique"}], "nameIdentifiers" => [{"nameIdentifier"=>"http://isni.org/isni/0000 0003 5752 6882", "nameIdentifierScheme"=>"ISNI", "schemeUri"=>"http://isni.org/isni/"}, {"nameIdentifier"=>"https://orcid.org/0000-0003-4514-4211", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}]) @@ -141,7 +141,7 @@ it "nameType organizational" do input = fixture_path + 'gtex.xml' - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") meta = Maremma.from_xml(subject.raw).fetch("resource", {}) response = subject.get_one_author(meta.dig("creators", "creator")) expect(response).to eq("nameType"=>"Organizational", "name"=>"The GTEx Consortium", "nameIdentifiers" => [], "affiliation" => []) @@ -149,7 +149,7 @@ it "only familyName and givenName" do input = "https://doi.pangaea.de/10.1594/PANGAEA.836178" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.creators.first).to eq("nameType" => "Personal", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson") end end diff --git a/spec/datacite_utils_spec.rb b/spec/datacite_utils_spec.rb index b49a6f74..02d026e2 100644 --- a/spec/datacite_utils_spec.rb +++ b/spec/datacite_utils_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://doi.org/10.5061/DRYAD.8515" } - subject { Bolognese::Metadata.new(input: input, from: "datacite") } + subject { Bolognese::Metadata.new(input, from: "datacite") } context "insert_identifier" do it "doi" do @@ -124,7 +124,7 @@ context "insert_formats" do let(:input) { IO.read(fixture_path + 'datacite-empty-sizes.xml') } - subject { Bolognese::Metadata.new(input: input, from: "datacite") } + subject { Bolognese::Metadata.new(input, from: "datacite") } it "insert" do xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') { |xml| subject.insert_formats(xml) }.to_xml @@ -169,7 +169,7 @@ context "insert_descriptions" do it "insert" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") xml = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') { |xml| subject.insert_descriptions(xml) }.to_xml response = Maremma.from_xml(xml) expect(response.dig("descriptions", "description")).to eq("descriptionType" => "Abstract", "__content__" => "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...") diff --git a/spec/doi_utils_spec.rb b/spec/doi_utils_spec.rb index 0b92e198..eaf60a7f 100644 --- a/spec/doi_utils_spec.rb +++ b/spec/doi_utils_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://doi.org/10.1101/097196" } - subject { Bolognese::Metadata.new(input: input, from: "crossref") } + subject { Bolognese::Metadata.new(input, from: "crossref") } context "doi resolver" do it "doi" do diff --git a/spec/metadata_spec.rb b/spec/metadata_spec.rb index 1d92766a..d4fbe06d 100644 --- a/spec/metadata_spec.rb +++ b/spec/metadata_spec.rb @@ -4,19 +4,19 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "http://doi.org/10.5438/4K3M-NYVG" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "handle input" do it "unknown DOI prefix" do input = "http://doi.org/10.0137/14802" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be false expect(subject.bibtex).to be_nil end it "DOI RA not Crossref or DataCite" do input = "http://doi.org/10.3980/j.issn.2222-3959.2015.03.07" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be false expect(subject.bibtex).to be_nil end diff --git a/spec/readers/bibtex_reader_spec.rb b/spec/readers/bibtex_reader_spec.rb index 25801e7e..158fe117 100644 --- a/spec/readers/bibtex_reader_spec.rb +++ b/spec/readers/bibtex_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "crossref.bib" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "detect format" do it "extension" do @@ -13,7 +13,7 @@ end it "string" do - Bolognese::Metadata.new(input: IO.read(input).strip) + Bolognese::Metadata.new(IO.read(input).strip) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") end @@ -48,7 +48,7 @@ it "DOI does not exist" do input = fixture_path + "pure.bib" doi = "10.7554/elife.01567" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be false expect(subject.state).to eq("not_found") expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") diff --git a/spec/readers/citeproc_reader_spec.rb b/spec/readers/citeproc_reader_spec.rb index 97762401..a65e43ca 100644 --- a/spec/readers/citeproc_reader_spec.rb +++ b/spec/readers/citeproc_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "citeproc.json" } - subject { Bolognese::Metadata.new(input: input, from: "citeproc") } + subject { Bolognese::Metadata.new(input, from: "citeproc") } context "get citeproc raw" do it "BlogPosting" do @@ -30,7 +30,7 @@ context "get citeproc no categories" do it "BlogPosting" do input = fixture_path + "citeproc-no-categories.json" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5072/4k3m-nyvg") expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") @@ -46,7 +46,7 @@ context "get citeproc no author" do it "Journal article" do input = fixture_path + "citeproc-no-author.json" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg") expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") diff --git a/spec/readers/codemeta_reader_spec.rb b/spec/readers/codemeta_reader_spec.rb index 5c4302a1..4e978503 100644 --- a/spec/readers/codemeta_reader_spec.rb +++ b/spec/readers/codemeta_reader_spec.rb @@ -5,12 +5,12 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://github.com/datacite/maremma" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get codemeta raw" do it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.raw).to eq(IO.read(input).strip) end end @@ -45,7 +45,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.id).to eq("https://doi.org/10.5063/f1m61h5x") expect(subject.url).to eq("https://github.com/DataONEorg/rdataone") expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") @@ -86,7 +86,7 @@ it "maremma" do input = fixture_path + 'maremma/codemeta.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/qeg0-3gm3") expect(subject.url).to eq("https://github.com/datacite/maremma") @@ -115,7 +115,7 @@ it "metadata_reports" do input = "https://github.com/datacite/metadata-reports/blob/master/software/codemeta.json" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/wr0x-e194") expect(subject.url).to eq("https://github.com/datacite/metadata-reports") diff --git a/spec/readers/crosscite_reader_spec.rb b/spec/readers/crosscite_reader_spec.rb index a7273b80..eeb4aa6b 100644 --- a/spec/readers/crosscite_reader_spec.rb +++ b/spec/readers/crosscite_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "crosscite.json" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get crosscite raw" do it "SoftwareSourceCode" do @@ -27,7 +27,7 @@ it "SoftwareSourceCode as string" do input = IO.read(fixture_path + "crosscite.json") - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.identifiers).to eq([{"Identifier"=>"https://doi.org/10.5281/zenodo.48440", "identifierType"=>"DOI"}, {"Identifier"=>"http://zenodo.org/record/48440", "identifierType"=>"URL"}]) expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"other", "resourceType"=>"Software", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") diff --git a/spec/readers/crossref_reader_spec.rb b/spec/readers/crossref_reader_spec.rb index c0a57554..de9285c2 100644 --- a/spec/readers/crossref_reader_spec.rb +++ b/spec/readers/crossref_reader_spec.rb @@ -5,12 +5,12 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "10.7554/eLife.01567" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get crossref raw" do it "journal article" do input = fixture_path + 'crossref.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.raw).to eq(IO.read(input).strip) end end @@ -52,7 +52,7 @@ it "journal article" do input = "https://doi.org/10.1371/journal.pone.0000030" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1371/journal.pone.0000030") expect(subject.identifiers).to eq([{"identifier"=>"10.1371/journal.pone.0000030", "identifierType"=>"Publisher ID"}]) @@ -79,7 +79,7 @@ it "journal article with funding" do input = "https://doi.org/10.3389/fpls.2019.00816" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.3389/fpls.2019.00816") expect(subject.identifiers).to eq([{"identifier"=>"816", "identifierType"=>"Publisher ID"}]) @@ -106,7 +106,7 @@ it "journal article original language title" do input = "https://doi.org/10.7600/jspfsm.56.60" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7600/jspfsm.56.60") expect(subject.url).to eq("http://jlc.jst.go.jp/JST.JSTAGE/jspfsm/56.60?lang=en&from=CrossRef&type=abstract") @@ -124,7 +124,7 @@ it "journal article with RDF for container" do input = "https://doi.org/10.1163/1937240X-00002096" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1163/1937240x-00002096") expect(subject.url).to eq("https://academic.oup.com/jcb/article-lookup/doi/10.1163/1937240X-00002096") @@ -144,7 +144,7 @@ it "book chapter with RDF for container" do input = "10.1007/978-3-642-33191-6_49" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1007/978-3-642-33191-6_49") expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-642-33191-6_49") @@ -163,7 +163,7 @@ it "posted_content" do input = "https://doi.org/10.1101/097196" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.url).to eq("http://biorxiv.org/lookup/doi/10.1101/097196") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"PostedContent", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") @@ -181,7 +181,7 @@ it "DOI with SICI DOI" do input = "https://doi.org/10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1890/0012-9658(2006)87%255b2832:tiopma%255d2.0.co;2") expect(subject.url).to eq("http://doi.wiley.com/10.1890/0012-9658(2006)87[2832:TIOPMA]2.0.CO;2") @@ -201,7 +201,7 @@ it "DOI with ORCID ID" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1155/2012/291294") expect(subject.url).to eq("http://www.hindawi.com/journals/pm/2012/291294/") @@ -226,7 +226,7 @@ it "date in future" do input = "https://doi.org/10.1016/j.ejphar.2015.03.018" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1016/j.ejphar.2015.03.018") expect(subject.identifiers).to eq([{"identifier"=>"S0014299915002332", "identifierType"=>"Publisher ID"}]) @@ -245,7 +245,7 @@ it "vor with url" do input = "https://doi.org/10.1038/hdy.2013.26" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1038/hdy.2013.26") expect(subject.url).to eq("http://www.nature.com/articles/hdy201326") @@ -264,7 +264,7 @@ it "dataset" do input = "10.2210/pdb4hhb/pdb" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.2210/pdb4hhb/pdb") expect(subject.url).to eq("https://www.wwpdb.org/pdb?id=pdb_00004hhb") @@ -281,7 +281,7 @@ it "component" do input = "10.1371/journal.pmed.0030277.g001" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1371/journal.pmed.0030277.g001") expect(subject.url).to eq("https://dx.plos.org/10.1371/journal.pmed.0030277.g001") @@ -297,7 +297,7 @@ it "dataset usda" do input = "https://doi.org/10.2737/RDS-2018-0001" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.2737/rds-2018-0001") expect(subject.url).to eq("https://www.fs.usda.gov/rds/archive/Catalog/RDS-2018-0001") @@ -314,7 +314,7 @@ it "book chapter" do input = "https://doi.org/10.1007/978-3-662-46370-3_13" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1007/978-3-662-46370-3_13") expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-662-46370-3_13") @@ -330,7 +330,7 @@ it "another book chapter" do input = "https://doi.org/10.1007/978-3-319-75889-3_1" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1007/978-3-319-75889-3_1") expect(subject.url).to eq("http://link.springer.com/10.1007/978-3-319-75889-3_1") @@ -345,7 +345,7 @@ it "yet another book chapter" do input = "https://doi.org/10.4018/978-1-4666-1891-6.ch004" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4018/978-1-4666-1891-6.ch004") expect(subject.url).to eq("http://services.igi-global.com/resolvedoi/resolve.aspx?doi=10.4018/978-1-4666-1891-6.ch004") @@ -360,7 +360,7 @@ it "missing creator" do input = "https://doi.org/10.3390/publications6020015" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.3390/publications6020015") expect(subject.url).to eq("http://www.mdpi.com/2304-6775/6/2/15") @@ -375,7 +375,7 @@ it "book" do input = "https://doi.org/10.1017/9781108348843" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1017/9781108348843") expect(subject.identifiers).to eq([{"identifier"=>"9781108348843", "identifierType"=>"ISBN"}]) @@ -392,7 +392,7 @@ it "another book" do input = "https://doi.org/10.2973/odp.proc.ir.180.2000" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.2973/odp.proc.ir.180.2000") expect(subject.url).to eq("http://www-odp.tamu.edu/publications/180_IR/180TOC.HTM") @@ -410,7 +410,7 @@ it "yet another book" do input = "https://doi.org/10.1029/ar035" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1029/ar035") expect(subject.identifiers).to eq([{"identifier"=>"0-87590-181-6", "identifierType"=>"ISBN"}]) @@ -430,7 +430,7 @@ it "mEDRA" do input = "https://doi.org/10.3280/ecag2018-001005" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.3280/ecag2018-001005") expect(subject.identifiers).to eq([{"identifier"=>"5", "identifierType"=>"Publisher ID"}]) @@ -447,7 +447,7 @@ it "KISTI" do input = "https://doi.org/10.5012/bkcs.2013.34.10.2889" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5012/bkcs.2013.34.10.2889") expect(subject.identifiers).to eq([{"identifier"=>"JCGMCS_2013_v34n10_2889", "identifierType"=>"Publisher ID"}]) @@ -464,7 +464,7 @@ it "JaLC" do input = "https://doi.org/10.1241/johokanri.39.979" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1241/johokanri.39.979") expect(subject.url).to eq("http://joi.jlc.jst.go.jp/JST.JSTAGE/johokanri/39.979?from=CrossRef") @@ -479,7 +479,7 @@ it "OP" do input = "https://doi.org/10.2903/j.efsa.2018.5239" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.2903/j.efsa.2018.5239") expect(subject.url).to eq("http://doi.wiley.com/10.2903/j.efsa.2018.5239") @@ -495,7 +495,7 @@ it "multiple titles" do input = "https://doi.org/10.4000/dms.865" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4000/dms.865") expect(subject.url).to eq("http://journals.openedition.org/dms/865") @@ -511,7 +511,7 @@ it "markup" do input = "https://doi.org/10.1098/rspb.2017.0132" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1098/rspb.2017.0132") expect(subject.url).to eq("https://royalsocietypublishing.org/doi/10.1098/rspb.2017.0132") @@ -528,7 +528,7 @@ it "empty given name" do input = "https://doi.org/10.1111/J.1865-1682.2010.01171.X" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1111/j.1865-1682.2010.01171.x") expect(subject.url).to eq("http://doi.wiley.com/10.1111/j.1865-1682.2010.01171.x") @@ -544,7 +544,7 @@ it "invalid date" do input = "https://doi.org/10.1055/s-0039-1690894" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1055/s-0039-1690894") expect(subject.identifiers).to eq([{"identifier"=>"s-0039-1690894", "identifierType"=>"Publisher ID"}]) @@ -565,7 +565,7 @@ it "journal article with" do input = "https://doi.org/10.1111/nph.14619" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1111/nph.14619") expect(subject.url).to eq("http://doi.wiley.com/10.1111/nph.14619") @@ -587,7 +587,7 @@ it "author literal" do input = "https://doi.org/10.1038/ng.3834" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1038/ng.3834") expect(subject.url).to eq("http://www.nature.com/articles/ng.3834") @@ -604,7 +604,7 @@ it "journal issue" do input = "https://doi.org/10.6002/ect.2015.0371" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.6002/ect.2015.0371") expect(subject.url).to eq("http://ectrx.org/forms/ectrxcontentshow.php?doi_id=10.6002/ect.2015.0371") @@ -622,7 +622,7 @@ it "not found error" do input = "https://doi.org/10.7554/elife.01567x" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be false expect(subject.id).to eq("https://doi.org/10.7554/elife.01567x") expect(subject.doi).to eq("10.7554/elife.01567x") diff --git a/spec/readers/datacite_json_reader_spec.rb b/spec/readers/datacite_json_reader_spec.rb index 8909325c..44ece072 100644 --- a/spec/readers/datacite_json_reader_spec.rb +++ b/spec/readers/datacite_json_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "datacite.json" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get datacite_json raw" do it "BlogPosting" do @@ -30,7 +30,7 @@ # it "SoftwareSourceCode" do # input = fixture_path + "datacite_software.json" - # subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + # subject = Bolognese::Metadata.new(input, from: "datacite_json") # expect(subject.valid?).to be true # expect(subject.identifier).to eq("https://doi.org/10.5063/f1m61h5x") # expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "resource_type"=>"Software", "resource_type_general"=>"Software", "ris"=>"COMP", "type"=>"SoftwareSourceCode") @@ -44,7 +44,7 @@ it "SoftwareSourceCode missing_comma" do input = fixture_path + "datacite_software_missing_comma.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true) + subject = Bolognese::Metadata.new(input, from: "datacite_json", show_errors: true) expect(subject.valid?).to be false expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"]) expect(subject.codemeta).to be_nil @@ -52,7 +52,7 @@ it "SoftwareSourceCode overlapping_keys" do input = fixture_path + "datacite_software_overlapping_keys.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true) + subject = Bolognese::Metadata.new(input, from: "datacite_json", show_errors: true) expect(subject.valid?).to be false expect(subject.errors).to eq(["The same key is defined more than once: id"]) expect(subject.codemeta).to be_nil @@ -60,7 +60,7 @@ it "metadata from api" do input = "10.5281/zenodo.28518" - subject = Bolognese::Metadata.new(input: input, regenerate: true) + subject = Bolognese::Metadata.new(input, regenerate: true) expect(subject.valid?).to be true expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators.length).to eq(2) diff --git a/spec/readers/datacite_reader_spec.rb b/spec/readers/datacite_reader_spec.rb index 9b1b6e79..358e4a27 100644 --- a/spec/readers/datacite_reader_spec.rb +++ b/spec/readers/datacite_reader_spec.rb @@ -5,12 +5,12 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://doi.org/10.5061/DRYAD.8515" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get datacite raw" do it "BlogPosting" do input = fixture_path + 'datacite.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.raw).to eq(IO.read(input).strip) end end @@ -50,7 +50,7 @@ it "BlogPosting" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") expect(subject.types["resourceType"]).to eq("BlogPosting") @@ -75,7 +75,7 @@ it "date" do input = "https://doi.org/10.4230/lipics.tqc.2013.93" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") expect(subject.types["resourceType"]).to eq("ConferencePaper") @@ -96,7 +96,7 @@ it "affiliation identifier" do input = fixture_path + 'datacite-example-affiliation.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("SoftwareSourceCode") expect(subject.types["resourceType"]).to eq("XML") @@ -148,7 +148,7 @@ it "xs:string attributes" do input = fixture_path + 'pure.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.types["resourceType"]).to eq("Dataset") @@ -165,7 +165,7 @@ it "empty sizes and dates attributes" do input = fixture_path + 'datacite-empty-sizes.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.types["resourceType"]).to be_nil @@ -184,7 +184,7 @@ it "multiple licenses" do input = "https://doi.org/10.5281/ZENODO.48440" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5281/zenodo.48440") expect(subject.identifiers).to eq([{"identifier"=>"https://zenodo.org/record/48440", "identifierType"=>"URL"}]) @@ -216,7 +216,7 @@ it "is identical to" do input = "10.6084/M9.FIGSHARE.4234751.V1" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.identifiers).to be_empty expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -248,7 +248,7 @@ it "subject scheme FOR" do input = "10.6084/m9.figshare.1449060" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.6084/m9.figshare.1449060") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -278,7 +278,7 @@ it "more subject scheme FOR" do input = "10.4225/03/5a6931f57c654" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.subjects).to eq([{"subject"=>"90301 Biomaterials", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"}, {"subject"=>"FOS: Medical engineering", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}]) @@ -286,7 +286,7 @@ it "even more subject scheme FOR" do input = "10.4225/03/5a31ec65634ef" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.subjects).to eq([{"subject"=>"130103 Higher Education", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"}, {"subject"=>"FOS: Educational sciences", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}, @@ -297,7 +297,7 @@ it "funding schema version 3" do input = "https://doi.org/10.5281/ZENODO.1239" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5281/zenodo.1239") expect(subject.identifiers).to eq([{"identifier"=>"https://zenodo.org/record/1239", "identifierType"=>"URL"}]) @@ -325,7 +325,7 @@ end it "from attributes" do - subject = Bolognese::Metadata.new(input: nil, + subject = Bolognese::Metadata.new(nil, from: "datacite", doi: "10.5281/zenodo.1239", creators: [{"nameType"=>"Personal", "name"=>"Jahn, Najko", "givenName"=>"Najko", "familyName"=>"Jahn"}], @@ -368,7 +368,7 @@ it "missing resource_type_general" do input = fixture_path + 'vivli.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.types["schemaOrg"]).to eq("CreativeWork") expect(subject.types["resourceTypeGeneral"]).to be_nil expect(subject.valid?).to be false @@ -377,7 +377,7 @@ it "multiple languages" do input = fixture_path + 'datacite-multiple-language.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.types["schemaOrg"]).to eq("Collection") expect(subject.language).to eq("de") expect(subject.publisher).to eq("Universitätsbibliothek Tübingen") @@ -388,7 +388,7 @@ it "funder identifier with different http scheme" do input = fixture_path + 'datacite-funderIdentifier.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.funding_references.first).to eq({ "funderIdentifier"=>"http://www.isni.org/isni/0000000119587073", "funderIdentifierType"=>"ISNI", @@ -405,7 +405,7 @@ it "geo_location empty" do input = fixture_path + 'datacite-geolocation-empty.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.geo_locations).to eq([{"geoLocationPoint"=>{"pointLatitude"=>"-11.64583333", "pointLongitude"=>"-68.2975"}}]) @@ -414,7 +414,7 @@ it "geo_location in separate input" do input = fixture_path + 'datacite-geolocation-empty.xml' geo_locations = [{"geoLocationPoint"=>{"pointLatitude"=>"49.0850736", "pointLongitude"=>"-123.3300992"}}] - subject = Bolognese::Metadata.new(input: input, geo_locations: geo_locations) + subject = Bolognese::Metadata.new(input, geo_locations: geo_locations) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.geo_locations).to eq(geo_locations) @@ -425,7 +425,7 @@ it "xml:lang attribute" do input = fixture_path + 'datacite-xml-lang.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Collection") expect(subject.titles).to eq([{"lang"=>"en", "title"=>"DOI Test 2 title content"}, {"lang"=>"en", "title"=>"AAPP"}]) @@ -435,7 +435,7 @@ it "wrong attributes" do input = fixture_path + 'nist.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.id).to eq("https://doi.org/10.5072/m32163") expect(subject.titles).to eq([{"title"=>"Peter Auto Dataset 501"}]) expect(subject.descriptions).to eq([{"description"=>"This is to overturn Einstein's Relativity Theory.", "descriptionType"=>"Abstract"}]) @@ -446,7 +446,7 @@ it "schema 4.0" do input = fixture_path + 'schema_4.0.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.6071/z7wc73") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -465,7 +465,7 @@ it "series_information" do input = fixture_path + 'datacite-seriesinformation.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg") expect(subject.identifiers).to eq([{"identifier"=>"MS-49-3632-5083", "identifierType"=>"Local accession number"}]) @@ -495,7 +495,7 @@ it "geo_location" do input = fixture_path + 'datacite-example-geolocation.xml' doi = "10.5072/geoPointExample" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5072/geopointexample") expect(subject.doi).to eq("10.5072/geopointexample") @@ -512,7 +512,7 @@ it "geo_location_box" do input = fixture_path + 'datacite-example-geolocation-2.xml' doi = "10.6071/Z7WC73" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.6071/z7wc73") expect(subject.doi).to eq("10.6071/z7wc73") @@ -540,7 +540,7 @@ it "author only full name" do input = "https://doi.org/10.14457/KMITL.RES.2006.17" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.14457/kmitl.res.2006.17") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -550,7 +550,7 @@ it "multiple author names in one creatorsName" do input = "https://doi.org/10.7910/DVN/EQTQYO" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7910/dvn/eqtqyo") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -559,7 +559,7 @@ it "author with scheme" do input = "https://doi.org/10.18429/JACOW-IPAC2016-TUPMY003" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.18429/jacow-ipac2016-tupmy003") expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") @@ -569,7 +569,7 @@ it "author with wrong orcid scheme" do input = "https://doi.org/10.2314/COSCV1" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.2314/coscv1") expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") @@ -579,7 +579,7 @@ it "keywords with attributes" do input = "https://doi.org/10.21233/n34n5q" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.21233/n34n5q") expect(subject.subjects).to eq([{"schemeUri"=>"http://id.loc.gov/authorities/subjects", "subject"=>"Paleoecology", "subjectScheme"=>"Library of Congress"}]) @@ -587,7 +587,7 @@ it "Funding" do input = "https://doi.org/10.15125/BATH-00114" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.15125/bath-00114") expect(subject.identifiers).to eq([{"identifier"=>"http://researchdata.bath.ac.uk/114/", "identifierType"=>"URL"}]) @@ -620,7 +620,7 @@ it "Funding schema version 4" do input = "https://doi.org/10.5438/6423" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/6423") expect(subject.types["schemaOrg"]).to eq("Collection") @@ -646,7 +646,7 @@ it "Funding empty awardTitle" do input = "https://doi.org/10.26102/2310-6018/2019.24.1.006" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.26102/2310-6018/2019.24.1.006") expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") @@ -666,7 +666,7 @@ it "BlogPosting from string" do input = fixture_path + "datacite.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") expect(subject.types["resourceType"]).to eq("BlogPosting") @@ -686,7 +686,7 @@ it "Schema 4.1 from string" do input = fixture_path + "datacite-example-complicated-v4.1.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Book") expect(subject.types["resourceType"]).to eq("Monograph") @@ -717,7 +717,7 @@ it "Schema 4.0 from string" do input = fixture_path + "datacite-example-complicated-v4.0.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Book") expect(subject.types["resourceType"]).to eq("Monograph") @@ -747,7 +747,7 @@ it "Schema 3 from string" do input = fixture_path + "datacite_schema_3.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.types["resourceType"]).to eq("DataPackage") @@ -776,7 +776,7 @@ it "Schema 3.0 from string" do input = fixture_path + "datacite-example-complicated-v3.0.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Book") expect(subject.types["resourceType"]).to eq("Monograph") @@ -806,7 +806,7 @@ it "Schema 2.2 from string" do input = fixture_path + "datacite-metadata-sample-complicated-v2.2.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Book") expect(subject.types["resourceType"]).to eq("Monograph") @@ -830,7 +830,7 @@ it "Schema 4.1 from string with doi in options" do input = fixture_path + "datacite-example-complicated-v4.1.xml" - subject = Bolognese::Metadata.new(input: input, doi: "10.5072/testpub2", content_url: "https://example.org/report.pdf") + subject = Bolognese::Metadata.new(input, doi: "10.5072/testpub2", content_url: "https://example.org/report.pdf") expect(subject.valid?).to be true expect(subject.types["schemaOrg"]).to eq("Book") expect(subject.types["resourceType"]).to eq("Monograph") @@ -863,7 +863,7 @@ it "namespaced xml from string" do input = fixture_path + "ns0.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4231/d38g8fk8b") expect(subject.types["schemaOrg"]).to eq("SoftwareSourceCode") @@ -881,7 +881,7 @@ it "Schema.org type" do input = "https://doi.org/10.25318/3410014001-fra" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.25318/3410014001-fra") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -898,7 +898,7 @@ it "doi with + sign" do input = "10.5067/terra+aqua/ceres/cldtyphist_l3.004" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5067/terra+aqua/ceres/cldtyphist_l3.004") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -913,7 +913,7 @@ it "subject scheme" do input = "https://doi.org/10.4232/1.2745" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4232/1.2745") expect(subject.identifiers).to eq([{"identifier"=>"ZA2745", "identifierType"=>"ZA-No."}, @@ -934,7 +934,7 @@ it "series-information" do input = "https://doi.org/10.4229/23RDEUPVSEC2008-5CO.8.3" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4229/23rdeupvsec2008-5co.8.3") expect(subject.identifiers).to eq([{"identifier"=>"3-936338-24-8", "identifierType"=>"ISBN"}]) @@ -956,7 +956,7 @@ it "content url" do input = "10.23725/8na3-9s47" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.doi).to eq("10.23725/8na3-9s47") expect(subject.id).to eq("https://doi.org/10.23725/8na3-9s47") @@ -969,7 +969,7 @@ it "empty subject" do input = "https://doi.org/10.18169/PAPDEOTTX00502" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.18169/papdeottx00502") expect(subject.identifiers).to eq([{"identifier"=>"http://www.priorartregister.com/resolve.php?disclosure=OTTX00502", "identifierType"=>"URL"}]) @@ -987,7 +987,7 @@ it "leading and trailing whitespace" do input = "https://doi.org/10.21944/temis-OZONE-MSR2" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true #expect(subject.errors.length).to eq(2) @@ -1027,7 +1027,7 @@ it "DOI not found" do input = "https://doi.org/10.4124/05F6C379-DD68-4CDB-880D-33D3E9576D52/1" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be false expect(subject.id).to eq("https://doi.org/10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") expect(subject.doi).to eq("10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") @@ -1037,7 +1037,7 @@ it "DOI in test system" do input = "https://handle.test.datacite.org/10.22002/d1.694" - subject = Bolognese::Metadata.new(input: input, sandbox: true) + subject = Bolognese::Metadata.new(input, sandbox: true) expect(subject.valid?).to be true expect(subject.id).to eq("https://handle.test.datacite.org/10.22002/d1.694") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -1054,7 +1054,7 @@ it "DOI in test system schema 3" do input = "10.21956/wellcomeopenres.25947.r17364" - subject = Bolognese::Metadata.new(input: input, doi: input, sandbox: true) + subject = Bolognese::Metadata.new(input, doi: input, sandbox: true) expect(subject.valid?).to be true expect(subject.id).to eq("https://handle.test.datacite.org/10.21956/wellcomeopenres.25947.r17364") expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") @@ -1071,7 +1071,7 @@ it "Referee report in test system" do input = "10.21956/gatesopenres.530.r190" - subject = Bolognese::Metadata.new(input: input, sandbox: true) + subject = Bolognese::Metadata.new(input, sandbox: true) expect(subject.valid?).to be true expect(subject.id).to eq("https://handle.test.datacite.org/10.21956/gatesopenres.530.r190") expect(subject.types["schemaOrg"]).to eq("ScholarlyArticle") @@ -1089,14 +1089,14 @@ it "multiple rights" do input = fixture_path + "datacite-multiple-rights.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.rights_list).to eq([{"rights"=>"info:eu-repo/semantics/openAccess"}, {"rights"=>"Open Access", "rightsUri"=>"info:eu-repo/semantics/openAccess"}]) end it ":tba" do input = fixture_path + "datacite-example-complicated-tba.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.titles).to eq([{"title"=>":unav"}]) expect(subject.formats).to eq([":null"]) @@ -1105,7 +1105,7 @@ it "ancient-dates" do input = fixture_path + "datacite-example-ancientdates-v4.3.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.dates).to eq([{"date"=>"-0024/-0022", "dateInformation"=>"from 25 BC to 23 BC", "dateType"=>"Created"}, {"date"=>"2010", "dateType"=>"Issued"}]) end @@ -1113,14 +1113,14 @@ # TODO properly handle escaped text it "escaped text" do input = fixture_path + "datacite-example-escaped-text.xml" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.titles).to eq([{"title"=>"Some initial text"}]) end it "missing creators" do input = fixture_path + "datacite_missing_creator.xml" - subject = Bolognese::Metadata.new(input: input, regenerate: true) + subject = Bolognese::Metadata.new(input, regenerate: true) expect(subject.creators).to be_blank expect(subject.valid?).to be false expect(subject.errors).to eq("4:0: ERROR: Element '{http://datacite.org/schema/kernel-4}creators': Missing child element(s). Expected is ( {http://datacite.org/schema/kernel-4}creator ).") @@ -1128,7 +1128,7 @@ it "malformed creators" do input = fixture_path + "datacite_malformed_creator.xml" - subject = Bolognese::Metadata.new(input: input, regenerate: false) + subject = Bolognese::Metadata.new(input, regenerate: false) expect(subject.creators).to be_blank expect(subject.valid?).to be false expect(subject.errors).to eq("16:0: ERROR: Element '{http://datacite.org/schema/kernel-4}creatorName': This element is not expected. Expected is ( {http://datacite.org/schema/kernel-4}affiliation ).") @@ -1136,7 +1136,7 @@ it "empty funding references" do input = fixture_path + "funding_reference.xml" - subject = Bolognese::Metadata.new(input: input, regenerate: false) + subject = Bolognese::Metadata.new(input, regenerate: false) expect(subject.valid?).to be false expect(subject.funding_references).to eq([{"funderName"=>"Agency for Science, Technology and Research (Singapore)"}]) expect(subject.errors.first).to eq("31:0: ERROR: Element '{http://datacite.org/schema/kernel-4}fundingReference': Missing child element(s). Expected is one of ( {http://datacite.org/schema/kernel-4}funderName, {http://datacite.org/schema/kernel-4}funderIdentifier, {http://datacite.org/schema/kernel-4}awardNumber, {http://datacite.org/schema/kernel-4}awardTitle ).") @@ -1144,7 +1144,7 @@ it "space in sizes" do input = fixture_path + "datacite-space-in-sizes.xml" - subject = Bolognese::Metadata.new(input: input, regenerate: false) + subject = Bolognese::Metadata.new(input, regenerate: false) expect(subject.valid?).to be true expect(subject.sizes).to be_empty expect(subject.related_identifiers).to eq([{"relatedIdentifier"=>"10.1016/s0040-1951(03)00197-5", @@ -1154,14 +1154,14 @@ it "formats with xs" do input = fixture_path + "datacite-formats-with-xs.xml" - subject = Bolognese::Metadata.new(input: input, regenerate: false) + subject = Bolognese::Metadata.new(input, regenerate: false) expect(subject.valid?).to be true expect(subject.formats).to eq(["PDF"]) end it "dissertation" do input = "10.3204/desy-2014-01645" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.3204/desy-2014-01645") expect(subject.types["resourceTypeGeneral"]).to eq("Text") @@ -1182,7 +1182,7 @@ it "funding references" do input = "10.26102/2310-6018/2019.24.1.006" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.26102/2310-6018/2019.24.1.006") expect(subject.types["resourceTypeGeneral"]).to eq("Text") @@ -1209,7 +1209,7 @@ it "DOI in with related id system" do input = "https://doi.org/10.4121/uuid:3926db30-f712-4394-aebc-75976070e91f" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.4121/uuid:3926db30-f712-4394-aebc-75976070e91f") expect(subject.types["schemaOrg"]).to eq("Dataset") @@ -1248,7 +1248,7 @@ it "change doi" do input = fixture_path + 'datacite.xml' doi = "10.5061/dryad.8515" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5061/dryad.8515") expect(subject.identifiers).to eq([{"identifier"=>"MS-49-3632-5083", "identifierType"=>"Local accession number"}]) @@ -1264,7 +1264,7 @@ input = fixture_path + 'gtex.xml' url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93" content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz" - subject = Bolognese::Metadata.new(input: input, from: 'datacite', url: url, content_url: content_url) + subject = Bolognese::Metadata.new(input, from: 'datacite', url: url, content_url: content_url) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.25491/9hx8-ke93") @@ -1289,7 +1289,7 @@ it "geo_location_polygon" do input = fixture_path + 'datacite-example-polygon-v4.1.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.id).to eq("https://doi.org/10.5072/example-polygon") expect(subject.types["schemaOrg"]).to eq("Dataset") expect(subject.types["resourceType"]).to eq("Dataset") diff --git a/spec/readers/npm_reader_spec.rb b/spec/readers/npm_reader_spec.rb index f26b8766..59caec97 100644 --- a/spec/readers/npm_reader_spec.rb +++ b/spec/readers/npm_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "cgimp_package.json" } - subject { Bolognese::Metadata.new(input: input, from: "npm") } + subject { Bolognese::Metadata.new(input, from: "npm") } context "get npm raw" do it "software" do @@ -31,7 +31,7 @@ it "minimal with description" do input = fixture_path + "cit_package.json" - subject = Bolognese::Metadata.new(input: input, from: "npm") + subject = Bolognese::Metadata.new(input, from: "npm") expect(subject.valid?).to be false expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'") #expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}]) @@ -47,7 +47,7 @@ it "minimal with description" do input = fixture_path + "edam_package.json" - subject = Bolognese::Metadata.new(input: input, from: "npm") + subject = Bolognese::Metadata.new(input, from: "npm") expect(subject.valid?).to be false expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'") #expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}]) diff --git a/spec/readers/ris_reader_spec.rb b/spec/readers/ris_reader_spec.rb index b47554a1..d88a9708 100644 --- a/spec/readers/ris_reader_spec.rb +++ b/spec/readers/ris_reader_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { fixture_path + "crossref.ris" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "detect format" do it "extension" do @@ -13,7 +13,7 @@ end it "string" do - Bolognese::Metadata.new(input: IO.read(input).strip) + Bolognese::Metadata.new(IO.read(input).strip) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") end @@ -49,7 +49,7 @@ it "DOI does not exist" do input = fixture_path + "pure.ris" doi = "10.7554/elife.01567" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be false expect(subject.state).to eq("not_found") expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") @@ -65,7 +65,7 @@ input = fixture_path + "ris_bug.ris" abs = "3D image based subject specific models of the ankle complex can be extremely significant in a wide variety of clinical and biomechanical applications such as evaluating the effect of ligament ruptures, diagnosing and comparing surgical procedures. However, there are very few computational models that can accurately capture the full 3D biomechanical properties of the ankle complex. One such computational model was introduced by our group in 2004 [1], and this model was partially validated with a very limited set of parameters for comparison. In the current study, we have developed an improvised version of this model and validated it on a subject to subject basis for a number of specimens. This is achieved by comparing a wide range of biomechanical parameters between the experiments and the simulation. Once, the model is validated, it can be used for a wide variety of clinical and surgical applications .Some applications include comparing the effects of surface morphology on the kinematics of the ankle joint, diagnosing and evaluation of ankle disorders like ligament tears and reconstruction surgeries. Previous experimental studies conducted to understand and validate the effect of morphological variations to kinematics involved invasive surgical procedures and hence could only be conducted in cadaveric foot. Hence a need for a dynamic model which could predict and recreate the kinematics of an ankle using only CT and, or MRI data was realized. Such a model could help in development and non-invasive testing of subject specific TAR. This thesis focusses on the subject specific validation of rigid body models of four specimens and an one-to-one validation based on Load-displacement curves, Range of Motion, Surface-to-surface interaction and Ligament straining patterns. Post validation of the MBS model in MSC ADAMS, the model is used to investigate the effect of axial loads, total ankle arthrodesis and the effect of varying surface morphologies on the behavior of the ankle joint complex. An in-depth comparative analysis on the use of a numerical model for the development and performance evaluation of an implant derived from the morphological parameters of the ankle joint is also presented." doi = "10.7554/elife.01567" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") expect(subject.titles).to eq([{"title"=>"Validation of an Image-based Subject-Specific Dynamic Model of the Ankle Joint Complex and its Applications to the Study of the Effect of Articular Surface Morphology on Ankle Joint Mechanics"}]) diff --git a/spec/readers/schema_org_reader_spec.rb b/spec/readers/schema_org_reader_spec.rb index 91c67b3d..edd3fa07 100644 --- a/spec/readers/schema_org_reader_spec.rb +++ b/spec/readers/schema_org_reader_spec.rb @@ -6,12 +6,12 @@ let(:input) { "https://blog.datacite.org/eating-your-own-dog-food/" } let(:fixture_path) { "spec/fixtures/" } - subject { Bolognese::Metadata.new(input: input) } + subject { Bolognese::Metadata.new(input) } context "get schema_org raw" do it "BlogPosting" do input = fixture_path + 'schema_org.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.raw).to eq(IO.read(input).strip) end end @@ -36,7 +36,7 @@ end it "BlogPosting with new DOI" do - subject = Bolognese::Metadata.new(input: input, doi: "10.5438/0000-00ss") + subject = Bolognese::Metadata.new(input, doi: "10.5438/0000-00ss") expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/0000-00ss") expect(subject.doi).to eq("10.5438/0000-00ss") @@ -46,7 +46,7 @@ it "BlogPosting with type as array" do input = fixture_path + 'schema_org_type_as_array.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) #expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg") expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") @@ -64,7 +64,7 @@ it "zenodo" do input = "https://www.zenodo.org/record/1196821" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be false expect(subject.language).to eq("eng") @@ -96,7 +96,7 @@ it "pangaea" do input = "https://doi.pangaea.de/10.1594/PANGAEA.836178" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.1594/pangaea.836178") @@ -113,7 +113,7 @@ # TODO: check redirections # it "ornl" do # input = "https://doi.org/10.3334/ornldaac/1339" - # subject = Bolognese::Metadata.new(input: input, from: "schema_org") + # subject = Bolognese::Metadata.new(input, from: "schema_org") # expect(subject.valid?).to be true # expect(subject.id).to eq("https://doi.org/10.3334/ornldaac/1339") # expect(subject.doi).to eq("10.3334/ornldaac/1339") @@ -126,7 +126,7 @@ it "harvard dataverse" do input = "https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/NJ7XSO" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7910/dvn/nj7xso") expect(subject.doi).to eq("10.7910/dvn/nj7xso") @@ -142,7 +142,7 @@ # TODO check 403 status in DOI resolver # it "harvard dataverse via identifiers.org" do # input = "https://identifiers.org/doi/10.7910/DVN/NJ7XSO" - # subject = Bolognese::Metadata.new(input: input, from: "schema_org") + # subject = Bolognese::Metadata.new(input, from: "schema_org") # expect(subject.valid?).to be true # expect(subject.id).to eq("https://doi.org/10.7910/dvn/nj7xso") # expect(subject.doi).to eq("10.7910/dvn/nj7xso") @@ -156,7 +156,7 @@ context "get schema_org metadata as string" do it "BlogPosting" do input = fixture_path + 'schema_org.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.language).to eq("en") expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -176,7 +176,7 @@ it "GTEx dataset" do input = fixture_path + 'schema_org_gtex.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.25491/d50j-3083") @@ -198,7 +198,7 @@ it "TOPMed dataset" do input = fixture_path + 'schema_org_topmed.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.identifiers).to eq([{"identifier"=>"3b33f6b9338fccab0901b7d317577ea3", "identifierType"=>"md5"}, {"identifier"=>"ark:/99999/fk41CrU4eszeLUDe", "identifierType"=>"minid"}, @@ -218,13 +218,13 @@ it "tdl_iodp dataset" do input = fixture_path + 'schema_org_tdl_iodp_invalid_authors.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be false end it "geolocation" do input = fixture_path + 'schema_org_geolocation.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.6071/z7wc73", "identifierType"=>"DOI"}]) @@ -249,7 +249,7 @@ it "geolocation geoshape" do input = fixture_path + 'schema_org_geoshape.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.language).to eq("en") @@ -267,7 +267,7 @@ it "schema_org list" do data = IO.read(fixture_path + 'schema_org_list.json').strip input = JSON.parse(data).first.to_json - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.23725/7jg3-v803") expect(subject.identifiers).to eq([{"identifier"=>"ark:/99999/fk4E1n6n1YHKxPk", "identifierType"=>"minid"}, @@ -288,7 +288,7 @@ it "aida dataset" do input = fixture_path + 'aida.json' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.23698/aida/drov") @@ -307,7 +307,7 @@ end it "from attributes" do - subject = Bolognese::Metadata.new(input: nil, + subject = Bolognese::Metadata.new(nil, from: "schema_org", doi: "10.5281/zenodo.1239", creators: [{"type"=>"Person", "name"=>"Jahn, Najko", "givenName"=>"Najko", "familyName"=>"Jahn"}], diff --git a/spec/utils_spec.rb b/spec/utils_spec.rb index 6b52e4a2..65d92a40 100644 --- a/spec/utils_spec.rb +++ b/spec/utils_spec.rb @@ -5,7 +5,7 @@ describe Bolognese::Metadata, vcr: true do let(:input) { "https://doi.org/10.1101/097196" } - subject { Bolognese::Metadata.new(input: input, from: "crossref") } + subject { Bolognese::Metadata.new(input, from: "crossref") } context "validate url" do it "DOI" do diff --git a/spec/writers/bibtex_writer_spec.rb b/spec/writers/bibtex_writer_spec.rb index d282f744..e3608420 100644 --- a/spec/writers/bibtex_writer_spec.rb +++ b/spec/writers/bibtex_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as bibtex" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("article") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.7554/elife.01567") @@ -21,7 +21,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("article") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1155/2012/291294") @@ -37,7 +37,7 @@ it "text" do input = "10.3204/desy-2014-01645" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("phdthesis") @@ -50,7 +50,7 @@ it "climate data" do input = "https://doi.org/10.5067/altcy-tj122" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") @@ -62,7 +62,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/qeg0-3gm3") @@ -78,7 +78,7 @@ it "BlogPosting from string" do input = fixture_path + "datacite.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + subject = Bolognese::Metadata.new(input, from: "datacite_json") expect(subject.valid?).to be true bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("article") @@ -92,7 +92,7 @@ it "BlogPosting" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("article") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -105,7 +105,7 @@ it "Dataset" do input = "https://doi.org/10.5061/dryad.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5061/dryad.8515") @@ -119,7 +119,7 @@ it "from schema_org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("article") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -133,7 +133,7 @@ it "authors with affiliations" do input = "10.16910/jemr.9.1.2" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.16910/jemr.9.1.2") @@ -148,7 +148,7 @@ it "keywords subject scheme" do input = "https://doi.org/10.1594/pangaea.721193" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1594/pangaea.721193") @@ -160,7 +160,7 @@ it "author is organization" do input = fixture_path + 'gtex.xml' - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.25491/9hx8-ke93") @@ -169,7 +169,7 @@ it "dataset neurophysiology" do input = fixture_path + 'datacite-schema-2.2.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) expect(subject.valid?).to be true bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first expect(bibtex[:bibtex_type].to_s).to eq("misc") diff --git a/spec/writers/citation_writer_spec.rb b/spec/writers/citation_writer_spec.rb index a06cbef0..4e0e83c5 100644 --- a/spec/writers/citation_writer_spec.rb +++ b/spec/writers/citation_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as citation" do it "Journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.style).to eq("apa") expect(subject.locale).to eq("en-US") expect(subject.citation).to eq("Sankar, M., Nieminen, K., Ragni, L., Xenarios, I., & Hardtke, C. S. (2014). Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. ELife, 3. https://doi.org/10.7554/elife.01567") @@ -14,7 +14,7 @@ it "Journal article vancouver style" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref", style: "vancouver", locale: "en-US") + subject = Bolognese::Metadata.new(input, from: "crossref", style: "vancouver", locale: "en-US") expect(subject.style).to eq("vancouver") expect(subject.locale).to eq("en-US") expect(subject.citation).to eq("Sankar M, Nieminen K, Ragni L, Xenarios I, Hardtke CS. Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. eLife [Internet]. 2014Feb11;3. Available from: https://elifesciences.org/articles/01567") @@ -22,20 +22,20 @@ it "Dataset" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.citation).to eq("Ollomo, B., Durand, P., Prugnolle, F., Douzery, E. J. P., Arnathau, C., Nkoghe, D., Leroy, E., & Renaud, F. (2011). Data from: A new malaria agent in African hominids. (Version 1) [Data set]. Dryad. https://doi.org/10.5061/dryad.8515") end it "Missing author" do input = "https://doi.org/10.3390/publications6020015" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.citation).to eq("Alexander Kohls, & Salvatore Mele. (2018). Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics. Publications, 6(2), 15. https://doi.org/10.3390/publications6020015") end it "software w/version" do input = "https://doi.org/10.5281/zenodo.2598836" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.style).to eq("apa") expect(subject.locale).to eq("en-US") expect(subject.citation).to eq("Lab For Exosphere And Near Space Environment Studies. (2019). lenses-lab/LYAO_RT-2018JA026426: Original Release (Version 1.0.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.2598836") @@ -43,7 +43,7 @@ it "interactive resource without dates" do input = "https://doi.org/10.34747/g6yb-3412" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.style).to eq("apa") expect(subject.locale).to eq("en-US") expect(subject.citation).to eq("Clark, D. (2019). Exploring the \"Many analysts, one dataset\" project from COS. Gigantum, Inc. https://doi.org/10.34747/g6yb-3412") diff --git a/spec/writers/citeproc_writer_spec.rb b/spec/writers/citeproc_writer_spec.rb index 828c0e4b..a588064c 100644 --- a/spec/writers/citeproc_writer_spec.rb +++ b/spec/writers/citeproc_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as citeproc" do it "Dataset" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("dataset") @@ -29,7 +29,7 @@ it "BlogPosting" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") @@ -43,7 +43,7 @@ it "BlogPosting DataCite JSON" do input = fixture_path + "datacite.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + subject = Bolognese::Metadata.new(input, from: "datacite_json") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["id"]).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -56,7 +56,7 @@ it "BlogPosting schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("post-weblog") expect(json["id"]).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -69,7 +69,7 @@ it "journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") @@ -89,7 +89,7 @@ it "software" do input = "https://doi.org/10.6084/m9.figshare.4906367.v1" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article") expect(json["DOI"]).to eq("10.6084/m9.figshare.4906367.v1") @@ -99,7 +99,7 @@ it "software w/version" do input = "https://doi.org/10.5281/zenodo.2598836" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("book") expect(json["DOI"]).to eq("10.5281/zenodo.2598836") @@ -109,7 +109,7 @@ it "software w/version from datacite_json" do input = fixture_path + "datacite_software_version.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + subject = Bolognese::Metadata.new(input, from: "datacite_json") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("book") expect(json["DOI"]).to eq("10.5281/ZENODO.2598836") @@ -119,7 +119,7 @@ it "multiple abstracts" do input = "https://doi.org/10.12763/ona1045" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["DOI"]).to eq("10.12763/ona1045") @@ -128,7 +128,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") @@ -151,7 +151,7 @@ it "with only first page" do input = "https://doi.org/10.1371/journal.pone.0214986" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") @@ -168,7 +168,7 @@ it "missing creator" do input = "https://doi.org/10.3390/publications6020015" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") @@ -185,7 +185,7 @@ it "container title" do input = "https://doi.org/10.6102/ZIS146" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["id"]).to eq("https://doi.org/10.6102/zis146") @@ -199,7 +199,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["id"]).to eq("https://doi.org/10.7554/elife.01567") @@ -217,7 +217,7 @@ it "author is organization" do input = fixture_path + 'gtex.xml' - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["id"]).to eq("https://doi.org/10.25491/9hx8-ke93") expect(json["author"]).to eq([{"literal"=>"The GTEx Consortium"}]) @@ -225,7 +225,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["id"]).to eq("https://doi.org/10.5438/qeg0-3gm3") @@ -239,7 +239,7 @@ it "keywords subject scheme" do input = "https://doi.org/10.1594/pangaea.721193" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("dataset") expect(json["id"]).to eq("https://doi.org/10.1594/pangaea.721193") @@ -250,7 +250,7 @@ it "organization author" do input = "https://doi.org/10.1186/s13742-015-0103-4" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article-journal") expect(json["id"]).to eq("https://doi.org/10.1186/s13742-015-0103-4") @@ -267,7 +267,7 @@ it "interactive resource without dates" do input = "https://doi.org/10.34747/g6yb-3412" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.citeproc) expect(json["type"]).to eq("article") expect(json["DOI"]).to eq("10.34747/g6yb-3412") diff --git a/spec/writers/codemeta_writer_spec.rb b/spec/writers/codemeta_writer_spec.rb index 4d26194a..d9bb4718 100644 --- a/spec/writers/codemeta_writer_spec.rb +++ b/spec/writers/codemeta_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as codemeta" do # it "SoftwareSourceCode DataCite JSON" do # input = fixture_path + "datacite_software.json" - # subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + # subject = Bolognese::Metadata.new(input, from: "datacite_json") # expect(subject.valid?).to be true # json = JSON.parse(subject.codemeta) # expect(json["@context"]).to eq("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld") @@ -21,7 +21,7 @@ it "SoftwareSourceCode DataCite" do input = "https://doi.org/10.5063/f1m61h5x" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true json = JSON.parse(subject.codemeta) expect(json["@context"]).to eq("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld") @@ -35,7 +35,7 @@ it "SoftwareSourceCode DataCite check codemeta v2" do input = "https://doi.org/10.5063/f1m61h5x" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true json = JSON.parse(subject.codemeta) expect(json["agents"]).to be_nil diff --git a/spec/writers/crosscite_writer_spec.rb b/spec/writers/crosscite_writer_spec.rb index d0418bac..418f6168 100644 --- a/spec/writers/crosscite_writer_spec.rb +++ b/spec/writers/crosscite_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as crosscite" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("url")).to eq("https://elifesciences.org/articles/01567") expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") @@ -23,7 +23,7 @@ it "with ORCID ID" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") expect(crosscite.fetch("creators").count).to eq(7) @@ -32,14 +32,14 @@ # it "with editor" do # input = "https://doi.org/10.1371/journal.pone.0000030" - # subject = Bolognese::Metadata.new(input: input, from: "crossref") + # subject = Bolognese::Metadata.new(input, from: "crossref") # crosscite = JSON.parse(subject.crosscite) # expect(crosscite["editor"]).to eq("contributorType"=>"Editor", "contributorName"=>"Janbon, Guilhem", "givenName"=>"Guilhem", "familyName"=>"Janbon") # end it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceTypeGeneral"=>"Text", "resourceType"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") expect(crosscite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}]) @@ -50,7 +50,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") expect(subject.valid?).to be true crosscite = JSON.parse(subject.crosscite) expect(crosscite["types"]).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting") @@ -61,7 +61,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") crosscite = JSON.parse(subject.crosscite) expect(crosscite["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}]) expect(crosscite["creators"].length).to eq(3) @@ -71,7 +71,7 @@ it "rdataone codemeta v2" do input = fixture_path + 'codemeta_v2.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") crosscite = JSON.parse(subject.crosscite) expect(crosscite["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}]) expect(crosscite["creators"].length).to eq(3) @@ -81,7 +81,7 @@ it "datacite database attributes" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("url")).to eq("http://datadryad.org/stash/dataset/doi:10.5061/dryad.8515") expect(crosscite.fetch("titles")).to eq([{"title"=>"Data from: A new malaria agent in African hominids."}]) @@ -95,7 +95,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("titles")).to eq( [{"title"=>"Maremma: a Ruby library for simplified network calls"}]) expect(crosscite.fetch("creators")).to eq([{"affiliation"=>[{"name"=>"DataCite"}], @@ -110,7 +110,7 @@ it "with data citation schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true crosscite = JSON.parse(subject.crosscite) expect(crosscite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) diff --git a/spec/writers/crossref_writer_spec.rb b/spec/writers/crossref_writer_spec.rb index 42428085..277cdf1a 100644 --- a/spec/writers/crossref_writer_spec.rb +++ b/spec/writers/crossref_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as crossref" do it "journal article" do input = fixture_path + 'crossref.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) crossref = Maremma.from_xml(subject.crossref).dig("crossref_result", "query_result", "body", "query", "doi_record") expect(crossref.dig("crossref", "journal", "journal_metadata", "full_title")).to eq("eLife") expect(crossref.dig("crossref", "journal", "journal_article", "doi_data", "doi")).to eq("10.7554/eLife.01567") @@ -14,7 +14,7 @@ it "from DataCite" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.crossref).to be nil end end diff --git a/spec/writers/csv_writer_spec.rb b/spec/writers/csv_writer_spec.rb index 15c79c16..11665955 100644 --- a/spec/writers/csv_writer_spec.rb +++ b/spec/writers/csv_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as csv" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") csv = (subject.csv).parse_csv expect(csv[0]).to eq("10.7554/elife.01567") @@ -23,7 +23,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") csv = (subject.csv).parse_csv expect(csv[0]).to eq("10.1155/2012/291294") @@ -40,7 +40,7 @@ it "text" do input = "https://doi.org/10.3204/desy-2014-01645" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true csv = (subject.csv).parse_csv @@ -58,7 +58,7 @@ it "climate data" do input = "https://doi.org/10.5067/altcy-tj122" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true csv = (subject.csv).parse_csv @@ -76,7 +76,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") csv = (subject.csv).parse_csv expect(csv[0]).to eq("10.5438/qeg0-3gm3") diff --git a/spec/writers/datacite_json_writer_spec.rb b/spec/writers/datacite_json_writer_spec.rb index 6956d807..033396c6 100644 --- a/spec/writers/datacite_json_writer_spec.rb +++ b/spec/writers/datacite_json_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as datacite json" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("url")).to eq("https://elifesciences.org/articles/01567") expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") @@ -22,7 +22,7 @@ it "with ORCID ID" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("url")).to eq("http://www.hindawi.com/journals/pm/2012/291294/") expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") @@ -32,7 +32,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") expect(datacite.fetch("titles")).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}]) @@ -43,7 +43,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting") expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) @@ -53,7 +53,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("titles")).to eq([{"title"=>"R Interface to the DataONE REST API"}]) expect(datacite.fetch("creators").length).to eq(3) @@ -64,7 +64,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("titles")).to eq([{"title"=>"Maremma: a Ruby library for simplified network calls"}]) expect(datacite.fetch("creators")).to eq([{"affiliation"=>[{"name"=>"DataCite"}], @@ -79,7 +79,7 @@ it "with data citation schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true datacite = JSON.parse(subject.datacite_json) expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) diff --git a/spec/writers/datacite_writer_spec.rb b/spec/writers/datacite_writer_spec.rb index 310869d1..67cb75bd 100644 --- a/spec/writers/datacite_writer_spec.rb +++ b/spec/writers/datacite_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as datacite xml" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text") @@ -21,7 +21,7 @@ it "with ORCID ID" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text") @@ -35,7 +35,7 @@ it "with editor" do input = "https://doi.org/10.1371/journal.pone.0000030" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("contributors", "contributor")).to eq("contributorName"=>{"__content__"=>"Janbon, Guilhem", "nameType"=>"Personal"}, "contributorType"=>"Editor", "familyName"=>"Janbon", "givenName"=>"Guilhem") @@ -43,7 +43,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text") @@ -56,7 +56,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text") @@ -68,7 +68,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API") @@ -92,7 +92,7 @@ it "rdataone and codemeta_v2" do input = fixture_path + 'codemeta_v2.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API") @@ -116,7 +116,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls") @@ -125,7 +125,7 @@ it "with version" do input = "https://doi.org/10.5281/zenodo.28518" - subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + subject = Bolognese::Metadata.new(input, from: "datacite", regenerate: true) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5281/zenodo.28518") expect(subject.identifiers).to eq([{"identifier"=>"https://zenodo.org/record/28518", "identifierType"=>"URL"}]) @@ -154,7 +154,7 @@ it "Text pass-thru" do input = "https://doi.org/10.23640/07243.5153971" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.23640/07243.5153971") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"Paper", "resourceTypeGeneral"=>"Text", "ris"=>"RPRT", "schemaOrg"=>"ScholarlyArticle") @@ -180,7 +180,7 @@ it "Text pass-thru with doi in options" do input = "https://doi.org/10.23640/07243.5153971" - subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.5072/07243.5153971") + subject = Bolognese::Metadata.new(input, from: "datacite", doi: "10.5072/07243.5153971") expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.5072/07243.5153971") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"Paper", "resourceTypeGeneral"=>"Text", "ris"=>"RPRT", "schemaOrg"=>"ScholarlyArticle") @@ -206,7 +206,7 @@ it "Dataset in schema 4.0" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + subject = Bolognese::Metadata.new(input, from: "datacite", regenerate: true) expect(subject.valid?).to be true expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset") expect(subject.creators.length).to eq(8) @@ -234,7 +234,7 @@ it "Affiliation" do input = fixture_path + 'datacite-example-geolocation-2.xml' doi = "10.6071/Z7WC73" - subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + subject = Bolognese::Metadata.new(input, from: "datacite", regenerate: true) expect(subject.valid?).to be true expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset") expect(subject.creators.length).to eq(6) @@ -259,7 +259,7 @@ it "with data citation schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("titles", "title")).to eq("Eating your own Dog Food") @@ -269,7 +269,7 @@ it "DOI not found" do input = "https://doi.org/10.4124/05F6C379-DD68-4CDB-880D-33D3E9576D52/1" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be false expect(subject.id).to eq("https://doi.org/10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") expect(subject.doi).to eq("10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") @@ -282,7 +282,7 @@ it "no input" do input = nil - subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") + subject = Bolognese::Metadata.new(input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") expect(subject.valid?).to be false datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite["identifier"]).to eq("identifierType"=>"DOI", "__content__"=>"10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") @@ -293,7 +293,7 @@ context "change metadata as datacite xml" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.doi = "10.5061/DRYAD.8515" subject.titles = [{ "title" => "Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth" }] subject.types = { "schemaOrg" => "Dataset", "resourceTypeGeneral" => "Dataset" } @@ -312,7 +312,7 @@ it "change description" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.descriptions = { "description" => "This is an abstract." } expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) @@ -321,7 +321,7 @@ it "change description no input" do input = nil - subject = Bolognese::Metadata.new(input: input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") + subject = Bolognese::Metadata.new(input, from: "datacite", doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") subject.descriptions = "This is an abstract." expect(subject.valid?).to be false datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) @@ -330,7 +330,7 @@ it "required metadata no input" do input = nil - subject = Bolognese::Metadata.new(input: input, doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") + subject = Bolognese::Metadata.new(input, doi: "10.4124/05f6c379-dd68-4cdb-880d-33d3e9576d52/1") subject.creators = [{"creatorName"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner"}] subject.titles = [{ "title" => "Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth" }] subject.types = { "schemaOrg" => "Dataset", "resourceTypeGeneral" => "Dataset" } @@ -346,7 +346,7 @@ it "change license" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.rights_list = [{ "rights_uri" => "https://creativecommons.org/licenses/by-nc-sa/4.0", "rights" => "Creative Commons Attribution-NonCommercial-ShareAlike" }] expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) @@ -355,7 +355,7 @@ it "change license url" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.rights_list = [{ "rightsUri" => "https://creativecommons.org/licenses/by-nc-sa/4.0" }] expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) @@ -364,7 +364,7 @@ it "change license name" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.rights_list = [{ "rights" => "Creative Commons Attribution-NonCommercial-ShareAlike" }] expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) @@ -373,7 +373,7 @@ it "change state" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true expect(subject.state).to eq("findable") subject.state = "registered" @@ -384,7 +384,7 @@ it "change identifiers" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true expect(subject.identifiers).to eq( [{"identifier"=>"e01567", "identifierType"=>"Publisher ID"}]) subject.identifiers = [{ "identifierType" => "Publisher ID", "identifier" => "abc" }] @@ -395,7 +395,7 @@ it "validates against schema" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") subject.doi = "123" subject.titles = "Data from: Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth" subject.types = { "schemaOrg" => "Dataset", "resourceTypeGeneral" => "Dataset" } @@ -405,7 +405,7 @@ it "from schema_org gtex" do input = fixture_path + "schema_org_gtex.json" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("identifier", "__content__")).to eq("10.25491/d50j-3083") diff --git a/spec/writers/jats_writer_spec.rb b/spec/writers/jats_writer_spec.rb index 4262a44f..8ee0b697 100644 --- a/spec/writers/jats_writer_spec.rb +++ b/spec/writers/jats_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as jats xml" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") @@ -20,7 +20,7 @@ it "with ORCID ID" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers") @@ -32,7 +32,7 @@ it "with editor" do input = "https://doi.org/10.1371/journal.pone.0000030" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization–Not Catalytic Inactivity–of the Mutant Enzymes") @@ -49,7 +49,7 @@ it "book chapter" do input = "https://doi.org/10.5005/jp/books/12414_3" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("chapter") expect(jats.dig("chapter_title")).to eq("Physical Examinations") @@ -63,7 +63,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") @@ -77,7 +77,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to be_nil expect(jats.dig("source")).to eq("Eating your own Dog Food") @@ -91,7 +91,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("software") expect(jats.dig("source")).to eq("R Interface to the DataONE REST API") @@ -107,7 +107,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("software") expect(jats.dig("source")).to eq("Maremma: a Ruby library for simplified network calls") @@ -121,7 +121,7 @@ it "Text pass-thru" do input = "https://doi.org/10.23640/07243.5153971" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Recommendation of: ORCID Works Metadata Working Group") @@ -134,7 +134,7 @@ it "Dataset in schema 4.0" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + subject = Bolognese::Metadata.new(input, from: "datacite", regenerate: true) jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("data") expect(jats.dig("data_title")).to eq("Data from: A new malaria agent in African hominids.") @@ -147,7 +147,7 @@ it "with data citation schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to be_nil expect(jats.dig("source")).to eq("Eating your own Dog Food") @@ -161,7 +161,7 @@ it "interactive resource without dates" do input = "https://doi.org/10.34747/g6yb-3412" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to be_nil expect(jats.dig("source")).to eq("Exploring the \"Many analysts, one dataset\" project from COS") @@ -177,7 +177,7 @@ context "change metadata as datacite xml" do it "with data citation" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") jats = Maremma.from_xml(subject.jats).fetch("element_citation", {}) expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") diff --git a/spec/writers/rdf_xml_writer_spec.rb b/spec/writers/rdf_xml_writer_spec.rb index dc3b0b60..1a53602f 100644 --- a/spec/writers/rdf_xml_writer_spec.rb +++ b/spec/writers/rdf_xml_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as rdf xml" do it "journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567") @@ -16,7 +16,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.1155/2012/291294") @@ -28,7 +28,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") expect(subject.valid?).to be true rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) @@ -40,7 +40,7 @@ it "BlogPosting" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg") @@ -51,7 +51,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("BlogPosting", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg") expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food") @@ -60,7 +60,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("SoftwareSourceCode", "rdf:about")).to eq("https://doi.org/10.5438/qeg0-3gm3") expect(rdf_xml.dig("SoftwareSourceCode", "author", "Person", "rdf:about")).to eq("https://orcid.org/0000-0003-0077-4738") @@ -72,7 +72,7 @@ it "BlogPosting schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {}) expect(rdf_xml.dig("BlogPosting", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg") diff --git a/spec/writers/ris_writer_spec.rb b/spec/writers/ris_writer_spec.rb index 35211959..c9f11e8c 100644 --- a/spec/writers/ris_writer_spec.rb +++ b/spec/writers/ris_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as ris" do it "journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - JOUR") @@ -25,7 +25,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - JOUR") @@ -46,7 +46,7 @@ it "alternate name" do input = "https://doi.org/10.3205/ZMA001102" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - RPRT") @@ -66,7 +66,7 @@ it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - JOUR") @@ -85,7 +85,7 @@ it "BlogPosting" do input = "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - RPRT") @@ -103,7 +103,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - GEN") expect(ris[1]).to eq("T1 - Eating your own Dog Food") @@ -120,7 +120,7 @@ it "BlogPosting DataCite JSON" do input = fixture_path + "datacite.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + subject = Bolognese::Metadata.new(input, from: "datacite_json") ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - RPRT") expect(ris[1]).to eq("T1 - Eating your own Dog Food") @@ -136,7 +136,7 @@ it "BlogPosting schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - GEN") expect(ris[1]).to eq("T1 - Eating your own Dog Food") @@ -153,7 +153,7 @@ it "Dataset" do input = "10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - DATA") @@ -170,7 +170,7 @@ it "maremma" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") ris = subject.ris.split("\r\n") expect(ris[0]).to eq("TY - COMP") expect(ris[1]).to eq("T1 - Maremma: a Ruby library for simplified network calls") @@ -186,7 +186,7 @@ it "keywords with subject scheme" do input = "https://doi.org/10.1594/pangaea.721193" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") ris = subject.ris.split("\r\n") expect(ris.first).to eq("TY - DATA") expect(ris).to include("T1 - Seawater carbonate chemistry and processes during experiments with Crassostrea gigas, 2007, supplement to: Kurihara, Haruko; Kato, Shoji; Ishimatsu, Atsushi (2007): Effects of increased seawater pCO2 on early development of the oyster Crassostrea gigas. Aquatic Biology, 1(1), 91-98") diff --git a/spec/writers/schema_org_writer_spec.rb b/spec/writers/schema_org_writer_spec.rb index 047f9622..8d07c355 100644 --- a/spec/writers/schema_org_writer_spec.rb +++ b/spec/writers/schema_org_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as schema_org" do it "journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.7554/elife.01567") expect(json["@type"]).to eq("ScholarlyArticle") @@ -29,7 +29,7 @@ it "maremma schema.org JSON" do input = "https://github.com/datacite/maremma" - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3") expect(json["@type"]).to eq("SoftwareSourceCode") @@ -39,7 +39,7 @@ it "Schema.org JSON" do input = "https://doi.org/10.5281/ZENODO.48440" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5281/zenodo.48440") expect(json["@type"]).to eq("SoftwareSourceCode") @@ -49,7 +49,7 @@ it "Schema.org JSON isReferencedBy" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515") expect(json["@type"]).to eq("Dataset") @@ -60,7 +60,7 @@ it "Schema.org JSON IsSupplementTo" do input = "https://doi.org/10.5517/CC8H01S" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5517/cc8h01s") expect(json["@type"]).to eq("Dataset") @@ -69,7 +69,7 @@ it "Schema.org JSON Cyark" do input = "https://doi.org/10.26301/jgf3-jm06" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.26301/jgf3-jm06") expect(json["@type"]).to eq("Dataset") @@ -77,7 +77,7 @@ it "rdataone" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x") expect(json["@type"]).to eq("SoftwareSourceCode") @@ -101,7 +101,7 @@ it "Funding" do input = "https://doi.org/10.5438/6423" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5438/6423") expect(json["@type"]).to eq("Collection") @@ -113,7 +113,7 @@ it "Funding OpenAIRE" do input = "https://doi.org/10.5281/ZENODO.1239" - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5281/zenodo.1239") expect(json["@type"]).to eq("Dataset") @@ -123,7 +123,7 @@ it "subject scheme" do input = "https://doi.org/10.4232/1.2745" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.4232/1.2745") expect(json["@type"]).to eq("Dataset") @@ -133,7 +133,7 @@ it "subject scheme multiple keywords" do input = "https://doi.org/10.1594/pangaea.721193" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.1594/pangaea.721193") expect(json["@type"]).to eq("Dataset") @@ -146,7 +146,7 @@ input = fixture_path + 'gtex.xml' url = "https://ors.datacite.org/doi:/10.25491/9hx8-ke93" content_url = "https://storage.googleapis.com/gtex_analysis_v7/single_tissue_eqtl_data/GTEx_Analysis_v7_eQTL_expression_matrices.tar.gz" - subject = Bolognese::Metadata.new(input: input, url: url, content_url: content_url, from: "datacite") + subject = Bolognese::Metadata.new(input, url: url, content_url: content_url, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.25491/9hx8-ke93") expect(json["@type"]).to eq("Dataset") @@ -161,7 +161,7 @@ it "series information" do input = "10.4229/23RDEUPVSEC2008-5CO.8.3" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.4229/23rdeupvsec2008-5co.8.3") expect(json["@type"]).to eq("ScholarlyArticle") @@ -173,7 +173,7 @@ it "data catalog" do input = "10.25491/8KMC-G314" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.25491/8kmc-g314") expect(json["@type"]).to eq("Dataset") @@ -186,7 +186,7 @@ it "alternate identifiers" do input = "10.23725/8na3-9s47" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.23725/8na3-9s47") expect(json["@type"]).to eq("Dataset") @@ -209,7 +209,7 @@ it "affiliation identifier" do input = fixture_path + 'datacite-example-affiliation.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5072/example-full") expect(json["@type"]).to eq("SoftwareSourceCode") @@ -232,7 +232,7 @@ it "geo_location_point" do input = fixture_path + 'datacite-example-geolocation-2.xml' doi = "10.6071/Z7WC73" - subject = Bolognese::Metadata.new(input: input, doi: doi) + subject = Bolognese::Metadata.new(input, doi: doi) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.6071/z7wc73") expect(json["@type"]).to eq("Dataset") @@ -256,7 +256,7 @@ it "geo_location_box" do input = "10.1594/PANGAEA.842237" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.1594/pangaea.842237") expect(json["@type"]).to eq("Dataset") @@ -274,7 +274,7 @@ it "geo_location_polygon" do input = fixture_path + 'datacite-example-polygon-v4.1.xml' - subject = Bolognese::Metadata.new(input: input) + subject = Bolognese::Metadata.new(input) json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5072/example-polygon") expect(json["@type"]).to eq("Dataset") @@ -287,7 +287,7 @@ it "from schema_org gtex" do input = fixture_path + 'schema_org_gtex.json' - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.25491/d50j-3083") expect(json["@type"]).to eq("Dataset") @@ -329,7 +329,7 @@ it "from schema_org topmed" do input = fixture_path + 'schema_org_topmed.json' - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.23725/8na3-9s47") expect(json["@type"]).to eq("Dataset") @@ -359,7 +359,7 @@ it "interactive resource without dates" do input = "https://doi.org/10.34747/g6yb-3412" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.34747/g6yb-3412") expect(json["@type"]).to eq("CreativeWork") diff --git a/spec/writers/turtle_writer_spec.rb b/spec/writers/turtle_writer_spec.rb index f1249f39..e500f20d 100644 --- a/spec/writers/turtle_writer_spec.rb +++ b/spec/writers/turtle_writer_spec.rb @@ -6,7 +6,7 @@ context "write metadata as turtle" do it "Crossref DOI" do input = fixture_path + "crossref.bib" - subject = Bolognese::Metadata.new(input: input, from: "bibtex") + subject = Bolognese::Metadata.new(input, from: "bibtex") ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") @@ -14,7 +14,7 @@ it "Dataset" do input = "https://doi.org/10.5061/DRYAD.8515" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") @@ -23,7 +23,7 @@ it "BlogPosting" do input= "https://doi.org/10.5438/4K3M-NYVG" - subject = Bolognese::Metadata.new(input: input, from: "datacite") + subject = Bolognese::Metadata.new(input, from: "datacite") expect(subject.valid?).to be true ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") @@ -32,7 +32,7 @@ it "BlogPosting Citeproc JSON" do input = fixture_path + "citeproc.json" - subject = Bolognese::Metadata.new(input: input, from: "citeproc") + subject = Bolognese::Metadata.new(input, from: "citeproc") ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:BlogPosting;") @@ -40,7 +40,7 @@ it "BlogPosting DataCite JSON" do input = fixture_path + "datacite.json" - subject = Bolognese::Metadata.new(input: input, from: "datacite_json") + subject = Bolognese::Metadata.new(input, from: "datacite_json") ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") @@ -48,7 +48,7 @@ it "BlogPosting schema.org" do input = "https://blog.datacite.org/eating-your-own-dog-food/" - subject = Bolognese::Metadata.new(input: input, from: "schema_org") + subject = Bolognese::Metadata.new(input, from: "schema_org") expect(subject.valid?).to be true ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") @@ -57,7 +57,7 @@ it "DataONE" do input = fixture_path + 'codemeta.json' - subject = Bolognese::Metadata.new(input: input, from: "codemeta") + subject = Bolognese::Metadata.new(input, from: "codemeta") ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:SoftwareSourceCode;") @@ -65,7 +65,7 @@ it "journal article" do input = "10.7554/eLife.01567" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") @@ -74,7 +74,7 @@ it "with pages" do input = "https://doi.org/10.1155/2012/291294" - subject = Bolognese::Metadata.new(input: input, from: "crossref") + subject = Bolognese::Metadata.new(input, from: "crossref") expect(subject.valid?).to be true ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .")