delete {
<0x1> * * .
}
Instructs Dgraph to delete every predicate it knows about node 0zx01.
The way it is done is to check ‘dgraph.type’ value for 0x01, which is ‘Person’. Then find the list of potential predicates using the type system.
It will find first_name, last_name, and has_spaceships and so will delete those predicates for this node.
As you saw it will not delete the predicate “is_owned_by” which is by the way on node 0x02.
GraphQL and DQL schemas - GraphQL dql provides info about the DQL Type system,
You can declare the reverse in Person using the angle bracket notation
type Person {
<~is_owned_by>
}
In fact in your schema you declared a predicate has_spaceships but you can use directly ~is_owned_by, which you do in the query has_spaceship: ~is_owned_by
Declaring <~is_owned_by> in the Person type will make expand(all) and delete work.