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

完成需求

相关推荐
长桥夜波1 天前
机器学习日报02
人工智能·机器学习·neo4j
麦麦大数据2 天前
D027 v2 vue+django+neo4j 基于知识图谱红楼梦问答系统 (新增问关系功能;新增知识节点和关系管理功能,neo4j增删改查功能)
vue.js·django·问答系统·知识图谱·neo4j·图谱管理·neo4j增删改查
青花瓷2 天前
neo4j的基础安装及简单实例
neo4j
不吃香菜的小趴菜3 天前
neo4j密码忘记如何解决
知识图谱·neo4j
问问计算机6 天前
2.Neo4j是什么?
neo4j
羊羊小栈6 天前
基于知识图谱(Neo4j)和大语言模型(LLM)的图检索增强(GraphRAG)的台风灾害知识问答系统(vue+flask+AI算法)
人工智能·毕业设计·知识图谱·创业创新·neo4j·毕设·大作业
FserSuN6 天前
GraphRAG 与 Neo4j 社区版:能力边界与适用场景学习总结
学习·neo4j
掘金安东尼8 天前
深入 Neo4j:从图数据库原理到企业知识引擎的实践指南
数据库·neo4j
熊文豪8 天前
Windows安装Neo4j保姆级教程(图文详解)
neo4j