From 9aa5837492757686f881972c5920985c36c69d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Wed, 6 Mar 2013 20:51:03 +0000 Subject: [PATCH] - improved Semantic Precision and recall tests - improved AlgTest --- test/src/AlgTest.java | 8 +++----- test/src/READMETest.java | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/test/src/AlgTest.java b/test/src/AlgTest.java index c9521357..bd8d0766 100644 --- a/test/src/AlgTest.java +++ b/test/src/AlgTest.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2008-2010 + * Copyright (C) INRIA, 2008-2010, 2013 * * 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 @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -//package test.com.acme.dona.dep; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -135,10 +134,9 @@ public class AlgTest { assertEquals( alignment1.nbCells(), 38 ); assertEquals( align2.nbCells(), 10 ); - // JE: big problem here: - // Apparently the compose destroys the loaded alignment! Alignment al = alignment1.compose( align2 ); - new NameAndPropertyAlignment().init( new URI("file:examples/rdf/edu.umbc.ebiquity.publication.owl"), new URI("file:examples/rdf/edu.mit.visus.bibtex.owl")); + assertEquals( alignment1.nbCells(), 38 ); + assertEquals( align2.nbCells(), 10 ); assertEquals( al.getOntology1(), alignment1.getOntology1() ); assertEquals( al.getOntology2(), align2.getOntology2() ); assertEquals( al.nbCells(), 4/*4*/ ); diff --git a/test/src/READMETest.java b/test/src/READMETest.java index 780c81c8..bdef873a 100644 --- a/test/src/READMETest.java +++ b/test/src/READMETest.java @@ -337,6 +337,41 @@ $ java -cp lib/procalign.jar fr.inrialpes.exmo.align.cli.EvalAlign -i fr.inrialp assertEquals( eval.getOverall(), 0.5 ); } + @Test(groups = { "full", "sem" }, dependsOnMethods = {"routineEvalTest"}, expectedExceptions = fr.paris8.iut.info.iddl.IDDLRuntimeException.class) + public void semanticIDDLEvalTest() throws Exception { + AlignmentParser aparser1 = new AlignmentParser( 0 ); + assertNotNull( aparser1 ); + Alignment align1 = aparser1.parse( "test/output/bibref2.rdf" ); + assertNotNull( align1 ); + aparser1.initAlignment( null ); + Alignment align2 = aparser1.parse( "test/output/bibref.rdf" ); + assertNotNull( align2 ); + SemPRecEvaluator eval = new SemPRecEvaluator( align1, align2 ); + assertNotNull( eval ); + Properties params = new Properties(); + params.setProperty( "semantics", "DL" ); + assertNotNull( params ); + eval.eval( params ) ; + + // This only output the result to check that this is possible + OutputStream stream = new NullStream(); + PrintWriter writer = new PrintWriter ( + new BufferedWriter( + new OutputStreamWriter( stream, "UTF-8" )), true); + eval.write( writer ); + writer.flush(); + writer.close(); + // These figures are different than those of classical PR + // only because some correspondences cannot be transcribed + // author<->hasAuthor/editor<->hasEditor/firstAuthor/hasAuthor + // because Object/DataProperties + assertEquals( eval.getPrecision(), 0.6904761904761905 ); + assertEquals( eval.getRecall(), 0.90625 ); + assertEquals( eval.getNoise(), 0.30952380952380953 ); + assertEquals( eval.getFmeasure(), 0.7837837837837837 ); + assertEquals( eval.getOverall(), 0.5 ); + } + @Test(groups = { "full", "impl" }, dependsOnMethods = {"routineEvalTest"}) public void weightedEvalTest() throws Exception { -- GitLab