[FIX AVAILABLE] Issue with cyclic subclass of/subproperty of detection

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

[FIX AVAILABLE] Issue with cyclic subclass of/subproperty of detection

Federico López
This post was updated on .
I'm trying to load http://www.ontobee.org/ontology/EFO (available as OWL in http://www.ebi.ac.uk/efo/efo.owl)

Using:
    onto_path.append('~/ontologies/efo.owl')
    ontology = get_ontology('http://www.ebi.ac.uk/efo/efo.owl').load()

Then I try to iterate over the ontology classes using:
    for ontology_class in ontology.classes():


But I'm getting this error:

    for ontology_class in ontology.classes():
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:143: in classes
    if not s.startswith("_"): yield self.world._get_by_storid(s)
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:338: in _get_by_storid
    return self._get_by_storid2(storid, full_iri, main_type, main_onto, default_to_none, ())
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:375: in _get_by_storid2
    obj = self._get_by_storid2(obj, None, main_type, main_onto, trace)
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:375: in _get_by_storid2
    obj = self._get_by_storid2(obj, None, main_type, main_onto, trace)
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:375: in _get_by_storid2
    obj = self._get_by_storid2(obj, None, main_type, main_onto, trace)
../.venv/lib/python3.6/site-packages/owlready2/namespace.py:375: in _get_by_storid2
    obj = self._get_by_storid2(obj, None, main_type, main_onto, trace)
E   RecursionError: maximum recursion depth exceeded
!!! Recursion detected (same locals & position)

Any ideas of why is this happening?

Cheers!

Federico

Reply | Threaded
Open this post in threaded view
|

Re: Issues iterating over classes on the Experimental Factor Ontology

Federico López
I think I have found the issue in namespace.py:410 (https://bitbucket.org/jibalamy/owlready2/src/b50d3c6120537e3620dc0f8b8cedf14956f0a3ed/namespace.py?at=default&fileviewer=file-view-default#namespace.py-410) the recursive call is wrong:

   obj = self._get_by_storid2(obj, None, main_type, main_onto, trace)

When it should be:
  obj = self._get_by_storid2(obj, None, main_type, main_onto, default_to_none, trace)

The default_to_none parameter is missing, therefor trace is always None and the recursion never ends.
Reply | Threaded
Open this post in threaded view
|

Re: Issues iterating over classes on the Experimental Factor Ontology

Jiba
Administrator
Hi,

Yes you are right. default_to_none is a recent addition and I forget to add it in this call.

I'm applying your fix.

Thank you,
Jiba