Where clause in relations does not return any value

create (P1:person {ID: '1', Name: 'Number One', Owner: 'One', Owner_id: 'O1'})
create (P2:person {ID: '2', Name: 'Number Two', Owner: 'Two', Owner_id: 'O2'})
create (P3:person {ID: '3', Name: 'Number Three', Owner: 'Two', Owner_id: 'O2'})
create (P4:person {ID: '4', Name: 'Number Four', Owner: 'Four', Owner_id: 'O4'})
create (P5:person {ID: '5', Name: 'Number Five', Owner: 'Five', Owner_id: 'O5'})
create (P6:person {ID: '6', Name: 'Number Six', Owner: 'Six', Owner_id: 'O6'})
create (P7:person {ID: '7', Name: 'Number Seven', Owner: 'Seven', Owner_id: 'O7'})
create (P1) - [:REL_TO {how_rel:['Son / Daughter']}]->(P2),
(P1) - [:REL_TO {how_rel:['Son / Daughter']}]->(P3),
(P2) - [:REL_TO {how_rel:['Fil / Mil']}]->(P6),
(P2) - [:REL_TO {how_rel:['Fil / Mil']}]->(P5),
(P3) - [:REL_TO {how_rel:['GS / GD']}]->(P4),
(P5) - [:REL_TO {how_rel:['GGS / GGD']}]->(P7)

For the above data the following returns values

MATCH (n:person {ID:'1'})-[r:REL_TO]->(per)
RETURN n, r, per

When a where clause is added there is no result

MATCH (n:person {ID:'1'})-[r:REL_TO]->(per)
WHERE r.how_rel = 'Son / Daughter'
RETURN n, r, per

Goodevening,
The value in the relations 'how_rel' seems to be a list type [ ].
I think that you try to compare different data types in your where statement (string vs lists).

If the relation atribute should only be a string, i think then you could remove the [ ].

Yours Kindle Omer

1 Like
Try this:

WHERE  'Son / Daughter'  IN  r.how_rel