cancel
Showing results for 
Search instead for 
Did you mean: 

Giving conditions to Nodes

vence_andersen1
Graph Buddy

When i query " match (n:label{Name_1:'A'})
match (n)--(p)--(q)--(r)
return n,p,q,r"

But B receives connection from other nodes aswell, like

Here I want B to be given only when I query every node connected to B with a query like

" match (n:label{Name_1:'A '}),(m:label{Name_1:'F'}),(o:label{Name_1:'E'})
match (n)--(p)--(q)--(r)
return n,m,o,p,q,r"

Can we attain it?

2 REPLIES 2

ronny_de_winter
Node Link

Is it something like this what you are looking for:

match (n:Label)--(m:Label{name:'B'})--(o:Label{name:'C'})--(p:Label{name:'D'})
where n.name in ['A', 'E', 'F']
return n,m,o,p

Benoit_d
Graph Buddy

in order to assign a variable name to the expected node, you may "reuse" the p-node 'B' in a template extension

MATCH (n:Label{name:'A'})--(p:Label{name:'B'})--(q:Label{name:'C'})--(r:Label{name:'D'}), 
(o:Label{name:'E'})--(p)--(m:Label{name:'F'})
RETURN m,n,o,p,q,r

but same result as @ronny.de.winter

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.