缩短Neo4j和Cypher的逻辑操作

时间:2017-04-28 20:53:14

标签: neo4j cypher

如何缩短以下查询以呈现相同的内容但使用较少的单词:

WHERE node.code<> '一个' AND node.code<> ' B' AND node.code<> ' C' AND node.code<> ' d' AND node.code<> ' E' AND node.code<> ' F'

1 个答案:

答案 0 :(得分:0)

您可以使用您不想要的值的集合,并执行成员资格检查:

WITH ['a', 'b', 'c', 'd', 'e', 'f'] as excludedCodes
// though it's better to pass these in as a list parameter if you can
... // perform your matches and such
WHERE NOT node.code in excludedCodes
...