1

在 python binding v 1.6 中对我的 neo4j 数据库运行以下 Cypher 查询时遇到问题:

START  n0 = node:my_nodes(label='1'), n1 = node:my_nodes(label='1'), 
       n2 = node:my_nodes(label='2'), n3 = node:my_nodes(label='2'), 
       n4 = node:my_nodes(label='2')
MATCH (n0)-[r0]-(n1),(n0)-[r1]-(n4),(n1)-[r2]-(n2),(n2)-[r3]-(n3)
WHERE (r1.year - r0.year = 1) AND (r2.year - r1.year = 0) AND 
      (r3.year - r2.year = 0)
RETURN count(distinct n0), count(distinct n1),
       count(distinct n2), count(distinct n3),
       count(distinct n4)

我的数据库有带有索引属性的节点label以及与整数属性的关系year。执行此查询时,出现错误

in decorator return fn(*args, **kwargs)
org.neo4j.cypher.CypherExceptionPyRaisable: Unclosed parenthesis
"WHERE (r1.label - r0.label = 1) AND 
(r2.label - r1.label = 0) AND (r3.label - r2.label = 0)"
                                                               ^

我已经在这个查询中玩过括号但没有成功。谁能帮我解决这个错误?

编辑:我认为问题出在使用 neo4j 嵌入式版本 1.6,但我将它升级到版本 1.9.dev0(从 gi​​thub 编译),但我仍然得到同样的错误。

Edit2:感谢 ulkas 的评论,我发现了交互式密码控制台并在那里创建了一个示例图和密码查询(但没有索引部分)。查询有问题:

 Error: java.lang.RuntimeException: org.neo4j.helpers.ThisShouldNotHappenError: 
 Developer: Andres claims that: Unexpected traversal state encountered.

Edit3:在玩过控制台之后,我发现它不允许根据文档提供的无向关系和菱形图案匹配。这就是我在控制台http://console.neo4j.org/?id=oqspkc中工作的内容。此查询在 Python 中失败,并显示相同的错误消息 ( Unclosed parenthesis)。我还能在 neo4j 中匹配菱形图案吗?python绑定有什么问题?

4

0 回答 0