如何仅在两个定义的顶点之间的某些边上应用AllShortestPaths()?
以下是查询:
MATCH
(from: SHIPPING_NODE {...}),
(to: SHIPPING_NODE {...}),
paths = allShortestPaths((from)-[connection:CONNECT*]->(to))
WITH
....
RETURN delay_min, delay_max, price, route
当我向查询添加WHERE connection.field_value > 10
时,我得到以下内容:
Type mismatch: expected Map, Node or Relationship but was Collection<Relationship> (line 5, column 7 (offset: 267))
"WHERE connection.field_value > 10"
connection has some fields that I need to select specifically
注意:我可以通过从allShortestPaths((from)-[connection:CONNECT*]->(to))
删除星号(*)来清除错误,但不再返回任何内容
答案 0 :(得分:1)
如果路径包含多个关系,您将获得一系列关系。
您可以指定所有连接关系的字段值应大于10:
WHERE ALL(x IN rels(paths) WHERE x.field_value > 10)
参考:http://neo4j.com/docs/stable/query-predicates.html#functions-all