Skip to content

Commit

Permalink
Update tugraph_store.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisonooo authored Oct 18, 2024
1 parent 630d644 commit b2d834d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions dbgpt/storage/graph_store/tugraph_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,39 +147,42 @@ def _create_schema(self):
create_vertex_gql = (
f"CALL db.createLabel("
f"'vertex', '{self._vertex_type}', "
f"'id', ['id',string,false],"
f"['name',string,false],"
f"['_document_id',string,true],"
f"['_chunk_id',string,true],"
f"['_community_id',string,true],"
f"['description',string,true])"
f"'id', ['id','string',false],"
f"['name','string',false],"
f"['_document_id','string',true],"
f"['_chunk_id','string',true],"
f"['_community_id','string',true],"
f"['description','string',true])"
)
logger.info(create_vertex_gql)
self.conn.run(create_vertex_gql)
self._add_vertex_index("_community_id")
else:
create_vertex_gql = (
f"CALL db.createLabel("
f"'vertex', '{self._vertex_type}', "
f"'id', ['id',string,false],"
f"['name',string,false])"
f"'id', ['id','string',false],"
f"['name','string',false])"
)
logger.info(create_vertex_gql)
self.conn.run(create_vertex_gql)

if not self._check_label("edge"):
create_edge_gql = f"""CALL db.createLabel(
'edge', '{self._edge_type}',
'[["{self._vertex_type}",
"{self._vertex_type}"]]',
["id",STRING,false],
["name",STRING,false])"""
["id",'STRING',false],
["name",'STRING',false])"""
if self._summary_enabled:
create_edge_gql = f"""CALL db.createLabel(
'edge', '{self._edge_type}',
'[["{self._vertex_type}",
"{self._vertex_type}"]]',
["id",STRING,false],
["name",STRING,false],
["description",STRING,true])"""
["id",'STRING',false],
["name",'STRING',false],
["description",'STRING',true])"""
logger.info(create_edge_gql)
self.conn.run(create_edge_gql)

def _format_query_data(self, data, white_prop_list: List[str]):
Expand Down

0 comments on commit b2d834d

Please sign in to comment.