diff --git a/html/relnotes.html b/html/relnotes.html index 6a567aef732b65664a96b2236e4f1e406ab14c39..a79c32ce3b9b709867e64a7ea994a4e3c40d8045 100644 --- a/html/relnotes.html +++ b/html/relnotes.html @@ -133,6 +133,7 @@ UPGRADE ALL LIBRARIES alignment parsed by the same parser to go into the same alignment (parser)</li> <li>Corrected a bug introduced in 3.6 which prevented from storing the "stored" date of alignments (server)</li> +<li>Corrected a bug in the "find" primitive of service (server)</li> <li>Corrected a bug in tests that did not forced to clean-up the state after <tt>OntoTest</tt> (test)</li> <li>Corrected a (commented) error in the <tt>wine.xml</tt> OMWG diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 8d778e1cc47e9b2cfe4f997d138d6d177f638fb2..477d34f2aa723032dcb994ef4b442fcd8f72f259 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -299,23 +299,18 @@ public class AServProtocolManager { public Message existingAlignments( Message mess ){ Properties params = mess.getParameters(); // find and access o, o' + String onto1 = params.getProperty("onto1"); + String onto2 = params.getProperty("onto2"); URI uri1 = null; URI uri2 = null; Set<Alignment> alignments = new HashSet<Alignment>(); try { - if( params.getProperty("onto1") == null || ((String)params.getProperty("onto1")).equals("") ) { - uri2 = new URI((String)params.getProperty("onto2")); - alignments = alignmentCache.getAlignments( uri2 ); - } - else if( params.getProperty("onto2") == null || ((String)params.getProperty("onto2")).equals("") ) { + if( onto1 != null || !onto1.equals("") ) { uri1 = new URI((String)params.getProperty("onto1")); - alignments = alignmentCache.getAlignments( uri1 ); - } - else { - uri1 = new URI((String)params.getProperty("onto1")); - uri2 = new URI((String)params.getProperty("onto2")); - alignments = alignmentCache.getAlignments( uri1, uri2 ); + } else if ( onto2 != null || !onto2.equals("") ) { + uri2 = new URI((String)params.getProperty("onto2")); } + alignmentCache.getAlignments( uri1, uri2 ); } catch (Exception e) { return new ErrorMsg(newId(),mess,myId,mess.getSender(),"MalformedURI problem",(Properties)null); }; //done below diff --git a/src/fr/inrialpes/exmo/align/service/CacheImpl.java b/src/fr/inrialpes/exmo/align/service/CacheImpl.java index 6052329d4574d185fb2a940796d7ec8590c6d79f..73a80269c200d9b9e232f3d6f0973252f968a802 100644 --- a/src/fr/inrialpes/exmo/align/service/CacheImpl.java +++ b/src/fr/inrialpes/exmo/align/service/CacheImpl.java @@ -2,7 +2,7 @@ * $Id$ * * Copyright (C) Seungkeun Lee, 2006 - * Copyright (C) INRIA, 2006-2009 + * Copyright (C) INRIA, 2006-2010 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -387,21 +387,34 @@ public class CacheImpl { return ontologyTable.get( uri ); } + /** + * returns the alignmants between two ontologies + * if one of the ontologies is null, then return them all + */ public Set<Alignment> getAlignments( URI uri1, URI uri2 ) { - // Create the set and compare - Set<Alignment> result = new HashSet<Alignment>(); - Set<Alignment> potentials = ontologyTable.get( uri1 ); - if ( potentials != null ) { + Set<Alignment> result; + Set<Alignment> potential = new HashSet<Alignment>(); + + // Just does not work properly if there is a uri2 but no result + if ( uri2 != null ){ String uri2String = uri2.toString(); - String uri1String = uri1.toString(); - for( Alignment al : potentials ) { + for( Alignment al : ontologyTable.get( uri2 ) ) { + if ( al.getExtension(SVCNS, OURI2).equals( uri2String ) ) { + potential.add( al ); + } + } + } + if ( uri1 != null ) { + if ( potential.isEmpty() ) potential = ontologyTable.get( uri1 ); + result = new HashSet<Alignment>(); + for( Alignment al : potential ) { + String uri1String = uri1.toString(); // This is not the best because URI are not resolved here... - if ( al.getExtension(SVCNS, OURI2).equals( uri2String ) - && al.getExtension(SVCNS, OURI1).equals( uri1String ) ) { + if ( al.getExtension(SVCNS, OURI1).equals( uri1String ) ) { result.add( al ); - } + } } - } + } else { result = potential; } return result; } diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java index 7ae54bcd88a552096337a31862f685f42fed80d4..500303f8e5b57c71643209fcb248490529e2179e 100644 --- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (C) INRIA, 2007-2009 + * Copyright (C) INRIA, 2007-2010 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -327,9 +327,7 @@ public class WSAServProfile implements AlignmentServiceProfile { } msg += " </alignResponse>\n"; } else if ( method.equals("findRequest") || method.equals("find") ) { // URI * URI -> List of URI - if ( newparameters.getProperty( "onto1" ) == null ) { - answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); - } else if ( newparameters.getProperty( "onto2" ) == null ) { + if ( newparameters.getProperty( "onto1" ) == null && newparameters.getProperty( "onto2" ) == null ) { answer = new NonConformParameters(0,(Message)null,myId,"",message,(Properties)null); } else { answer = manager.existingAlignments( new Message(newId(),(Message)null,myId,serverURL,"", newparameters) );