From b7cd74503bcf5e77066437dd70576ec70e6675a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Fri, 8 Jul 2005 07:22:42 +0000 Subject: [PATCH] - added addCell for the purposes of better alignment extractor --- .../exmo/align/impl/BasicAlignment.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java index 5baf0653..bbe56109 100644 --- a/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/BasicAlignment.java @@ -160,15 +160,20 @@ public class BasicAlignment implements Alignment { /** Cell methods **/ public Cell addAlignCell(Object ob1, Object ob2, String relation, double measure) throws AlignmentException { - //try { - if ( !( ob1 instanceof OWLEntity && ob1 instanceof OWLEntity ) ) - //if (!Class.forName("org.semanticweb.owl.model.OWLEntity").isInstance(ob1) - //|| !Class.forName("org.semanticweb.owl.model.OWLEntity").isInstance(ob2)) - throw new AlignmentException("addAlignCell: arguments must be OWLEntities"); - //} catch (ClassNotFoundException e) { e.printStackTrace(); } - try { - Cell cell = (Cell) new BasicCell((OWLEntity) ob1, (OWLEntity) ob2, + if ( !( ob1 instanceof OWLEntity && ob1 instanceof OWLEntity ) ) + throw new AlignmentException("addAlignCell: arguments must be OWLEntities"); + Cell cell = (Cell) new BasicCell((OWLEntity)ob1, (OWLEntity)ob2, relation, measure); + addCell( (OWLEntity)ob1, (OWLEntity)ob2, cell ); + return cell; + }; + + public Cell addAlignCell(Object ob1, Object ob2) throws AlignmentException { + return addAlignCell( ob1, ob2, "=", 1. ); + } + + public void addCell( OWLEntity ob1, OWLEntity ob2, Cell cell ) throws AlignmentException { + try { //Raph: //HashSet s1 = hash1.get((Object)(((OWLEntity)ob1).getURI())); //if ( s1 == null ){ @@ -185,14 +190,9 @@ public class BasicAlignment implements Alignment { //} //s2.add(cell); hash2.put((Object)(((OWLEntity)ob2).getURI()), cell); - return cell; } catch (OWLException e) { throw new AlignmentException("getURI problem", e); } - }; - - public Cell addAlignCell(Object ob1, Object ob2) throws AlignmentException { - return addAlignCell( ob1, ob2, "=", 1. ); } // Raph: -- GitLab