curationexperts / mahonia

Oregon Health & Science Repository
Apache License 2.0
6 stars 0 forks source link

Support typed EDTF data for the `Etd#date` field #258

Closed no-reply closed 6 years ago

no-reply commented 6 years ago

An RDF::Literal subclass for EDTF datatypes is introduced. This supports the id.loc.gov namespaced datatype for EDTF and can accept any string value as its lexical value. We test that when a date is set to this type, it is correctly serialized in the object's .ttl view.

Handling is added to EtdIndexer#generate_solr_document to ensure edtf dates are indexed text values (they are also indexed as dates, but we do not consume them in catalog controller or elsewhere). The correct appearance of typed data in the show view is tested.

Dates input through the EtdForm are cast to the typed literal so they can be serialized to Fedora with the correct type. We assume any value put into the "EDTF Date" form field is intended to be interpreted as typed data.

Factories are updated to set an EDTF date on build.

Closes #186.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.06%) to 98.212% when pulling 31c021f886bfdacf6405d2cfc1dde88237001d66 on edtf into f4ef5e74bc6ffa6b69779c46409aedb3a7a86145 on master.