Reputation: 125
On each relationship, I have a propriety SAB which has 10 different values. I would like to count on distinct SAB propriety the number of distinct relationships and display it as a list.
MATCH (n)-[r]->(m) WITH n,m,collect(r)[1..] AS rels, r.SAB AS SAB FOREACH(distinct SAB IN rels | count(r)) return count(r), rels;
I tried to create a query which will do this for me, but i dont have enugh knowledge.
I would like to have a list showing
type1(SAB) COUNT(HAS_CHILD) 1000
type1(SAB) COUNT(HAS_DESCENDANT) 2000
type2(SAB) COUNT(HAS_CHILD) 2198
type2(SAB) COUNT(HAS_DESCENDANT) 81924
....
UNTIL TYPE 10 SAB
Upvotes: 0
Views: 41
Reputation: 15490
if i am right, you want query something like this
MATCH (n)-[r]->(m)
RETURN DISTINCT r.SAB, TYPE(r), COUNT(r)
RESULT
r.SAB TYPE(r) COUNT(r)
sab01 HAS_CHILD 1
sab02 HAS_DESCENDANT 2
sab02 HAS_CHILD 1
Upvotes: 2