cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Chain of Nodes query

OmarHamdy
Node Clone

I want to write a query to get my chain of nodes 

Loop HAS_TAG Tag 

Tag HAS_ALARM Alarm

Tag HAS_CABLE Cable 

I want the 4 nodes in the same query 

OmarHamdy_0-1664121054285.png

 

1 REPLY 1

You can try something like this.  The outputs are examples; change to meet your requirements.

match(l:Loop{id:0})
optional match (l)-[:HAS_TAG]->(t:Tag)
with l, t
optional match(t)-[:HAS_ALARM]->(a:Alarm)
with l, t, a
optional match(t)-[:HAS_CABLE]->(c:Cable)
return l.Loopname, labels(t) as tag_type, properties(a) as alarm, properties(c) as cable