datacite / bolognese

Ruby gem and command-line utility for conversion of DOI metadata
MIT License
40 stars 14 forks source link

bolognese Metadata objects produce errors when generating geoLocationPolygon DataCite XML #165

Closed codycooperross closed 11 months ago

codycooperross commented 1 year ago

Describe the bug

bolognese Metadata objects generate invalid geoLocationPolygon DataCite XML.

Expected Behaviour

bolognese Metadata objects generated valid DataCite XML geoLocationPolygon metadata.

Current Behaviour

The datacite_xml attribute produces an erro, the valid? attribute is false, and the errors attribute contains errors.

Steps to Reproduce

Run debugger at this line: https://github.com/datacite/bolognese/blob/7b3e8cd408cd141903765fb4904d33c5bba5ac42/spec/readers/datacite_reader_spec.rb#L1372

subject.valid?
false
subject.errors
"3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}script': This element is not expected. Expected is one of ( {http://datacite.org/schema/kernel-4}identifier, {http://datacite.org/schema/kernel-4}creators, {http://datacite.org/schema/kernel-4}titles, {http://datacite.org/schema/kernel-4}publisher, {http://datacite.org/schema/kernel-4}publicationYear, {http://datacite.org/schema/kernel-4}resourceType, {http://datacite.org/schema/kernel-4}subjects, {http://datacite.org/schema/kernel-4}contributors, {http://datacite.org/schema/kernel-4}dates, {http://datacite.org/schema/kernel-4}language )."
subject.datacite_xml
*** TypeError Exception: no implicit conversion of String into Integer

nil

Context (Environment)

Screenshots

Further details

Proposal

Hypothesis

The geoLocationPolygon property seems to be handled inconsistently from the other attributes here: https://github.com/datacite/bolognese/blob/7b3e8cd408cd141903765fb4904d33c5bba5ac42/lib/bolognese/datacite_utils.rb#L377-L389 This seems to result in the no implicit conversion of String into Integer error.

Possible Implementation