-
Notifications
You must be signed in to change notification settings - Fork 555
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
Issues with negative dates #2829
Comments
Oh dear, that's a good find and I've got no solution for you, sorry. Someone will have to look in to the Python date parser. So it's either a limitation in Python general date parsing (unlikely) or an issue with the way RDFLib is using the Python date parsing (more likely). But I don't know that part of the library, sorry. |
@nicholascar thanks for the response! if anything is a nightmare in any programming language/package it's date/time, looks like we might need someone familiar with the deep magics for this one! |
I just tried to reproduce the error but can't: from rdflib import Graph, Literal, URIRef
from rdflib.namespace import XSD, PROV
d_neg = Literal("-0028-08-10T00:00:00Z", datatype=XSD.dateTimeStamp)
g = Graph()
g.add((
URIRef("http://example.com"),
PROV.startedAtTime,
d_neg
))
print(d_neg.toPython())
print(d_neg.n3())
print(g.serialize(format="longturtle"))
print(g.serialize(format="json-ld")) This correctly prints out:
Can you supply code that triggers the error so I can take a look at it in more depth? |
Sorry for taking so long! Here's an example portion of the TTL that was causing the issue (sorry Wikibase Turtle is... a bit nested):
The time value causing the issue is The code itself is a bit long (it's been a while since I've tested this case so I need to dig through it), but it essentially deconstructed the file into triples and loaded them into the graph. I'll do more checking on this this week and get back to you as soon as I can! |
Sorry to jump in or state something obvious but I happened to be looking into this a bit. In case it helps:
Negative years (BCE dates) are not supported in either the Python standard library's |
I'm currently trying to parse an RDF file in TTL exported from a Wikibase using its dumpRdf.php feature.
The Wikibase includes some ISO-8601 dates that are BCE, such as
"-0028-08-10T00:00:00Z"^^xsd:dateTime"
. When processing these, RDFLib spits out the following error:Is there any recommended way to deal with this? Thanks so much!
The text was updated successfully, but these errors were encountered: