用neo4j完成下面代码CREATE (sue:Person {name:"Sue"}),(anna:Person {name:"Anna"}), (joe:Person {name:"Joe"}), (bob:Person {name:"Bob"}), (sue)-[:KNOWS]->(bob), (sue)-[:KNOWS]->(anna), (sue)-[:KNOWS]->(joe), (joe)-[:KNOWS]->(anna)
时间: 2023-12-10 14:39:06 浏览: 130
neo4j-driver-firstApp:试用Neo4J JS驱动程序
以下是使用Cypher语句在Neo4j中创建节点和关系的代码:
```
CREATE (sue:Person {name:"Sue"}), (anna:Person {name:"Anna"}), (joe:Person {name:"Joe"}), (bob:Person {name:"Bob"})
CREATE (sue)-[:KNOWS]->(bob), (sue)-[:KNOWS]->(anna), (sue)-[:KNOWS]->(joe), (joe)-[:KNOWS]->(anna)
```
这个代码块将创建四个Person节点,分别代表Sue、Anna、Joe和Bob。然后,它会创建四个KNOWS关系,连接这些人之间的知晓关系。具体来说,Sue知道Bob、Anna和Joe,而Joe知道Anna。
阅读全文