neo4j 删除从一个node开始的所有数据。

##一、 需求

删除红线右边重复的数据


二、 删除与中心点1的右边连线

2.1 中心点1橙色:
bash 复制代码
<elementId>: 4:fbde4fa1-3453-4e00-91ce-92b16aec22e3:425
<id>: 425
fileName: /Users/guibing.gao/Desktop/lib

2.2 与中新点1右边链接的node

bash 复制代码
<elementId>: 4:fbde4fa1-3453-4e00-91ce-92b16aec22e3:427
<id>: 427
fileName: /adaptor-1.0-SNAPSHOT.jar
valid: true
2.3 查询与中心点1链接的线
bash 复制代码
MATCH p =(a:Directory:File)-[r]-(b)
WHERE a.fileName = '/Users/guibing.gao/Desktop/lib' and b.fileName = '/adaptor-1.0-SNAPSHOT.jar'
return  a ,r,b
2.4 删除右边与中心点1的连线。
bash 复制代码
MATCH p =(a:Directory:File)-[r]-(b)
WHERE a.fileName = '/Users/guibing.gao/Desktop/lib' and b.fileName = '/adaptor-1.0-SNAPSHOT.jar'
delete r
2.5 查看数据 只剩一个中心点2

三、删除与中心点2的右边连线

3.1 中心点2绿色:
bash 复制代码
<elementId>: 4:fbde4fa1-3453-4e00-91ce-92b16aec22e3:480
<id>: 480
fqn: org.example:adaptor:jar:1.0-SNAPSHOT
group: org.example
name: adaptor
type: jar
version: 1.0-SNAPSHOT
3.2 与中心点2 链接的右边node
bash 复制代码
<elementId>: 4:fbde4fa1-3453-4e00-91ce-92b16aec22e3:467
<id>: 467
artifactId: adaptor
characterEncodingScheme: UTF-8
fileName: /META-INF/maven/org.example/adaptor/pom.xml
groupId: org.example
lineNumber: 1
packaging: jar
standalone: false
valid: true
version: 1.0-SNAPSHOT
xmlVersion: 1.0
xmlWellFormed: true
3.3 删除右边与中心点2的连线。
bash 复制代码
MATCH p =(a:Artifact:Maven)-[r]-(b)
WHERE a.fqn = 'org.example:adaptor:jar:1.0-SNAPSHOT' and id(b) = 467
delete r
3.4 查看数据

三 、删除右边图形的全部数据

3.1 确认起始node
bash 复制代码
MATCH (f:Document:File:Maven:Pom:Xml)
where id(f) = 467
return f
3.2 删除从这个点开始的所有数据
bash 复制代码
MATCH (f:Document:File:Maven:Pom:Xml)
where id(f) = 467
CALL apoc.path.subgraphNodes(f, {})
YIELD node
detach delete  node;
3.3 查看数据

完成需求

相关推荐
m_136873 天前
Mac Intel 芯片 Docker 一键部署 Neo4j 最新版本教程
macos·docker·neo4j
我是海飞6 天前
TensorFlow的Yes/No 关键词识别模型训练
人工智能·python·tensorflow·语音识别·neo4j
学习中的程序媛~10 天前
图数据库neo4j的安装
数据库·neo4j
耳东哇14 天前
在使用spring ai进行llm处理的rag的时候,选择milvus还是neo4j呢?
人工智能·neo4j·milvus
预判你的代码19 天前
Docker 快速下载Neo4j 方法记录
docker·容器·neo4j
tangjunjun-owen1 个月前
Docker部署 Neo4j 及集成 APOC 插件:安装与配置完整指南(docker-compose)
docker·容器·docker-compose·neo4j·apoc
stray小书童1 个月前
neo4j数据库实战
数据库·neo4j
阿明 -李明1 个月前
鲲鹏arm服务器安装neo4j社区版,实现图书库自然语言检索基础
服务器·ubuntu·neo4j
编程研究坊1 个月前
Neo4j APOC插件安装教程
数据库·人工智能·python·neo4j
GawynKing1 个月前
Neo4j 社区版 Mac 安装教程
macos·neo4j