Skip to content
gromgull edited this page Mar 8, 2013 · 9 revisions

Between version 3.4.0 and 4.0, a backwards incompatible change was made in RDFLib to how datatyped literals are handled.

Hopefully, the changes will not affect very many users of RDFLib, but this page outlines what was changed and collects any changes required in code using RDFLib.

Why were backwards incomaptible changes introduced?

The by far biggest problem was that in the pre 4.0 handling of Datatyped Literals, __hash__ and __eq___ were not consistent, i.e.

What is new?

What do I have to watch out for?

Literals no longer compare equal across data-types with ==

i.e.

>>> Literal(2, datatype=XSD.int) == Literal(2, datatype=XSD.float)
False

But a new method eq on all Nodes has been introduced, which does semantic equality checking, i.e.:

>>> Literal(2, datatype=XSD.int).eq(Literal(2, datatype=XSD.float))
True