Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 68c15efc authored by Luz-Maria Priego's avatar Luz-Maria Priego
Browse files

ontology network functionalities added

parent 4c30b800
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
package fr.inrialpes.exmo.align.service;
import fr.inrialpes.exmo.align.parser.AlignmentParser;
import fr.inrialpes.exmo.align.parser.SyntaxElement;
import fr.inrialpes.exmo.align.impl.Annotations;
import fr.inrialpes.exmo.align.impl.BasicOntologyNetwork;
import fr.inrialpes.exmo.align.impl.Namespace;
......@@ -65,6 +66,9 @@ import org.semanticweb.owl.align.OntologyNetwork;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import java.lang.ClassNotFoundException;
import java.lang.InstantiationException;
import java.lang.NoSuchMethodException;
......@@ -87,6 +91,7 @@ import java.io.OutputStreamWriter;
import java.io.IOException;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.net.JarURLConnection;
......@@ -108,6 +113,11 @@ import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.util.zip.ZipEntry;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* This is the main class which controls the behaviour of the Alignment Server
* It is as independent from the OWL API as possible.
......@@ -1254,8 +1264,7 @@ public class AServProtocolManager implements Service {
try {
noo = alignmentCache.getOntologyNetwork(id);
} catch (AlignmentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new UnreachableOntologyNetwork( params, newId(), serverId, id );
}
BasicOntologyNetwork newnoo = (BasicOntologyNetwork)noo;
......@@ -1269,14 +1278,12 @@ public class AServProtocolManager implements Service {
new BufferedWriter(
new OutputStreamWriter( result, "UTF-8" )), true);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new ErrorMsg( params, newId(), serverId,"Network encoding error" );
}
try {
newnoo.write( writer );
} catch (AlignmentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return new ErrorMsg( params, newId(), serverId,"Network writing error" );
} finally {
writer.flush();
writer.close();
......@@ -1285,13 +1292,12 @@ public class AServProtocolManager implements Service {
}
public Message renderHTMLNetwork( Properties params ){
public Message renderHTMLNetwork( Properties params ){ //called by HTTPTransport
// Retrieve the alignment
String result = new String();
String idON = new String();
String pidON = new String();
String id = params.getProperty( "id" );
//String id = idON;
BasicOntologyNetwork noo = null;
try {
logger.trace("Network sought for {}", id);
......@@ -1367,89 +1373,33 @@ public class AServProtocolManager implements Service {
}
}
private Message retrieveAlignmentON( Properties params, URI uri1, URI uri2 ){
String method = params.getProperty("method");
Set<Alignment> alignments = alignmentCache.getAlignments( uri1, uri2 );
if ( alignments != null && params.getProperty("force") == null ) {
for ( Alignment al: alignments ){
String meth2 = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.METHOD );
if ( meth2 != null && meth2.equals(method) ) {
return new AlignmentId( params, newId(), serverId,
al.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ) ,
al.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ) );
}
}
}
return (Message)null;
}
public List<Message> alignonet( Properties params ) {
List<Message> result = new ArrayList<>();
//not finished
//parameters: onID, method, reflexive, symmetric
for ( Enumeration<String> e = (Enumeration<String>)commandLineParams.propertyNames(); e.hasMoreElements();) {
String key = e.nextElement();
if ( params.getProperty( key ) == null ){
params.setProperty( key , commandLineParams.getProperty( key ) );
}
}
//prepare for
String id = params.getProperty("id");
Boolean reflexive = false;
if (params.getProperty("reflexive") != null) reflexive = true;
Boolean symmetric = false;
if (params.getProperty("symmetric") != null) symmetric = true;
Collection<URI> networkOntologyA = networkOntologyUri(id);
Collection<URI> networkOntologyB = networkOntologyUri(id);
// Reflexive and Symmetric
if ( reflexive && symmetric ) {
for ( URI ontoA : networkOntologyA ) {
for ( URI ontoB : networkOntologyB ) {
params.setProperty("onto1", ontoA.toString());
params.setProperty("onto2", ontoB.toString());
Message answer = align( params );
if ( answer != null || answer.toString().contains("AlignmentId")) {
result.add(answer);
};
}
}
}
return result;
}
// TO VERIFY
public Message alignonet2( Properties params ) {
public Message alignonet( Properties params ) {
//parameters: onID, method, reflexive, symmetric
OntologyNetwork noo = null;
Boolean reflexive = false;
Boolean symmetric = false;
Boolean newnet = false;
String id = params.getProperty("id");
String pretty = params.getProperty("pretty");
String pretty = params.getProperty("pretty");
String method = params.getProperty("method");
if (params.getProperty("reflexive") != null) reflexive = true;
if (params.getProperty("symmetric") != null) symmetric = true;
if (params.getProperty("new") != null) newnet = true;
try {
noo = alignmentCache.getOntologyNetwork( id );
} catch (AlignmentException e1) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
logger.debug(" Before Network alignments results, id: {} total ontologies: {} total alignments: {}",id, noo.getOntologies().size(),noo.getAlignments().size());
noo = alignmentCache.getOntologyNetwork( id );
if (newnet) noo = ((BasicOntologyNetwork) noo).clone();
} catch (AlignmentException e1) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
try {
((BasicOntologyNetwork)noo).match( method, reflexive, symmetric, params );
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Network alignment error" );
}
((BasicOntologyNetwork)noo).match( method, reflexive, symmetric, params );
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Network alignment error" );
}
logger.debug(" Network alignments results, id: {} total ontologies: {} total alignments: {}",id, noo.getOntologies().size(),noo.getAlignments().size());
Set<Alignment> networkAlignments = networkAlignmentUri(id);
......@@ -1459,24 +1409,38 @@ public List<Message> alignonet( Properties params ) {
al.setExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY, pretty );
}
}
return new OntologyNetworkId( params, newId(), serverId, id,
return new OntologyNetworkId( params, newId(), serverId, id,
((BasicOntologyNetwork) noo).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ));
}
public Message trimonet( Properties params ) {
//parameters: onID, method, reflexive, symmetric
OntologyNetwork noo = null;
OntologyNetwork nooClone = null;
public Message trimonet( Properties params ) {
BasicOntologyNetwork noo = new BasicOntologyNetwork();
String id = params.getProperty("id");
String method = params.getProperty("type");
String idClone = new String();
double threshold = Double.parseDouble(params.getProperty("threshold"));
try {
noo = alignmentCache.getOntologyNetwork( id );
} catch (AlignmentException e1) {
noo = (BasicOntologyNetwork) alignmentCache.getOntologyNetwork(id);
noo = (BasicOntologyNetwork) noo.clone();
// We preserve the pretty tag within the loaded ontology network
String pretty = noo.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pretty == null ) pretty = params.getProperty("pretty");
if ( pretty != null && !pretty.equals("") ) {
noo.setExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY, pretty );
}
// register it
idClone = alignmentCache.recordNewNetwork( noo, true );
// Generate new ids to trimmed alignments
Set<Alignment> networkAlignments = networkAlignmentUri(idClone);
for (Alignment al : networkAlignments) {
String idAl = alignmentCache.recordNewAlignment( al, true );
}
} catch (AlignmentException e) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
......@@ -1485,31 +1449,145 @@ public List<Message> alignonet( Properties params ) {
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Network alignment error" );
}
return new OntologyNetworkId( params, newId(), serverId, id,
logger.debug(" Ontology network trimmed from id: {}, to new id: {} total ontologies: {} total alignments: {}",id, idClone, noo.getOntologies().size(),noo.getAlignments().size());
return new OntologyNetworkId( params, newId(), serverId, idClone,
((BasicOntologyNetwork) noo).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ));
}
public Message closeonet( Properties params ) {
BasicOntologyNetwork noo = new BasicOntologyNetwork();
Boolean invert = false;
Boolean compose = false; //what should it do?
Boolean newnet = false; //would always be a network, what is the behaviour with compose?
String id = params.getProperty("id");
if (params.getProperty("invert") != null) invert = true;
if (params.getProperty("compose") != null) compose = true;
if (params.getProperty("new") != null) newnet = true;
String idClone = new String();
try {
noo = (BasicOntologyNetwork) alignmentCache.getOntologyNetwork(id);
noo = (BasicOntologyNetwork) noo.clone();
// We preserve the pretty tag within the loaded ontology network
String pretty = noo.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pretty == null ) pretty = params.getProperty("pretty");
if ( pretty != null && !pretty.equals("") ) {
noo.setExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY, pretty );
}
// register it
idClone = alignmentCache.recordNewNetwork( noo, true );
// Generate new ids to trimmed alignments
Set<Alignment> networkAlignments = networkAlignmentUri(idClone);
for (Alignment al : networkAlignments) {
String idAl = alignmentCache.recordNewAlignment( al, true );
}
} catch (AlignmentException e) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
try {
if (invert) ((BasicOntologyNetwork) noo).invert();
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Invert network alignment error" );
}
logger.debug(" Ontology network inverted from id: {}, to new id: {} total ontologies: {} total alignments: {}",id, idClone, noo.getOntologies().size(),noo.getAlignments().size());
return new OntologyNetworkId( params, newId(), serverId, idClone,
((BasicOntologyNetwork) noo).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ));
}
public Message normonet( Properties params ) {
BasicOntologyNetwork noo = new BasicOntologyNetwork();
Boolean normalize = false;
String id = params.getProperty("id");
if (params.getProperty("normalize") != null) normalize = true;
String idClone = new String();
try {
noo = (BasicOntologyNetwork) alignmentCache.getOntologyNetwork(id);
noo = (BasicOntologyNetwork) noo.clone();
// We preserve the pretty tag within the loaded ontology network
String pretty = noo.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pretty == null ) pretty = params.getProperty("pretty");
if ( pretty != null && !pretty.equals("") ) {
noo.setExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY, pretty );
}
// register it
idClone = alignmentCache.recordNewNetwork( noo, true );
// Generate new ids to normalized alignments
Set<Alignment> networkAlignments = networkAlignmentUri(idClone);
for (Alignment al : networkAlignments) {
String idAl = alignmentCache.recordNewAlignment( al, true );
}
} catch (AlignmentException e) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
try {
((BasicOntologyNetwork) noo).normalize();
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Network alignment error" );
}
logger.debug(" Ontology network normalized from id: {}, to new id: {} total ontologies: {} total alignments: {}",id, idClone, noo.getOntologies().size(),noo.getAlignments().size());
return new OntologyNetworkId( params, newId(), serverId, idClone,
((BasicOntologyNetwork) noo).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ));
}
public Message opsetonet( Properties params ) {
BasicOntologyNetwork noo = new BasicOntologyNetwork();
BasicOntologyNetwork noo1 = new BasicOntologyNetwork();
BasicOntologyNetwork noo2 = new BasicOntologyNetwork();
Boolean meet = false;
Boolean join = false;
Boolean diff = false;
String id = new String();
String id1 = params.getProperty("id1");
String id2 = params.getProperty("id2");
if (params.getProperty("meet") != null) meet = true;
if (params.getProperty("join") != null) join = true;
if (params.getProperty("diff") != null) diff = true;
try {
noo1 = (BasicOntologyNetwork) alignmentCache.getOntologyNetwork(id1);
noo2 = (BasicOntologyNetwork) alignmentCache.getOntologyNetwork(id2);
if (meet) ((BasicOntologyNetwork) noo).meet(noo1, noo2);
else if (join) ((BasicOntologyNetwork) noo).join(noo1, noo2);
else if (diff) ((BasicOntologyNetwork) noo).diff(noo1, noo2);
// We preserve the pretty tag within the loaded ontology network
String pretty = noo.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pretty == null ) pretty = params.getProperty("pretty");
if ( pretty != null && !pretty.equals("") ) {
noo.setExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY, pretty );
}
// register it
id = alignmentCache.recordNewNetwork( noo, true );
// Generate new ids to operation set alignments
Set<Alignment> networkAlignments = networkAlignmentUri(id);
for (Alignment al : networkAlignments) {
String idAl = alignmentCache.recordNewAlignment( al, true );
}
} catch (AlignmentException e) {
return new UnknownOntologyNetwork( params, newId(), serverId,id );
}
try {
((BasicOntologyNetwork) noo).normalize();
} catch (AlignmentException e) {
return new ErrorMsg( params, newId(), serverId,"Network alignment error" );
}
logger.debug(" Ontology network operation set from id1: {}, id2: {} to new id: {}total ontologies: {} total alignments: {}",id1, id2, id, noo.getOntologies().size(),noo.getAlignments().size());
return new OntologyNetworkId( params, newId(), serverId, id,
((BasicOntologyNetwork) noo).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ));
}
public Message listNetworkOntology( Properties params ) { //not UsED??
String result = "";
OntologyNetwork noo = null;
noo = new BasicOntologyNetwork();
String id = params.getProperty( "id" );
//URI onto2 = null;
try {
noo = alignmentCache.getOntologyNetwork(id);
noo.getOntologies().size();
Iterator<URI> iterator2 = noo.getOntologies().iterator();
while (iterator2.hasNext()){
URI onto2 = (URI) iterator2.next();
result += "<li><a href=\""+onto2+"\">"+onto2+"</a></li>";
}
return new OntologyNetworkId( params, newId(), serverId, id ,result );
} catch (AlignmentException e) {
return new UnknownOntologyNetwork( params, newId(), serverId, id );
}
}
}
......@@ -204,7 +204,6 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
String id = "";
String pid = "";
msg = "<h1>Available networks</h1>";
//msg += "<form action=\"listNetOnto\"><ul compact=\"1\">";
msg += "<form action=\"listnetwork\"><ul compact=\"1\">";
for ( OntologyNetwork oNetwork : ontologyNetworks ) {
noo = (BasicOntologyNetwork) oNetwork;
......@@ -215,20 +214,23 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
}
msg += "</ul></form>";
} else if ( perf.equals("listNetOnto") ){ //TODO eliminate this
//Message answer = manager.renderHTMLON( params );
/*
} else if ( perf.equals("listNetOnto") ){ //TODO verify if will it be used
Message answer = manager.renderHTMLNetwork( params );
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
return answer.getContent();
}
} else if ( perf.equals("listNetOnto2") ){
*/
/*
} else if ( perf.equals("listNetOnto2") ){//TODO verify if will it be used
msg = "<h1>Ontologies</h1>";
msg += "<form action=\"listNetAlig\">";
String uriON = params.getProperty("uriON"); //send as parameter uriON for listNetAlig
String uriON = params.getProperty("uriON");
int numOnto = 0;
Collection<URI> networkOntology = manager.networkOntologyUri(uriON);
msg += "<p>" + uriON + " ";
......@@ -239,6 +241,8 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg += "<li><a href=\""+onto.toString()+"\"> ("+String.format("%05d", numOnto)+") "+onto.toString()+"</a></li>";
}
//msg += "&nbsp;<input type=\"submit\" value=\"List alignments\"/></form><ul compact=\"1\">";
*/
/*
} else if ( perf.equals("listNetAlig") ){
......@@ -252,6 +256,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
numAlig ++;
msg += "<li><a href=\""+"idAlign" + "\"> ("+String.format("%05d", numAlig)+") " +"idAlign:"+"</a>&nbsp;&nbsp;&nbsp; "+ al.getFile1() + "&nbsp;&nbsp;&nbsp;" + al.getFile2() + "</li>";
}
*/
} else if ( perf.equals("prmloadonet") ){
//TODO add two more parameters TYPE of file (json/html, etc) and STRUCTURE of the file
......@@ -267,6 +272,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg += "Pretty name: <input type=\"text\" name=\"pretty\" size=\"80\"/><br />";
msg += "<input type=\"submit\" Value=\"Upload\">";
msg += " </form>";
} else if ( perf.equals("loadonet") ) {
Message answer = manager.loadonet( params );
......@@ -276,6 +282,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg = "<h1>Ontology Network loaded</h1>";
msg += displayAnswerON( answer, params );
}
} else if ( perf.equals("storeonet") ){
// here should be done the switch between store and load/store
......@@ -295,7 +302,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg = testErrorMessages( answer, params, eSource );
} else {
msg = "<h1>Ontology Network stored</h1>";
msg += displayAnswer( answer, params );
msg += displayAnswerON( answer, params ); //it was msg += displayAnswer( answer, params );
}
}
......@@ -340,8 +347,8 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg = "<h1>Store an ontology network</h1><form action=\"storeonet\">";
msg += "Network: <select name=\"id\">";
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); //TODO eliminate BasicOntologyNetwork
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); //TODO eliminate BasicOntologyNetwork
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
......@@ -356,8 +363,8 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg ="<h1>Trim networks</h1><form action=\"trimonet\">";
msg += "Network: <select name=\"id\">";
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); //TODO eliminate BasicOntologyNetwork
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); //TODO eliminate BasicOntologyNetwork
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
......@@ -369,34 +376,26 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
} else if ( perf.equals("trimonet") ){
Message answer = manager.trimonet( params );
if ( answer instanceof ErrorMsg ) {
System.out.println("answer error ");
msg = testErrorMessages( answer, params, eSource );
msg = testErrorMessages( answer, params, eSource );
} else {
msg ="<h1>Trimed network</h1><form action=\"trimonet\">";
msg += "<a href=\"" + answer.getContent() +"\">" + answer.getContent() + "</a>";
System.out.println("answer: "+ answer.getContent());
}
msg ="<h1>Trimmed network</h1>";
msg += displayAnswerON( answer, params );
}
} else if ( perf.equals("prmmatchonet") ){
msg = "<h1>Match an ontology network</h1><form action=\"matchonet\">";
msg += "<h2><font color=\"red\">(not implemented yet)</font></h2>";
msg += "Network: <select name=\"id\">";
String sel = params.getProperty("id");
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); //TODO eliminate BasicOntologyNetwork
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); //TODO eliminate BasicOntologyNetwork
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
} else { msg += "<option value=\""+id+"\">"+pid+"</option>";}
}
msg += "</select><br />";
// msg += "<!--input type=\"submit\" name=\"action\" value=\"Find\"/>";
// msg += "<br /-->Methods: <select name=\"method\">";
msg += "<br />Methods: <select name=\"method\">";
for( String idMethod : manager.listmethods() ) {
msg += "<option value=\""+idMethod+"\">"+idMethod+"</option>";
......@@ -415,24 +414,10 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
} else if ( perf.equals("matchonet") ) {
// DO MATCHING version 1
/*
List<Message> answer = manager.alignonet( params );
msg = "<h1>Network Alignments results</h1>";
Iterator<Message> it = answer.iterator();
msg += "<ul>";
while (it.hasNext()) {
final Message alignment = it.next();
msg += "<li><a href=\"" + alignment.getContent() +"\">" + alignment.getContent() + "</a></li>";
}
msg += "</ul>";
*/
// DO MATCHING
String idON = params.getProperty("id");
logger.debug("Matching network {}", idON);
Message answer = manager.alignonet2( params );
Message answer = manager.alignonet( params );
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
......@@ -457,8 +442,8 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg = "<h1>Retrieve ontology network</h1><form action=\"retrieveonet\">";
msg += "Network: <select name=\"id\">";
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); //TODO eliminate BasicOntologyNetwork
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); //TODO eliminate BasicOntologyNetwork
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
......@@ -474,23 +459,17 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg = testErrorMessages( answer, params, eSource );
} else {
// Depending on the type we should change the MIME type
//return answer.getContent().replaceAll("&", "&amp;").replaceAll("<", "&lt;");
return answer.getContent();
}
} else if ( perf.equals("prmcloseonet") ){
msg = "<h1>Close an ontology network</h1><form action=\"matchonet\">";
msg += "<h2><font color=\"red\">(not implemented yet)</font></h2>";
msg = "<h1>Close an ontology network</h1><form action=\"closeonet\">";
msg += "Network: <select name=\"id\">";
String sel = params.getProperty("id");
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ); //TODO eliminate BasicOntologyNetwork
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY ); //TODO eliminate BasicOntologyNetwork
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
......@@ -498,11 +477,89 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
}
msg += "</select><br />";
msg += "<input type=\"submit\" name=\"action\" value=\"Invert\" /> ";
msg += "<input type=\"submit\" name=\"action\" value=\"Compose\"/> ";
msg += "<input type=\"checkbox\" name=\"new\" /> New ";
msg += "<input type=\"submit\" name=\"invert\" value=\"Invert\" /> ";
//msg += "<input type=\"submit\" name=\"compose\" value=\"Compose\"/> ";
//msg += "<input type=\"checkbox\" name=\"new\" /> New ";
msg += "</form>";
} else if ( perf.equals("closeonet") ){
Message answer = manager.closeonet( params );
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
msg ="<h1>Closed network</h1>";
msg += displayAnswerON( answer, params );
}
} else if ( perf.equals("prmnormalizeonet") ){
msg = "<h1>Normalize an ontology network</h1><form action=\"normonet\">";
msg += "Network: <select name=\"id\">";
String sel = params.getProperty("id");
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
if ( sel != null && sel.equals( id ) ){
msg += "<option selected=\"1\" value=\""+id+"\">"+pid+"</option>";
} else { msg += "<option value=\""+id+"\">"+pid+"</option>";}
}
msg += "</select><br />";
msg += "<input type=\"submit\" name=\"action\" value=\"Normalize\" /> ";
msg += "</form>";
} else if ( perf.equals("normonet") ){
Message answer = manager.normonet( params );
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
msg ="<h1>Normalized network</h1>";
msg += displayAnswerON( answer, params );
}
} else if ( perf.equals("prmopersetonet") ){
msg = "<h1>Operations on ontology network sets</h1><form action=\"opsetonet\">";
msg += "Network 1: <select name=\"id1\">";
String sel1 = params.getProperty("id1");
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id1 = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid1 = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid1 == null ) pid1 = id1; else pid1 = id1+" ("+pid1+")";
if ( sel1 != null && sel1.equals( id1 ) ){
msg += "<option selected=\"1\" value=\""+id1+"\">"+pid1+"</option>";
} else { msg += "<option value=\""+id1+"\">"+pid1+"</option>";}
}
msg += "</select><br />";
msg += "Network 2: <select name=\"id2\">";
String sel2 = params.getProperty("id2");
for ( OntologyNetwork on : manager.ontologyNetworks() ) {
String id2 = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid2 = ((BasicOntologyNetwork)on).getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid2 == null ) pid2 = id2; else pid2 = id2+" ("+pid2+")";
if ( sel2 != null && sel2.equals( id2 ) ){
msg += "<option selected=\"1\" value=\""+id2+"\">"+pid2+"</option>";
} else { msg += "<option value=\""+id2+"\">"+pid2+"</option>";}
}
msg += "</select><br />";
msg += "<br /><input type=\"checkbox\" name=\"meet\" /> Meet ";
msg += "<input type=\"checkbox\" name=\"join\" /> Join ";
msg += "<input type=\"checkbox\" name=\"diff\" /> Diff ";
msg += "<br /><br />";
msg += "<input type=\"submit\" name=\"action\" value=\"Execute\"/> ";
msg += "<br /><br /></form>";
} else if ( perf.equals("opsetonet") ){
Message answer = manager.opsetonet( params );
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
msg ="<h1>Operation on network done</h1>";
msg += displayAnswerON( answer, params );
}
} else if ( perf.equals("") ) {
msg = "<h1>Ontology network commands</h1>";
......@@ -512,6 +569,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
msg += "<form action=\"prmmatchonet\"><button title=\"Match an ontology network\" type=\"submit\">Match network </button></form>";
msg += "<form action=\"prmtrimonet\"><button title=\"Trim a network\" type=\"submit\">Trim network</button></form>";
msg += "<form action=\"prmnormalizeonet\"><button title=\"Normalize an ontology network\" type=\"submit\">Normalize network</button></form>";
msg += "<form action=\"prmopersetonet\"><button title=\"Operations on ontology network sets\" type=\"submit\">Operations on network sets</button></form>";
msg += "<form action=\"prmcloseonet\"><button title=\"Close an ontology network\" type=\"submit\">Close network</button></form>";
msg += "<form action=\"prmretreiveonet\"><button title=\"Render an ontology network in a particular format\" type=\"submit\">Render network</button></form>";
msg += "<form action=\"prmstoreonet\"><button title=\"Store a network in the server\" type=\"submit\">Store network</button></form>";
......@@ -667,7 +725,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
if ( answer instanceof ErrorMsg ) {
msg = testErrorMessages( answer, params, eSource );
} else {
msg = "<h1>Alignment trimed</h1>";
msg = "<h1>Alignment trimmed</h1>";
msg += displayAnswer( answer, params );
}
}
......@@ -1021,7 +1079,7 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
result += "<td><form action=\"getID\"><input type=\"hidden\" name=\"id\" value=\""+answer.getContent()+"\"/><input type=\"submit\" name=\"action\" value=\"GetID\" disabled=\"disabled\"/></form></td>";
result += "<td><form action=\"metadata\"><input type=\"hidden\" name=\"id\" value=\""+answer.getContent()+"\"/><input type=\"submit\" name=\"action\" value=\"Metadata\"/></form></td>";
result += "</tr></table>";
//} else if( answer instanceof OntologyNetworkIds && ( answer.getParameters() == null || answer.getParameters().getProperty("async") == null )) { //TODO is it needed??create public class OntologyNetworkIds extends Success {
//} else if( answer instanceof OntologyNetworkIds && ( answer.getParameters() == null || answer.getParameters().getProperty("async") == null )) { }
result = answer.HTMLRESTString();
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment