[英]Create relationship between nodes in neo4j
1)如果简单:
// Choose a pair of students with common teacher
MATCH p = (S1:Student)-[:has_teacher]->(T:Teacher)<-[:has_teacher]-(S2:Student)
// Without [:common_teacher] relationships
WHERE NOT (S1)-[:common_teacher]-(S2)
// And create relationships
CREATE (S1)-[r1:common_teacher]->(S2)
CREATE (S2)-[r2:common_teacher]->(S1)
2)如果相反:
您无需在学生之间创建其他关系,因为他们已经受到普通教师的约束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.