From 0c856bbd4b3948722907f90cf88846c961a645e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20L=C3=B3pez-Doriga?= Date: Tue, 16 Jan 2024 17:59:34 +0100 Subject: [PATCH] get descendants fixed --- beacon/db/get_descendants.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/beacon/db/get_descendants.py b/beacon/db/get_descendants.py index fbb18978..9def0439 100644 --- a/beacon/db/get_descendants.py +++ b/beacon/db/get_descendants.py @@ -33,22 +33,22 @@ def load_ontology(ontology_id: str) -> Optional[owlready2.Ontology]: urllib.request.urlretrieve(url, path, MyProgressBar()) except HTTPError: # TODO: Handle error - print("ERROR", HTTPError) + #print("ERROR", HTTPError) pass except ValueError: - print("ERROR", ValueError) + #print("ERROR", ValueError) pass try: - print (os.stat(path).st_size) + #print (os.stat(path).st_size) if os.stat(path).st_size == 0: try: urllib.request.urlretrieve(url_alt, path, MyProgressBar()) except HTTPError: # TODO: Handle error - print("ERROR", HTTPError) + #print("ERROR", HTTPError) pass except ValueError: - print("ERROR", ValueError) + #print("ERROR", ValueError) pass except Exception: pass @@ -127,16 +127,19 @@ def get_descendants_and_similarities(ontology:str): path = "/beacon/beacon/db/similarities/{}{}{}.txt".format(ontology_list[0],ontology_list[1],'high') with open(path, 'w') as f: for item in similarity_high: + print(item) f.write(item+"\n") f.close() path = "/beacon/beacon/db/similarities/{}{}{}.txt".format(ontology_list[0],ontology_list[1],'medium') with open(path, 'w') as f: for item in similarity_medium: + print(item) f.write(item+"\n") f.close() path = "/beacon/beacon/db/similarities/{}{}{}.txt".format(ontology_list[0],ontology_list[1],'low') with open(path, 'w') as f: for item in similarity_low: + print(item) f.write(item+"\n") f.close()