Neo4j 如何使用空筛选器在一个密码查询中返回2个集
因此,我尝试从一个cypher查询返回2个集: 给定父节点在索引中,则Neo4j 如何使用空筛选器在一个密码查询中返回2个集,neo4j,cypher,Neo4j,Cypher,因此,我尝试从一个cypher查询返回2个集: 给定父节点在索引中,则 父节点的子节点 无子节点的父节点 我能够得到一个类似的查询,它返回一个集合中索引中的父项以及另一个集合中的子项,如下所示 START Parents = node:app_fulltext('name:"City"'), MATCH Parents-[?:ChildOf]-Apps RETURN collect(Apps.Title), collect(Parents.Name); ==> +---------
START Parents = node:app_fulltext('name:"City"'),
MATCH Parents-[?:ChildOf]-Apps
RETURN collect(Apps.Title), collect(Parents.Name);
==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name) |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"] | ["Empty City 3D","Empty City 3D Fake"] |
==> +--------------------------------------------------------------+
这接近我想要的。但是,我想从父项中筛选。请在Apps.Title集合中命名那些已经有子项的项目
这是我想要的结果集。“Empty City 3D Fake”没有任何子项,因此以Parents.Name返回
==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name) |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"] | ["Empty City 3D Fake"] |
当我刚刚添加Where r is null子句时,它没有返回任何内容,因此我不得不添加两个相同的起始父集合(Parents和Parents2)来完成此操作。然而,这看起来真的很笨拙,所以我希望有更好的方法
START Parents = node:app_fulltext('name:"City"'),
Parents2 = node:app_fulltext('name:"City"')
MATCH Parents-[r?:ChildOf]-Children, Parents2-[:ChildOf]-Apps
Where r is null
return collect(Apps.Title), collect(Parents.Name);
==> +--------------------------------------------------------------+
==> | collect(Apps.Title) | collect(Parents.Name) |
==> +--------------------------------------------------------------+
==> | ["Empty City 3D"] | ["Empty City 3D Fake"] |
==> +--------------------------------------------------------------+
你能试试这个吗-
START Parents = node:app_fulltext('name:"City"'),
MATCH Parents-[?:ChildOf]-Apps
WITH collect(Apps.Title) as myapps, collect(Parents.Name) as myparents
RETURN myapps, filter(x in parents : not x in myapps) as myfilteredparents
看起来很有希望,但在.net neo4j客户端中遇到了一些问题。你不能告诉我如何将其添加到linq返回条款中,是吗?在java中,使用spring存储库,我们将返回类型映射到带有@MapResult注释的接口。不知道如何在.net/linq中实现。如需了解更多信息,请参阅第17.3节