diff --git a/lib/iddl/iddl.jar b/lib/iddl/iddl.jar index 74b8fb8970b9164cf3a3a813df5ee16e48c4ebf3..5947b750ed8aab6089c8d9f5b1a0a791fcc60b50 100644 Binary files a/lib/iddl/iddl.jar and b/lib/iddl/iddl.jar differ diff --git a/lib/iddl/iddl.pom b/lib/iddl/iddl.pom index 201fefb0f8042d65668b6d35c929a79afaa1c640..42795d5a295b9a73e8543f467240b23fc1be6d52 100644 --- a/lib/iddl/iddl.pom +++ b/lib/iddl/iddl.pom @@ -3,8 +3,8 @@ <groupId>fr.paris8.iut.info.iddl</groupId> <artifactId>iddl</artifactId> - <version>1.4d</version> - <!-- Unreleased version of 2013-03-01 --> + <version>1.4e</version> + <!-- Unreleased version of 2013-03-06 --> <name>Integrated Distributed Description Logic</name> <description>A Resonner for Integrated Distributed Description Logic</description> <licenses> diff --git a/src/fr/inrialpes/exmo/align/impl/IDDLOntologyNetwork.java b/src/fr/inrialpes/exmo/align/impl/IDDLOntologyNetwork.java index efe7a817a1c6d66d7a24bcddaa42d2410c68c3a1..1955813ef3e2dd158520a8e98b544b6bc547331d 100644 --- a/src/fr/inrialpes/exmo/align/impl/IDDLOntologyNetwork.java +++ b/src/fr/inrialpes/exmo/align/impl/IDDLOntologyNetwork.java @@ -25,6 +25,7 @@ import java.lang.Iterable; import java.util.Enumeration; import java.util.Iterator; import java.util.Set; +import java.util.ArrayList; import java.util.HashSet; import java.util.Hashtable; import java.net.URI; @@ -49,21 +50,24 @@ import fr.paris8.iut.info.iddl.conf.Semantics; public class IDDLOntologyNetwork extends BasicOntologyNetwork implements LogicOntologyNetwork { IDDLReasoner reasoner = null; - String semantics = ""; + String semantics = "DL"; - protected void init(){ + protected void init() throws AlignmentException { + //for( URI u : getOntologies() ){ + // reasoner.addOntology( u ); + //} + ArrayList<Alignment> allist = new ArrayList<Alignment>(); + for( Alignment al : alignments ){ + //reasoner.addAlignment( al ); + allist.add( al ); + } if ( reasoner == null ){ - if ( semantics.equals("DL") ) { - reasoner = new IDDLReasoner( Semantics.DL ); - } else { - reasoner = new IDDLReasoner( Semantics.IDDL ); - } - for( URI u : getOntologies() ){ - reasoner.addOntology( u ); - } - for( Alignment al : alignments ){ - reasoner.addAlignment( al ); + try { + reasoner = new IDDLReasoner( allist ); + } catch ( IDDLException iddlex ) { + throw new AlignmentException( "Cannot initialise IDDLReasoner", iddlex ); } + setSemantics( semantics ); } } @@ -76,17 +80,16 @@ public class IDDLOntologyNetwork extends BasicOntologyNetwork implements LogicOn public String getSemantics(){ return semantics; }; - public boolean isConsistent(){ + public boolean isConsistent() throws AlignmentException { init(); return reasoner.isConsistent(); }; - public boolean isEntailed( Alignment al ) { + public boolean isEntailed( Alignment al ) throws AlignmentException { init(); try { return reasoner.isEntailed( al ); } catch ( IDDLException idex ) { - idex.printStackTrace(); - return false; + throw new AlignmentException( "Cannot test entailment", idex ); } }; diff --git a/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java b/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java index b0103186adfb71d39d1047fa0f46ed690643d0c6..3e5b00fa722687dccbe46b1f159d0de92d6810fe 100644 --- a/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java +++ b/src/fr/inrialpes/exmo/align/impl/eval/SemPRecEvaluator.java @@ -86,6 +86,7 @@ import java.util.Properties; import java.util.Enumeration; import java.util.Iterator; import java.util.Set; +import java.util.ArrayList; import java.io.PrintWriter; import java.net.URI; @@ -100,7 +101,7 @@ import java.net.URI; public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { - final Logger logger = LoggerFactory.getLogger( SemPRecEvaluator.class ); + final static Logger logger = LoggerFactory.getLogger( SemPRecEvaluator.class ); private int nbfoundentailed = 0; // nb of returned cells entailed by the reference alignment private int nbexpectedentailed = 0; // nb of reference cells entailed by returned alignment @@ -114,7 +115,7 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { **/ public SemPRecEvaluator( Alignment al1, Alignment al2) throws AlignmentException { super( al1, al2 ); - logger.info( "Created one SemPREvaluator" ); + logger.info( "Created a SemPREvaluator" ); convertToObjectAlignments( al1, al2 ); } @@ -169,13 +170,17 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } public int nbEntailedCorrespondences( ObjectAlignment al1, ObjectAlignment al2 ) throws AlignmentException { - logger.debug( "Computing entailment (semantics: {})", semantics ); + logger.trace( "Computing entailment (semantics: {})", semantics ); if ( semantics != null ) { // IDDL - IDDLReasoner iddlreasoner = new IDDLReasoner( semantics ); - loadOntology( iddlreasoner, ((BasicAlignment)al1).getOntologyObject1() ); - loadOntology( iddlreasoner, ((BasicAlignment)al1).getOntologyObject2() ); - iddlreasoner.addAlignment( al1 ); - reasoner = iddlreasoner; + ArrayList<Alignment> allist = new ArrayList<Alignment>(); + allist.add( al1 ); + try { + IDDLReasoner iddlreasoner = new IDDLReasoner( allist ); + iddlreasoner.setSemantics( semantics ); + reasoner = iddlreasoner; + } catch ( IDDLException idex ) { + throw new AlignmentException( "Cannot create IDDLReasoner", idex ); + } } else { // Hermit loadPipedAlignedOntologies( al1 ); } @@ -254,8 +259,8 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } manager = OWLManager.createOWLOntologyManager(); - logger.debug( "{} ----> {}", align.getOntology1URI(), align.getFile1() ); - logger.debug( "{} ----> {}", align.getOntology2URI(), align.getFile2() ); + //logger.trace( "{} ----> {}", align.getOntology1URI(), align.getFile1() ); + //logger.trace( "{} ----> {}", align.getOntology2URI(), align.getFile2() ); manager.addIRIMapper(new SimpleIRIMapper( IRI.create( align.getOntology1URI() ), IRI.create( align.getFile1() ) ) ); manager.addIRIMapper(new SimpleIRIMapper( IRI.create( align.getOntology2URI() ), @@ -300,8 +305,8 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { // Load the ontology manager = OWLManager.createOWLOntologyManager(); - logger.debug( "{} ----> {}", align.getOntology1URI(), align.getFile1() ); - logger.debug( "{} ----> {}", align.getOntology2URI(), align.getFile2() ); + //logger.trace( "{} ----> {}", align.getOntology1URI(), align.getFile1() ); + //logger.trace( "{} ----> {}", align.getOntology2URI(), align.getFile2() ); manager.addIRIMapper(new SimpleIRIMapper( IRI.create( align.getOntology1URI() ), IRI.create( align.getFile1() ) ) ); manager.addIRIMapper(new SimpleIRIMapper( IRI.create( align.getOntology2URI() ), @@ -392,12 +397,13 @@ public class SemPRecEvaluator extends PRecEvaluator implements Evaluator { } // load ontology for the IDDLReasoner + /* public void loadOntology( IDDLReasoner reasoner, Object onto ) { Ontology oo = (Ontology)onto; URI f = oo.getFile(); if ( f == null ) f = oo.getURI(); reasoner.addOntology( f ); - } + }*/ } diff --git a/src/org/semanticweb/owl/align/LogicOntologyNetwork.java b/src/org/semanticweb/owl/align/LogicOntologyNetwork.java index 7b54ff85406471d1307ec5a5e5a6906d5891abe6..e605084e753cf6d634f611868ecfa4a22f388177 100644 --- a/src/org/semanticweb/owl/align/LogicOntologyNetwork.java +++ b/src/org/semanticweb/owl/align/LogicOntologyNetwork.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2009 + * Copyright (C) INRIA, 2009, 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 @@ -39,8 +39,8 @@ public interface LogicOntologyNetwork extends OntologyNetwork { public void setSemantics( String s ); public String getSemantics(); - public boolean isConsistent(); - public boolean isEntailed( Alignment al ); - //public boolean isEntailed( URI ontology, Object axiom ); + public boolean isConsistent() throws AlignmentException; + public boolean isEntailed( Alignment al ) throws AlignmentException; + //public boolean isEntailed( URI ontology, Object axiom ) throws AlignmentException; } diff --git a/test/src/READMETest.java b/test/src/READMETest.java index bdef873a65465b3e8fb6d4143a2e9f0353c37064..bbee258b874571f635ca5dd1831380b039b80653 100644 --- a/test/src/READMETest.java +++ b/test/src/READMETest.java @@ -337,7 +337,7 @@ $ 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) + @Test(groups = { "full", "sem" }, dependsOnMethods = {"routineEvalTest"}, expectedExceptions = org.semanticweb.owl.align.AlignmentException.class) public void semanticIDDLEvalTest() throws Exception { AlignmentParser aparser1 = new AlignmentParser( 0 ); assertNotNull( aparser1 );