Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rdf 3.2.5 causes superclass mismatch for class DateTime #1466

Closed
cziaarm opened this issue Feb 23, 2022 · 3 comments · Fixed by #1468 or #1472
Closed

rdf 3.2.5 causes superclass mismatch for class DateTime #1466

cziaarm opened this issue Feb 23, 2022 · 3 comments · Fixed by #1468 or #1472

Comments

@cziaarm
Copy link

cziaarm commented Feb 23, 2022

.../active-fedora-13.2.5/lib/active_fedora.rb:16:in '<class:Literal>': superclass mismatch for class DateTime (TypeError)

rdf 3.2.4, no problem

@cjcolvar
Copy link
Member

This is due to a change in the namespacing of the DateTime class in rdf (see https://github.com/ruby-rdf/rdf/releases/tag/3.2.5) which ActiveFedora was monkey-patching (see

# Monkey patching RDF::Literal::DateTime to support fractional seconds.
# See https://github.com/samvera/active_fedora/issues/497
# Also monkey patches in a fix for timezones to be stored properly.
module RDF
class Literal
class DateTime < Literal
ALTERNATIVE_FORMAT = '%Y-%m-%dT%H:%M:%S'.freeze
DOT = '.'.freeze
EMPTY = ''.freeze
TIMEZONE_FORMAT = '%:z'.freeze
def to_s
@string ||= begin
# Show nanoseconds but remove trailing zeros
nano = @object.strftime('%N').sub(/0+\Z/, EMPTY)
nano = DOT + nano unless nano.blank?
@object.strftime(ALTERNATIVE_FORMAT) + nano + @object.strftime(TIMEZONE_FORMAT)
end
end
end
end
end
)

We should investigate if the monkey patch is still needed in rdf 3.2.5. We'll also need to change this monkey-patch to detect and apply itself to the properly namespaced class.

@cziaarm
Copy link
Author

cziaarm commented Feb 23, 2022

Thanks Chris, we'll hold with rdf 3.2.4 until then.

@cjcolvar
Copy link
Member

cjcolvar commented Mar 2, 2022

ActiveFedora 13.2.6 was released with a fix for this issue but it introduced 3 failing tests in Hyrax around date precision beyond milliseconds. This version of the gem was yanked until we have a better fix which should hopefully be soon. For now pinning rdf to < 3.2.5 might be your best bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants