无法使用 属性 过滤聚合的 Neo4j 查询

Can't filter aggregated Neo4j query with property

我有一个查询将节点和关系汇总为组,但我无法通过 属性 对其进行过滤。以下查询:

CALL apoc.nodes.group(['*'],["workspace"]) YIELD nodes, relationships
Unwind nodes as node
unwind relationships as rel
WITH coalesce(node) as result, rel
return result

结果显示

但我无法使用 result.workspace 访问,它显示 [] 个空数组。 我希望能够使用 result.workspace = '100'

进行过滤

编辑: 我添加了显示查询结果的新屏幕截图。我正在尝试只获得具有 属性 'workspace':'100' 的灰色(例如,我的查询可以是 '99'),而不是其他像绿色的 'workspace':'99' 或具有不同的属性。

Image

编辑2: 通过此查询,它 returns 没有

CALL apoc.nodes.group(['*'],['workspace']) YIELD 节点 UNWIND 节点作为节点 带节点 其中 node.workspace = '100' RETURN节点

Image after query

问题已解决,查询如下:

CALL apoc.nodes.group(['*'],['workspace']) YIELD 节点,关系 UNWIND 节点作为节点 UNWIND 关系作为 rel WITH节点,相对 WHERE apoc.any.properties(node).workspace = '100' RETURN节点,rel

apoc.any.properties() 在虚拟节点上工作,就像它们是真实节点一样。

[更新]

这将 return 仅具有 workspace 属性 值“100”的组节点:

CALL apoc.nodes.group(['*'],["workspace"]) YIELD nodes
UNWIND nodes AS node
WITH node
WHERE apoc.any.property(node, 'workspace') = '100'
RETURN node

注意:您必须使用 apoc.any.property 函数从虚拟节点获取 属性 值。