From 6d58eda93c8fa789a96c412f8af3c0f7e51ae413 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr>
Date: Tue, 12 Oct 2010 07:52:49 +0000
Subject: [PATCH] - fixed the problem with loading twice the same ontology from
 different files

---
 .../exmo/ontowrap/owlapi30/OWLAPI3OntologyFactory.java      | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3OntologyFactory.java b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3OntologyFactory.java
index a0522855..f4f340ea 100644
--- a/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3OntologyFactory.java
+++ b/src/fr/inrialpes/exmo/ontowrap/owlapi30/OWLAPI3OntologyFactory.java
@@ -100,8 +100,10 @@ public class OWLAPI3OntologyFactory extends OntologyFactory {
 	    // This is a cache failure
 	    throw new OntowrapException("Already loaded [doc cache failure] " + uri, oodaeex );
 	} catch ( OWLOntologyAlreadyExistsException ooaeex ) {
-	    // This is a cache failure
-	    throw new OntowrapException("Already loaded [owl cache failure] " + uri, ooaeex );
+	    // This happens when the ontology has been loaded from a different URIs
+	    ontology = manager.getOntology( ooaeex.getOntologyID() );
+	    if ( ontology == null )
+		throw new OntowrapException("Already loaded [owl cache failure] " + uri, ooaeex );
 	} catch ( OWLOntologyCreationException oocex ) {
 	    oocex.printStackTrace();
 	    throw new OntowrapException("Cannot load " + uri, oocex );
-- 
GitLab