diff --git a/src/fr/inrialpes/exmo/align/impl/MatrixMeasure.java b/src/fr/inrialpes/exmo/align/impl/MatrixMeasure.java index 20de6aff55c88a1c35ba0c1109d391ea60753378..773fc59dbd75a3d0694ea7da9f6fb4a14945368f 100644 --- a/src/fr/inrialpes/exmo/align/impl/MatrixMeasure.java +++ b/src/fr/inrialpes/exmo/align/impl/MatrixMeasure.java @@ -119,7 +119,7 @@ public abstract class MatrixMeasure implements Similarity { indlist2.put( it.next(), new Integer(nbind2) ); } for ( Iterator it = onto1.getIndividuals().iterator(); it.hasNext(); nbind1++ ){ - indlist1.put( it.next(), new Integer(nbind1) ); + indlist1.put( it.next(), new Integer(nbind1) ); } indmatrix = new double[nbind1+1][nbind2+1]; @@ -136,6 +136,7 @@ public abstract class MatrixMeasure implements Similarity { clmatrix[((Integer)classlist1.get(cl1)).intValue()][((Integer)classlist2.get(cl2)).intValue()] = measure( cl1, cl2 ); } } + System.err.println("IND: "+nbind1+" / "+nbind2); // Compute distances on individuals // (this comes first because otherwise, it2 is defined) for ( Iterator it2 = onto2.getIndividuals().iterator(); it2.hasNext(); ){ diff --git a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java index 635f28ba4b4247d9444afe7ba5edb449dd56a9ae..0a205280111256140a611a9c47ee98127a47454d 100644 --- a/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java +++ b/src/fr/inrialpes/exmo/align/impl/method/StringDistAlignment.java @@ -23,6 +23,7 @@ package fr.inrialpes.exmo.align.impl.method; import java.util.Iterator; import java.util.Hashtable; import java.lang.reflect.Method; +import java.net.URI; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLClass; @@ -62,15 +63,28 @@ public class StringDistAlignment extends DistanceAlignment implements AlignmentP setSimilarity( new MatrixMeasure() { public double measure( OWLClass cl1, OWLClass cl2 ) throws Exception{ String[] params = { cl1.getURI().getFragment(), cl2.getURI().getFragment() }; - //if ( debug > 4 ) + if ( debug > 4 ) + System.err.println( "CL:"+cl1.getURI().getFragment()+" ++ "+cl2.getURI().getFragment()); return ((Double)dissimilarity.invoke( null, params )).doubleValue(); } public double measure( OWLProperty pr1, OWLProperty pr2 ) throws Exception{ String[] params = { pr1.getURI().getFragment(), pr2.getURI().getFragment() }; + if ( debug > 4 ) + System.err.println( "PR:"+pr1.getURI().getFragment()+" ++ "+pr2.getURI().getFragment()); return ((Double)dissimilarity.invoke( null, params )).doubleValue(); } public double measure( OWLIndividual id1, OWLIndividual id2 ) throws Exception{ - String[] params = { id1.getURI().getFragment(), id2.getURI().getFragment() }; + if ( debug > 4 ) + System.err.println( "ID:"+id1+" -- "+id2); + URI URI1 = id1.getURI(); + String name1; + if ( URI1 != null ) name1 = URI1.getFragment(); + else name1 = ""; + URI URI2 = id2.getURI(); + String name2; + if ( URI2 != null ) name2 = URI2.getFragment(); + else name2 = ""; + String[] params = { name1, name2 }; return ((Double)dissimilarity.invoke( null, params )).doubleValue(); } } ); diff --git a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java index c696a3d9e016102dc98fcb3479b9e8c5fdf6844c..460c96e7dad6a4bbb88c00ddf716cb0e8b9d2b1d 100644 --- a/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java +++ b/src/fr/inrialpes/exmo/align/impl/renderer/RDFRendererVisitor.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA Rhône-Alpes, 2003-2005 + * Copyright (C) INRIA Rhône-Alpes, 2003-2006 * * 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 @@ -104,6 +104,8 @@ public class RDFRendererVisitor implements AlignmentVisitor this.cell = cell; //OWLOntology onto1 = (OWLOntology)alignment.getOntology1(); try { + if ( ((OWLEntity)cell.getObject1()).getURI() != null && + ((OWLEntity)cell.getObject2()).getURI() != null ){ writer.print(" <map>\n"); writer.print(" <Cell"); if ( cell.getId() != null ){ @@ -121,6 +123,7 @@ public class RDFRendererVisitor implements AlignmentVisitor writer.print(" <relation>"); cell.getRelation().accept( this ); writer.print("</relation>\n </Cell>\n </map>\n"); + } } catch ( OWLException e) { throw new AlignmentException( "getURI problem", e ); } } public void visit( Relation rel ) {