简体   繁体   English

使用Cypher在Neo4j中的两个节点之间创建相同类型的多个关系

[英]Creating multiple relationships of the same type between two nodes in Neo4j using Cypher

Is it possible to create multiple relationships of the same type with different properties between two nodes? 是否可以在两个节点之间创建具有不同属性的相同类型的多个关系?

For example: for a movie with a double role: 例如:对于具有双重角色的电影:

Actor--acts{charactername : "hank"}--> movie.

and also the same actor, does another character in the same movie say, FRED 也是同一位演员,同一部电影中的另一个角色说FRED

Actor-- acts{ charactername: "Fred"}-->Movie

.

Is there a way to do so using Cypher? 有没有办法使用Cypher做到这一点? I am using the REST API, Neo4j 2.0.2. 我正在使用REST API Neo4j 2.0.2。

Multiple of relations of the same type with or without different properties are allowed between two nodes. 两个节点之间允许具有或不具有不同属性的相同类型的多个关系。

This Cypher statement will create acts relations for all character names passed in: 该Cypher语句将为传入的所有字符名称创建行为关系:

MATCH (actor:Actor {id:3}),(movie:Movie { id:4})
FOREACH (character IN ['Hank', 'Fred']| 
         CREATE actor-[:acts { charactername:character }]->movie)

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

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