I have 3 kinds of nodes: miid node, dev node and login node.
2 kinds of edges: miid <miid.login> login; dev <dev.login> login. BOTH have reverse edges.
in fact it is in essence simply miid dev. Making login as nodes facilitates indexing on the login properties.
Now starting with a set of miids, I want to find the subset of miids which have a common logged-in device with at least one other miid on the starting set, along with the devices that connects them.
{
startingset as var(func: has(miid.ovd_level.3))quer(func: uid(startingset))
@ignorereflex
@cascade
{
miid.login{
~dev.login @filter(lt(count(dev.login), 100) ){
dev.login{
~miid.login @filter(uid(startingset)){
destmiids as miid: miid.miid
ovdmd: miid.ovd_max_days
}
}
}
}
}ctt(func: uid(destmiids)){
count(uid)
}
}
The return graph of this query well fits my need, but I can’t understand the result of the count(uid) in ctt, which is much bigger than the number of returned nodes yet a bit smaller than the total number of miids in the starting set.
example mutation:
_:miid1 <miid.login> _:login1A .
_:devA <dev.login> _:login1A .
_:miid1 <miid.miid> “11111” .
_:devA <dev.id> “aaaaa” .
_:miid2 <miid.miid> “22222” .
_:devA <dev.login> _:login2A .
_:miid2 <miid.login> _:login2A .
_:miid3 <miid.miid> “33333” .
_:devB <dev.login> _:login3B .
_:miid3 <miid.login> _:login3B .
_:devB <dev.id> “bbbbb” .
_:miid4 <miid.miid> “44444” .
in this case I want to only return miid1, miid2, devA, login1A, login2A, and I want destmiids
to be assigned only miid1, miid2