Neo4j检查列表中的ID

时间:2015-03-01 22:31:27

标签: neo4j graph-databases

我想检查关系是否在关系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``

我尝试过以多种方式解决这个问题,但似乎都没有。

我正在使用Neo4j 2.1.6社区版。

1 个答案:

答案 0 :(得分:2)

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

试试这个:

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