I think you are overthinking it.
This should work
{
v0 as var(func: eq(node_key, evil_0)) @cascade {
c0 as children @filter(eq(node_key, "evil_1")) {
process_name
}
c1 as children2 : children @filter(eq(node_key, "evil_3")) {
process_name
}
}
q(func: uid(v0)){
uid
children @filter(uid(c0, c1)){ # This is a bit unnecessary, but if you need, keep it
uid
process_name
}
}
}
Explaining the query:
Basically, the block var is checking on the same edge for the two values in an “AND” concept (cascade do the trick). If there are no two children with the given values. It would return empty. But if the values match, the second block returns the parent node.
BTW, if you provide samples with the same structure you have, that would help a lot to help you. Not everyone would pick your issue and work on it fast due to the lack of real context (dataset). If you provide it, fast answers you would get.
Also, avoid using commas (can be problematic to the parse, it is supported but it can increase processing) and too much cascade, unless you know what is happening. Also, in Var blocks, you don’t need obvious values like “dgraph.type” and “uid”, only when you need to “printout” on the response. Unless you wanna check (I mean, make sure) the absence of it using cascade.
Also, you have two blocks doing the same query. I consider it a good practice to use the first block as a reference. e.g.:
v0 as var(func: eq(node_key, evil_0)) @cascade {
c0 as children @filter(eq(node_key, "evil_1")) {
process_name
}
}
var(func: uid(v0) @cascade {
c1 as children @filter(eq(node_key, "evil_3")) {
process_name
}
}
This practice avoids other problems.
The sample I did:
{
"set": {
"dgraph.type": "Parent",
"name": "A",
"node_key": "evil_0",
"children": [
{
"node_key": "evil_1",
"dgraph.type": "Child",
"process_name": "B"
},
{
"node_key": "evil_3",
"dgraph.type": "Child",
"process_name": "C"
}
]
}
}
If you have more questions I’m around.
Cheers.
PS. Please, avoid using wrong tags. You have used GraphQL tag on a GraphQL+- question. This also confuses others.