From 2d695820ed12f7119b32a112eb410067c79c4660 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Lamercerie?=
 <aurelien.lamercerie@tetras-libre.fr>
Date: Tue, 19 Sep 2023 17:39:09 +0200
Subject: [PATCH] Refinement Management Without Parent Found

---
 .../heuristic_deducer/refine_mother_relation_1.py          | 7 ++++++-
 tests/main_tests/test_main_owl_extraction.py               | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py b/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py
index c39e8b9e..25352e93 100644
--- a/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py
+++ b/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py
@@ -90,9 +90,14 @@ def refine_mother_relation(graph):
         for row in parent_class_set:
             
             if pattern.target_class_net != row.parent_class_net:
-                # Associate mother relation between class nets
+                # Associate mother relation between target and found parent
                 new_triples = __associate_mother_relation(graph, pattern.target_class_net, row.parent_class_net)
                 rule_triple_list.extend(new_triples)
+                
+        if len(parent_class_set) == 0: # no parent found
+            # Associate mother relation between target and origin mother
+            new_triples = __associate_mother_relation(graph, pattern.target_class_net, pattern.mother_class_net)
+            rule_triple_list.extend(new_triples)
     
     return rule_label, rule_triple_list
 
diff --git a/tests/main_tests/test_main_owl_extraction.py b/tests/main_tests/test_main_owl_extraction.py
index 7ee428d0..a89785c4 100644
--- a/tests/main_tests/test_main_owl_extraction.py
+++ b/tests/main_tests/test_main_owl_extraction.py
@@ -56,7 +56,7 @@ test_data_dir = f'{INPUT_DIR_PATH}amrDocuments/'
 # onto_prefix = f'SimpleTest'
 # base_output_name = f'SimpleTest'
 
-uuid_num = '01'
+uuid_num = '02'
 amrld_dir_path = f'{test_data_dir}dev/solar-system-{uuid_num}/'
 amrld_file_path = f'{amrld_dir_path}SSC-{uuid_num}-01.stog.amr.ttl'
 base_output_name = f'SolarSystemDev{uuid_num}'
-- 
GitLab