adding neo4j

This commit is contained in:
Ken Wiltshire
2024-10-25 17:45:59 -04:00
parent 526cc06e97
commit 7b589d41cf

View File

@@ -395,7 +395,17 @@ class Neo4JStorage(BaseGraphStorage):
# edge_degree
# from neo4j import GraphDatabase
async def edge_degree(self, src_id: str, tgt_id: str) -> int:
entity_name__label_source = src_id
entity_name_label_target = tgt_id
with graph_db.session() as session:
result = session.run(
"""MATCH (n1:{node_label1})-[r]-(n2:{node_label2})
RETURN count(r) AS degree"""
.format(node_label1=node_label1, node_label2=node_label2)
)
record = result.single()
return record["degree"]
# driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))
#