关于Neo4j的使用及其基本命令

关于Neo4j的使用

文章目录

1、启动方式

进入bin目录:

properties 复制代码
neo4j console

2、创建新节点,节点内有属性

cypher 复制代码
create (:大学{name:"北京邮电大学"})

create (:院系{name:"计算机学院"})

先创建了两个节点:

3、创建关系

cypher 复制代码
match (p1:大学),(p2:院系) Create(p1)-[r:院系]->(p2)

这个关系创建完成!

4、查询节点

cypher 复制代码
match (n:大学)
where n.name='北京邮电大学'
return n

n代表节点,可以替换。

5、查询关系

cypher 复制代码
match (:大学{name:'北京邮电大学'})-[r]->(:院系{name:"计算机学院"}) return r

6、删除两个节点的关系

必须先删除关系才能删除节点:

cypher 复制代码
match (:大学{name:'北京邮电大学'})-[r]->(:院系{name:"计算机学院"}) delete r

7、删除节点

cypher 复制代码
match (a:大学{name:"北京邮电大学"}) delete a

8、删除某个标签的全部关系

cypher 复制代码
match (:大学{name:'北京邮电大学'})-[r]->() delete r

9、某个节点添加属性

cypher 复制代码
match (a:大学) where a.name="北京邮电大学" set a.sal="123" return a

10、删除节点某个属性

cypher 复制代码
match (a:大学) where a.name="北京邮电大学" remove a.sal
相关推荐
2401_8979300610 小时前
使用Docker轻松部署Neo4j图数据库
数据库·docker·neo4j
lucky_lyovo2 天前
Neo4j--登录及简单操作
数据库·neo4j
danns8885 天前
neo4j数据库创建范例(SQL文)
数据库·sql·neo4j
attitude.x5 天前
TensorFlow 2.x 核心 API 与模型构建:从入门到实践
neo4j
m_136879 天前
Mac Intel 芯片 Docker 一键部署 Neo4j 最新版本教程
macos·docker·neo4j
我是海飞12 天前
TensorFlow的Yes/No 关键词识别模型训练
人工智能·python·tensorflow·语音识别·neo4j
学习中的程序媛~15 天前
图数据库neo4j的安装
数据库·neo4j
耳东哇20 天前
在使用spring ai进行llm处理的rag的时候,选择milvus还是neo4j呢?
人工智能·neo4j·milvus
预判你的代码24 天前
Docker 快速下载Neo4j 方法记录
docker·容器·neo4j
tangjunjun-owen1 个月前
Docker部署 Neo4j 及集成 APOC 插件:安装与配置完整指南(docker-compose)
docker·容器·docker-compose·neo4j·apoc