24
24
from src .make_relationships import *
25
25
from src .document_sources .web_pages import *
26
26
from src .graph_query import get_graphDB_driver
27
- from src .graph_query import get_graphDB_driver
28
27
import re
29
28
from langchain_community .document_loaders import WikipediaLoader , WebBaseLoader
30
29
import warnings
@@ -402,7 +401,6 @@ async def processing_source(uri, userName, password, database, model, file_name,
402
401
obj_source_node .processing_time = processed_time
403
402
obj_source_node .processed_chunk = select_chunks_upto + select_chunks_with_retry
404
403
if retry_condition == START_FROM_BEGINNING :
405
- result = execute_graph_query (graph ,QUERY_TO_GET_NODES_AND_RELATIONS_OF_A_DOCUMENT , params = {"filename" :file_name })
406
404
result = execute_graph_query (graph ,QUERY_TO_GET_NODES_AND_RELATIONS_OF_A_DOCUMENT , params = {"filename" :file_name })
407
405
obj_source_node .node_count = result [0 ]['nodes' ]
408
406
obj_source_node .relationship_count = result [0 ]['rels' ]
@@ -506,10 +504,6 @@ async def processing_chunks(chunkId_chunkDoc_list,graph,uri, userName, password,
506
504
logging .info (f'Time taken to create relationship between chunk and entities: { elapsed_relationship :.2f} seconds' )
507
505
latency_processing_chunk ["relationship_between_chunk_entity" ] = f'{ elapsed_relationship :.2f} '
508
506
509
- graphDb_data_Access = graphDBdataAccess (graph )
510
- count_response = graphDb_data_Access .update_node_relationship_count (file_name )
511
- node_count = count_response [file_name ].get ('nodeCount' ,"0" )
512
- rel_count = count_response [file_name ].get ('relationshipCount' ,"0" )
513
507
graphDb_data_Access = graphDBdataAccess (graph )
514
508
count_response = graphDb_data_Access .update_node_relationship_count (file_name )
515
509
node_count = count_response [file_name ].get ('nodeCount' ,"0" )
@@ -536,7 +530,6 @@ def get_chunkId_chunkDoc_list(graph, file_name, pages, token_chunk_size, chunk_o
536
530
else :
537
531
chunkId_chunkDoc_list = []
538
532
chunks = execute_graph_query (graph ,QUERY_TO_GET_CHUNKS , params = {"filename" :file_name })
539
- chunks = execute_graph_query (graph ,QUERY_TO_GET_CHUNKS , params = {"filename" :file_name })
540
533
541
534
if chunks [0 ]['text' ] is None or chunks [0 ]['text' ]== "" or not chunks :
542
535
raise LLMGraphBuilderException (f"Chunks are not created for { file_name } . Please re-upload file and try again." )
@@ -548,13 +541,11 @@ def get_chunkId_chunkDoc_list(graph, file_name, pages, token_chunk_size, chunk_o
548
541
if retry_condition == START_FROM_LAST_PROCESSED_POSITION :
549
542
logging .info (f"Retry : start_from_last_processed_position" )
550
543
starting_chunk = execute_graph_query (graph ,QUERY_TO_GET_LAST_PROCESSED_CHUNK_POSITION , params = {"filename" :file_name })
551
- starting_chunk = execute_graph_query (graph ,QUERY_TO_GET_LAST_PROCESSED_CHUNK_POSITION , params = {"filename" :file_name })
552
544
553
545
if starting_chunk and starting_chunk [0 ]["position" ] < len (chunkId_chunkDoc_list ):
554
546
return len (chunks ), chunkId_chunkDoc_list [starting_chunk [0 ]["position" ] - 1 :]
555
547
556
548
elif starting_chunk and starting_chunk [0 ]["position" ] == len (chunkId_chunkDoc_list ):
557
- starting_chunk = execute_graph_query (graph ,QUERY_TO_GET_LAST_PROCESSED_CHUNK_WITHOUT_ENTITY , params = {"filename" :file_name })
558
549
starting_chunk = execute_graph_query (graph ,QUERY_TO_GET_LAST_PROCESSED_CHUNK_WITHOUT_ENTITY , params = {"filename" :file_name })
559
550
return len (chunks ), chunkId_chunkDoc_list [starting_chunk [0 ]["position" ] - 1 :]
560
551
@@ -734,7 +725,6 @@ def manually_cancelled_job(graph, filenames, source_types, merged_dir, uri):
734
725
delete_uploaded_local_file (merged_file_path ,file_name )
735
726
return "Cancelled the processing job successfully"
736
727
737
- def populate_graph_schema_from_text (text , model , is_schema_description_checked , is_local_storage ):
738
728
def populate_graph_schema_from_text (text , model , is_schema_description_checked , is_local_storage ):
739
729
"""_summary_
740
730
@@ -748,8 +738,6 @@ def populate_graph_schema_from_text(text, model, is_schema_description_checked,
748
738
"""
749
739
result = schema_extraction_from_text (text , model , is_schema_description_checked , is_local_storage )
750
740
return result
751
- result = schema_extraction_from_text (text , model , is_schema_description_checked , is_local_storage )
752
- return result
753
741
754
742
def set_status_retry (graph , file_name , retry_condition ):
755
743
graphDb_data_Access = graphDBdataAccess (graph )
@@ -762,7 +750,6 @@ def set_status_retry(graph, file_name, retry_condition):
762
750
if retry_condition == DELETE_ENTITIES_AND_START_FROM_BEGINNING or retry_condition == START_FROM_BEGINNING :
763
751
obj_source_node .processed_chunk = 0
764
752
if retry_condition == DELETE_ENTITIES_AND_START_FROM_BEGINNING :
765
- execute_graph_query (graph ,QUERY_TO_DELETE_EXISTING_ENTITIES , params = {"filename" :file_name })
766
753
execute_graph_query (graph ,QUERY_TO_DELETE_EXISTING_ENTITIES , params = {"filename" :file_name })
767
754
obj_source_node .node_count = 0
768
755
obj_source_node .relationship_count = 0
0 commit comments