From 18452f30b2808d2cec1f8801e324269e1fb4dc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Wed, 11 Jul 2007 13:00:42 +0000 Subject: [PATCH] - Added the inverse operation --- .../align/service/AServProtocolManager.java | 2 +- .../exmo/align/service/HTMLAServProfile.java | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java index 85baa349..6cf6b52e 100644 --- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java +++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java @@ -493,11 +493,11 @@ public class AServProtocolManager { } catch (Exception e) { return new UnknownAlignment(newId(),mess,myId,mess.getSender(),"unknown/Alignment/"+id,(Parameters)null); } + // I think that this is useless because invert always copy the alignment if ( params.getParameter("id") == null ){ // Copy the alignment } // Invert it - //try { al = al.clone().inverse(); } try { al.inverse(); } catch (AlignmentException e) { return new ErrorMsg(newId(),mess,myId,mess.getSender(),"dummy//",(Parameters)null); diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java index c29c68db..638f4e3e 100644 --- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java +++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java @@ -470,6 +470,26 @@ public class HTMLAServProfile implements AlignmentServiceProfile { msg += displayAnswer( answer ); } } + } else if ( perf.equals("prminv") ) { + msg ="<h1>Inverse alignment</h1><form action=\"inv\">"; + msg += "Alignment id: <select name=\"id\">"; + for( Enumeration e = manager.alignments(); e.hasMoreElements(); ){ + String id = ((Alignment)e.nextElement()).getExtension("id"); + msg += "<option value=\""+id+"\">"+id+"</option>"; + } + msg += "</select><br />"; + msg += "<input type=\"submit\" name=\"action\" value=\"Invert\"/><br /></form>"; + } else if ( perf.equals("inv") ) { + String id = (String)params.getParameter("id"); + if ( id != null && !id.equals("") ){ // Trim it + Message answer = manager.inverse( new Message(newId(),(Message)null,myId,serverId,id, params) ); + if ( answer instanceof ErrorMsg ) { + msg = testErrorMessages( answer ); + } else { + msg = "<h1>Alignment inverted</h1>"; + msg += displayAnswer( answer ); + } + } } else if ( perf.equals("prmalign") ) { msg ="<h1>Match ontologies</h1><form action=\"align\">Ontology 1: <input type=\"text\" name=\"onto1\" size=\"80\"/> (uri)<br />Ontology 2: <input type=\"text\" name=\"onto2\" size=\"80\"/> (uri)<br /><small>These are the URL of places where to find these ontologies. They must be reachable by the server (i.e., file:// URI are acceptable if they are on the server)</small><br /><!--input type=\"submit\" name=\"action\" value=\"Find\"/><br /-->Methods: <select name=\"method\">"; for( Iterator it = manager.listmethods().iterator(); it.hasNext(); ) { @@ -608,6 +628,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile { msg += "<li><form action=\"prmfind\"><input type=\"submit\" value=\"Find an alignment for ontologies\"/></form></li>"; msg += "<li><form action=\"prmalign\"><input type=\"submit\" value=\"Match ontologies\"/></form></li>"; msg += "<li><form action=\"prmcut\"><input type=\"submit\" value=\"Trim an alignment above some threshold\"/></form></li>"; + msg += "<li><form action=\"prminv\"><input type=\"submit\" value=\"Invert an alignment\"/></form></li>"; msg += "<li><form action=\"prmload\"><input type=\"submit\" value=\"Load alignments\"/></form></li>"; msg += "<li><form action=\"prmstore\"><input type=\"submit\" value=\"Store an alignment in the server\"/></form></li>"; msg += "<li><form action=\"prmretrieve\"><input type=\"submit\" value=\"Retrieve an alignment from id\"/></form></li>"; -- GitLab