diff --git a/html/impl.html b/html/impl.html index 70338f619250b9f785d6fa16b8352902d8f70684..0aa1e7fd89a1c88437189b3e4159d2c8f355b3b3 100644 --- a/html/impl.html +++ b/html/impl.html @@ -172,7 +172,17 @@ Approaches</a>, Proc. International Conference on Complex, Intelligent and Software Intensive Systems (CISIS), pp.879-885, 2008</small> </dd> - +<dt>[<a href="https://sites.google.com/site/charbelweb/ontologies">ATOPAI</a>]</dt> +<dd> +ATOPAI (Alignment and annotation Tool framewOrk for Plug and plAy +Interoperability) is a graphical interface on top of the Alignment API for +matching ontologies, manipulating alignments and extracting patterns +from the Alignments. +<br /> +<small>Charbel El Kaed, Yves Denneulin, François Ottogalli, <a href="http://www.computer.org/portal/web/csdl/doi/10.1109/MDM.2011.47">On the Fly Proxy Generation for Home Devices + Interoperability</a>, Proc. 12th IEEE International Conference on + Mobile Data Management (Industrial Track), Lulea (SW), pp299-302, 2011</small> +</dd> </dl></p> @@ -543,6 +553,16 @@ Atlanta (GA US) paper 41, 2006 </small> </dd> +<dt>[noname]</dt> +<dd> +The Alignment API has been used matching classes in Java code to be migrated. +<br /><small> +Davide Ancona, Viviana Mascardi, Ombretta Pavarino. <a href="">Ontology-based + documentation extraction for semi-automatic migration of Java + code</a>, Proc. ACM Symposium on Applied Computing (SAC), 2012 +</small> +</dd> + </dl> diff --git a/html/relnotes.html b/html/relnotes.html index daf714c9b80f0cda51f919ea04657e2b1166a416..2b275568260f602c64d7dcba676633343d117020 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -63,7 +63,8 @@ with a warning: <h2>Current SVN trunk version</h2> -<!--h2>Version 4.3 (): xx/xx/2011 - Zimt</h2--> +<!--h2>Version 4.3 (): xx/02/2012 - Zimt</h2--> + <p><span style="color: red;">BEWARE:</span> All command-line utilities are now found in the <span style="color: red;">cli</span> package instead of <b>util</b>.</p> @@ -85,6 +86,7 @@ with a warning: <li>Added better error checking in <tt>toObjectAlignment</tt> (impl)</li> <li>Fixed a bug on <tt>DistanceAlignment</tt> 1:1 extraction when the second ontology is larger than the first one (impl)</li> +<li>Used more systematically <tt>finally</tt></li> </ul></p> <h2>Version 4.2 (1618): 31/05/2011 - Tring</h2> diff --git a/src/fr/inrialpes/exmo/align/cli/EvalAlign.java b/src/fr/inrialpes/exmo/align/cli/EvalAlign.java index 257835bacf42fed9ba46e78b2795283be05f2da3..3436829645e5e52003dace678abc73a572b45e7c 100644 --- a/src/fr/inrialpes/exmo/align/cli/EvalAlign.java +++ b/src/fr/inrialpes/exmo/align/cli/EvalAlign.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2008, 2010-2011 + * Copyright (C) INRIA, 2003-2008, 2010-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -197,10 +197,11 @@ public class EvalAlign { new BufferedWriter( new OutputStreamWriter( stream, "UTF-8" )), true); eval.write( writer ); - writer.flush(); - writer.close(); } catch ( IOException ex ) { ex.printStackTrace(); + } finally { + writer.flush(); + writer.close(); } } diff --git a/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java b/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java index 17bb9c289697de1dc0e3e25ee8f1ec20e9836c96..d69dc4438305b9ea16d361d0daec1d97a79797e8 100644 --- a/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/ExtGroupEval.java @@ -3,7 +3,7 @@ * * Copyright (C) 2003 The University of Manchester * Copyright (C) 2003 The University of Karlsruhe - * Copyright (C) 2003-2005, 2007-2011 INRIA + * Copyright (C) 2003-2005, 2007-2012 INRIA * Copyright (C) 2004, Université de Montréal * * This program is free software; you can redistribute it and/or @@ -439,8 +439,12 @@ public class ExtGroupEval { writer.println("<p><small>n/a: result alignment not provided or not readable<br />"); writer.println("NaN: division per zero, likely due to empty alignent.</small></p>"); writer.println("</body></html>"); + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + writer.flush(); writer.close(); - } catch (Exception ex) { ex.printStackTrace(); } + } } public void usage() { diff --git a/src/fr/inrialpes/exmo/align/cli/GenPlot.java b/src/fr/inrialpes/exmo/align/cli/GenPlot.java index eca997441ee7a4df834c0fe7ce63267327c2cde2..dff2c9615a48726b5546cf9bc620d1e677a833e3 100644 --- a/src/fr/inrialpes/exmo/align/cli/GenPlot.java +++ b/src/fr/inrialpes/exmo/align/cli/GenPlot.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2003-2011, INRIA + * Copyright (C) 2003-2012, INRIA * Copyright (C) 2004, Université de Montréal * * This program is free software; you can redistribute it and/or @@ -424,7 +424,7 @@ public class GenPlot { for( Vector<Pair> table : result ) { String algo = listAlgo.get(i); // Open one file - PrintWriter writer; + PrintWriter writer = null; try { writer = new PrintWriter ( new BufferedWriter( @@ -446,8 +446,11 @@ public class GenPlot { if ( debug > 1 ) System.err.println( " >> "+p.getX()+" - "+p.getY() ); writer.println( p.getX()*10+" "+ p.getY()*10 ); } - writer.close(); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + if ( writer != null ) writer.close(); + } // UnsupportedEncodingException + FileNotFoundException i++; } diff --git a/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java b/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java index 9b2e60542e1b591bcd8facd64d5da0ad15304904..54ab358f0d70f0744ac6194a53f22069775cb3a1 100644 --- a/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java +++ b/src/fr/inrialpes/exmo/align/cli/ParserPrinter.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2004, 2007-2008, 2011 + * Copyright (C) INRIA, 2003-2004, 2007-2008, 2011-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -234,9 +234,10 @@ public class ParserPrinter { // Throw the initial one throw aex; } + } finally { + writer.flush(); + writer.close(); } - writer.flush(); - writer.close(); } catch (Exception ex) { ex.printStackTrace(); diff --git a/src/fr/inrialpes/exmo/align/cli/Procalign.java b/src/fr/inrialpes/exmo/align/cli/Procalign.java index be94bf2210e180294f9f0521ce860a6de50891d1..8736bd45a2a22bd69b97c588f35f1cccd95172f4 100644 --- a/src/fr/inrialpes/exmo/align/cli/Procalign.java +++ b/src/fr/inrialpes/exmo/align/cli/Procalign.java @@ -3,7 +3,7 @@ * * Copyright (C) 2003 The University of Manchester * Copyright (C) 2003 The University of Karlsruhe - * Copyright (C) 2003-2008, 2010-2011 INRIA + * Copyright (C) 2003-2008, 2010-2012 INRIA * Copyright (C) 2004, Université de Montréal * * This program is free software; you can redistribute it and/or @@ -272,14 +272,16 @@ public class Procalign { usage(); throw ex; } - + // Output result.render(renderer); - writer.flush(); - writer.close(); - } catch (Exception ex) { throw ex; + } finally { + if ( writer != null ) { + writer.flush(); + writer.close(); + } } return result; } diff --git a/src/fr/inrialpes/exmo/align/cli/WGroupEval.java b/src/fr/inrialpes/exmo/align/cli/WGroupEval.java index 42a6819f3698a1fc4a81f858868a4630bb97a3c0..97c8bba4fd8f9e5db75540d2eddc4c5e6b10e5be 100644 --- a/src/fr/inrialpes/exmo/align/cli/WGroupEval.java +++ b/src/fr/inrialpes/exmo/align/cli/WGroupEval.java @@ -3,7 +3,7 @@ * * Copyright (C) 2003 The University of Manchester * Copyright (C) 2003 The University of Karlsruhe - * Copyright (C) 2003-2011, INRIA + * Copyright (C) 2003-2012, INRIA * Copyright (C) 2004, Université de Montréal * * This program is free software; you can redistribute it and/or @@ -559,9 +559,10 @@ which the program does... writer.println("<p><small>n/a: result alignment not provided or not readable<br />"); writer.println("NaN: division per zero, likely due to empty alignment.</small></p>"); if ( embedded != true ) writer.println("</body></html>"); - writer.close(); } catch (Exception ex) { ex.printStackTrace(); + } finally { + writer.close(); } } diff --git a/src/fr/inrialpes/exmo/align/gen/TestGenerator.java b/src/fr/inrialpes/exmo/align/gen/TestGenerator.java index 4ad44a4a0ecd9d9beae91cdba0cf75dae3e7fad3..154a88c71fa6a6a0371f6e49558e524d875b8dc9 100644 --- a/src/fr/inrialpes/exmo/align/gen/TestGenerator.java +++ b/src/fr/inrialpes/exmo/align/gen/TestGenerator.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) 2011, INRIA + * Copyright (C) 2011-2012, INRIA * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -114,12 +114,14 @@ public class TestGenerator { public static void writeOntology( OntModel model, String destFile, String ns ) { //System.err.println( " ==> Writing: "+ns ); + FileOutputStream fout = null; try { File f = new File( destFile ); - FileOutputStream fout = new FileOutputStream( f ); + fout = new FileOutputStream( f ); Charset defaultCharset = Charset.forName("UTF8"); RDFWriter writer = model.getWriter("RDF/XML-ABBREV"); writer.setProperty( "showXmlDeclaration","true" ); + writer.setProperty("relativeURIs","");//faster // Instructions below are Jena specific // They ensure that the default prefix (that of the ontology) is ns // This also warrants that the owl:Ontology element is generated @@ -128,31 +130,36 @@ public class TestGenerator { writer.setProperty( "xmlbase", ns ); model.createOntology( ns ); writer.write( model.getBaseModel(), new OutputStreamWriter(fout, defaultCharset), ""); - fout.close(); } catch (Exception ex) { ex.printStackTrace(); - } + } finally { + try { fout.close(); } catch (Exception ex) {}; + } } private void outputTestDirectory( OntModel onto, Alignment align, String testnumber ) { // build the directory to save the file boolean create = new File( dirprefix+"/"+testnumber ).mkdir(); + PrintWriter writer = null; // write the ontology into the directory writeOntology( onto, dirprefix+"/"+testnumber+"/"+ontoname, getURI( testnumber )); try { //write the alignment into the directory OutputStream stream = new FileOutputStream( dirprefix+"/"+testnumber+"/"+alignname ); // Outputing - PrintWriter writer = new PrintWriter ( - new BufferedWriter( - new OutputStreamWriter( stream, "UTF-8" )), true); + writer = new PrintWriter ( + new BufferedWriter( + new OutputStreamWriter( stream, "UTF-8" )), true); AlignmentVisitor renderer = new RDFRendererVisitor( writer ); align.render( renderer ); - writer.flush(); - writer.close(); } catch ( Exception ex ) { ex.printStackTrace(); - } + } finally { + if ( writer != null ) { + writer.flush(); + writer.close(); + } + } } /** diff --git a/src/fr/inrialpes/exmo/align/parser/RDFParser.java b/src/fr/inrialpes/exmo/align/parser/RDFParser.java index d34b783e7a7aadb9337484f9b7161f9e32add32b..008e6bc4620d39faef7bbf2c243884a2b8a43b0b 100644 --- a/src/fr/inrialpes/exmo/align/parser/RDFParser.java +++ b/src/fr/inrialpes/exmo/align/parser/RDFParser.java @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Digital Enterprise Research Insitute (DERI) Innsbruck * Sourceforge version 1.7 - 2008 - * Copyright (C) INRIA, 2008-2011 + * Copyright (C) INRIA, 2008-2010 * * 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 diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index b143db3e7ea20cf37d0663a983fac426dbf41801..acf4aaf140f90050faa4c0ccbef68f207df8d642 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2006-2011 + * Copyright (C) INRIA, 2006-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -411,17 +411,15 @@ public class AServProtocolManager { al = ObjectAlignment.toObjectAlignment( (URIAlignment)al ); al.render( renderer ); } - writer.flush(); - writer.close(); } catch (AlignmentException e) { - writer.flush(); - writer.close(); return new UnknownMethod(newId(),mess,myId,mess.getSender(),method,(Properties)null); } catch (Exception e) { // These are exceptions related to I/O writer.flush(); - writer.close(); - System.err.println(result.toString()); + System.err.println( result.toString() ); e.printStackTrace(); + } finally { + writer.flush(); + writer.close(); } return new RenderedAlignment(newId(),mess,myId,mess.getSender(),result.toString(),(Properties)null); @@ -874,21 +872,27 @@ public class AServProtocolManager { if ( debug ) System.err.println("JAR "+entryName); visited.add( entryName ); //System.err.println( "jarEntry is a jarfile="+je.getName() ); + InputStream jarSt = null; + OutputStream out = null; + File f = null; try { - InputStream jarSt = jar.getInputStream( (ZipEntry)entry ); - File f = File.createTempFile( "aservTmpFile"+visited.size(), "jar" ); - OutputStream out = new FileOutputStream( f ); + jarSt = jar.getInputStream( (ZipEntry)entry ); + f = File.createTempFile( "aservTmpFile"+visited.size(), "jar" ); + out = new FileOutputStream( f ); byte buf[]=new byte[1024]; int len1 ; while( (len1 = jarSt.read(buf))>0 ) out.write(buf,0,len1); - out.close(); - jarSt.close(); JarFile inJar = new JarFile( f ); exploreJar( list, visited, tosubclass, inJar, debug ); - f.delete(); } catch (IOException ioex) { System.err.println( "Cannot read embedded jar: "+ioex ); + } finally { + try { + jarSt.close(); + out.close(); + f.delete(); + } catch (Exception ex) {}; } } } diff --git a/src/fr/inrialpes/exmo/align/service/CacheImpl.java b/src/fr/inrialpes/exmo/align/service/CacheImpl.java index 2d4183b6478fb311af5bf8edf394c1bde77b439b..0c39e850aaf20dccb3a8107fd6dbc032e1aded25 100644 --- a/src/fr/inrialpes/exmo/align/service/CacheImpl.java +++ b/src/fr/inrialpes/exmo/align/service/CacheImpl.java @@ -2,7 +2,7 @@ * $Id$ * * Copyright (C) Seungkeun Lee, 2006 - * Copyright (C) INRIA, 2006-2011 + * Copyright (C) INRIA, 2006-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -220,9 +220,9 @@ public class CacheImpl { String value; URIAlignment result = new URIAlignment(); - + Statement st = null; try { - Statement st = createStatement(); + st = createStatement(); // Get basic ontology metadata query = "SELECT * FROM alignment WHERE id = '" + id +"'"; rs = st.executeQuery(query); @@ -246,11 +246,12 @@ public class CacheImpl { value = rs.getString("val"); result.setExtension( rs.getString("uri"), tag, value); } - st.close(); } catch (Exception e) { // URI exception that should not occur System.err.println("Unlikely URI exception!"); e.printStackTrace(); return null; + } finally { + try { st.close(); } catch (Exception ex) {}; } // has been extracted from the database //result.setExtension( SVCNS, STORED, "DATE"); diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java index 0bac60f043b897ef76baa5a66339cff6d38dbac3..e73a68ae53e4752add7b884e72e45e3ea7539ec6 100644 --- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2006-2011 + * Copyright (C) INRIA, 2006-2012 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -232,9 +232,10 @@ public class HTMLAServProfile implements AlignmentServiceProfile { if (bytes < 0) break; fos.write(buffer, 0, bytes); } + } catch (Exception e) { + } finally { fos.flush(); fos.close(); - } catch (Exception e) { } is.close(); params.setProperty( "content", "" );