neo4j-community-4.0.11 添加数据

原创
2021/07/07 17:01
阅读数 64

创建节点

create(suxun:Person_{name:"苏洵",age:80,sex:"男"})
create(sushi:Person_{name:"苏轼",age:53,sex:"男"})
create(suzhe:Person_{name:"苏辙",age:51,sex:"男"})
create(suxiaomei:Person_{name:"苏小妹",age:45,sex:"女"})
create(susun:Person_{name:"苏孙",age:29,sex:"男"})
create(suxiaosun:Person_{name:"苏重孙",age:6,sex:"女"})

创建关系

match(p1:Person_),(p2:Person_)
where p1.name="苏洵" and p2.name = "苏轼"
create (p1) -[parent:Parent{relation:"父亲"}]-> (p2);
 
match(p1:Person_),(p2:Person_)
where p1.name="苏洵" and p2.name = "苏辙"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

match(p1:Person_),(p2:Person_)
where p1.name="苏洵" and p2.name = "苏小妹"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);
 
match(p1:Person_),(p2:Person_)
where p1.name="苏轼" and p2.name = "苏孙"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

match(p1:Person_{name:"苏孙"}),(p2:Person_{name:"苏重孙"})
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

创建节点

create(sumai:Person_{name:"苏迈",age:15,sex:"男"})
create(sudai:Person_{name:"苏迨",age:20,sex:"男"})
create(suguo:Person_{name:"苏过",age:20,sex:"男"})
create(sudun:Person_{name:"苏遁",age:20,sex:"男"})

创建关系

match(p1:Person_),(p2:Person_)
where p1.name="苏轼" and p2.name = "苏迈"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

match(p1:Person_),(p2:Person_)
where p1.name="苏轼" and p2.name = "苏迨"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

match(p1:Person_),(p2:Person_)
where p1.name="苏轼" and p2.name = "苏过"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);

match(p1:Person_),(p2:Person_)
where p1.name="苏轼" and p2.name = "苏遁"
create (p1) -[parent:Parent{relation:"父亲"}] -> (p2);
展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部