Reputation: 11
I am trying to load two ontologies using OWL-api in Java. They way I load them is this:
String onto1_iri = "http://purl.obolibrary.org/obo/psdo.owl"
String onto2_iri = "http://purl.obolibrary.org/obo/stato.owl";
OWLOntologyManager onto_manager = OWLManager.createOWLOntologyManager();
OWLOntology onto1 = onto_manager.loadOntology(IRI.create(onto1_iri.trim()));
OWLOntology onto2 = onto_manager.loadOntology(IRI.create(onto2_iri.trim()));
I've been working on this project for four weeks, yet until next week, everything was running perfect. However, I tried to rerun the code two days ago, and I got the error OWLOntologyDocumentAlreadyExistsException
. I've been trying to find what causes the error, and based on the owl-api documentation, it says, An exception that describes the situation where there was an attempt to create or load an ontology where the corresponding ontology document IRI already was already mapped to an ontology.
Yet, I am unable to find a solution...
Is there any way I can resolve this problem, somehow? This image below shows the message it throws.
Upvotes: 1
Views: 39
Reputation: 4787
First determine which IRI is it complaining about. This you can do by catching the OWLOntologyDocumentAlreadyExistsException
and by printing out the IRI. See OWLOntologyDocumentAlreadyExistsException docs.
Secondly, this failing most likely due to changes in STATO. I suggest having a look at their Github repo in this regard. You will notice that they have made changes in the last few days.
Upvotes: 1
Reputation: 10684
Did the ontologies being loaded, or their imports closure, change in the last few weeks?
The error you're seeing happens when an ontology getting loaded clashes with an already loaded one - specifically, the same ontology document appears to be referenced twice with different contents. This can happen if two different URLs in the imports closure of both ontologies load two different ontologies with the same ontology IRI (e.g., two different versions of the same ontology. Imports do not allow for a version to be specified, which is part of the reason two different versions of the same ontology cannot coexist in one manager.
Assuming that some ontology changes outside your control have happened, the first thing I'd try is to use one manager for each ontology - this would work around the problem, if the conflict is in the merged imports closures (one manager has to resolve all imports closure ontologies from the same map of ontology IRIs to ontologies, while two would not have that constraint).
If that doesn't help, then the conflicting imports need to be identified. Creating an issue on the owlapi GitHub repo id probably the best way.
Upvotes: 1