-
Notifications
You must be signed in to change notification settings - Fork 0
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 multiple optionals #248
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some `select` tests are broken due to changes in this commit.
RickMoynihan
commented
Apr 14, 2023
Breaking change, `select` results should be more in line with SPARQL query results.
RickMoynihan
commented
Apr 24, 2023
Thanks a million for this @rosado it's great work! 🙇 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TPX: matcha: fix multiple optionals
Issue: #21
In short: handling of
optional
clauses in matcha queries was returning incorrect results (depending on order). Root cause of that was the use ofcore.logic/conda
wherecore.logic/conde
should be used. But that change necessitates extra processing of the the raw core logic results (for bothselect
andbuild
macros).Summary of changes
build
We infer which projected vars in the constructed map are optional. Knowing that, and having a solution we either set the (top level!) keys to the value from the solution (a set, if multiple values were returned by
core.logic
) or remove those keys.We also rewrite the query by extracting the
optional
s and appending them at the end of a query.While this should make no difference to
core.logic
it could make a difference in a SPARQL query, so one needs to be aware that those two are not the same.select
conda -> conde
change, we get different results.For example, a SPARQL query returns:
The changes to
select
macro are cleaning up the unbound variables.