问一下,现在最新版(1.0.13)能支持带聚合的递归了么?

我们希望在DGraph中存一些树形结构的数据,希望获得某一节点的子节点数量。
当知道层级数量时可以通过这样的查询语句获得:

{
  dir(func: eq(uuid, "00000000-0000-0000-0000-000000000001")) @normalize {
    ~parent {
      childCount1 as count(~parent)
      childCountSum1 as sum(val(childCount2))
      tatolCount1 as math(childCount1+childCountSum1)
      ~parent {
        childCount2 as count(~parent)
      }
    }
    total : sum(val(tatolCount1))
  }
}

类似于[Recursive query with aggregation]中提到的。

目前的最新版在面对这种需求的时候,还是只能确定一个最大的层级,然后按照上面的语句规则,构建一条很长的查询语句来查询,还是说已经存在一个更简单的带聚合的递归查询 ?

类似于Neo4j的:

MATCH (a:data)-[*]->(c:data{id: "00000000-0000-0000-0000-000000000001"})
RETURN count(a) AS num

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.