Equality of Path objects cannot be checked · Issue #2281 · RDFLib/rdflib (original) (raw)

Hi!
Since RDFLib 6.2.0, it's no longer possible to check the equality of two Path objects with ==.

With RDFLib 6.1.1:

from rdflib import DCTERMS, DCAT DCTERMS.temporal / DCAT.endDate == DCTERMS.temporal / DCAT.endDate True

With RDFLib 6.2.0 and 6.3.0:

from rdflib import DCTERMS, DCAT DCTERMS.temporal / DCAT.endDate == DCTERMS.temporal / DCAT.endDate False

This is most likely due to PR #1528. The __eq__() method of the Path class was removed, while functools.total_ordering apparently requires it:

The class must define one of __lt__(), __le__(), __gt__(), or __ge__(). In addition, the class should supply an __eq__() method.

This also explains why membership tests currently don't work, as mentionned in the issue #2242.

Adding back the __eq__() method from RDFLib 6.1.1 should solve everything?