我正在执行以下两个查询,我得到了一些结果。
第一次查询
START
person=node:NODE_TYPE(NODE_TYPE='PERSON')
MATCH
(person)-[?:contacts]->(var1)-[?:addresses]->(var2)-[?:details]->(var3)-[?:items]->(var4)-[?:items]->(var5)-[?:value]->(var6)
WHERE
var2.`#nodeId` ='at0000' and var3.`#nodeId` ='at0001' and var4.`#nodeId` ='at0002' and var5.`#nodeId` ='at0028' and var6.`value` =~'address.*'
return distinct person;
第二次查询
START
person=node:NODE_TYPE(NODE_TYPE='PERSON')
MATCH
(person)-[?:contacts]->(var1)-[?:addresses]->(var2)-[?:details]->(var3)-[?:items]->(var4)-[?:value]->(var5)
WHERE
var2.`#nodeId` ='at0000' and var3.`#nodeId` ='at0001' and var4.`#nodeId` ='at0009' and var5.`value` =~'india.*'
return distinct person;
但是,当我将这两个查询组合到一个查询中以获取同时符合这两个条件的人员时,它不起作用。
组合查询是
START
person=node:NODE_TYPE(NODE_TYPE='PERSON')
MATCH
(person)-[?:contacts]->(var1)-[?:addresses]->(var2)-[?:details]->(var3)-[?:items]->(var4)-[?:items]->(var5)-[?:value]->(var6) , (person)-[?:contacts]->(var7)-[?:addresses]->(var8)-[?:details]->(var9)-[?:items]->(var10)-[?:value]->(var11)
WHERE
var2.`#nodeId` ='at0000' and var3.`#nodeId` ='at0001' and var4.`#nodeId` ='at0002' and var5.`#nodeId` ='at0028' and var6.`value` =~'address.*' and
var8.`#nodeId` ='at0000' and var9.`#nodeId` ='at0001' and var10.`#nodeId` ='at0009' and var11.`value` =~'india.*'
return distinct person;
此查询返回一个空迭代器。
我使用 'comma' 来组合 MATCH 条件和 'and' 来组合 WHERE 条件。这有什么问题吗?
(我正在实现一个查询构建器来构建密码查询。我必须检查多个条件匹配。最好的方法是什么?)
Neo4j 1.9M04