Reading ontolgy with imported ontology

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

Reading ontolgy with imported ontology

Hello everybody,

I am trying to use imported ontologies and read ontologies with imports with OWLReady2.
I created 2 ontologies essai1.owl and essai2.owl using Protege (my version is 5.5)
I did two experiments :

1) Import using Protege
In essai1.owl, I use the import Ontology tool in Protege to import essai2.owl, and save the result in essai1_with_import.owl.
I used the option to import a local file.

When I read essai1_with_import.owl using get_ontology, I get the following mistake :

owlready2.base.OwlReadyOntologyParsingError: Cannot download ''!

(untitled-ontology-547 is the IRI of the imported ontology). Both ontologies are in the same folder (let's say F), and I extended my onto_path variable in Python to add F.

2) Import using OWLReady2

I created a new ontolgy using onto.imported_ontologies.append(onto2) syntax in Python and save the result to essai3.owl

When I read essai3.owl using get_ontology, it works.

When I open essai3.owl and compare it to essai1_with_import.owl (using Notepad++), I cannot see any difference. Same comparison using Protege.

So I wonder how it works. There are certainly subtelties in the behaviour of both but I cannot see them.

My end users are familiar with Protege, so I need to understand what failed in my way of doing.

Thank you in advance.

Best regards,

Reply | Threaded
Open this post in threaded view

Re: Reading ontolgy with imported ontology


In the Protégé method, Owlready need to be able to access the imported ontology for loading it. This can be done :
 * via Internet, if the ontology is available online using its IRI as an URL (this is not the case in your example)
 * in a local copy cached on disk. The directory containing the local copy must be added to the list "onto_path". I think you need to do that.