diff --git a/Gemfile.lock b/Gemfile.lock
index 4abeb12d..e4cb3436 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- bolognese (1.6.5)
+ bolognese (1.6.6)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
@@ -56,7 +56,7 @@ GEM
namae (~> 1.0)
csl-styles (1.0.1.10)
csl (~> 1.0)
- diff-lcs (1.3)
+ diff-lcs (1.4.1)
docile (1.3.2)
ebnf (1.2.0)
rdf (~> 3.1)
diff --git a/lib/bolognese/metadata_utils.rb b/lib/bolognese/metadata_utils.rb
index 190dcf34..b5eaa6c1 100644
--- a/lib/bolognese/metadata_utils.rb
+++ b/lib/bolognese/metadata_utils.rb
@@ -140,8 +140,14 @@ def citeproc_hsh
author = to_citeproc(creators)
end
+ if types["resourceTypeGeneral"] == "Software" && version_info.present?
+ type = "book"
+ else
+ type = types["citeproc"]
+ end
+
{
- "type" => types["citeproc"],
+ "type" => type,
"id" => normalize_doi(doi),
"categories" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence,
"language" => language,
diff --git a/lib/bolognese/version.rb b/lib/bolognese/version.rb
index 9c2eb064..ac1e382b 100644
--- a/lib/bolognese/version.rb
+++ b/lib/bolognese/version.rb
@@ -1,3 +1,3 @@
module Bolognese
- VERSION = "1.6.5"
+ VERSION = "1.6.6"
end
diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/software_w/version.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/software_w/version.yml
new file mode 100644
index 00000000..17ddb80e
--- /dev/null
+++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/software_w/version.yml
@@ -0,0 +1,52 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.datacite.org/dois/10.5281/zenodo.2598836
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Mozilla/5.0 (compatible; Maremma/4.8; mailto:info@datacite.org)
+ Accept:
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Date:
+ - Tue, 23 Jun 2020 20:15:32 GMT
+ Content-Type:
+ - application/json; charset=utf-8
+ Connection:
+ - keep-alive
+ Status:
+ - 200 OK
+ X-Anonymous-Consumer:
+ - 'true'
+ Cache-Control:
+ - max-age=0, private, must-revalidate
+ Vary:
+ - Accept-Encoding, Origin
+ X-Request-Id:
+ - c3c8d01b-f2f5-47b3-94be-708f587f12ad
+ Etag:
+ - W/"eef90050e859855e481905772350de2a"
+ X-Runtime:
+ - '0.254035'
+ X-Powered-By:
+ - Phusion Passenger 6.0.5
+ Server:
+ - nginx/1.14.0 + Phusion Passenger 6.0.5
+ body:
+ encoding: ASCII-8BIT
+ string: '{"data":{"id":"10.5281/zenodo.2598836","type":"dois","attributes":{"doi":"10.5281/zenodo.2598836","prefix":"10.5281","suffix":"zenodo.2598836","identifiers":[{"identifier":"https://doi.org/10.5281/zenodo.2598836","identifierType":"DOI"},{"identifier":"https://zenodo.org/record/2598836","identifierType":"URL"}],"alternateIdentifiers":[{"alternateIdentifierType":"URL","alternateIdentifier":"https://zenodo.org/record/2598836"}],"creators":[{"name":"Lab
+ For Exosphere And Near Space Environment Studies","affiliation":[]}],"titles":[{"title":"lenses-lab/LYAO_RT-2018JA026426:
+ Original Release"}],"publisher":"Zenodo","container":{},"publicationYear":2019,"subjects":[],"contributors":[],"dates":[{"date":"2019-03-20","dateType":"Issued"}],"language":null,"types":{"ris":"COMP","bibtex":"misc","citeproc":"article","schemaOrg":"SoftwareSourceCode","resourceTypeGeneral":"Software"},"relatedIdentifiers":[{"relationType":"IsSupplementTo","relatedIdentifier":"https://github.com/lenses-lab/LYAO_RT-2018JA026426/tree/1.0.0","relatedIdentifierType":"URL"},{"relationType":"IsVersionOf","relatedIdentifier":"10.5281/zenodo.2598835","relatedIdentifierType":"DOI"}],"sizes":[],"formats":[],"version":"1.0.0","rightsList":[{"rights":"Open
+ Access","rightsUri":"info:eu-repo/semantics/openAccess"}],"descriptions":[{"description":"Original
+ executables used by Gallant et al. for JGR publication 2018JA026426.","descriptionType":"Abstract"}],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00LjEvbWV0YWRhdGEueHNkIj4KICA8aWRlbnRpZmllciBpZGVudGlmaWVyVHlwZT0iRE9JIj4xMC41MjgxL1pFTk9ETy4yNTk4ODM2PC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWU+TGFiIGZvciBFeG9zcGhlcmUgYW5kIE5lYXIgU3BhY2UgRW52aXJvbm1lbnQgU3R1ZGllczwvY3JlYXRvck5hbWU+CiAgICAgIDxhZmZpbGlhdGlvbi8+CiAgICA8L2NyZWF0b3I+CiAgPC9jcmVhdG9ycz4KICA8dGl0bGVzPgogICAgPHRpdGxlPmxlbnNlcy1sYWIvTFlBT19SVC0yMDE4SkEwMjY0MjY6IE9yaWdpbmFsIFJlbGVhc2U8L3RpdGxlPgogIDwvdGl0bGVzPgogIDxwdWJsaXNoZXI+WmVub2RvPC9wdWJsaXNoZXI+CiAgPHB1YmxpY2F0aW9uWWVhcj4yMDE5PC9wdWJsaWNhdGlvblllYXI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3QiPiZsdDtwJmd0O09yaWdpbmFsIGV4ZWN1dGFibGVzIHVzZWQgYnkgR2FsbGFudCBldCBhbC4gZm9yIEpHUiBwdWJsaWNhdGlvbiAyMDE4SkEwMjY0MjYuJmx0Oy9wJmd0OzwvZGVzY3JpcHRpb24+CiAgPC9kZXNjcmlwdGlvbnM+CjwvcmVzb3VyY2U+","url":"https://zenodo.org/record/2598836","contentUrl":null,"metadataVersion":0,"schemaVersion":"http://datacite.org/schema/kernel-4","source":"mds","isActive":true,"state":"findable","reason":null,"viewCount":0,"viewsOverTime":[],"downloadCount":0,"downloadsOverTime":[],"referenceCount":0,"citationCount":0,"citationsOverTime":[],"partCount":0,"partOfCount":0,"versionCount":0,"versionOfCount":0,"created":"2019-03-20T02:32:02.000Z","registered":"2019-03-20T02:32:02.000Z","published":"2019","updated":"2019-08-02T22:04:29.000Z"},"relationships":{"client":{"data":{"id":"cern.zenodo","type":"clients"}},"media":{"data":{"id":"10.5281/zenodo.2598836","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}}}'
+ http_version:
+ recorded_at: Tue, 23 Jun 2020 20:15:32 GMT
+recorded_with: VCR 3.0.3
diff --git a/spec/writers/citation_writer_spec.rb b/spec/writers/citation_writer_spec.rb
index 881679ee..4724a3ce 100644
--- a/spec/writers/citation_writer_spec.rb
+++ b/spec/writers/citation_writer_spec.rb
@@ -32,5 +32,13 @@
subject = Bolognese::Metadata.new(input: 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")
+ 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")
+ end
end
end
diff --git a/spec/writers/citeproc_writer_spec.rb b/spec/writers/citeproc_writer_spec.rb
index b9c2891c..dc28d86a 100644
--- a/spec/writers/citeproc_writer_spec.rb
+++ b/spec/writers/citeproc_writer_spec.rb
@@ -101,7 +101,7 @@
input = "https://doi.org/10.5281/zenodo.2598836"
subject = Bolognese::Metadata.new(input: input, from: "datacite")
json = JSON.parse(subject.citeproc)
- expect(json["type"]).to eq("article")
+ expect(json["type"]).to eq("book")
expect(json["DOI"]).to eq("10.5281/zenodo.2598836")
expect(json["version"]).to eq("1.0.0")
expect(json["copyright"]).to eq("Open Access")
@@ -111,7 +111,7 @@
input = fixture_path + "datacite_software_version.json"
subject = Bolognese::Metadata.new(input: input, from: "datacite_json")
json = JSON.parse(subject.citeproc)
- expect(json["type"]).to eq("article")
+ expect(json["type"]).to eq("book")
expect(json["DOI"]).to eq("10.5281/ZENODO.2598836")
expect(json["version"]).to eq("1.0.0")
expect(json["copyright"]).to eq("Open Access")