In my example i have the following association:
(a1:Author)-[co:COAUTHOR]->(a2:Author)
Which every COAUTHOR
relationship has a year
property.
I tried to compute the highest and lowest occurrence of co authorship relationship between authors, from distinct a1:Author
by year with Cypher using the WHERE
clause, with an array of years. When testing only one value in array of years, i get the right values, but with more years in array, the counting of minAmount
and maxAmount
are accumulating all years i put in array, then things become wrong.
The following code i tried:
MATCH (a1:Author)-[co:COAUTHOR]-(a2:Author) WHERE co.year IN [2018] // problem here if put more years
WITH a1,count (co) as amount
WITH MIN(amount) as minAmount, MAX(amount) as maxAmount
return minAmount,maxAmount
I tried to use FOREACH
, CASE
and others to loop over years in array of years and compute the highest and lowest ocurrence by year separated, but without success.