5

给定具有数组属性的 Neo4J 节点,如何创建 Cypher 查询以仅返回与数组文字匹配的节点?

使用控制台,我创建了一个带有名为“list”的数组属性的节点:

neo4j-sh (0)$ create n = {list: [1,2,3]};
==> +-------------------+
==> | No data returned. |
==> +-------------------+
==> Nodes created: 1
==> Properties set: 1
==> 83 ms

neo4j-sh (0)$ start n=node(1) return n;
==> +-----------------------+
==> | n                     |
==> +-----------------------+
==> | Node[1]{list:[1,2,3]} |
==> +-----------------------+
==> 1 row
==> 1 ms

但是,我的查询不会返回刚刚创建的节点,因为它有一个匹配数组文字的 WHERE 子句:

neo4j-sh (0)$ start n=node(1) where n.list=[1,2,3] return n;
==> +---+
==> | n |
==> +---+
==> +---+
==> 0 row
==> 0 ms

我完全有可能误用了 Cypher。在 Cypher 中进行精确数组属性匹配的任何提示都会有所帮助。

4

2 回答 2

6

控制台始终运行 Neoj4 的最新 SNAPSHOT 版本。该版本指的是密码语法解析器,我们会更清楚地指出:)

现在,Cypher 中的数组处理有一些修复,请参阅https://github.com/neo4j/community/pull/815https://github.com/neo4j/community/issues/818,这可能是使控制台工作的那些。这已在 1.8.M07 之后合并,因此为了使其在本地工作,请下载最新的 1.8.-SNAPSHOT 之一,从 GITHUB 构建它或等待即将到期的 1.8.M08。

/彼得

于 2012-08-30T08:07:56.937 回答
3

Which version of Neo4j are you using?

Your same code works for me in 1.8M07.

http://console.neo4j.org/?id=p9cy6l

Update: I get the same result (no results) in a local install via the web client. Maybe it's a web client issue?

于 2012-08-29T14:08:51.447 回答