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 查看数据

完成需求

相关推荐
问问计算机12 小时前
2.Neo4j是什么?
neo4j
羊羊小栈12 小时前
基于知识图谱(Neo4j)和大语言模型(LLM)的图检索增强(GraphRAG)的台风灾害知识问答系统(vue+flask+AI算法)
人工智能·毕业设计·知识图谱·创业创新·neo4j·毕设·大作业
FserSuN12 小时前
GraphRAG 与 Neo4j 社区版:能力边界与适用场景学习总结
学习·neo4j
掘金安东尼2 天前
深入 Neo4j:从图数据库原理到企业知识引擎的实践指南
数据库·neo4j
熊文豪2 天前
Windows安装Neo4j保姆级教程(图文详解)
neo4j
Maer094 天前
Neo4j+Gephi制作社区检测染色图
neo4j
叶楊6 天前
数据处理常用函数
neo4j
向阳蒲公英7 天前
http://localhost:7474/browser/ 登陆之后账号密码neo4j / neo4j 不对 页面出现以下:
neo4j
BTU_YC8 天前
Neo4j查询计划完全指南:读懂数据库的“执行蓝图“
数据库·neo4j