Save seems to mess with IRI

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

Save seems to mess with IRI

KayJay
Hello,

Thank you for your work, it's great to have a Python API for dealing with ontologies.
I have no problem so far to load an ontology created with Protégé (the base_iri is valid) and to populate it. I specifically used the following commands to create a new instance (in a class already existing):
1) className = IRIS(onto.base_iri + "name of the class")
2) instance = className("name of the instance")

Then I saved the ontology. So far, everything was ok, I checked with Owlready2 that the instance was created where it should.

The problem is that when I open the saved ontology with Protégé, the new instance is created, but is linked to a new class which has the same name as my existing class before using Owlready2. They however are different since the new created class has the right IRI (with base_iri at the beginning) but all the other classes, which were present before I loaded the ontology with Owlready2, have now a different IRI name (no more base_iri, only "#class name").

Did I do something wrong?
KayJay
Reply | Threaded
Open this post in threaded view
|

Re: Save seems to mess with IRI

Jiba
Administrator
Hello,

Your approach seem Ok. Could you send me a small ontology and program that reproduce the problem, please?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Save seems to mess with IRI

KayJay
Hello,

Sorry for the late answer, I was working on something else.

I have tried with a small example and have finally found what was the problem. I had changed with Protégé the ontology IRIs and replaced the "http" prefix with "urn:absolute:". Apparently, this is not supported IRIs in Owlready since after having loaded and saved the ontology with Owlready, all the "urn:absolute" prefixes were removed from the class names in Protégé. I solved my problem by changing back the ontology IRIs with a "http" prefix.

Kayjay