I have a neo4j db which have this form
(:FBuser)-[:Published]->(:Post)<-[:Tagged_in]-(:Friend)<-[:Tagged_together]->(:Friend)
A Post (:Node)
could have two or more Node (:Friend)
connected with it.
I want to write a query that returns this schema
(:FBuser)-[:Friend]->(n:Friend)-[:Tagged_in]->(:Post)<-[:Tagged_in]-(m:Friend)<-[:Tagged_together]->(n)
where for (:Post)
I need all the post for that specific (n:Friend)
. The problem is that not all the (:Post)
has connected with another (m:Friend)
so, only for some nodes I have (n:Friend)<-[:Tagged_together]->(m:Friend)
I write this code but obviously returns just all the nodes (:Post)
for a specific node (:Friend)
and supplementary (:Friend)
connected with it
MATCH t=(:fbUser)-[:FRIEND]-(w)-[:TAGGED_IN]-(p)
MATCH s=(:Friend)-[:TAGGED_IN]-(q)
WHERE
w.name=~ '(?i).*edoardo.*' AND
q.timestamp=p.timestamp AND
w.nodeDegree>=0
RETURN t,s
How can I solve the problem ?