Ontolearn is an open-source software library for explainable structured machine learning in Python. It learns OWL class expressions from positive and negative examples.
Traceback (most recent call last):
File "/local/upb/users/q/quannian/profiles/unix/cs/Pycharm_Project/Ontolearn-0.7.3/Ontolearn/examples/concept_learning_drill_[train.py](http://train.py/)", line 125, in <module>
start(parser.parse_args())
File "/local/upb/users/q/quannian/profiles/unix/cs/Pycharm_Project/Ontolearn-0.7.3/Ontolearn/examples/concept_learning_drill_[train.py](http://train.py/)", line 50, in start
drill.train(num_of_target_concepts=args.num_of_target_concepts,
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/learners/[drill.py](http://drill.py/)", line 263, in train
sum_of_rewards_per_actions = self.rl_learning_loop(pos_uri=frozenset(positives),
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/learners/[drill.py](http://drill.py/)", line 224, in rl_learning_loop
sequence_of_states, rewards = self.sequence_of_actions(root_rl_state)
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/learners/[drill.py](http://drill.py/)", line 464, in sequence_of_actions
next_rl_states = list(self.apply_refinement(current_state))
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/learners/[drill.py](http://drill.py/)", line 444, in apply_refinement
for i in self.operator.refine(rl_state.concept): # O(N)
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/refinement_[operators.py](http://operators.py/)", line 249, in refine
for i in self.refine_top():
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/refinement_[operators.py](http://operators.py/)", line 111, in refine_top
most_general_concepts = [i for i in self.kb.get_most_general_classes()]
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/refinement_[operators.py](http://operators.py/)", line 111, in <listcomp>
most_general_concepts = [i for i in self.kb.get_most_general_classes()]
File "/upb/users/q/quannian/profiles/unix/cs/.conda/envs/ontolearn-0.7.3/lib/python3.10/site-packages/ontolearn/knowledge_[base.py](http://base.py/)", line 795, in get_most_general_classes
yield from self.class_hierarchy.roots()
AttributeError: 'TripleStoreKnowledgeBase' object has no attribute 'class_hierarchy'
It seems like the class_hierarchy attribute is never created because the TripleStoreKnowledgeBase initializes its superclass KnowledgeBase with load_class_hierarchy=False (see here).
Currently, we do not support TripleStoreKnowledgeBasefor the time being.
So, please use TripleStore()
DRILL is not designed to acces class hiearahrcy :)
Problem
DRILL crashes with the following stack trace:
Recreate problem
Adapt the example script of DRILL in the following way:
Possible source
It seems like the
class_hierarchy
attribute is never created because theTripleStoreKnowledgeBase
initializes its superclassKnowledgeBase
withload_class_hierarchy=False
(see here).