Skip to content

Commit 70d95c2

Browse files
committed
Fix Cache Ontology Set Bug
The Cache Ontology Set functionality was broken due to the previous refactoring. It has now been fixed
1 parent 38b7fde commit 70d95c2

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

test/simple-test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ def main():
1010
# cached_onto = text2term.cache_ontology("EFO")
1111
# # df = cached_onto.map_terms(["asthma", "disease location", "obsolete food allergy"], excl_deprecated=True, term_type="classes")
1212
# print("Cache exists:", cached_onto.cache_exists())
13-
# df = text2term.map_terms(["asthma", "disease location", "obsolete food allergy"], "EFO", excl_deprecated=True, use_cache=True, term_type="classes")
14-
df = text2term.map_terms(["contains", "asthma"], "EFO", term_type="classes")
13+
caches = text2term.cache_ontology_set("text2term/resources/ontologies.csv")
14+
df = text2term.map_terms(["asthma", "disease location", "obsolete food allergy"], "EFO", excl_deprecated=True, use_cache=True, term_type="classes")
15+
# df = text2term.map_terms(["contains", "asthma"], "EFO", term_type="classes")
1516
print(df.to_string())
1617

1718
if __name__ == '__main__':

text2term/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "2.3.0"
1+
VERSION = "2.3.1"

text2term/onto_cache.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import os
44
from shutil import rmtree
55
import sys
6+
import pandas as pd
7+
import owlready2
68

79
"""
810
CACHING FUNCTIONS -- Public
@@ -16,7 +18,8 @@ def cache_ontology_set(ontology_registry_path):
1618
cache = text2term.cache_ontology(row.url, row.acronym)
1719
cache_set.update({row.acronym : cache})
1820
except Exception as err:
19-
sys.stderr.write("Could not cache ontology", row.acronym, "due to error:", err)
21+
err_message = "Could not cache ontology " + row.acronym + " due to error: " + str(err)
22+
sys.stderr.write(err_message)
2023
owlready2.default_world.ontologies.clear()
2124
return cache_set
2225

0 commit comments

Comments
 (0)