Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 9e82e981 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- implemented selection in alignment list

parent 620f8a99
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,8 @@ with a warning:
<!--h2>Version 4.5 (17xx): ??/??/2012 - Al pesto</h2-->
<p><ul compact="1">
<!--li>Upgraded to <span style="color: green"></span> (lib)</li-->
<li>Added alignment selection per ontologies in list alignment interface (server)</li>
<li>Fixed a bug with subsumption statements in <tt>OWLAxiomsRendererVisitor</tt> (impl)</li>
</ul></p>
<h2>Version 4.4 (1754): 17/07/2012 - Casa Cirilo</h2>
......
......@@ -192,15 +192,12 @@ public class AServProtocolManager {
return alignmentCache.alignments();
}
public Collection<Alignment> alignments( String uri1, String uri2 ) {
if ( uri1 != null || uri2 != null ) {
try {
URI u1 = (uri1==null)?null:new URI( uri1 );
URI u2 = (uri2==null)?null:new URI( uri2 );
return alignmentCache.alignments( u1, u2 );
} catch ( URISyntaxException usex ) {} //
}
return alignmentCache.alignments();
public Collection<URI> ontologies() {
return alignmentCache.ontologies();
}
public Collection<Alignment> alignments( URI uri1, URI uri2 ) {
return alignmentCache.alignments( uri1, uri2 );
}
public String query( String query ){
......
......@@ -191,22 +191,28 @@ public class CacheImpl {
return alignmentTable.values();
}
protected Collection<URI> ontologies() {
return ontologyTable.keySet();
}
protected Collection<Alignment> alignments( URI u1, URI u2 ) {
Collection<Alignment> results = new HashSet<Alignment>();
if ( u1 != null ) {
for ( Alignment al : ontologyTable.get( u1 ) ) {
try {
if ( al.getOntology1URI().equals( u1 ) ) {
if ( u2 == null ) results.add( al );
else if ( al.getOntology2URI().equals( u2 ) ) results.add( al );
}
// if ( al.getOntology1URI().equals( u1 ) ) {
if ( u2 == null ) results.add( al );
else if ( al.getOntology2URI().equals( u2 )
|| al.getOntology1URI().equals( u2 )) results.add( al );
// }
} catch (AlignmentException alex) {} // ignore
}
} else if ( u2 != null ) {
for ( Alignment al : ontologyTable.get( u2 ) ) {
try {
if ( al.getOntology2URI().equals( u2 ) ) results.add( al );
} catch (AlignmentException alex) {} // ignore
//try {
// if ( al.getOntology2URI().equals( u2 ) )
results.add( al );
//} catch (AlignmentException alex) {} // ignore
}
} else { results = alignmentTable.values(); }
return results;
......
......@@ -53,6 +53,8 @@ import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.Socket;
import java.net.ServerSocket;
import java.net.URLEncoder;
......@@ -474,40 +476,47 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
// REST get
String msg = "";
if ( perf.equals("listalignments") ) {
String uri1 = params.getProperty("uri1");
String uri2 = params.getProperty("uri2");
URI uri1 = null;
String u1 = params.getProperty("uri1");
try {
if ( u1 != null && !u1.equals("all") ) uri1 = new URI( u1 );
} catch ( URISyntaxException usex ) {}; // take all
URI uri2 = null;
String u2 = params.getProperty("uri2");
try {
if ( u2 != null && !u2.equals("all") ) uri2 = new URI( u2 );
} catch ( URISyntaxException usex ) {}; // take all
// Add two onto checklist
Collection<URI> ontologies = manager.ontologies();
msg = "<h1>Available alignments</h1><form action=\"listalignments\">";
/*
msg += "Onto1: <select name=\"uri1\"><option value=\"all\" selected=\"1\">all</option>";
for ( Alignment al : manager.alignments() ) { // onto
// I NEED TO GET THE ONTOLOGIES THERE...
String id = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID);
params.setProperty("id", id);
if ( manager.storedAlignment( new Message(newId(),(Message)null,myId,serverId,"", params ) ) ){
String pid = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
msg += "<option value=\""+id+"\">"+pid+"</option>";
}
msg += "Onto1: <select name=\"uri1\"><option value=\"all\"";
if ( uri1 == null ) msg += " selected=\"1\"";
msg += ">all</option>";
for ( URI ont : ontologies ) {
msg += "<option";
if ( ont.equals( uri1 ) ) msg += " selected =\"1\"";
msg += " value=\""+ont+"\">"+ont+"</option>"; //simplify
}
msg += "</select>";
msg += "Onto2: <select name=\"uri2\"><option value=\"all\" selected=\"1\">all</option>";
for ( Alignment al : manager.alignments() ) { // onto
String id = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID);
params.setProperty("id", id);
if ( manager.storedAlignment( new Message(newId(),(Message)null,myId,serverId,"", params ) ) ){
String pid = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
msg += "<option value=\""+id+"\">"+pid+"</option>";
}
msg += "Onto2: <select name=\"uri2\"><option value=\"all\"";
if ( uri2 == null ) msg += " selected=\"1\"";
msg += ">all</option>";
for ( URI ont : ontologies ) {
msg += "<option";
if ( ont.equals( uri2 ) ) msg += " selected =\"1\"";
msg += " value=\""+ont+"\">"+ont+"</option>"; //simplify
}
msg += "</select>";
msg += "&nbsp;<input type=\"submit\" value=\"Update\"/></form><ul compact=\"1\">";
if ( uri1 != null && uri1.equals("all") ) uri1 = null;
if ( uri2 != null && uri2.equals("all") ) uri2 = null;
//To be implemented
*/
for ( Alignment al : manager.alignments( uri1, uri2 ) ) {
msg += "&nbsp;<input type=\"submit\" value=\"Restrict\"/></form><ul compact=\"1\">";
// would be better as a JavaScript which updates
Collection<Alignment> alignments = null;
if ( uri1 == null && uri2 == null ) {
alignments = manager.alignments();
} else {
alignments = manager.alignments( uri1, uri2 );
}
for ( Alignment al : alignments ) {
String id = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID );
String pid = al.getExtension( Namespace.ALIGNMENT.uri, Annotations.PRETTY );
if ( pid == null ) pid = id; else pid = id+" ("+pid+")";
......
......@@ -192,7 +192,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
/**
* HTTP protocol implementation
* each call of the protocol is a direct URL
* and the answer is through the resulting page (RDF? SOAP? HTTP?)
* and the answer is through the resulting page (RDF? SOAP? HTTP? JSON?)
* Not implemented yet
* but reserved if appears useful
*/
......
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