Neo4j where 多个属性的谓词

Neo4j where predicates on multiple attributes

在 Neo4j 中,对于 where 谓词,我们可以限制多个 属性 吗?例如,假设我们有一个对列表:L = [(23, 'San Diego'), (25, 'Palo Alto'), (21, 'Seattle'), ....] ,那么 Cypher 是否支持类似于以下内容的内容:

Match (a) where (a.age, a.city) in L return a

年龄和城市组合需要在L列表中

Neo4j 不接受元组,但接受键、值对(或字典)的映射。

但是,此查询将接近您所描述的内容。

WITH [{age:23, city:'San Diego'}, {age:25, city:'Palo Alto'}, {age:21, city:'Seattle'}] as L
MATCH (p:Person) WHERE {age: p.age, city: p.city} in L
RETURN p 

Sample result:
╒═══════════════════════════════════════════╕
│"p"                                        │
╞═══════════════════════════════════════════╡
│{"name":"Andy","city":"San Diego","age":23}│
└───────────────────────────────────────────┘

见下文:

https://neo4j.com/docs/cypher-manual/current/syntax/values/#composite-types