Ontolearn icon indicating copy to clipboard operation
Ontolearn copied to clipboard

Saving an OWLClasss with save_owl_class_expressions

Open Demirrr opened this issue 2 years ago • 0 comments

An owl class cannot be saved at the moment.

from owlapy.model import IRI, OWLObjectOneOf, OWLClass
from ontolearn.utils.static_funcs import save_owl_class_expressions
save_owl_class_expressions(OWLClass(IRI.create('http://www.benchmark.org/family#Brother')))

Traceback (most recent call last):
  File "/home/demir/Desktop/Softwares/Ontolearn/ontolearn/utils/static_funcs.py", line 182, in save_owl_class_expressions
    manager.add_axiom(ontology, equivalent_classes_axiom)
  File "/home/demir/Desktop/Softwares/Ontolearn/ontolearn/base/_base.py", line 100, in add_axiom
    axioms._add_axiom(axiom, ontology, self._world)
  File "/home/demir/anaconda3/envs/venv/lib/python3.10/functools.py", line 889, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/home/demir/Desktop/Softwares/Ontolearn/ontolearn/base/axioms.py", line 156, in _
    ce_2_x.equivalent_to.append(ce_1_x)
  File "/home/demir/anaconda3/envs/venv/lib/python3.10/site-packages/owlready2/util.py", line 89, in append
    def append(self, x):          old = list(self); super().append(x)         ; self._callback(self._obj, old)
  File "/home/demir/anaconda3/envs/venv/lib/python3.10/site-packages/owlready2/entity.py", line 219, in _class_equivalent_to_changed
    if not x.equivalent_to._indirect is None:
AttributeError: 'NoneType' object has no attribute 'equivalent_to'

Exception at creating OWLEquivalentClassesAxiom
OWLEquivalentClassesAxiom([OWLClass(IRI('https://dice-research.org/predictions#','Brother')), OWLClass(IRI('http://www.benchmark.org/family#','Brother'))],[])
OWLClass(IRI('https://dice-research.org/predictions#','Brother'))
OWLClass(IRI('http://www.benchmark.org/family#','Brother'))
[OWLClass(IRI('http://www.benchmark.org/family#','Brother'))]

Demirrr avatar Apr 03 '24 10:04 Demirrr