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

完成需求

相关推荐
心念枕惊3 天前
Conda 环境一键搬家:用 conda-pack 打包带走,连网都不用
conda·neo4j
码农学院12 天前
Neo4j知识图谱赋能跨境电商GEO:LLM实体识别与AI搜索引擎结构化数据输出实战
人工智能·知识图谱·neo4j
TE-茶叶蛋12 天前
RAG智能电商客服什么时候上Neo4j?
neo4j
羊羊小栈12 天前
基于GraphRAG的税务财务智能问答系统(Neo4j_大语言模型)
人工智能·算法·语言模型·自然语言处理·毕业设计·neo4j·大作业
hhzz14 天前
(九)在MCU上跑AI推理:ESP-DL vs TFLite Micro,选哪个?怎么优化?
人工智能·单片机·neo4j·esp·ai推理
༄沐࿆风࿆࿆14 天前
neo4j Desktop下载学习笔记
笔记·学习·neo4j
我是唐青枫14 天前
Java Neo4j 实战指南:从图模型、Cypher 到 Spring Boot 关系查询
java·spring boot·neo4j
AI-好学者19 天前
RDF对比与Neo4j性能优化
人工智能·知识图谱·neo4j·knowledge graph
冷小鱼24 天前
Neo4j 深度解析:从原生图存储到 GraphRAG 的知识图谱革命
人工智能·知识图谱·neo4j
24计网1王仔寿1 个月前
Linux运维与云计算全栈系统化学习指南(Shell+虚拟化+OpenStack+Docker+公私云实战)
linux·课程设计·数据库开发·微信公众平台·neo4j·命令模式·sequoiadb