1. 下载安装
下载链接:https://neo4j.com/download-center/#releases
设置环境变量
2. 运行
启动:neo4j start
打开页面:http://localhost:7474/browser/
初次进入,用户名密码都是neo4j
关闭:neo4j stop
3. 系统自带demo
在输入框输入 :play movies
点击后面的▶️执行
执行结果
进入第二页,点击create那段代码,将代码复制到上面的输入框
然后执行
结果如下:
4. 简单应用
(复制注意特殊字符,可以先复制到txt,再复制到neo4j输入框)
1. 一步一步创建、查看
- 执行下面语句,将第三部中添加的内容全部删除:
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r
- 创建-实体和属性:
create (zhangsan:person {name:'张三',age:'21'})
create (lisi:person {name:'莉丝',age:'22'})
create (wangwu:person {name:'王五',age:'20'})
create (maliu:person {name:'马琉',age:'19'})
create (yizhong:school {name:'一中',address:'北京'})
- 创建-关系
MATCH (p:person),(s:school)
WHERE p.name = "莉丝" AND s.name = "一中"
CREATE (p)-[y:study]->(s)
RETURN y
- 查询:
MATCH (p:person),(s:school) RETURN p,s
MATCH p=()-[r:study]->() RETURN p
2. 一起创建实体、属性和关系的例子
- 先删除之前的
-
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r
- 执行以下语句
create (zhangsan:person {name:'张三',age:'21'})
create (lisi:person {name:'莉丝',age:'22'})
create (wangwu:person {name:'王五',age:'20'})
create (maliu:person {name:'马琉',age:'19'})
create (yizhong:school {name:'一中',address:'北京'})
CREATE
(zhangsan)-[: study {cla:[ '一班']}]->( yizhong),
(lisi)-[: study {cla:[ '一班']}]->( yizhong),
(wangwu)-[: study {cla:[ '一班']}]->( yizhong),
(maliu)-[: study {cla:[ '一班']}]->( yizhong)
点击出现下面的图
附使用参考链接:https://www.cnblogs.com/hwaggLee/p/5959716.html