Fix entity merging to include target entity relationships
* Include target entity in collection * Merge all relevant relationships * Prevent relationship loss * Fix merge completeness
This commit is contained in:
parent
69b4cda242
commit
38559373b3
1 changed files with 9 additions and 3 deletions
|
|
@ -1113,10 +1113,16 @@ async def amerge_entities(
|
||||||
for key, value in target_entity_data.items():
|
for key, value in target_entity_data.items():
|
||||||
merged_entity_data[key] = value
|
merged_entity_data[key] = value
|
||||||
|
|
||||||
# 4. Get all relationships of the source entities
|
# 4. Get all relationships of the source entities and target entity (if exists)
|
||||||
all_relations = []
|
all_relations = []
|
||||||
for entity_name in source_entities:
|
entities_to_collect = source_entities.copy()
|
||||||
# Get all relationships of the source entities
|
|
||||||
|
# If target entity exists, also collect its relationships for merging
|
||||||
|
if target_exists:
|
||||||
|
entities_to_collect.append(target_entity)
|
||||||
|
|
||||||
|
for entity_name in entities_to_collect:
|
||||||
|
# Get all relationships of the entities
|
||||||
edges = await chunk_entity_relation_graph.get_node_edges(entity_name)
|
edges = await chunk_entity_relation_graph.get_node_edges(entity_name)
|
||||||
if edges:
|
if edges:
|
||||||
for src, tgt in edges:
|
for src, tgt in edges:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue