Reputation: 103
I have a Neo4j Graph database which stores Twitter data.
Each Tweet
is about a Topic
and has got this kind of relationship:
(t:Tweet)-[:ABOUT]->(t1:Topic)
A User
can be mentioned by a Tweet
due to this relationship
(t:Tweet)-[:MENTIONS]->(u:User)
I'd like to know how many users are mentioned in tweets regarding a specific topic.
My query is:
match (n:Topic)<--()-[r:MENTIONS]->(u:User)
where n.name='politics'
return count(r)
Is this query right? Because I've got unexpected results.
Thanks a lot.
Upvotes: 2
Views: 560
Reputation: 6514
You can try using the following query.
match (n:Topic{name:'politics'})
RETURN size((n)<--()-[:MENTIONS]->(:User)) as count
Upvotes: 3