From 0bc157e1ec434e080c25e1aeb3602739b91afaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Wed, 8 Jun 2016 09:07:53 +0000 Subject: [PATCH] - Fixed a bug in SQLCache loading from database which prevented to reload EDOAL ontologies (serv) --- html/relnotes.html | 2 ++ src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java | 4 +++- src/fr/inrialpes/exmo/align/service/SQLCache.java | 10 +++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/html/relnotes.html b/html/relnotes.html index 8dfe172f..642a3f05 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -60,6 +60,8 @@ with a warning: <!--h2>Version 4.9 (2xxx): ??/??/201X - Letraset</h2--> <p><ul compact="1"> +<li><span style="color: red;">Suppressed</span> empty constructor in <tt>DBServiceImpl</tt> (serv)</li> +<li>Fixed a bug in <tt>SQLCache</tt> loading from database which prevented to reload EDOAL ontologies (serv)</li> <li>Fixed a problem with Jade when running a server with no X server running (serv)</li> <li>Moved all shell examples from csh to bash (html)</li> <li>Clarified EDOAL documentation (html)</li> diff --git a/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java b/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java index bd6420f4..d5492544 100644 --- a/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/EDOALSQLCache.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2014-2015 + * Copyright (C) INRIA, 2014-2016 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -236,6 +236,7 @@ public class EDOALSQLCache { } public Expression extractExpression( long intid ) throws SQLException, AlignmentException { + logger.trace( "extractExpression for Id = {} ", intid ); try ( Statement st = service.getConnection().createStatement() ) { ResultSet rs = st.executeQuery( "SELECT type,joinid FROM edoalexpr WHERE intid='"+intid+"'" ); if ( !rs.next() ) throw new AlignmentException( "Cannot retrieve EDOAL expression : "+intid ); @@ -295,6 +296,7 @@ public class EDOALSQLCache { ResultSet rs = st.executeQuery( "SELECT uri FROM classid WHERE intid='"+intid+"'" ); if ( !rs.next() ) throw new AlignmentException( "Cannot retrieve class id : "+intid ); try { + logger.trace( "Identified ClassId = {}", rs.getString( "uri" ) ); return new ClassId( new URI( rs.getString( "uri" ) ) ); } catch ( URISyntaxException urisex ) { diff --git a/src/fr/inrialpes/exmo/align/service/SQLCache.java b/src/fr/inrialpes/exmo/align/service/SQLCache.java index 13be632b..ea2eabbc 100644 --- a/src/fr/inrialpes/exmo/align/service/SQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/SQLCache.java @@ -289,14 +289,15 @@ public class SQLCache extends VolatilCache implements Cache { if ( confClassName != null ) { result.setConfidenceType( confClassName ); } - onto1 = rs.getString( "onto1" ); - onto2 = rs.getString( "onto2" ); // Get the ontolologies + onto1 = rs.getString( "onto1" ); + onto2 = rs.getString( "onto2" ); retrieveOntology( onto1, result.getOntologyObject1() ); result.setExtension( SVCNS, OURI1, onto1 ); retrieveOntology( onto2, result.getOntologyObject2() ); result.setExtension( SVCNS, OURI2, onto2 ); + result.init( result.getOntologyObject1(), result.getOntologyObject2() ); // Get dependencies if necessary @@ -325,7 +326,6 @@ public class SQLCache extends VolatilCache implements Cache { ResultSet rs = st.executeQuery( "SELECT * FROM ontology WHERE uri = '" + uri +"'" ); if ( rs.next() ) { ob.setURI( new URI(rs.getString("uri")) ); - // I am really surprised by this if ( rs.getString("file") != null ) ob.setFile( new URI( rs.getString("file") ) ); if ( rs.getString("formuri") != null ) ob.setFormURI( new URI( rs.getString("formuri") ) ); if ( rs.getString("formname") != null ) ob.setFormalism( rs.getString("formname") ); @@ -366,8 +366,12 @@ public class SQLCache extends VolatilCache implements Cache { } else { // load the cell (if this is not a URIAlignment, this is an EDOALAlignment) esrv = new EDOALSQLCache( service ); esrv.init(); + logger.debug( " Entity1" ); Object ent1 = esrv.extractExpression( Long.parseLong( rs.getString("uri1") ) ); + logger.debug( "{}", ent1 ); + logger.debug( " Entity2" ); Object ent2 = esrv.extractExpression( Long.parseLong( rs.getString("uri2") ) ); + logger.debug( "{}", ent2 ); if ( ent1 == null || ent2 == null ) break; cell = ((EDOALAlignment)alignment).addAlignCell( ent1, ent2, rs.getString("relation"), Double.parseDouble(rs.getString("measure")) ); } -- GitLab