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

Equality of Path objects cannot be checked #2281

Closed
alhyss opened this issue Mar 17, 2023 · 3 comments · Fixed by #2292
Closed

Equality of Path objects cannot be checked #2281

alhyss opened this issue Mar 17, 2023 · 3 comments · Fixed by #2292
Assignees
Labels
bug Something isn't working core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` regression Something stopped working

Comments

@alhyss
Copy link

alhyss commented Mar 17, 2023

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?

@aucampia aucampia added regression Something stopped working bug Something isn't working core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` labels Mar 19, 2023
@aucampia
Copy link
Member

Thanks for reporting this @alhyss - I will have a look at this when I have time.

@aucampia
Copy link
Member

I will try to release 6.3.2 with this fixed by 2023-03-27.

aucampia added a commit to aucampia/rdflib that referenced this issue Mar 19, 2023
These methods were removed when `@total_ordering` was added, but
`@total_ordering` does not add them, so removing them essentially
removes functionality.

This change adds the methods back and adds tests to ensure they work
correctly.

I also moved all path related tests into one file.

- Closes <RDFLib#2281>.
- Closes <RDFLib#2242>.
aucampia added a commit to aucampia/rdflib that referenced this issue Mar 19, 2023
These methods were removed when `@total_ordering` was added, but
`@total_ordering` does not add them, so removing them essentially
removes functionality.

This change adds the methods back and adds tests to ensure they work
correctly.

All path related tests are also moved into one file.

- Closes <RDFLib#2281>.
- Closes <RDFLib#2242>.
@aucampia aucampia self-assigned this Mar 19, 2023
aucampia added a commit to aucampia/rdflib that referenced this issue Mar 19, 2023
These methods were removed when `@total_ordering` was added, but
`@total_ordering` does not add them, so removing them essentially
removes functionality.

This change adds the methods back and adds tests to ensure they work
correctly.

All path related tests are also moved into one file.

- Closes <RDFLib#2281>.
- Closes <RDFLib#2242>.
@alhyss
Copy link
Author

alhyss commented Mar 20, 2023

I will try to release 6.3.2 with this fixed by 2023-03-27.

Thanks! That would be really helpful.

aucampia added a commit that referenced this issue Mar 21, 2023
These methods were removed when `@total_ordering` was added, but
`@total_ordering` does not add them, so removing them essentially
removes functionality.

This change adds the methods back and adds tests to ensure they work
correctly.

All path related tests are also moved into one file.

- Closes <#2281>.
- Closes <#2242>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Relates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}` regression Something stopped working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants