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

Fix for issue #837. Graph.[subjects|objects|predicates] optionally return uniques. #1520

Merged
merged 8 commits into from Dec 29, 2021
Merged

Conversation

ghost
Copy link

@ghost ghost commented Dec 20, 2021

Recovered from expired-and-closed PR #1068 and buffed up.

Fixes #837

Proposed Changes

  • Add unique parameter (boolean) to specify unique results returned for: Graph().subjects(), Graph().predicates() and Graph().objects(), transcribing the implementation from Fixes #837 #1068
  • Extended unique parameter and implementation to Graph().subject_predicates(), Graph().subject_objects() and Graph().predicate_objects()
  • Added (tentative) typing to the above
  • Added functional tests of above six methods mapped over Graph, ConjunctiveGraph and Dataset classes.

Graham Higgins added 2 commits December 20, 2021 14:13
…turn uniques.

Added `unique` parameter (boolean), extended to include subject_predicate, subject_object and predicate_object results - tentative typing added - and with tests of Graph, ConjunctiveGraph and Dataset.
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
test/test_issue837.py Outdated Show resolved Hide resolved
test/test_issue837.py Outdated Show resolved Hide resolved
Copy link
Member

@nicholascar nicholascar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the comments have been addressed so approving but throwing back to @aucampia for a final check

rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
rdflib/graph.py Outdated Show resolved Hide resolved
Copy link
Member

@aucampia aucampia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@nicholascar nicholascar merged commit 4a2a0eb into RDFLib:master Dec 29, 2021
@ghost ghost deleted the fix-for-issue837 branch December 29, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graph.subjects and Graph.predicates should return only unique values
2 participants