1
votes

I am pretty new to neo4j/cypher and i need your help with a query.

With this cypher statement: Match p=(a:Value_Node {katalog_name:"id"})-[r:RELATED_TO_*]->(b:Value_Node {katalog_name:"Gewicht"}) return p i get that picture below.

But i want to query only the path for one value that is also given in the properties (id_nr) of the relation RELATED_TO_. So i am looking for the path of one id from Start-node (a:Value_Node {katalog_name:"id"}) to End-Node (b:Value_Node {katalog_name:"Gewicht"}. With this query: Match p=(a:Value_Node {katalog_name:"id"})-[r:RELATED_TO_*]->(b:Value_Node {katalog_name:"Gewicht"}) WHERE (a.value = r.id_nr) return p i get the Errormessage:

Neo.ClientError.Statement.SyntaxError Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List (line 1, column 117 (offset: 116)) "Match p=(a:Value_Node {katalog_name:"id"})-[r:RELATED_TO_*]->(b:Value_Node {katalog_name:"Gewicht"}) WHERE (a.value=r.id_nr) return p" `

enter image description here

Any help is useful! Thanks a lot!

1

1 Answers

1
votes

When you look for all relationships of any length (r:RELATED_TO_*) the value of r is a list of all relationship from value_node named "id" to value_node name "Gewicht". Thus you should iterate on this list and check if the value of a.value is equal to ALL items in r.

Match p=(a:Value_Node {katalog_name:"id"})-[r:RELATED_TO_*]->(b:Value_Node {katalog_name:"Gewicht"}) 
WHERE ALL(rel in r WHERE rel.id_nr = a.value)
return p