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?
I didn’t really mean “out of order” in terms of sorting with a created field. I meant that there are missing nodes and sometimes the returned branch and tree edges (in rq) are not real edges.
If there are missing nodes, add more edges in order to the recurse expand them. I havent added cuz I dont know your context. But with this example you can go from there.