diff --git a/lib/align.jar b/lib/align.jar index 3e1fd7f811411bbbf6c03a49245b352e560a9757..8122fb87bf733918d7a2c6afe175f82b3690e786 100644 Binary files a/lib/align.jar and b/lib/align.jar differ diff --git a/lib/alignsvc.jar b/lib/alignsvc.jar index 2f9b1ede4893e2512d5128eda2e6068c87f274ee..bcae81a407cb186080f389e7ec7644ef419f5f42 100644 Binary files a/lib/alignsvc.jar and b/lib/alignsvc.jar differ diff --git a/lib/alignwn.jar b/lib/alignwn.jar index 507afc3527f44359701b13e0f1630a1331be1360..91e53945aecf340ed033bf98d995bb03bccb9379 100644 Binary files a/lib/alignwn.jar and b/lib/alignwn.jar differ diff --git a/lib/procalign.jar b/lib/procalign.jar index b38f4380f26c8aee4c22c73a3932f5f5dcd2d536..a8d35505ccb0dc4a2f89ff3b0bca112dd0970697 100644 Binary files a/lib/procalign.jar and b/lib/procalign.jar differ diff --git a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java index 40efe82cb52bf2032a314c5c487a57d4509f2ee7..d2e5525db464c473e18a7e3feace84f8e758b0aa 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java @@ -8,12 +8,12 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -48,10 +48,10 @@ import org.semanticweb.owl.align.Parameters; * NOTE(JE): hashtabale are indexed by URI. * This is strange, but there might be a reason * NOTE(JE): I do not think that this is the case anymore - * + * * In version 3.0 this class is virtually abstract. * But it cannot be declared abstract because it uses its own constructor. - * + * * @author Jérôme Euzenat, David Loup, Raphaël Troncy * @version $Id$ */ @@ -211,7 +211,7 @@ public class BasicAlignment implements Alignment { return (String)namespaces.getParameter( label ); }; - public Enumeration getElements() { + public Enumeration getElements() { return new MEnumeration( hash1 ); } @@ -521,7 +521,21 @@ public class BasicAlignment implements Alignment { */ public Alignment compose(Alignment align) throws AlignmentException { BasicAlignment result = new BasicAlignment(); - result.init(onto1,onto2); + result.init(onto1,((BasicAlignment) align).getOntologyObject2()); + // TODO type and level + // TODO extension + for ( Enumeration e = getElements() ; e.hasMoreElements(); ){ + Cell c1 = (Cell) e.nextElement(); + Set<Cell> cells2 = align.getAlignCells1(c1.getObject2()); + if (cells2 !=null) { + for (Cell c2 : cells2) { + Cell newCell = c1.compose(c2); + if (newCell != null) { + result.addCell(newCell); + } + } + } + } return result; } diff --git a/src/fr/inrialpes/exmo/align/impl/BasicCell.java b/src/fr/inrialpes/exmo/align/impl/BasicCell.java index c97f3e19611691af719c9842cf773cc5a527f9a7..4ee69ad3f814ad8165c3c2e15050fa225f4f92a0 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicCell.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicCell.java @@ -7,19 +7,19 @@ * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. */ -package fr.inrialpes.exmo.align.impl; +package fr.inrialpes.exmo.align.impl; import java.net.URI; import java.util.Enumeration; @@ -33,10 +33,10 @@ import org.semanticweb.owl.align.Relation; import org.semanticweb.owl.align.Parameters; /** - * Represents an ontology alignment correspondence. + * Represents an ontology alignment correspondence. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class BasicCell implements Cell, Comparable { @@ -50,11 +50,11 @@ public class BasicCell implements Cell, Comparable { protected Object object2 = null; protected Relation relation = null; protected double strength = 0; - protected Parameters extensions = null; + protected Parameters extensions = null; /** Creation **/ public BasicCell( String id, Object ob1, Object ob2, Relation rel, double m ) throws AlignmentException { - setId( id ); + setId( id ); object1 = ob1; object2 = ob2; relation = rel; @@ -85,23 +85,23 @@ public class BasicCell implements Cell, Comparable { public String getId(){ return id; }; public void setId( String id ){ this.id = id; }; - public String getSemantics(){ + public String getSemantics(){ if ( semantics != null ) { return semantics; } else { return "first-order"; } }; public void setSemantics( String sem ){ semantics = sem; }; public Object getObject1(){ return object1; }; public Object getObject2(){ return object2; }; - public URI getObject1AsURI() throws AlignmentException { + public URI getObject1AsURI() throws AlignmentException { if ( object1 instanceof URI ) { - return (URI)object1; + return (URI)object1; } else { throw new AlignmentException( "Cannot find URI for "+object1 ); } } - public URI getObject2AsURI() throws AlignmentException { + public URI getObject2AsURI() throws AlignmentException { if ( object2 instanceof URI ) { - return (URI)object2; + return (URI)object2; } else { throw new AlignmentException( "Cannot find URI for "+object2 ); } @@ -149,6 +149,14 @@ public class BasicCell implements Cell, Comparable { return result; } + public Cell compose(Cell c) throws AlignmentException { + if (!object2.equals(c.getObject1()) && relation.compose(c.getRelation())==null ) + return null; + Cell result = (Cell)new BasicCell( (String)null, object1, c.getObject2(), relation.compose(c.getRelation()), strength*c.getStrength() ); + // TODO : extension... + return result; + } + /** Housekeeping **/ public void dump( ContentHandler h ){}; diff --git a/src/fr/inrialpes/exmo/align/impl/BasicRelation.java b/src/fr/inrialpes/exmo/align/impl/BasicRelation.java index b0ab77cf63a10191dba7c8185f654541f6b7da38..34c04acad04d9d2be9d7ec8a275e33f5496aed40 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicRelation.java @@ -7,18 +7,18 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package fr.inrialpes.exmo.align.impl; +package fr.inrialpes.exmo.align.impl; import fr.inrialpes.exmo.align.impl.rel.EquivRelation; import fr.inrialpes.exmo.align.impl.rel.SubsumeRelation; @@ -39,7 +39,7 @@ import org.xml.sax.ContentHandler; * Represents an ontology alignment relation. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class BasicRelation implements Relation @@ -95,6 +95,11 @@ public class BasicRelation implements Relation return this; } + /** By default...**/ + public Relation compose(Relation r) { + return null; + } + /** Are the two relations equal **/ public boolean equals( Relation r ) { if ( r instanceof BasicRelation ){ diff --git a/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java index a6b9bc5b1ac11d9988f1d1fc2f5165d23c2d968b..1ad25d26daf18c25f54f2962c356c190fe2c3d9a 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/EquivRelation.java @@ -6,21 +6,22 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package fr.inrialpes.exmo.align.impl.rel; +package fr.inrialpes.exmo.align.impl.rel; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.AlignmentVisitor; +import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; @@ -28,7 +29,7 @@ import fr.inrialpes.exmo.align.impl.BasicRelation; * Represents an OWL equivalence relation. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class EquivRelation extends BasicRelation @@ -45,6 +46,11 @@ public class EquivRelation extends BasicRelation public EquivRelation(){ super("="); } + + public Relation compose(Relation r) { + return r; + } + } diff --git a/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java index 888b6c10063237a793397713c5a93bb5856fd2d9..77a19817f060267ef37687e8be27ea757fb514e8 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/IncompatRelation.java @@ -6,21 +6,22 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package fr.inrialpes.exmo.align.impl.rel; +package fr.inrialpes.exmo.align.impl.rel; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.AlignmentVisitor; +import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; @@ -28,7 +29,7 @@ import fr.inrialpes.exmo.align.impl.BasicRelation; * Represents an OWL equivalence relation. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class IncompatRelation extends BasicRelation @@ -45,6 +46,12 @@ public class IncompatRelation extends BasicRelation public IncompatRelation(){ super("%"); } + + public Relation compose(Relation r) { + if (r instanceof EquivRelation || r instanceof SubsumeRelation) + return this; + return null; + } } diff --git a/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java index 95f1f08661ab4753ed2e1703c2aff711c4dbf5ca..7bfb10668205b513a448c03e3f573e528c588248 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/NonTransitiveImplicationRelation.java @@ -47,6 +47,8 @@ public class NonTransitiveImplicationRelation extends BasicRelation public NonTransitiveImplicationRelation(){ super("~>"); } + + } diff --git a/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java index 0ee50e5e0b393f3eaf29f0cd345e8f9b150ba55c..b7d285c17d5eb0e564dad06d177587c81a686e17 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/SubsumeRelation.java @@ -6,29 +6,31 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package fr.inrialpes.exmo.align.impl.rel; +package fr.inrialpes.exmo.align.impl.rel; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.AlignmentVisitor; +import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; + /** * Represents an OWL subsumption relation. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class SubsumeRelation extends BasicRelation @@ -45,6 +47,13 @@ public class SubsumeRelation extends BasicRelation public SubsumeRelation(){ super(">"); } + + public Relation compose(Relation r) { + if (r.equals(this) || r instanceof EquivRelation) + return this; + return null; + } + } diff --git a/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java b/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java index a90b79fd003e51e8d506e823c4b5974408638d8d..c7111960a2da15d9eb3db1c640de0bfdb7485f43 100644 --- a/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java +++ b/src/fr/inrialpes/exmo/align/impl/rel/SubsumedRelation.java @@ -6,21 +6,22 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package fr.inrialpes.exmo.align.impl.rel; +package fr.inrialpes.exmo.align.impl.rel; import org.semanticweb.owl.align.AlignmentException; import org.semanticweb.owl.align.AlignmentVisitor; +import org.semanticweb.owl.align.Relation; import fr.inrialpes.exmo.align.impl.BasicRelation; @@ -30,7 +31,7 @@ import java.io.PrintWriter; * Represents an OWL subsumption relation. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ public class SubsumedRelation extends BasicRelation @@ -48,6 +49,14 @@ public class SubsumedRelation extends BasicRelation super("<"); } + public Relation compose(Relation r) { + if (r.equals(this) || r instanceof EquivRelation) + return this; + else if (r instanceof IncompatRelation) + return r; + return null; + } + public void write( PrintWriter writer ) { writer.print("<"); } diff --git a/src/org/semanticweb/owl/align/Cell.java b/src/org/semanticweb/owl/align/Cell.java index a08679bd0f85ab2f159544e73063c683300966ac..30716b09367881c78b2776f8028c837a6ca79c24 100644 --- a/src/org/semanticweb/owl/align/Cell.java +++ b/src/org/semanticweb/owl/align/Cell.java @@ -7,18 +7,18 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package org.semanticweb.owl.align; +package org.semanticweb.owl.align; import java.io.PrintStream; import java.io.PrintWriter; @@ -36,7 +36,7 @@ import org.xml.sax.SAXException; * about those objects. * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ @@ -72,6 +72,7 @@ public interface Cell public void setExtension( String uri, String label, String value ); public Cell inverse() throws AlignmentException; + public Cell compose(Cell c) throws AlignmentException; /** Housekeeping **/ public void dump(ContentHandler h); diff --git a/src/org/semanticweb/owl/align/Relation.java b/src/org/semanticweb/owl/align/Relation.java index f1edb714defebe31548cb8668ccbcb4a2057d677..3775821094322a253fcbc4dcb494e0fde324017f 100644 --- a/src/org/semanticweb/owl/align/Relation.java +++ b/src/org/semanticweb/owl/align/Relation.java @@ -7,18 +7,18 @@ * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -package org.semanticweb.owl.align; +package org.semanticweb.owl.align; import java.io.PrintWriter; @@ -27,7 +27,7 @@ import org.xml.sax.ContentHandler; /** * * @author Jérôme Euzenat - * @version $Id$ + * @version $Id$ */ @@ -37,6 +37,7 @@ public interface Relation public void accept( AlignmentVisitor visitor ) throws AlignmentException; public Relation inverse(); + public Relation compose(Relation r); public boolean equals( Relation r );