Sure, you can use Upsert Mutation.
The logic is like this.
You have a block to search for the target and a block to mutate the logic. For example, you wanna link two persons. You gonna find then in the query block. And link them via variables in the mutation block. That’s the only way.