stochastic "UnboundLocalError" when loading ontology
I have an ontology file which can sometimes be loaded with owlready and sometimes I get an
. 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()
Re: stochastic "UnboundLocalError" when loading ontology
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).