I attempted to do this in batches using a single query like:
query {
q(func: has(On), offset:0, first:500) @cascade {
sourceID as uid
<On> {
targetID as uid
}
}
}
And a mutation:
uid(sourceID) <On> uid(targetID) (new_field="foo") .
Assuming this would just add a new facet to existing edges. But in addition to this it appears to be adding edges between all the sourceID’s and targetID’s returned (losing the association between each sourceID and their specific connected targetID’s). Anyone see a way to accomplish this with a single query\mutation?
Note I did implemented an alternative in which I run the query by itself and then iterate over the results and send in a mutation for each edge, but that’s a multi pass solution with a lot of data being returned by the query. I am wondering how to accomplish this in a single pass if possible.