say i have this simplified schema in graphql:
type Folder {
id: ID!
title: String! @search(by: [exact])
createdby: User!
folders: [Folder] @hasInverse(field: parent)
files: [File] @hasInverse(field: parent)
parent: Folder
}
type File {
id: ID!
title: String! @search(by: [exact])
createdby: User!
parent: Folder
}
When I delete a folder I also want to delete all its children folders and files. I’m struggling to think of a recursive DQL query to solve this. I was thinking of an upsert with a recursive query to get all the UIDs of the child nodes and then somehow pass that to the delete mutation. for starters:
upsert {
query {
q(func: uid("0x2e357")) { // apply recursive query here to
loop through all children
Folder.folders {
uid
}
}
}
mutation {
delete {
// triples with queried uids
}
}
}
any help to go from there would be great. i guess if too complicated I can generated RDF quads from the client side and go from there.