例如:
match (v:apply{appno:“1”}-[e2]-(v2) return collect(distinct v2.appno) as appnoList返回结果
[“1”,“2”,“3”]
match (v:apply{appno:“1”}-[e4]-(v2) return distinct v2.appno 返回结果
1
2
3
4
5
match (v:apply{appno:“1”}-[e2]-(v2) return collect(distinct v2.appno) as appnoList
| match (v:apply{appno:“1”}-[e4]-(v2) where v2.appno not in $-.appnoList return distinct v2.appno
上面语句查询结果为空
无法达到与下面语句查询结果
match (v:apply{appno:“1”}-[e*4]-(v2) where v2.appno not in [“1”,“2”,“3”] return distinct v2.appno
结果:
4
5
LOOKUP ON apply WHERE apply.appno=="1" | GO FROM $-.VertexID OVER e2 YIELD $$.app.appno AS appnos, $-.VertexID as vid | GROUP BY $-.vid YIELD collect($-.appnos) as appnos, $-.vid as vid | GO FROM $-.vid OVER e4 WHERE $$.app.appno not in $-.appnos yield e4._dst;
在 basketball 的数据集上:
(root@nebula) [nba]> lookup on player where player.name=="Tim Duncan" | GO FROM $-.VertexID Over like where $$.player.name != "Tony Parker" yield $$.player.name as names, $-.VertexID as vs | GROUP By $-.vs yield collect($-.names) as names, $-.vs as vs | GO FROM $-.vs OVER like WHERE $$.player.name NOT IN $-.names YIELD like._dst
+---------------+
| like._dst |
+---------------+
| "Tony Parker" |
+---------------+
Got 1 rows (time spent 21883/22299 us)
Wed, 14 Jul 2021 15:32:54 CST
使用minus
(go N steps [ids] over e bidirect yield e.dstId as dstId minus go M steps xxx over e bidirect yield e.dstId as dstId )|fetch prop on tag $-.dstId