Ref of a DB doing something similar to it:
Before starting see an example in the next comment block.
Example with Bulk Upsert
upsert {
query {
source as var(func: has(linkto)) {
v0 as uid
LK as linkto
}
LINK as var(func: eq(name, val(LK)))
}
mutation @exec(foreach(in: source)) {
set {
uid(v0) <friend> uid(LINK) .
uid(LINK) <friend> uid(v0) .
}
delete {
uid(v0) <linkto> * .
}
}
}
What is this query doing? simple. Instead of the user having to execute the same query several times. This query creates a series of parallel query blocks (Sets and deletes). Thus avoiding the user to have to use hacks in the body of the query.
If he does it openly (without control) he will have an unwanted result. Where you may end up adding values that were not anticipated in the query construction.
In the example I will write in the next comment I will demonstrate the problem that happens if you send an open Bulk Upsert.
This is a sample that I’ve created to help a user. But I found it too limited. Due to the need to run 6 times manually.