Is there some order in a recursive query that one can rely on?
For example, assuming a virtual filesystem, I want to traverse from an arbitrary child to the root node.
Naively, I would use a query like that, assuming that the parent knows its children and the children know their parent:
{
foo(func:uid(0x1)) @recurse {
RES as uid
~children {
uid
}
}
}
Will the result be in any order?
Moreover, what if I want to retrieve associated Nodes for each Node?
For Example:
{
var(func:uid(0x1)) @recurse {
RES as uid
~children {
uid
}
}
foo(func:uid(RES)) {
metadata {
name
}
}
}
Metadata might be several nodes, or none. Also, there are more metadata information than just name
I think, I can not include this in the top-level query, because of the @recurse
keyword.
What I want in the end, is kind of retrieving a list of uid
that have some order, except sorted by uid
, and then mapping each uid to multiple uids, in Haskell terms:
[a] -> (a -> [b]) -> [[b]]
or
[a] -> (a -> [b]) -> [b]
.