From 022f06f32efaa9ffb7b666d5d2074522f9a5de50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr>
Date: Wed, 7 May 2014 09:04:36 +0000
Subject: [PATCH] - fixed two bugs with network storage management

---
 src/fr/inrialpes/exmo/align/service/SQLCache.java    |  2 ++
 .../inrialpes/exmo/align/service/VolatilCache.java   | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/fr/inrialpes/exmo/align/service/SQLCache.java b/src/fr/inrialpes/exmo/align/service/SQLCache.java
index f6e29ab2..a60bb991 100644
--- a/src/fr/inrialpes/exmo/align/service/SQLCache.java
+++ b/src/fr/inrialpes/exmo/align/service/SQLCache.java
@@ -633,6 +633,8 @@ public class SQLCache extends VolatilCache implements Cache {
 		    st = createStatement();
 		    logger.debug( "Storing network {} as {}", uri, id );
 		    conn.setAutoCommit( false );
+		    // Declare ontology network
+		    st.executeUpdate("INSERT INTO network (id) VALUES ("+qid+");");
 		    // Store alignments
 		    for ( Alignment align : network.getAlignments() ) {
 			String alid = align.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
diff --git a/src/fr/inrialpes/exmo/align/service/VolatilCache.java b/src/fr/inrialpes/exmo/align/service/VolatilCache.java
index dd3ab00a..26a5fd2d 100644
--- a/src/fr/inrialpes/exmo/align/service/VolatilCache.java
+++ b/src/fr/inrialpes/exmo/align/service/VolatilCache.java
@@ -310,10 +310,14 @@ public class VolatilCache implements Cache {
      * retrieve network of ontologies from id
      */
     public OntologyNetwork getOntologyNetwork( String uri ) throws AlignmentException {
-	OntologyNetwork result = onetworkTable.get( uri );
-	if ( result == null )
-	    throw new AlignmentException("Cannot find ontology network "+uri);
-	return result;
+	try {
+	    OntologyNetwork result = onetworkTable.get( new URI( uri ) );
+	    if ( result == null )
+		throw new AlignmentException("Cannot find ontology network "+uri);
+	    return result;
+	} catch (URISyntaxException uriex) {
+	    throw new AlignmentException( "URI Syntax exception: "+uri, uriex );
+	}
     }
 	
     public void flushCache() { // throws AlignmentException
-- 
GitLab