@@ -91,7 +91,7 @@ this will return a list of dictionaries with the following structure
9191}
9292```
9393
94- Example using Neo4j
94+ Example using FalkorDB
9595``` python
9696relationships = graph.get_relationships_as_objects()
9797nodes = graph.get_nodes_as_objects()
@@ -111,6 +111,7 @@ graph_manager.close()
111111# Taken from blarify/examples/graph_builder.py
112112from blarify.prebuilt.graph_builder import GraphBuilder
113113from blarify.db_managers.neo4j_manager import Neo4jManager
114+ from blarify.db_managers.falkordb_manager import FalkorDBManager
114115
115116import dotenv
116117import os
@@ -123,7 +124,7 @@ def build(root_path: str = None):
123124 relationships = graph.get_relationships_as_objects()
124125 nodes = graph.get_nodes_as_objects()
125126
126- save_to_neo4j (relationships, nodes)
127+ save_to_falkordb (relationships, nodes)
127128
128129
129130def save_to_neo4j (relationships , nodes ):
@@ -134,7 +135,19 @@ def save_to_neo4j(relationships, nodes):
134135 graph_manager.close()
135136
136137
138+ def save_to_falkordb (relationships , nodes ):
139+ graph_manager = FalkorDBManager(repo_id = " repo" , entity_id = " organization" )
140+
141+ print (f " Saving graph with { len (nodes)} nodes and { len (relationships)} relationships " )
142+ graph_manager.save_graph(nodes, relationships)
143+ graph_manager.close()
144+
145+
137146if __name__ == " __main__" :
147+ import logging
148+
149+ logging.basicConfig(level = logging.INFO )
150+
138151 dotenv.load_dotenv()
139152 root_path = os.getenv(" ROOT_PATH" )
140153 build(root_path = root_path)
0 commit comments