From 3cf30085eab3a1cf0e572954f7124ebe4f2df7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Fri, 23 Jul 2010 14:49:48 +0000 Subject: [PATCH] - added drop by n correspondences in addition to by n% correspondences --- .../exmo/align/util/OntologyNetworkWeakener.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fr/inrialpes/exmo/align/util/OntologyNetworkWeakener.java b/src/fr/inrialpes/exmo/align/util/OntologyNetworkWeakener.java index 6e7439d3..fdd3b910 100644 --- a/src/fr/inrialpes/exmo/align/util/OntologyNetworkWeakener.java +++ b/src/fr/inrialpes/exmo/align/util/OntologyNetworkWeakener.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2009 + * Copyright (C) INRIA, 2009-2010 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -102,9 +102,16 @@ public class OntologyNetworkWeakener { * Returns a brand new BasicOntologyNetwork (with the initial alignments) */ public static OntologyNetwork dropAlignments( OntologyNetwork on, double n ) throws AlignmentException { - System.err.println( " >>>> "+n ); + //System.err.println( " >>>> "+n ); if ( n < 0. || n > 1. ) throw new AlignmentException( "Argument must be between 0 and 1.: "+n ); + return dropAlignments( on, (int)(n*on.getAlignments().size()) ); + } + + public static OntologyNetwork dropAlignments( OntologyNetwork on, int n ) throws AlignmentException { + //System.err.println( " >>>> "+n ); + if ( n < 0 || n > on.getAlignments().size() ) + throw new AlignmentException( "Argument must be a positive integer: "+n ); OntologyNetwork newon = new BasicOntologyNetwork(); for ( URI ontouri : on.getOntologies() ){ newon.addOntology( ontouri ); @@ -121,4 +128,6 @@ public class OntologyNetworkWeakener { } return newon; } + + } -- GitLab