I have 4 Types of nodes :
A it the start point
B
C
D final destination points
I want to display some node D. with these steps :
1 - When we go with node A to node B I want to explore node B when r.val < 5 for example
So in this example I want to explore B2
2- Then I want to explore all Nodes B attached to B when its attached to the same Node C (for example when C nom:Travail), in my example its B1 and B4
3- In the last I want to suggest Nodes D ORDER BY r.s (score between B nodes) (in my example the relationship between B2 - B1 and B2 - B4)
So I want the result are id of D6 and D7 ( ana and moa)
I take this code :
MATCH (a:A1{name: "bale"})-[r1]->(b:B)
MATCH (b)-[r2]-(b2:B)
WHERE r1.val < 3
WITH DISTINCT b.name AS skill_k_1 , a AS a, r1 AS r1, b AS b, r2 AS r2,b2 AS b2
MATCH (b:B{name:skill_k_1})-[r3]-(cat:C)
WITH DISTINCT cat.nom AS cat_k_1, a AS a, r1 AS r1, b AS b, r2 AS r2 ,b2 AS b2, r3 AS r3, cat AS cat
MATCH (b2)-[r]-(b3:B)-[r4]-(cat2:C{nom:cat_k_1})
MATCH (b3)-[r5]-(d:D)
RETURN d.id ORDER BY r.s
My code display doesn't select just the node who attached to C where C.nom == Travail but he select all nodes and it juggest ALL nodes D not just D6 and D7
If i understood correctly, i think this query should work:
It's not clear to me what is
:SKILL
label, (maybe all :B nodes have the SKILL label as well?) but I guess your query doesn’t work because theMATCH (b2)-[r]-(b3:SKILL)
part get ALL b3 nodes with a labelSKILL
related to b2, without any match-filter.