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

#248 Add initial support for 'optional' queries (single statement only) #252

Merged
merged 3 commits into from
Nov 10, 2022

Conversation

bplatz
Copy link
Contributor

@bplatz bplatz commented Nov 7, 2022

This adds back support for optional statements in queries.

See new optional query test namespace for examples.

Note that multi-statement optional queries are not yet supported (throws a 'not implemented yet' exception). See issue #251

In the prior version of Fluree, optional statements were always wrapped inside a vector, even if just one statement. In this version single optional statements can just be declared (but can still be wrapped inside of a vector if desired). So the following two statements are equivalent:

{:select ['?name '?favColor]
 :where  [['?s :rdf/type :ex/User]
          ['?s :schema/name '?name]
          {:optional ['?s :ex/favColor '?favColor]}]}
{:select ['?name '?favColor]
 :where  [['?s :rdf/type :ex/User]
          ['?s :schema/name '?name]
          {:optional [['?s :ex/favColor '?favColor]]}]}

@bplatz bplatz requested a review from a team November 7, 2022 19:32
Base automatically changed from feature/reverse-query to main November 7, 2022 20:54
Copy link
Contributor

@zonotope zonotope left a comment

Choose a reason for hiding this comment

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

📻

@bplatz bplatz merged commit 1cd5846 into main Nov 10, 2022
@bplatz bplatz deleted the feature/optional-query branch November 10, 2022 02:53
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.

None yet

2 participants