Deleting all incoming edges to a node

I am trying to delete all edges pointing to a particular node. My understanding of how to do this is to check for every uid, for every edge type, whether an edge exists to the uid of the node under consideration.

Then, run something like:

mutation {
  delete {
    <uid> <edge_type> <uid of concerned node> .
  }
}

Is there an easier way to do this?

1 Like

That’s the easiest way. (And you need to have a well-defined Type Schema)

upsert {
  query {
    v as var(func: eq(name, "some")){ 
    #First you need to capture the edges
      SE1 as ~someEdge1 
      SE2 as ~someEdge2
      SE3 as ~someEdge3
      SE4 as ~someEdge4
    }
  }

  mutation {
    delete {
       uid(SE1) <someEdge1> uid(v) .
       uid(SE1) <someEdge2> uid(v) .
       uid(SE1) <someEdge3> uid(v) .
       uid(SE1) <someEdge4> uid(v) .
       uid(v) * * .
    }
  }
}