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

support selectDistinct queries #237

Closed
dpetran opened this issue Nov 3, 2022 · 0 comments · Fixed by #383
Closed

support selectDistinct queries #237

dpetran opened this issue Nov 3, 2022 · 0 comments · Fixed by #383
Assignees
Milestone

Comments

@dpetran
Copy link
Contributor

dpetran commented Nov 3, 2022

Description

When selectDistinct is used in lieu of the select keyword in a query, e.g.

@(fluree/query db1 {:selectDistinct {'?s [:*]} :where [['?s '?p '?o]]})

;; instead of

@(fluree/query db1 {:select {'?s [:*]} :where [['?s '?p '?o]]})

the results of selectDistinct should be unique/distinct. Consider a property, :ex/favNums, that is multi-cardinality. In the following :where clause, we are looking for every subject with a predicate-object pair on :ex/favNums

    {:select '?s
     :where  [['?s :ex/favNums '?o]]}

If one subject has two triples for this property (i.e. two different favNums), then the :select '?s portion of the query would return duplicates of the same subject, because two identical values were bound to '?s given the conditions of the :where clause. In this case, :selectDistinct should return only one instance of each identical result.

Acceptance Criteria

  • :selectDistinct is a valid keyword in queries and causes returned results to be unique/distinct from one another

Implementation Details

@dpetran dpetran added this to the 3.0.0-alpha2 milestone Nov 3, 2022
@zonotope zonotope self-assigned this Feb 14, 2023
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 a pull request may close this issue.

2 participants