Neo4j 检查列表中的 ID

Neo4j check id in list

我想检查关系是否在关系 ID 列表中。我尝试了以下方法:

MATCH (start:Stagepoint),(stop:Stagepoint), path=shortestPath(start-[track:TRACK*]-stop) 
WITH REDUCE(dist = 0, rel in rels(path) | dist + rel.distance) AS distance, path, start.name as start, stop.name as stop, track, [1] as visited 
WHERE distance <= 25 AND distance >= 20 AND NOT ID(track) IN visited  
RETURN start, stop, distance, track ORDER BY distance ASC

得到:Expected `track` to be a node or relationship, but it was``

我试过用多种方法解决这个问题,但 none 似乎有效。

我正在使用 Neo4j 2.1.6 社区版。

在可变长度路径中,关系标识符实际上是关系的集合。所以你的 track 是关系的集合。

试试这个:

WHERE NONE(t in track WHERE id(t) in visited)