diff --git a/Gemfile.lock b/Gemfile.lock
index 9d7363b9..5c2b3dd4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- bolognese (1.6.11)
+ bolognese (1.6.12)
activesupport (>= 4.2.5)
benchmark_methods (~> 0.7)
bibtex-ruby (>= 5.1.0)
@@ -11,13 +11,13 @@ PATH
concurrent-ruby (~> 1.1, >= 1.1.5)
csl-styles (~> 1.0, >= 1.0.1.8)
edtf (~> 3.0, >= 3.0.4)
- faraday (= 0.17.0)
+ faraday (~> 0.17.3)
gender_detector (~> 0.1.2)
iso8601 (~> 0.9.1)
json-ld (~> 3.1, >= 3.1.4)
jsonlint (~> 0.3.0)
loofah (~> 2.0, >= 2.0.3)
- maremma (>= 4.3, < 5)
+ maremma (>= 4.7, < 5)
namae (~> 1.0)
nokogiri (~> 1.10.4)
oj (~> 3.10)
@@ -64,11 +64,11 @@ GEM
edtf (3.0.5)
activesupport (>= 3.0, < 7.0)
excon (0.71.1)
- faraday (0.17.0)
+ faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-encoding (0.0.5)
faraday
- faraday_middleware (0.13.1)
+ faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0)
gender_detector (0.1.2)
unicode_utils (>= 1.3.0)
@@ -98,23 +98,23 @@ GEM
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
- maremma (4.7)
+ maremma (4.7.1)
activesupport (>= 4.2.5)
addressable (>= 2.3.6)
builder (~> 3.2, >= 3.2.2)
excon (~> 0.71.0)
- faraday (= 0.17.0)
+ faraday (~> 0.17.3)
faraday-encoding (~> 0.0.4)
- faraday_middleware (~> 0.13.1)
+ faraday_middleware (~> 0.14.0)
nokogiri (~> 1.10.4)
oj (>= 2.8.3)
oj_mimic_json (~> 1.0, >= 1.0.1)
mini_portile2 (2.4.0)
minitest (5.14.1)
- multi_json (1.14.1)
+ multi_json (1.15.0)
multipart-post (2.1.1)
namae (1.0.1)
- nokogiri (1.10.9)
+ nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oj (3.10.6)
oj_mimic_json (1.0.1)
@@ -133,7 +133,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-aggregate-repo (3.1.0)
rdf (~> 3.1)
- rdf-rdfa (3.1.1)
+ rdf-rdfa (3.1.2)
haml (~> 5.1)
htmlentities (~> 4.3)
rdf (~> 3.1, >= 3.1.2)
@@ -148,7 +148,7 @@ GEM
rdf-turtle (3.1.1)
ebnf (~> 1.2)
rdf (~> 3.1, >= 3.1.2)
- rdf-vocab (3.1.5)
+ rdf-vocab (3.1.7)
rdf (~> 3.1, >= 3.1.2)
rdf-xsd (3.1.0)
rdf (~> 3.1)
diff --git a/bolognese.gemspec b/bolognese.gemspec
index 127a4cc7..6b8c53a2 100644
--- a/bolognese.gemspec
+++ b/bolognese.gemspec
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = '~> 2.3'
# Declare dependencies here, rather than in the Gemfile
- s.add_dependency 'maremma', '>= 4.3', '< 5'
- s.add_dependency 'faraday', "0.17.0"
+ s.add_dependency 'maremma', '>= 4.7', '< 5'
+ s.add_dependency 'faraday', '~> 0.17.3'
s.add_dependency 'nokogiri', '~> 1.10.4'
s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
diff --git a/lib/bolognese/metadata_utils.rb b/lib/bolognese/metadata_utils.rb
index b5eaa6c1..489f0a9b 100644
--- a/lib/bolognese/metadata_utils.rb
+++ b/lib/bolognese/metadata_utils.rb
@@ -153,7 +153,7 @@ def citeproc_hsh
"language" => language,
"author" => author,
"contributor" => to_citeproc(contributors),
- "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : nil,
+ "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year),
"submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
"abstract" => parse_attributes(descriptions, content: "description", first: true),
"container-title" => container_title,
diff --git a/lib/bolognese/version.rb b/lib/bolognese/version.rb
index 6b361c1f..0da78229 100644
--- a/lib/bolognese/version.rb
+++ b/lib/bolognese/version.rb
@@ -1,3 +1,3 @@
module Bolognese
- VERSION = "1.6.11"
+ VERSION = "1.6.12"
end
diff --git a/lib/bolognese/writers/codemeta_writer.rb b/lib/bolognese/writers/codemeta_writer.rb
index b82e5036..807136ae 100644
--- a/lib/bolognese/writers/codemeta_writer.rb
+++ b/lib/bolognese/writers/codemeta_writer.rb
@@ -17,7 +17,7 @@ def codemeta
"description" => parse_attributes(descriptions, content: "description", first: true),
"version" => version_info,
"tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
- "datePublished" => get_date(dates, "Issued"),
+ "datePublished" => get_date(dates, "Issued") || publication_year,
"dateModified" => get_date(dates, "Updated"),
"publisher" => publisher,
"license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap,
diff --git a/lib/bolognese/writers/jats_writer.rb b/lib/bolognese/writers/jats_writer.rb
index ce859152..1f4b1bb6 100644
--- a/lib/bolognese/writers/jats_writer.rb
+++ b/lib/bolognese/writers/jats_writer.rb
@@ -121,7 +121,7 @@ def insert_pub_id(xml)
end
def date
- get_date_parts(date_published)
+ get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year)
end
def publication_type
diff --git a/lib/bolognese/writers/schema_org_writer.rb b/lib/bolognese/writers/schema_org_writer.rb
index 2fb1c3bd..0d23b8c5 100644
--- a/lib/bolognese/writers/schema_org_writer.rb
+++ b/lib/bolognese/writers/schema_org_writer.rb
@@ -21,7 +21,7 @@ def schema_hsh
"contentSize" => Array.wrap(sizes).unwrap,
"encodingFormat" => Array.wrap(formats).unwrap,
"dateCreated" => get_date(dates, "Created"),
- "datePublished" => get_date(dates, "Issued"),
+ "datePublished" => get_date(dates, "Issued") || publication_year,
"dateModified" => get_date(dates, "Updated"),
"pageStart" => container.to_h["firstPage"],
"pageEnd" => container.to_h["lastPage"],
diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml
new file mode 100644
index 00000000..e6bc046f
--- /dev/null
+++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citation/interactive_resource_without_dates.yml
@@ -0,0 +1,52 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.datacite.org/dois/10.34747/g6yb-3412
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Mozilla/5.0 (compatible; Maremma/4.7.1; 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:
+ - Sat, 11 Jul 2020 10:15:22 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:
+ - 7648137b-5c3a-409c-b2a8-ece2d2dc81c5
+ Etag:
+ - W/"428b4daf1127c41e29e332a03d2f46c2"
+ X-Runtime:
+ - '1.399490'
+ 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.34747/g6yb-3412","type":"dois","attributes":{"doi":"10.34747/g6yb-3412","prefix":"10.34747","suffix":"g6yb-3412","identifiers":[],"alternateIdentifiers":[],"creators":[{"name":"Clark,
+ Dav","nameType":"Personal","givenName":"Dav","familyName":"Clark","affiliation":[],"nameIdentifiers":[{"schemeUri":"https://orcid.org","nameIdentifier":"https://orcid.org/0000-0002-3982-4416","nameIdentifierScheme":"ORCID"}]}],"titles":[{"lang":null,"title":"Exploring
+ the \"Many analysts, one dataset\" project from COS","titleType":null}],"publisher":"Gigantum,
+ Inc.","container":{},"publicationYear":2019,"subjects":[],"contributors":[],"dates":[],"language":null,"types":{"resourceType":"Gigantum
+ Project","resourceTypeGeneral":"InteractiveResource"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00L21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuMzQ3NDcvRzZZQi0zNDEyPC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWUgbmFtZVR5cGU9IlBlcnNvbmFsIj5DbGFyaywgRGF2PC9jcmVhdG9yTmFtZT4KICAgICAgPGdpdmVuTmFtZT5EYXY8L2dpdmVuTmFtZT4KICAgICAgPGZhbWlseU5hbWU+Q2xhcms8L2ZhbWlseU5hbWU+CiAgICAgIDxuYW1lSWRlbnRpZmllciBuYW1lSWRlbnRpZmllclNjaGVtZT0iT1JDSUQiIHNjaGVtZVVSST0iaHR0cHM6Ly9vcmNpZC5vcmciPmh0dHBzOi8vb3JjaWQub3JnLzAwMDAtMDAwMi0zOTgyLTQ0MTY8L25hbWVJZGVudGlmaWVyPgogICAgPC9jcmVhdG9yPgogIDwvY3JlYXRvcnM+CiAgPHRpdGxlcz4KICAgIDx0aXRsZT5FeHBsb3JpbmcgdGhlICJNYW55IGFuYWx5c3RzLCBvbmUgZGF0YXNldCIgcHJvamVjdCBmcm9tIENPUzwvdGl0bGU+CiAgPC90aXRsZXM+CiAgPHB1Ymxpc2hlcj5HaWdhbnR1bSwgSW5jLjwvcHVibGlzaGVyPgogIDxwdWJsaWNhdGlvblllYXI+MjAxOTwvcHVibGljYXRpb25ZZWFyPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iSW50ZXJhY3RpdmVSZXNvdXJjZSI+R2lnYW50dW0gUHJvamVjdDwvcmVzb3VyY2VUeXBlPgogIDxzaXplcy8+CiAgPGZvcm1hdHMvPgogIDx2ZXJzaW9uLz4KPC9yZXNvdXJjZT4K","url":"https://gigantum.com/tinydav/football-skin-tone","contentUrl":null,"metadataVersion":2,"schemaVersion":"http://datacite.org/schema/kernel-4","source":"fabricaForm","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":"2020-03-20T19:48:26.000Z","registered":"2020-03-20T19:49:25.000Z","published":"2019","updated":"2020-07-11T09:44:36.000Z"},"relationships":{"client":{"data":{"id":"gigantum.gigantum","type":"clients"}},"media":{"data":{"id":"10.34747/g6yb-3412","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}}}'
+ http_version:
+ recorded_at: Sat, 11 Jul 2020 10:15:22 GMT
+recorded_with: VCR 3.0.3
diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/interactive_resource_without_dates.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/interactive_resource_without_dates.yml
new file mode 100644
index 00000000..b786bfea
--- /dev/null
+++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/interactive_resource_without_dates.yml
@@ -0,0 +1,52 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.datacite.org/dois/10.34747/g6yb-3412
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Mozilla/5.0 (compatible; Maremma/4.7.1; 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:
+ - Sat, 11 Jul 2020 10:13:34 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
+ Etag:
+ - W/"428b4daf1127c41e29e332a03d2f46c2"
+ X-Runtime:
+ - '0.350807'
+ X-Request-Id:
+ - bd8c497b-5d91-46c7-ad9f-d6d787d9a549
+ 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.34747/g6yb-3412","type":"dois","attributes":{"doi":"10.34747/g6yb-3412","prefix":"10.34747","suffix":"g6yb-3412","identifiers":[],"alternateIdentifiers":[],"creators":[{"name":"Clark,
+ Dav","nameType":"Personal","givenName":"Dav","familyName":"Clark","affiliation":[],"nameIdentifiers":[{"schemeUri":"https://orcid.org","nameIdentifier":"https://orcid.org/0000-0002-3982-4416","nameIdentifierScheme":"ORCID"}]}],"titles":[{"lang":null,"title":"Exploring
+ the \"Many analysts, one dataset\" project from COS","titleType":null}],"publisher":"Gigantum,
+ Inc.","container":{},"publicationYear":2019,"subjects":[],"contributors":[],"dates":[],"language":null,"types":{"resourceType":"Gigantum
+ Project","resourceTypeGeneral":"InteractiveResource"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00L21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuMzQ3NDcvRzZZQi0zNDEyPC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWUgbmFtZVR5cGU9IlBlcnNvbmFsIj5DbGFyaywgRGF2PC9jcmVhdG9yTmFtZT4KICAgICAgPGdpdmVuTmFtZT5EYXY8L2dpdmVuTmFtZT4KICAgICAgPGZhbWlseU5hbWU+Q2xhcms8L2ZhbWlseU5hbWU+CiAgICAgIDxuYW1lSWRlbnRpZmllciBuYW1lSWRlbnRpZmllclNjaGVtZT0iT1JDSUQiIHNjaGVtZVVSST0iaHR0cHM6Ly9vcmNpZC5vcmciPmh0dHBzOi8vb3JjaWQub3JnLzAwMDAtMDAwMi0zOTgyLTQ0MTY8L25hbWVJZGVudGlmaWVyPgogICAgPC9jcmVhdG9yPgogIDwvY3JlYXRvcnM+CiAgPHRpdGxlcz4KICAgIDx0aXRsZT5FeHBsb3JpbmcgdGhlICJNYW55IGFuYWx5c3RzLCBvbmUgZGF0YXNldCIgcHJvamVjdCBmcm9tIENPUzwvdGl0bGU+CiAgPC90aXRsZXM+CiAgPHB1Ymxpc2hlcj5HaWdhbnR1bSwgSW5jLjwvcHVibGlzaGVyPgogIDxwdWJsaWNhdGlvblllYXI+MjAxOTwvcHVibGljYXRpb25ZZWFyPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iSW50ZXJhY3RpdmVSZXNvdXJjZSI+R2lnYW50dW0gUHJvamVjdDwvcmVzb3VyY2VUeXBlPgogIDxzaXplcy8+CiAgPGZvcm1hdHMvPgogIDx2ZXJzaW9uLz4KPC9yZXNvdXJjZT4K","url":"https://gigantum.com/tinydav/football-skin-tone","contentUrl":null,"metadataVersion":2,"schemaVersion":"http://datacite.org/schema/kernel-4","source":"fabricaForm","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":"2020-03-20T19:48:26.000Z","registered":"2020-03-20T19:49:25.000Z","published":"2019","updated":"2020-07-11T09:44:36.000Z"},"relationships":{"client":{"data":{"id":"gigantum.gigantum","type":"clients"}},"media":{"data":{"id":"10.34747/g6yb-3412","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}}}'
+ http_version:
+ recorded_at: Sat, 11 Jul 2020 10:13:34 GMT
+recorded_with: VCR 3.0.3
diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml
new file mode 100644
index 00000000..f37058e1
--- /dev/null
+++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_jats_xml/interactive_resource_without_dates.yml
@@ -0,0 +1,52 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.datacite.org/dois/10.34747/g6yb-3412
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Mozilla/5.0 (compatible; Maremma/4.7.1; 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:
+ - Sat, 11 Jul 2020 10:24:59 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
+ Etag:
+ - W/"428b4daf1127c41e29e332a03d2f46c2"
+ X-Runtime:
+ - '0.825431'
+ X-Request-Id:
+ - 2068e42a-4388-41a2-b3e8-5761b8273211
+ 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.34747/g6yb-3412","type":"dois","attributes":{"doi":"10.34747/g6yb-3412","prefix":"10.34747","suffix":"g6yb-3412","identifiers":[],"alternateIdentifiers":[],"creators":[{"name":"Clark,
+ Dav","nameType":"Personal","givenName":"Dav","familyName":"Clark","affiliation":[],"nameIdentifiers":[{"schemeUri":"https://orcid.org","nameIdentifier":"https://orcid.org/0000-0002-3982-4416","nameIdentifierScheme":"ORCID"}]}],"titles":[{"lang":null,"title":"Exploring
+ the \"Many analysts, one dataset\" project from COS","titleType":null}],"publisher":"Gigantum,
+ Inc.","container":{},"publicationYear":2019,"subjects":[],"contributors":[],"dates":[],"language":null,"types":{"resourceType":"Gigantum
+ Project","resourceTypeGeneral":"InteractiveResource"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00L21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuMzQ3NDcvRzZZQi0zNDEyPC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWUgbmFtZVR5cGU9IlBlcnNvbmFsIj5DbGFyaywgRGF2PC9jcmVhdG9yTmFtZT4KICAgICAgPGdpdmVuTmFtZT5EYXY8L2dpdmVuTmFtZT4KICAgICAgPGZhbWlseU5hbWU+Q2xhcms8L2ZhbWlseU5hbWU+CiAgICAgIDxuYW1lSWRlbnRpZmllciBuYW1lSWRlbnRpZmllclNjaGVtZT0iT1JDSUQiIHNjaGVtZVVSST0iaHR0cHM6Ly9vcmNpZC5vcmciPmh0dHBzOi8vb3JjaWQub3JnLzAwMDAtMDAwMi0zOTgyLTQ0MTY8L25hbWVJZGVudGlmaWVyPgogICAgPC9jcmVhdG9yPgogIDwvY3JlYXRvcnM+CiAgPHRpdGxlcz4KICAgIDx0aXRsZT5FeHBsb3JpbmcgdGhlICJNYW55IGFuYWx5c3RzLCBvbmUgZGF0YXNldCIgcHJvamVjdCBmcm9tIENPUzwvdGl0bGU+CiAgPC90aXRsZXM+CiAgPHB1Ymxpc2hlcj5HaWdhbnR1bSwgSW5jLjwvcHVibGlzaGVyPgogIDxwdWJsaWNhdGlvblllYXI+MjAxOTwvcHVibGljYXRpb25ZZWFyPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iSW50ZXJhY3RpdmVSZXNvdXJjZSI+R2lnYW50dW0gUHJvamVjdDwvcmVzb3VyY2VUeXBlPgogIDxzaXplcy8+CiAgPGZvcm1hdHMvPgogIDx2ZXJzaW9uLz4KPC9yZXNvdXJjZT4K","url":"https://gigantum.com/tinydav/football-skin-tone","contentUrl":null,"metadataVersion":2,"schemaVersion":"http://datacite.org/schema/kernel-4","source":"fabricaForm","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":"2020-03-20T19:48:26.000Z","registered":"2020-03-20T19:49:25.000Z","published":"2019","updated":"2020-07-11T09:44:36.000Z"},"relationships":{"client":{"data":{"id":"gigantum.gigantum","type":"clients"}},"media":{"data":{"id":"10.34747/g6yb-3412","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}}}'
+ http_version:
+ recorded_at: Sat, 11 Jul 2020 10:24:59 GMT
+recorded_with: VCR 3.0.3
diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml
new file mode 100644
index 00000000..ece2da4f
--- /dev/null
+++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_schema_org/interactive_resource_without_dates.yml
@@ -0,0 +1,52 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.datacite.org/dois/10.34747/g6yb-3412
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - Mozilla/5.0 (compatible; Maremma/4.7.1; 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:
+ - Sat, 11 Jul 2020 10:17:43 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
+ Etag:
+ - W/"428b4daf1127c41e29e332a03d2f46c2"
+ X-Runtime:
+ - '0.764455'
+ X-Request-Id:
+ - f7078933-5bd6-4ab1-8fe8-1debdab355fb
+ 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.34747/g6yb-3412","type":"dois","attributes":{"doi":"10.34747/g6yb-3412","prefix":"10.34747","suffix":"g6yb-3412","identifiers":[],"alternateIdentifiers":[],"creators":[{"name":"Clark,
+ Dav","nameType":"Personal","givenName":"Dav","familyName":"Clark","affiliation":[],"nameIdentifiers":[{"schemeUri":"https://orcid.org","nameIdentifier":"https://orcid.org/0000-0002-3982-4416","nameIdentifierScheme":"ORCID"}]}],"titles":[{"lang":null,"title":"Exploring
+ the \"Many analysts, one dataset\" project from COS","titleType":null}],"publisher":"Gigantum,
+ Inc.","container":{},"publicationYear":2019,"subjects":[],"contributors":[],"dates":[],"language":null,"types":{"resourceType":"Gigantum
+ Project","resourceTypeGeneral":"InteractiveResource"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC00L21ldGFkYXRhLnhzZCI+CiAgPGlkZW50aWZpZXIgaWRlbnRpZmllclR5cGU9IkRPSSI+MTAuMzQ3NDcvRzZZQi0zNDEyPC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWUgbmFtZVR5cGU9IlBlcnNvbmFsIj5DbGFyaywgRGF2PC9jcmVhdG9yTmFtZT4KICAgICAgPGdpdmVuTmFtZT5EYXY8L2dpdmVuTmFtZT4KICAgICAgPGZhbWlseU5hbWU+Q2xhcms8L2ZhbWlseU5hbWU+CiAgICAgIDxuYW1lSWRlbnRpZmllciBuYW1lSWRlbnRpZmllclNjaGVtZT0iT1JDSUQiIHNjaGVtZVVSST0iaHR0cHM6Ly9vcmNpZC5vcmciPmh0dHBzOi8vb3JjaWQub3JnLzAwMDAtMDAwMi0zOTgyLTQ0MTY8L25hbWVJZGVudGlmaWVyPgogICAgPC9jcmVhdG9yPgogIDwvY3JlYXRvcnM+CiAgPHRpdGxlcz4KICAgIDx0aXRsZT5FeHBsb3JpbmcgdGhlICJNYW55IGFuYWx5c3RzLCBvbmUgZGF0YXNldCIgcHJvamVjdCBmcm9tIENPUzwvdGl0bGU+CiAgPC90aXRsZXM+CiAgPHB1Ymxpc2hlcj5HaWdhbnR1bSwgSW5jLjwvcHVibGlzaGVyPgogIDxwdWJsaWNhdGlvblllYXI+MjAxOTwvcHVibGljYXRpb25ZZWFyPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iSW50ZXJhY3RpdmVSZXNvdXJjZSI+R2lnYW50dW0gUHJvamVjdDwvcmVzb3VyY2VUeXBlPgogIDxzaXplcy8+CiAgPGZvcm1hdHMvPgogIDx2ZXJzaW9uLz4KPC9yZXNvdXJjZT4K","url":"https://gigantum.com/tinydav/football-skin-tone","contentUrl":null,"metadataVersion":2,"schemaVersion":"http://datacite.org/schema/kernel-4","source":"fabricaForm","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":"2020-03-20T19:48:26.000Z","registered":"2020-03-20T19:49:25.000Z","published":"2019","updated":"2020-07-11T09:44:36.000Z"},"relationships":{"client":{"data":{"id":"gigantum.gigantum","type":"clients"}},"media":{"data":{"id":"10.34747/g6yb-3412","type":"media"}},"references":{"data":[]},"citations":{"data":[]},"parts":{"data":[]},"partOf":{"data":[]},"versions":{"data":[]},"versionOf":{"data":[]}}}}'
+ http_version:
+ recorded_at: Sat, 11 Jul 2020 10:17:43 GMT
+recorded_with: VCR 3.0.3
diff --git a/spec/writers/citation_writer_spec.rb b/spec/writers/citation_writer_spec.rb
index 4724a3ce..a6189b20 100644
--- a/spec/writers/citation_writer_spec.rb
+++ b/spec/writers/citation_writer_spec.rb
@@ -40,5 +40,13 @@
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
+
+ it "interactive resource without dates" do
+ input = "https://doi.org/10.34747/g6yb-3412"
+ 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("Clark, D. (2019). Exploring the \"Many analysts, one dataset\" project from COS. Gigantum, Inc. https://doi.org/10.34747/g6yb-3412")
+ end
end
end
diff --git a/spec/writers/citeproc_writer_spec.rb b/spec/writers/citeproc_writer_spec.rb
index dc28d86a..870987a0 100644
--- a/spec/writers/citeproc_writer_spec.rb
+++ b/spec/writers/citeproc_writer_spec.rb
@@ -264,5 +264,14 @@
{"literal"=>"The Genome Denmark Consortium"}])
expect(json["container-title"]).to eq("GigaScience")
end
+
+ it "interactive resource without dates" do
+ input = "https://doi.org/10.34747/g6yb-3412"
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
+ json = JSON.parse(subject.citeproc)
+ expect(json["type"]).to eq("article")
+ expect(json["DOI"]).to eq("10.34747/g6yb-3412")
+ expect(json["issued"]).to eq("date-parts"=>[[2019]])
+ end
end
end
diff --git a/spec/writers/jats_writer_spec.rb b/spec/writers/jats_writer_spec.rb
index e3ee6047..61bd696f 100644
--- a/spec/writers/jats_writer_spec.rb
+++ b/spec/writers/jats_writer_spec.rb
@@ -158,6 +158,20 @@
expect(jats.dig("day")).to eq("20")
expect(jats.dig("pub_id")).to eq("pub_id_type"=>"doi", "__content__"=>"10.5438/4k3m-nyvg")
end
+
+ it "interactive resource without dates" do
+ input = "https://doi.org/10.34747/g6yb-3412"
+ subject = Bolognese::Metadata.new(input: 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")
+ expect(jats.dig("publisher_name")).to eq("Gigantum, Inc.")
+ expect(jats.dig("person_group", "name")).to eq("given_names"=>"Dav", "surname"=>"Clark")
+ expect(jats.dig("year")).to eq("__content__"=>"2019", "iso_8601_date"=>"2019")
+ expect(jats.dig("month")).to be_nil
+ expect(jats.dig("day")).to be_nil
+ expect(jats.dig("pub_id")).to eq("pub_id_type"=>"doi", "__content__"=>"10.34747/g6yb-3412")
+ end
end
context "change metadata as datacite xml" do
diff --git a/spec/writers/schema_org_writer_spec.rb b/spec/writers/schema_org_writer_spec.rb
index 4e338e9b..5cb7b5f5 100644
--- a/spec/writers/schema_org_writer_spec.rb
+++ b/spec/writers/schema_org_writer_spec.rb
@@ -368,5 +368,14 @@
expect(json["funder"]).to eq("@id"=>"https://doi.org/10.13039/100000050", "@type"=>"Organization", "name"=>"National Heart, Lung, and Blood Institute (NHLBI)")
expect(json["provider"]).to eq("@type"=>"Organization", "name"=>"DataCite")
end
+
+ it "interactive resource without dates" do
+ input = "https://doi.org/10.34747/g6yb-3412"
+ subject = Bolognese::Metadata.new(input: 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")
+ expect(json["datePublished"]).to eq("2019")
+ end
end
end