如何检查neo4j中的数组属性? [英] How to check array property in neo4j?

查看:240
本文介绍了如何检查neo4j中的数组属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用密码查询来搜索节点,其中节点属性之一具有字符串数组?
例如members-- > ["abc","xyz","pqr"].
我可以通过以相同的方式保持数组元素的顺序来找到节点,例如

How to search node using cypher query where one of the node property having array of string ?
e.g. members-- > ["abc","xyz","pqr"].
I can find the node by keeping order of array elements in same manner, for e.g.

START root=node(*) where has(root.members) and root.members=["abc","xyz","pqr"] return root;

但是如果我不/无法提供像在节点属性中一样的元素的确切顺序,该如何搜索节点?

but How to search node if I do not / cannot provide the exact order of elements as they are in node property ?

推荐答案

使用"all"谓词确保root.member中的每个元素都在给定列表中,即root.members是给定列表的子集,并且length表达式确保给定列表中的元素不超过root.members中的元素,因此它们都包含完全相同的成员.

Use the "all" predicate to ensure every element in the root.member is in the given list, i.e. root.members is a subset of the given list, and the length expression ensures that the given list has no more elements than what is in the root.members, so both of them contain the exactly same members.

START root=node(*)
Where has(root.members) and all ( m in root.members where m in ["abc","xyz","pqr"]) and length(root.members) = length(["abc","xyz","pqr"])
Return root

这篇关于如何检查neo4j中的数组属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆