From 9d7f23f1815f01919bd502c56806ac9ad1547c59 Mon Sep 17 00:00:00 2001 From: Louis-Mozart Date: Wed, 18 Dec 2024 16:34:51 +0100 Subject: [PATCH] Minor error fixed --- examples/retrieval_with_cache.py | 4 ++-- ontolearn/semantic_caching.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/retrieval_with_cache.py b/examples/retrieval_with_cache.py index 308b142..6007635 100644 --- a/examples/retrieval_with_cache.py +++ b/examples/retrieval_with_cache.py @@ -6,8 +6,8 @@ import seaborn as sns parser = argparse.ArgumentParser() -parser.add_argument('--cache_size_ratios', type=list, default=[.1], help="cache size is proportional to num_concepts, cache size = k * num_concepts") -parser.add_argument('--path_kg', type=str, default=["KGs/Family/father.owl"]) +parser.add_argument('--cache_size_ratios', type=list, default=[.1, .2, .4, .8, 1.], help="cache size is proportional to num_concepts, cache size = k * num_concepts") +parser.add_argument('--path_kg', type=str, default=["KGs/Family/family.owl", "KGs/Family/father.owl"]) parser.add_argument('--path_kge', type=list, default=None) parser.add_argument('--name_reasoner', type=str, default='EBR', choices=["EBR",'HermiT', 'Pellet', 'JFact', 'Openllet']) parser.add_argument('--eviction_strategy', type=str, default='LRU', choices=['LIFO', 'FIFO', 'LRU', 'MRU', 'RP']) diff --git a/ontolearn/semantic_caching.py b/ontolearn/semantic_caching.py index 6440887..a25339b 100644 --- a/ontolearn/semantic_caching.py +++ b/ontolearn/semantic_caching.py @@ -254,7 +254,7 @@ def initialize_cache(self, func, path_onto, third, All_individuals, handle_restr for negated_cls in tqdm(negated_class_concepts, desc=f"Adding Complement concepts"): # Compute and store complement negated_cls_str = owl_expression_to_dl(negated_cls) - cached = self.cache.get(concept_str) or None + cached = self.cache.get(negated_cls_str.split("¬")[-1]) if cached is None: cached = func(negated_cls, path_onto, third) neg = All_individuals - cached @@ -554,6 +554,3 @@ def run_cache(path_kg:str, path_kge:str, cache_size:int, name_reasoner:str, evic 'avg_jaccard_reas': f"{sum(Avg_jaccard_reas) / len(Avg_jaccard_reas):.3f}", 'strategy': eviction }, D - - -