I am wondering is there any good way to count all edges.
schema is simple:
node1: string @index(exact) .
node2: string @index(exact) .
node3: string @index(exact) .
rela1: [uid] @count .
rela2: [uid] @count .
rela3: [uid] @count .
Data:
# nodes
_:x1 <node1> "a1" .
_:x1 <node2> "b1" .
_:x1 <node3> "c1" .
_:x2 <node1> "a2" .
_:x2 <node2> "b2" .
_:x2 <node3> "c2" .
_:x3 <node1> "a3" .
_:x3 <node2> "b3" .
_:x3 <node3> "c3" .
...
# edges
_:x1 <rela1> _:x2 .
_:x1 <rela2> _:x2 .
_:x1 <rela3> _:x2 .
_:x2 <rela1> _:x1 .
_:x2 <rela2> _:x1 .
_:x2 <rela3> _:x1 .
_:x3 <rela1> _:x1 .
_:x3 <rela2> _:x1 .
...
I want to count all edges (including rela1, rela2, rela3)
Below codes do work, but just for single edge, how can I calculate all edges, by using type function (avoiding “has” to save time)
{
var(func: has(rela1)) {
c as count(rela1)
}
Cul() {
total: sum(val(c))
}
}