目录
neo4j操作笔记
创建节点:
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///city.csv' AS line
CREATE (:City{
city_id: line.city_id,
cityself_id:line.cityself_id,
name: line.city
})
删除节点(City):MATCH (n:City) DELETE n
导入创建关系1:
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///province_city.csv' AS line
MATCH (c:City) where c.name = line.city WITH c,line
MATCH (p:Provice) where p.id = line.city_id
MERGE (c)-[:所属]->(p)
导入创建关系2:
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///city_quota.csv' AS line
MATCH (q:Quota2) where q.name = line.quota2 WITH q,line
MATCH (c:City) where c.cityself_id = line.id
MERGE (q)-[:增长指标]->(c)
做各城市生态综合环境影响因素:GDP影响显著。
MATCH(n:City),(n:City)
WHERE n.name='桂林市' AND n.name='柳州市'
CREATE (n)-[r:邻近市的企业数量对本地区的GDP有显著推动作用] -> (n)
return r
创建关系3:
kongjian _city.csv
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///kongjian _city.csv' AS line
MATCH (y:Yinsu) where q.name = line.kongjian2 WITH y,line
MATCH (c:City) where c.cityself_id = line.self_id
MERGE (y)-[:空间相关分析关系1]->(c)
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM 'file:///kongjian _city.csv' AS line
MATCH (s:Space) where s.name = line.kongjian2 WITH s,line
MATCH (c:City) where c.cityself_id = line.self_id
MERGE (s)-[:空间相关分析关系2]->(c)