I've got a neo4j cypher traversal problem.
setup: I have a query which starts at node "a" and gives me all the paths with the relation "FOO". All these "FOO" relations have a parameter "BAR". The parameter "BAR" can have 2 (or more) values "1" and "2". Now I want to exclude all paths containing one or more FOO.BAR="2" relation.
The query: START a=node(x) MATCH a-[rh:FOO*]->b RETURN rh; rh gives me all possible paths, but I don't know how to add criteria regarding a relationship.
I have a scenario created in the console (http://console.neo4j.org/?id=219eub)
create
(a {name:"A"}),
(b {name:"B"}),
(c {name:"C"}),
(d {name:"D"}),
b-[:FOO{BAR:'1'}]->a,
d-[:FOO{BAR:'1'}]->a,
c-[:FOO{BAR:'2'}]->b,
d-[:FOO{BAR:'1'}]->c
START n=node(4)
MATCH n-[rh:FOO*]-b
RETURN rh;
This gives me Query Results
+---------------------------------------------------------------------------+
| n.name | rh | b.name |
+---------------------------------------------------------------------------+
| "D" | [:FOO[2] {BAR:"1"}] | "A" |
| "D" | [:FOO[3] {BAR:"1"}] | "C" |
| "D" | [:FOO[3] {BAR:"1"},:FOO[1] {BAR:"2"}] | "B" |
| "D" | [:FOO[3] {BAR:"1"},:FOO[1] {BAR:"2"},:FOO[0] {BAR:"1"}] | "A" |
+---------------------------------------------------------------------------+
but I only want
+---------------------------------------------------------------------------+
| n.name | rh | b.name |
+---------------------------------------------------------------------------+
| "D" | [:FOO[2] {BAR:"1"}] | "A" |
| "D" | [:FOO[3] {BAR:"1"}] | "C" |
+---------------------------------------------------------------------------+