stochastic "UnboundLocalError" when loading ontology

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

stochastic "UnboundLocalError" when loading ontology

cknoll
Hi,

I have an ontology file which can sometimes be loaded with owlready and sometimes I get an
UnboundLocalError
. The ontology file originally comes from an n-triples file which I converted to rdf/xml with rdflib. It might be the case that something is wrong with that file, but I find it strange that sometimes there is an error and sometimes not.

Here is the code that reproduces the error:

import owlready2 as owl2
onto = owl2.get_ontology("ontology_data/base.rdf.xml").load()

See also this notebook for the informative traceback:
https://nbviewer.ipython.org/github/cknoll/demo-material/blob/main/expertise_system/owlready_demo3.ipynb

This is the corresponding data file:

https://github.com/cknoll/demo-material/blob/main/expertise_system/ontology_data/base.rdf.xml

Any ideas how to prevent or mitigate this behavior?
Reply | Threaded
Open this post in threaded view
|

Re: stochastic "UnboundLocalError" when loading ontology

Jiba
Administrator
Hi,

I investigated the problem. It was caused by the fact that object property hasPart was declared as a subProperty of TransitiveProperty, but not with the type ObjectProperty (I suppose that this was considered as implied by the super property, but Owlready did not understand that).

I fixed that in the development version.

Jiba