1 Star 0 Fork 0

非洲挖井队之猎天/Medical-Graph-RAG

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cleangraph.py 560 Bytes
一键复制 编辑 原始数据 按行查看 历史
WuJunde 提交于 2024-10-25 09:46 +08:00 . update
from neo4j import GraphDatabase
class Neo4jConnection:
def __init__(self, uri, user, pwd):
self.driver = GraphDatabase.driver(uri, auth=(user, pwd))
def close(self):
self.driver.close()
def clean_graph(self):
with self.driver.session() as session:
session.write_transaction(self._delete_all)
@staticmethod
def _delete_all(tx):
tx.run("MATCH (n) DETACH DELETE n")
# Example usage
conn = Neo4jConnection("bolt://host.docker.internal:7687", "neo4j", "binglabi")
conn.clean_graph()
conn.close()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/rengm/Medical-Graph-RAG.git
git@gitee.com:rengm/Medical-Graph-RAG.git
rengm
Medical-Graph-RAG
Medical-Graph-RAG
main

搜索帮助