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

Feature/update #456

Merged
merged 13 commits into from
Apr 25, 2023
Merged

Feature/update #456

merged 13 commits into from
Apr 25, 2023

Conversation

zonotope
Copy link
Contributor

This patch adds a dedicated update query execution namespace with the previous functionality to process delete statements and the additional functionality to process multiple delete statements at once, and also to process one or more "insert" statements in parallel with delete statements which use the same where clause.

Closes https://github.com/fluree/core/issues/11

@zonotope zonotope added this to the 3.0.0-alpha2 milestone Apr 25, 2023
@zonotope zonotope requested a review from a team April 25, 2023 02:00
@zonotope zonotope self-assigned this Apr 25, 2023
Copy link
Contributor

@dpetran dpetran 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, here's my understanding of how this works (please feel free to correct any misunderstandings):

Now instead of a "delete" transaction we now have a "modify" transaction, which is defined as a map with a "where" clause and either a "delete" or "insert" select-like statement.

These work by initiating a search with the "where" clause, and then transforming that stream of flakes into some additional assert and retract flakes, according to the "insert" "delete" track.

And this builds on a prior design decision where we're explicitly using "delete" as a keyword instead of "retract" because that's what new users are going to search for when trying to figure out how to change the data.

@bplatz
Copy link
Contributor

bplatz commented Apr 25, 2023

we're explicitly using "delete" as a keyword instead of "retract" because that's what new users are going to search for when trying to figure out how to change the data

While true, the reason has more to retain compatibility with SPARQL update. We'd like to stay consistent wherever possible, and stray only if necessary.

@zonotope
Copy link
Contributor Author

Now instead of a "delete" transaction we now have a "modify" transaction, which is defined as a map with a "where" clause and either a "delete" or "insert" select-like statement.

I would rather call this an operation instead of transaction. This describes a way to generate a transaction, or at least the flakes that will go in a transaction, but there's more to it given the where clause. It's more like the combination of a query and transaction performed atomically.

These work by initiating a search with the "where" clause, and then transforming that stream of flakes into some additional assert and retract flakes, according to the "insert" "delete" track.

The where search returns a channel that contains solutions, not flakes. A solution is a map who's keys are variable symbols, and the values are matches, which themselves are maps which contain entries for the variable name, the matched value (usually found from a flake) and the data type. These solutions represent some set of flakes from the db that meet all the constraints in the where clause.

The update operations take the stream of solutions and build new flakes out of the matched variables found in each solution as well as the values found in the triples within the :insert and :delete clauses.

@zonotope zonotope merged commit 02e38ca into main Apr 25, 2023
@zonotope zonotope deleted the feature/update branch April 25, 2023 18:40
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.

3 participants