What I want to do
Perform a recursive query with a second level structure
What I did
Here’s the query I have:
{
query(func: uid($a)) {
uid
created
leaf (first: 1) {
stem
}
tree {
uid
created
grape (first: 1) {
num
}
branches { # multiple
uid
created
leaf (first: 1) {
stem
}
tree {
uid
created
grape (first: 1) {
num
}
branches etc.
}
}
}
}
}
I want to replace “branches” with some form of a recursive query such that instead of referring to branches, I could instead point to a function. How would I go about doing that. I tried using the recurse keyword, but that doesn’t seem to like the multi-depth structure of this query. Also pagination asks for a sorting method, but given this sort of query, how would I paginate based on depth? The uid in the filter is what I call the “root node” where all nodes are linked to that specific node. Would I need to create a depth attribute?