简体   繁体   English

匹配Cypher / Neo4J中的多个节点属性值

[英]Match several node property values in Cypher / Neo4J

using Cypher 2 I want to find all the nodes of a certain label (Context), which are called either "health" or "opinion". 使用Cypher 2我想找到某个标签(Context)的所有节点,它们被称为“健康”或“意见”。

The query that works is: 有效的查询是:

MATCH (c:Context) WHERE c.name="health" OR c.name="opinion" RETURN c;

But I'm wondering if Cypher has a syntax that I could put it into the first MATCH part, something like this: 但我想知道Cypher是否有一种语法可以将它放入第一个MATCH部分,如下所示:

MATCH (c:Context{name:"health"|name:"opinion})

The example above doesn't work, but I'm just showing it to let you know what I mean. 上面的例子不起作用,但我只是展示它让你知道我的意思。

Thank you! 谢谢!

Alternatively, you can do this: 或者,您可以这样做:

MATCH (c:Context) WHERE c.name IN ['health', 'opinion'] RETURN c

Still not in the "MATCH" statement, but a little easier as your list of possible values grows. 仍然没有在“MATCH”声明中,但随着可能值列表的增长而变得更容易一些。

You could do 你可以做到

MATCH (c:Context {name:"health"}), (d:Context { name:"opinion"}) 
RETURN c,d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM