Re: Issues using W3C Time Ontology

Posted by cknoll on
URL: http://owlready.306.s1.nabble.com/Issues-using-W3C-Time-Ontology-tp2204p2231.html

I had a look on my example and noticed that I had messed up the different world-objects ("world3" was never used).

My current knowledge-status on this matter is: It seems to need one failing attempt to load the ontology, but the second attempt will work. See full example notebook here:

https://nbviewer.jupyter.org/github/cknoll/demo-material/blob/main/expertise_system/experimental_onto_conversion.ipynb#Short-Version-(works-with-freshly-restarted-kernel)


Short version:

from owlready2 import *
try:
    # while the following attempt fails, it is necessary to enable to load this ontology later
    ctime = default_world.get_ontology('http://ontology.eil.utoronto.ca/tove/ctime.owl').load()
except OwlReadyOntologyParsingError:
    print(f"could not import ontology on first attempt" )


time = default_world.get_ontology('time.owl').load()

# this now works
ctime = default_world.get_ontology('http://ontology.eil.utoronto.ca/tove/ctime.owl').load()