I am trying to get the top 10 values of a property P1 in node N1 for each property P2 in the same node N1. So far I have tried the following:
match (n:N1)
where n.P2 is not null
with
n.P2 as test, count(*) as times
with collect ({P2:test,times:times}) as rows, count(*) as times1
order by times1 desc
unwind [row in rows] as row
return row.P2 as test, row.times as times
order by times desc
limit 10
I'm not sure if this is giving me the right values.
Another thing I tried is as follows:
match (m:N1)
where m.P1 is not null
with m
match(n:N1{P1:m.P1})
where n.P2 is not null
return
m.P1 as test1, n.P2 as test2, count(*) as domainCount
order by domainCount desc
limit 10
I'm trying to run this on the Neo4j browser version 1.4.7. Properties P1 and P2 are both Strings. There can be duplicate values of property P2 for each property P1.
I'm not sure if I am on the right track to solving this. Any help is appreciated.