Multi-label syntax of Neo4j database Cypher

Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right


foreword

提示:这里可以添加本文要记录的大概内容:

I feel that Neo4j is very powerful when I use Neo4j to make a knowledge map. Here I record my learning process. Welcome all bloggers to communicate


提示:以下是本篇文章正文内容,下面案例可供参考

1. Nodes that match multiple labels at the same time

match (a:CHEM:TECT:WORD) return a
match (a:User:Admin)-->(b) return a,b

2. Edges that match multiple labels at the same time

match (a)-[r:TYPE1|TYPE2]->(b) return r

3. Allow nodes and edges that match multiple labels

match (a)-[r]-(b) where (a:"标签1" or a:"标签2") and (b:"标签1" or b:"标签2") and  (r:"标签a" or r:"标签b") return a,b,r

4. Obtain a list sorted by node name

distinct means deduplication

match (n) with n order by n.name return collect(distinct n)

5. Merge the start and end points of the relationship into an ordered list

unwind means to unwind the list

match (a)-[p]-(b) with collect(a) as a,collect(b) as b with a+b as c unwind c as node with node order by node.name return collect(distinct node)

Guess you like

Origin blog.csdn.net/weixin_43342297/article/details/125659273