You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now of course parseDatetime isn't intended to return an interval, so it's not clear what the right way to proceed is.
I've presented a test case demonstrating the problem in Missing support for time intervals so that the isodate team can see there are other scenarios where users of the function are tripping up.
As we can see in the test case, the value is round-tripping just fine because the Literal holds the supplied value.
The use of this dateTime format might occur when using http://purl.org/dc/terms/valid for example, because there is no validFrom and validTo.
Unfortunately the current behaviour causes noise in the logs of code using rdflib . I can suppress that like this:
logging.getLogger("rdflib.term").addFilter(lambdarecord:notrecord.msg.startswith('Failed to convert Literal lexical form to value.'))
but I wasn't able to work out how to do this with warnings. I believe we'd need to change the logger.warning to something like:
warnings.warn(
f"Failed to convert Literal lexical form to value. Datatype={datatype}, Converter={conv_func}",
category=UserWarning
)
which would allow users of rdflib to do this (example in code, but it could be in config):
importwarningswarnings.filterwarnings("ignore", message="Failed to convert Literal lexical form to value.", category=UserWarning)
As you've discussed this before, I suspect you've settled on logging it as a warning. Perhaps this is because the wide variety of causes means it would be very messy to handle conv_func specific outcomes.
Feel free to close this issue if there's no way to resolve this.
The text was updated successfully, but these errors were encountered:
Very much along the same lines as #2210, the use of
isodate
causes problems when parsing date intervals such as:Now of course
parseDatetime
isn't intended to return an interval, so it's not clear what the right way to proceed is.I've presented a test case demonstrating the problem in Missing support for time intervals so that the
isodate
team can see there are other scenarios where users of the function are tripping up.As we can see in the test case, the value is round-tripping just fine because the
Literal
holds the supplied value.The use of this dateTime format might occur when using http://purl.org/dc/terms/valid for example, because there is no
validFrom
andvalidTo
.Unfortunately the current behaviour causes noise in the logs of code using
rdflib
. I can suppress that like this:but I wasn't able to work out how to do this with
warnings
. I believe we'd need to change thelogger.warning
to something like:which would allow users of
rdflib
to do this (example in code, but it could be in config):As you've discussed this before, I suspect you've settled on logging it as a warning. Perhaps this is because the wide variety of causes means it would be very messy to handle
conv_func
specific outcomes.Feel free to close this issue if there's no way to resolve this.
The text was updated successfully, but these errors were encountered: