stack overflow error during readin of ontologies

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

stack overflow error during readin of ontologies

AleSteB
With some ontologies, I get a stack overflow error during readin of the respective ontology using owlready2's get_ontology(URL).load()

This often is due to contained obsolete classes and deprecated object properties within the ontology file.
My workaround is to manual delete the obsolete classes and object properties within the ontology file with Protégé and then saving the resulting file in rdf/xml as a local copy.
Afterwards you can use get_ontology('./local_path_to_ontology/ontology_name.owl').load() to load the 'fixed' ontology.
Reply | Threaded
Open this post in threaded view
|

Re: stack overflow error during readin of ontologies

Jiba
Administrator
Hello,

Thank you for reporting this problem. Could you provide me an example of an ontology that causes the stack overflow error ?

This is probably due to recursive function calls, and might be solved be rewriting them as loop (if possible).

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: stack overflow error during readin of ontologies

AleSteB
Hello Jiba,

an example would be the CHEMINF ontology
(http://semanticchemistry.github.io/semanticchemistry/ontology/cheminf.owl)

to reproduce the error:

from owlready2 import *
load_onto = get_ontology('http://semanticchemistry.github.io/semanticchemistry/ontology/cheminf.owl').load()

then executing
len(list(load_onto.classes()))

results in a restarting kernel (Spyder, Python 3.10) after several lines of
File "C:\Users\...\anaconda3\lib\site-packages\owlready2\namespace.py", line 668 in _load_by_storid

AleSteB
Reply | Threaded
Open this post in threaded view
|

Re: stack overflow error during readin of ontologies

Jiba
Administrator
Hello,

I tried that ontology, but I do not obtain stack overflow error.

I get a few warnings about cyclic subclass of, as follows:

* Owlready2 * Warning: ignoring cyclic subclass of/subproperty of, involving:
  http://purl.obolibrary.org/obo/BFO_0000015

* Owlready2 * Warning: ignoring cyclic subclass of/subproperty of, involving:
  http://semanticscience.org/resource/CHEMINF_000356


Do you also obtain the stack overflow error if you run your program outside Spyder? It might add some level of function calls, and thus reduce the remaining space on the stack.

Jiba