因为毕设用到了neo4j这个数据库,所以简单记录cypher的语法
创建节点和关系
#创建节点
create (variable1:labelname{propertyname1:value1,propertyname2:value2})
create (variable2:labelname{propertyname1:value1,propertyname2:value2})
#创建关系
create (variable1)-[r:relationshipname]->(variable2)
导入csv
### 导入csv 创建节点关系
本地导入的文件放在了neo4j所在的文件夹的import目录下
load csv with headers from "file:///xxx" as row
搜索节点
#cypher 的语法类似sql,这里简单的示例
match (a:labelname)
where a.property1 = vaule
return a
导入csv,创建节点,关系
#导入csv,有http 和本地(file:///)两种方式
match(n:labelname{propertyname1:value1,propertyname2:value2})
#导入csv,创建节点
load csv with headers from "file:///xxx" as row
create (n:labelname)
set n = row,
n.property1 = row.title1
n.property2 = row.title2
#创建关系
load csv with headers from "file:///A刊关系Suffix.csv" as row
match (from:Catalog{name:row.catalog,type:'A刊'}),(to:Journal{name:row.journal})
merge (from)-[:Contains]->(to)
本文详细介绍了Neo4j数据库中Cypher查询语言的基础语法,包括节点与关系的创建、CSV文件的导入及节点关系的建立,是理解和操作图数据库的重要指南。
2301

被折叠的 条评论
为什么被折叠?



