我想要那些名称不在a_row
集合中的节点。例如:b,c
拥有b_row
,将a_row
与b_row
b,c,e
合并后,entity.name
正在a,b,c,d
,a,d
正在match (a)-[r:relations]->(b) with collect(distinct a.FirstName) as a_row
match (a)-[r:relations]->(b) with a_row + collect(distinct b.LastName) as b_row
match (n:entity) with b_row where n.name <> b_row return n
。所以我希望节点形式的输出0xF
不在列表表单中。
0b1111
提前致谢,如果需要进一步的信息,请与我们联系。
答案 0 :(得分:0)
尝试按IN operator更改<>
。这样:
match (a)-[r:relations]->(b) with collect(distinct a.FirstName) as a_row
match (a)-[r:relations]->(b) with a_row + collect(distinct b.LastName) as b_row
match (n:entity) where n.name NOT IN b_row return n
答案 1 :(得分:0)
第一
match (a)-[r:relations]->(b) with collect(distinct a.FirstName) as a_row
match (a)-[r:relations]->(b) with a_row + collect(distinct b.LastName) as b_row
match (n:entity) with b_row where n.name <> b_row return n
无效,因为最后with
会丢弃n,并且可以简化为
MATCH (a)-[r:relations]->(b)
WITH collect(distinct a.FirstName)+collect(distinct b.LastName) as b_row
MATCH (n:entity)
// b_row in now a list, so if n.name is a string, <> is always false
WHERE n.name NOT IN b_row
RETURN n
我将简化为
MATCH (a)-[r:relations]->(b)
WITH collect(distinct a.FirstName)+collect(distinct b.LastName) as b_row
MATCH (n:entity)
RETURN n, b_row
首先验证您的查询是否在过滤之前提升了您的想法。