For example, A and B are nodes with a uid. How do I find all the predicates (forward and reverse) between only these two nodes?
I could not think of anything practical for that. Maybe someone has a better idea.
You can use _reverse_
and _forward_
in the expand ()
function, but they have no filter option. So the best way to do this is to manually enter all known Edges and add filters manually. Just as it is below.
{
A as var(func: has(something_A))
B as var(func: has(something_B))
AtoB(func: uid(A)) @recurse(depth: 5, loop: false) {
edge1 @filter( uid(B) )
edge2 @filter( uid(B) )
edge3 @filter( uid(B) )
edge4 @filter( uid(B) )
~edge1 @filter( uid(B) )
~edge2 @filter( uid(B) )
~edge3 @filter( uid(B) )
~edge4 @filter( uid(B) )
}
BtoA(func: uid(B)) @recurse(depth: 5, loop: false) {
edge1 @filter( uid(A) )
edge2 @filter( uid(A) )
edge3 @filter( uid(A) )
edge4 @filter( uid(A) )
~edge1 @filter( uid(A) )
~edge2 @filter( uid(A) )
~edge3 @filter( uid(A) )
~edge4 @filter( uid(A) )
}
}