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

Do PUT requests with the exact modified date (precise to a thousandth of a second) #497

Closed
jcoyne opened this issue Oct 22, 2014 · 4 comments
Milestone

Comments

@jcoyne
Copy link
Member

jcoyne commented Oct 22, 2014

On edge fcrepo4, we get a 409 Conflict error when we attempt to do an update:

Could not remove triple containing predicate http://fedora.info/definitions/v4/repository#lastModified to node /test/9f/30/63/86/9f306386-f98f-4fc0-af2f-8a85cb2257ad

I believe this is because we are sending a lastModifed value with whole second precision, but Fedora has the value precise to a thousandth of a second. We are currently getting this value from the header, but we might need to get it from the graph in order to get the correct precision.

@jcoyne jcoyne added this to the Fedora 4 milestone Oct 22, 2014
@cbeer
Copy link
Member

cbeer commented Oct 22, 2014

s/precise to a thousandth of a second/what Fedora gave you in the graph/. Precision isn't really the issue.

@jcoyne
Copy link
Member Author

jcoyne commented Oct 22, 2014

This will be a challenge. Ruby can dump a date time to any level of precision you want, but you have to specify what that level will be. It looks like RDF.rb is just using DateTime#xmlschema(0) (the default). We'd have to use DateTime#xmlschema(3) in order to get it to match Fedora 4, and as @cbeer says, we shouldn't do to the thousandth, but to whatever precision was given as the input. cc: @gkellogg @no-reply

g = RDF::Graph.new
=> #<RDF::Graph:0x3fefd5e9e2d8(default)>
g.insert([RDF::URI.new('http://example.com/foo'), RDF::DC.available, DateTime.parse("2014-10-22T22:58:00.804Z")])
=> #<RDF::Graph:0x3fefd5e9e2d8(default)>
puts g.dump(:ttl)

<http://example.com/foo> <http://purl.org/dc/terms/available> "2014-10-22T22:58:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
=> nil

@gkellogg
Copy link

RDF::Literal::DateTime actually uses #strftime with a FORMAT constant; you could monkey-patch that. Note that it only formats the literal if it is provided as a native datatype, or it is canonicalized.

FORMAT   = '%Y-%m-%dT%H:%M:%SZ'.freeze

@jcoyne
Copy link
Member Author

jcoyne commented Oct 27, 2014

I monkey patched RDF::Literal::DateTime in f261ba5

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

No branches or pull requests

3 participants