知识图谱的创建,节点,关系

今天学习了知识图谱的创建,成功创建了一个知识图谱。也初步了解了neo4j数据库的原理

语句:

CREATE (t1:Title {title: "合同"})
CREATE (t2:Title {title: "人权"})
CREATE (t3:Title {title: "物权"})
CREATE (a1:Author {name: "自然人"})
CREATE (a2:Author {name: "法人"})
CREATE (d1:Dynasty {dynasty: "民法"})
CREATE (c1:Content {content: "民事纠纷"})
CREATE (c2:Content {content: "遗产继承"})
CREATE (c3:Content {content: "婚姻"})
CREATE (b1:Background {background: "赡养"})
CREATE (b2:Background {background: "监督"})
CREATE (b3:Background {background: "劳务关系"})
CREATE (A1:Appreciation {appreciate: "社会责任"})
CREATE (A2:Appreciation {appreciate: "家庭责任"})
CREATE (A3:Appreciation {appreciate: "民事责任"})
CREATE (s1:Style {style: "紧急避险"})
CREATE (s2:Style {style: "侵权"})
CREATE (s3:Style {style: "居住"})
CREATE (f1:Form {form: "人"})
CREATE (t1)-[r1:poetry_author]->(a1)
CREATE (t2)-[:poetry_author]->(a1)
CREATE (t3)-[:poetry_author]->(a2)
CREATE (a1)-[r2:lie_in]->(d1)
CREATE (a2)-[:lie_in]->(d1)
CREATE (c1)-[r3:content_poetry]->(t1)
CREATE (c2)-[:content_poetry]->(t2)
CREATE (c3)-[:content_poetry]->(t3)
CREATE (A1)-[r4:apprec_content]->(c1)
CREATE (A2)-[:apprec_content]->(c2)
CREATE (A3)-[:apprec_content]->(c3)
CREATE (b1)-[r5:create_back]->(t1)
CREATE (b2)-[:create_back]->(t2)
CREATE (b3)-[:create_back]->(t3)
CREATE (t1)-[r6:belongs_to]->(s1)
CREATE (t2)-[:belongs_to]->(s2)
CREATE (t3)-[:belongs_to]->(s3)
CREATE (t1)-[r7:is_from]->(f1)
CREATE (t2)-[:is_from]->(f1)
CREATE (t3)-[:is_from]->(f1)
RETURN t1,t2,t3,a1,a2,d1,c1,c2,c3,b1,b2,b3,A1,A2,A3,s1,s2,s3,f1

图谱:

 

posted @ 2022-05-28 16:14  潘福龙  阅读(203)  评论(0编辑  收藏  举报