From 61be1f90ed58defdf18a1bf18bc469937f1b41d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Sun, 16 Aug 2009 21:08:26 +0000 Subject: [PATCH] - added the Vistable interface and adapted the interface to this one --- src/org/semanticweb/owl/align/Alignment.java | 20 ++++++++++-- .../owl/align/AlignmentVisitor.java | 4 +-- src/org/semanticweb/owl/align/Cell.java | 5 ++- src/org/semanticweb/owl/align/Relation.java | 5 +-- src/org/semanticweb/owl/align/Visitable.java | 32 +++++++++++++++++++ 5 files changed, 53 insertions(+), 13 deletions(-) create mode 100644 src/org/semanticweb/owl/align/Visitable.java diff --git a/src/org/semanticweb/owl/align/Alignment.java b/src/org/semanticweb/owl/align/Alignment.java index c87a5d4c..a7a969a4 100644 --- a/src/org/semanticweb/owl/align/Alignment.java +++ b/src/org/semanticweb/owl/align/Alignment.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2003-2005, 2007-2008 + * Copyright (C) INRIA, 2003-2005, 2007-2009 * * 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 @@ -37,7 +37,7 @@ import org.xml.sax.ContentHandler; */ -public interface Alignment extends Cloneable, Iterable<Cell> { +public interface Alignment extends Cloneable, Iterable<Cell>, Visitable { /** Initialize the alignement before using it **/ @@ -52,7 +52,6 @@ public interface Alignment extends Cloneable, Iterable<Cell> { /** Alignment methods **/ - public void accept( AlignmentVisitor visitor ) throws AlignmentException; /** * The alignment has reference to the two aligned ontology. * All Alignment cells contain firts the entity from the first ontology @@ -164,6 +163,21 @@ public interface Alignment extends Cloneable, Iterable<Cell> { public Iterator<Cell> iterator(); public int nbCells(); + // What about implementing methods here? + // enum CutMethod { + // HARD, + // ... + // } + /* + * - getting those cells with strength above n (hard) + * - getting the n best cells (best) + * - getting those cells with strength at worse n under the best (span) + * - getting the n% best cells (perc) + * - getting those cells with strength at worse n% of the best (prop) + * - getting all cells until a gap of n (hardgap) + * - getting all cells until a gap of n% of the last (propgap) + */ + public void cut( String method, double threshold ) throws AlignmentException; public void cut( double threshold ) throws AlignmentException; public void harden( double threshold ) throws AlignmentException; diff --git a/src/org/semanticweb/owl/align/AlignmentVisitor.java b/src/org/semanticweb/owl/align/AlignmentVisitor.java index 1cae81e8..b14138ac 100644 --- a/src/org/semanticweb/owl/align/AlignmentVisitor.java +++ b/src/org/semanticweb/owl/align/AlignmentVisitor.java @@ -29,7 +29,5 @@ package org.semanticweb.owl.align; public interface AlignmentVisitor { public void init( Parameters p ); - public void visit( Alignment a ) throws AlignmentException; - public void visit( Cell c ) throws AlignmentException; - public void visit( Relation r ) throws AlignmentException; + public void visit( Visitable o ) throws AlignmentException; } diff --git a/src/org/semanticweb/owl/align/Cell.java b/src/org/semanticweb/owl/align/Cell.java index 0e5d247e..6933d4ff 100644 --- a/src/org/semanticweb/owl/align/Cell.java +++ b/src/org/semanticweb/owl/align/Cell.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA Rhône-Alpes, 2003-2005, 2007-2008 + * Copyright (C) INRIA, 2003-2005, 2007-2009 * * 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 @@ -40,8 +40,7 @@ import org.xml.sax.SAXException; */ -public interface Cell extends Comparable<Cell> { - public void accept( AlignmentVisitor visitor ) throws AlignmentException; +public interface Cell extends Comparable<Cell>, Visitable { /** Creation **/ diff --git a/src/org/semanticweb/owl/align/Relation.java b/src/org/semanticweb/owl/align/Relation.java index fdfc8600..29877e39 100644 --- a/src/org/semanticweb/owl/align/Relation.java +++ b/src/org/semanticweb/owl/align/Relation.java @@ -31,11 +31,8 @@ import org.xml.sax.ContentHandler; */ -public interface Relation -{ +public interface Relation extends Visitable { /** Creation **/ - public void accept( AlignmentVisitor visitor ) throws AlignmentException; - public String getRelation(); public Relation inverse(); diff --git a/src/org/semanticweb/owl/align/Visitable.java b/src/org/semanticweb/owl/align/Visitable.java new file mode 100644 index 00000000..caa1975a --- /dev/null +++ b/src/org/semanticweb/owl/align/Visitable.java @@ -0,0 +1,32 @@ +/* + * $Id$ + * + * Copyright (C) INRIA, 2009 + * + * 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 + * 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; + +/** + * The interface of the objects that can be visited by a renderer + * + * @author Jérôme Euzenat + * @version $Id$ + */ + +public interface Visitable { + public void accept( AlignmentVisitor visitor ) throws AlignmentException; + } -- GitLab