创建关系1

create
(qiao:Person{name:"qiao"}),
(wang:Person{name:"wang"}),
(zhao:Person{name:"zhao"}),
(liang:Person{name:"liang"}),
(desk:Desk{num:123456}),
(qiao)-[:has_desk]->(desk),
(wang)-[:has_desk]->(desk),
(zhao)-[:has_desk]->(desk),
(zhao)-[:Friends{relation:"friend"}]->(qiao),
(zhao)-[:Friends{relation:"friend"}]->(liang)

创建关系1

1.共享信息

match(p1:Person)-[:has_desk]->(desk)<-[:has_desk]-(p2:Person)
where exists(desk.num)
with p1,p2
merge (p1)-[:Know{relation:"know"}]->(p2)

创建关系1

2.原有关系

match(p1:Person)-[r1:Friends{relation:"friend"}]->(p2:Person)
where exists(r1.relation)
with p1,p2
merge (p1)-[r2:Know{relation:"know"}]->(p2)

创建关系1

3.获取所需关系图

match  m=(p1:Person)-[:Know{relation:"know"}]->(p2:Person) return m

创建关系1

 

上一篇:#c语言 不同路径问题#


下一篇:76.纯 CSS 创作一组单元素办公用品