First thing, never add the Type or any other attribute that you don’t have to delete. Adding the “dgraph.type” into the delete operation, it will delete the type.
In delete operations you insert only the UID and what you need to delete or patterns of deletion.
This operation will delete dgraph.type and the relation between 0x4e4d and 0x4e4f via pet_isAnimal.
{
"delete": {
"dgraph.type": "Pet",
"uid": "0x4e4d",
"pet_isAnimal": {
"uid": "0x4e4f"
}
}
}
This operation will delete only the dgraph.type
{
"delete": {
"dgraph.type": "Pet",
"uid": "0x4e4d"
}
}
This operation will delete dgraph.type and all relations via pet_isAnimal.
{
"delete": {
"dgraph.type": "Pet",
"uid": "0x4e4d",
"pet_isAnimal": null
}
}
And the last one is a mix of all the others.
This operation below will first delete the relation, and then the pet itself.
{
"delete": [
{
"uid": "0x4e4c",
"person_hasPet": {
"uid": "0x4e4d"
}
},
{
"uid": "0x4e4d"
}
]
}
Ok, this would be a kind of “ontology”. Nice.
Well, that’s it.
Cheers.