Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ff35aedf authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- Better catched exceptions

parent ebc7fc68
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ package fr.inrialpes.exmo.align.util; ...@@ -30,6 +30,7 @@ package fr.inrialpes.exmo.align.util;
//import org.semanticweb.owl.model.OWLOntology; //import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.align.Alignment; import org.semanticweb.owl.align.Alignment;
import org.semanticweb.owl.align.AlignmentException;
import org.semanticweb.owl.align.Parameters; import org.semanticweb.owl.align.Parameters;
import org.semanticweb.owl.align.Evaluator; import org.semanticweb.owl.align.Evaluator;
...@@ -43,6 +44,7 @@ import java.io.OutputStream; ...@@ -43,6 +44,7 @@ import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.IOException;
import java.lang.Integer; import java.lang.Integer;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
...@@ -50,6 +52,7 @@ import java.util.Enumeration; ...@@ -50,6 +52,7 @@ import java.util.Enumeration;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import gnu.getopt.LongOpt; import gnu.getopt.LongOpt;
import gnu.getopt.Getopt; import gnu.getopt.Getopt;
...@@ -247,8 +250,10 @@ public class GroupOutput { ...@@ -247,8 +250,10 @@ public class GroupOutput {
for ( int i=0; i<tests.length; i++ ){//size() or length for ( int i=0; i<tests.length; i++ ){//size() or length
if ( debug > 1 ) System.err.println(" tests: "+tests[i]); if ( debug > 1 ) System.err.println(" tests: "+tests[i]);
String prefix = dir.toURI().toString()+"/"+tests[i]+"/"; String prefix = dir.toURI().toString()+"/"+tests[i]+"/";
PRecEvaluator evaluator = (PRecEvaluator)eval( prefix+"refalign.rdf", prefix+algo+".rdf"); try {
result = result + evaluator.getFmeasure(); PRecEvaluator evaluator = (PRecEvaluator)eval( prefix+"refalign.rdf", prefix+algo+".rdf");
result = result + evaluator.getFmeasure();
} catch (AlignmentException aex ) { aex.printStackTrace(); }
} }
// Unload the ontologies. // Unload the ontologies.
loaded.clear(); loaded.clear();
...@@ -261,10 +266,10 @@ public class GroupOutput { ...@@ -261,10 +266,10 @@ public class GroupOutput {
return (double)result/(double)tests.length; return (double)result/(double)tests.length;
} }
public Evaluator eval( String alignName1, String alignName2 ) { public Evaluator eval( String alignName1, String alignName2 ) throws AlignmentException {
Evaluator eval = null; Evaluator eval = null;
int nextdebug;
try { try {
int nextdebug;
if ( debug < 3 ) nextdebug = 0; if ( debug < 3 ) nextdebug = 0;
else nextdebug = debug - 3; else nextdebug = debug - 3;
// Load alignments // Load alignments
...@@ -279,13 +284,15 @@ public class GroupOutput { ...@@ -279,13 +284,15 @@ public class GroupOutput {
// Compare // Compare
params.setParameter( "debug", new Integer( nextdebug ) ); params.setParameter( "debug", new Integer( nextdebug ) );
eval.eval( params, loaded ) ; eval.eval( params, loaded ) ;
} catch (Exception ex) { return eval;
// The returned value must be 0 } catch (ParserConfigurationException pce) {
eval = new PRecEvaluator( (Alignment)null, (Alignment)null ); throw new AlignmentException( "Cannot eval ", pce );
((PRecEvaluator)eval).init(); } catch (SAXException se) {
System.err.println(ex); throw new AlignmentException( "Cannot eval ", se );
} catch (IOException ioe) {
throw new AlignmentException( "Cannot eval ", ioe );
} }
return eval;
} }
public void printPGFTeX( String algo, double[] cells ){ public void printPGFTeX( String algo, double[] cells ){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment