Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2a1c871b authored by Chan Leduc's avatar Chan Leduc
Browse files

--Improved data transfer from server

parent 43d9ed71
No related branches found
No related tags found
No related merge requests found
...@@ -28,8 +28,13 @@ import java.io.FileInputStream; ...@@ -28,8 +28,13 @@ import java.io.FileInputStream;
//import java.io.FileWriter; //import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
//import java.io.InputStream; //import java.io.InputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
//mport javax.swing.JOptionPane; //mport javax.swing.JOptionPane;
import javax.swing.ProgressMonitorInputStream; import javax.swing.ProgressMonitorInputStream;
...@@ -46,6 +51,7 @@ import java.net.HttpURLConnection; ...@@ -46,6 +51,7 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import org.semanticweb.owl.align.AlignmentVisitor;
import org.semanticweb.owl.align.Parameters; import org.semanticweb.owl.align.Parameters;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
...@@ -65,7 +71,11 @@ import javax.xml.transform.OutputKeys; ...@@ -65,7 +71,11 @@ import javax.xml.transform.OutputKeys;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import fr.inrialpes.exmo.align.impl.BasicAlignment;
import fr.inrialpes.exmo.align.impl.BasicParameters; import fr.inrialpes.exmo.align.impl.BasicParameters;
import fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor;
import fr.inrialpes.exmo.align.parser.AlignmentParser;
import org.semanticweb.owl.align.AlignmentException;
public class OnlineAlign { public class OnlineAlign {
...@@ -127,7 +137,7 @@ public class OnlineAlign { ...@@ -127,7 +137,7 @@ public class OnlineAlign {
//System.out.println("SOAP loaded align=" + answer ); //System.out.println("SOAP loaded align=" + answer );
} catch ( Exception ex ) { ex.printStackTrace(); }; } catch ( Exception ex ) { ex.printStackTrace(); };
if(! connected ) return null; //if(! connected ) return null;
Document domMessage = null; Document domMessage = null;
try { try {
...@@ -168,12 +178,13 @@ public class OnlineAlign { ...@@ -168,12 +178,13 @@ public class OnlineAlign {
//System.out.println("Message :"+ message); //System.out.println("Message :"+ message);
// Send message // Send message
System.out.println("Trim Message="+ message);
answer = sendMessage( message, params ); answer = sendMessage( message, params );
System.out.println("Trim Align="+ answer);
} }
catch ( Exception ex ) { ex.printStackTrace(); }; catch ( Exception ex ) { ex.printStackTrace(); };
if(! connected ) return null; //if(! connected ) return null;
Document domMessage = null; Document domMessage = null;
try { try {
...@@ -216,7 +227,7 @@ public class OnlineAlign { ...@@ -216,7 +227,7 @@ public class OnlineAlign {
answer = sendMessage( message, params ); answer = sendMessage( message, params );
} }
catch ( Exception ex ) { ex.printStackTrace(); }; catch ( Exception ex ) { ex.printStackTrace(); };
if(! connected ) return null; //if(! connected ) return null;
Document domMessage = null; Document domMessage = null;
try { try {
...@@ -259,7 +270,7 @@ public class OnlineAlign { ...@@ -259,7 +270,7 @@ public class OnlineAlign {
//System.out.println("answer find=" + answer); //System.out.println("answer find=" + answer);
} }
catch ( Exception ex ) { ex.printStackTrace(); }; catch ( Exception ex ) { ex.printStackTrace(); };
if(!connected ) return null; //if(!connected ) return null;
Document domMessage = null; Document domMessage = null;
try { try {
...@@ -304,7 +315,7 @@ public class OnlineAlign { ...@@ -304,7 +315,7 @@ public class OnlineAlign {
} }
catch ( Exception ex ) { ex.printStackTrace(); }; catch ( Exception ex ) { ex.printStackTrace(); };
if(! connected ) return null; //if(! connected ) return null;
// Cut SOAP header // Cut SOAP header
//answer = "<?xml version='1.0' encoding='utf-8' standalone='no'?>" + answer ; //answer = "<?xml version='1.0' encoding='utf-8' standalone='no'?>" + answer ;
...@@ -324,6 +335,57 @@ public class OnlineAlign { ...@@ -324,6 +335,57 @@ public class OnlineAlign {
} }
//Used without ProgressBar
public String getAlignIdMonoThread(String method, String wserver, String wsmethod, String onto1, String onto2) {
String answer = null ;
Parameters params = new BasicParameters();
params.setParameter( "host", HOST );
params.setParameter( "command","match");
params.setParameter( "arg1", method);
params.setParameter( "arg2", onto1);
params.setParameter( "arg3", onto2);
params.setParameter( "arg4", wserver);
if(wsmethod != null )
params.setParameter( "arg5", wsmethod);
try {
// Read parameters
// Create the SOAP message
String message = createMessage( params );
// Send message
answer = sendMessageMonoThread( message, params );
//System.out.println("SOAP Match align=" + answer );
}
catch ( Exception ex ) { ex.printStackTrace(); };
//if(! connected ) return null;
// Cut SOAP header
//answer = "<?xml version='1.0' encoding='utf-8' standalone='no'?>" + answer ;
Document domMessage = null;
try {
domMessage = BUILDER.parse( new ByteArrayInputStream( answer.getBytes()) );
} catch ( IOException ioex ) {
ioex.printStackTrace();
} catch ( SAXException saxex ) {
saxex.printStackTrace();
}
String result[] = getTagFromSOAP( domMessage, "matchResponse" );
//System.out.println("Match align Id=" + result[0]);
return result[0];
}
public void getAlignId(String method, String wserver, String wsmethod, String onto1, String onto2 ) { public void getAlignId(String method, String wserver, String wsmethod, String onto1, String onto2 ) {
...@@ -420,7 +482,7 @@ public class OnlineAlign { ...@@ -420,7 +482,7 @@ public class OnlineAlign {
// Send message // Send message
answer = sendMessage( message, params ); answer = sendMessage( message, params );
if(! connected ) return null; //if(! connected ) return null;
} catch ( Exception ex ) { ex.printStackTrace(); }; } catch ( Exception ex ) { ex.printStackTrace(); };
...@@ -497,7 +559,57 @@ public class OnlineAlign { ...@@ -497,7 +559,57 @@ public class OnlineAlign {
} catch ( Exception ex ) { ex.printStackTrace(); }; } catch ( Exception ex ) { ex.printStackTrace(); };
} }
public void getRDFAlignmentMonoThread(String alignId) {
//retrieve alignment for storing in OWL file
Parameters params = new BasicParameters();
params.setParameter( "host", HOST );
//params.setParameter( "http", PORT );
//params.setParameter( "wsdl", WSDL );
params.setParameter( "command","retrieve");
params.setParameter( "arg1", alignId);
params.setParameter( "arg2", "fr.inrialpes.exmo.align.impl.renderer.RDFRendererVisitor" );
String answer=null;
try {
// Read parameters
//Parameters params = ws.readParameters( aservArgRetrieve );
// Create the SOAP message
String message = createMessage( params );
//System.out.println("URL SOAP :"+ SOAPUrl + ", Action:"+ SOAPAction);
//System.out.println("Message :" + message);
// Send message
answer = sendMessageMonoThread( message, params );
} catch ( Exception ex ) { ex.printStackTrace(); };
/*
Document domMessage = null;
try {
domMessage = BUILDER.parse( new ByteArrayInputStream( answer.getBytes()) );
} catch ( IOException ioex ) {
ioex.printStackTrace();
} catch ( SAXException saxex ) {
saxex.printStackTrace();
}
String result[] = getTagFromSOAP( domMessage, "retrieveResponse/result/RDF" );
globalAnswer = result[0];
*/
globalAnswer = answer;
//return result[0];
}
public String storeAlign(String alignId) { public String storeAlign(String alignId) {
...@@ -530,7 +642,7 @@ public class OnlineAlign { ...@@ -530,7 +642,7 @@ public class OnlineAlign {
} }
catch ( Exception ex ) { ex.printStackTrace() ;}; catch ( Exception ex ) { ex.printStackTrace() ;};
if(! connected ) return null; //if(! connected ) return null;
Document domMessage = null; Document domMessage = null;
try { try {
...@@ -759,6 +871,96 @@ public class OnlineAlign { ...@@ -759,6 +871,96 @@ public class OnlineAlign {
return message; return message;
} }
public String sendMessageMonoThread( String message, Parameters param ) {
// Create the connection
byte[] b = message.getBytes();
String answer = "";
// Create HTTP Request
try {
URLConnection connection = SOAPUrl.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProperty( "Content-Length",
String.valueOf( b.length ) );
httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
httpConn.setRequestProperty("SOAPAction",SOAPAction);
httpConn.setRequestMethod( "POST" );
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
// Send the request through the connection
OutputStream out = httpConn.getOutputStream();
out.write( b );
out.close( );
if( param.getParameter("command").equals("retrieve") ) {
/*
try {
AlignmentParser parser = new AlignmentParser( 0 );
parser.initAlignment( null );
parser.setEmbedded( true );
BasicAlignment clonedA1 = (BasicAlignment) parser.parse( httpConn.getInputStream() );
StringWriter sw = new StringWriter();
AlignmentVisitor rdfV = new RDFRendererVisitor( new PrintWriter ( sw ) );
clonedA1.render( rdfV );
answer = sw.toString();
} catch (SAXException saxex) {
throw new AlignmentException( "Malformed XML/SOAP result ("+saxex.getMessage()+")", saxex );
} catch (IOException ioex) {
throw new AlignmentException( "XML/SOAP parsing error", ioex );
} catch (javax.xml.parsers.ParserConfigurationException pcex) {
throw new AlignmentException( "XML/SOAP parsing error", pcex );
}
System.out.println("RDF=" + answer );
*/
InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
BufferedReader in = new BufferedReader(isr);
StringBuffer lineBuff = new StringBuffer();
String line;
while ((line = in.readLine()) != null) {
lineBuff.append(line + "\n");
}
if (in != null)
in.close();
answer = lineBuff.toString();
//System.out.println("RDF=" + answer );
}
else {
// Read the response and write it to standard output
InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
BufferedReader in = new BufferedReader(isr);
String line;
while ((line = in.readLine()) != null) {
answer += line + "\n";
}
if (in != null)
in.close();
if(httpConn.HTTP_REQ_TOO_LONG == httpConn.getResponseCode()) System.err.println("Request too long");
}
} catch (Exception ex) {
connected= false; ex.printStackTrace() ; return null;
}
return answer;
}
public String sendMessage( String message, Parameters param ) { public String sendMessage( String message, Parameters param ) {
// Create the connection // Create the connection
...@@ -790,6 +992,8 @@ public class OnlineAlign { ...@@ -790,6 +992,8 @@ public class OnlineAlign {
if( param.getParameter("command").equals("match") ) { if( param.getParameter("command").equals("match") ) {
globalAnswer = ""; globalAnswer = "";
Thread th = new Thread() { Thread th = new Thread() {
public void run() { public void run() {
...@@ -803,14 +1007,15 @@ public class OnlineAlign { ...@@ -803,14 +1007,15 @@ public class OnlineAlign {
BufferedReader in = new BufferedReader(isr); BufferedReader in = new BufferedReader(isr);
String line; String line;
String alignRes = ""; //String alignRes = "";
StringBuffer strBuff = new StringBuffer();
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
alignRes += line + "\n"; //alignRes += line + "\n";
strBuff.append(line + "\n");
} }
String alignId = getAlignIdParsed( alignRes ); //String alignId = getAlignIdParsed( alignRes );
String alignId = getAlignIdParsed( strBuff.toString() );
if(alignId == null || alignId.equals("")) { if(alignId == null || alignId.equals("")) {
JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2); JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
SWTInterface.set3Buttons(); SWTInterface.set3Buttons();
...@@ -863,9 +1068,10 @@ public class OnlineAlign { ...@@ -863,9 +1068,10 @@ public class OnlineAlign {
//String line; //String line;
int co = 0; int co = 0;
StringBuffer strBuff2 = new StringBuffer();
while ((line = in2.readLine()) != null) { while ((line = in2.readLine()) != null) {
globalAnswer += line + "\n"; strBuff2.append( line + "\n");
//globalAnswer += line + "\n";
co += line.length(); co += line.length();
pm.setNote(co + " bytes read."); pm.setNote(co + " bytes read.");
if( co >= maxSize -10000 ) { if( co >= maxSize -10000 ) {
...@@ -874,6 +1080,7 @@ public class OnlineAlign { ...@@ -874,6 +1080,7 @@ public class OnlineAlign {
pm.setProgress( co ); pm.setProgress( co );
} }
} }
globalAnswer = strBuff2.toString();
SWTInterface.resetActionButtons( true ); SWTInterface.resetActionButtons( true );
...@@ -885,8 +1092,7 @@ public class OnlineAlign { ...@@ -885,8 +1092,7 @@ public class OnlineAlign {
SWTInterface.set3Buttons(); SWTInterface.set3Buttons();
} }
e.printStackTrace(); e.printStackTrace();
} }
} }
}; };
...@@ -916,9 +1122,11 @@ public class OnlineAlign { ...@@ -916,9 +1122,11 @@ public class OnlineAlign {
String line; String line;
int co = 0; int co = 0;
//int coL = 0; StringBuffer strBuff3 = new StringBuffer();
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
globalAnswer += line + "\n"; //globalAnswer += line + "\n";
strBuff3.append( line + "\n" );
co += line.length(); co += line.length();
pm.setNote(co + " bytes read."); pm.setNote(co + " bytes read.");
if( co >= maxSize -10000 ) { if( co >= maxSize -10000 ) {
...@@ -927,7 +1135,7 @@ public class OnlineAlign { ...@@ -927,7 +1135,7 @@ public class OnlineAlign {
pm.setProgress( co ); pm.setProgress( co );
} }
} }
globalAnswer = strBuff3.toString();
SWTInterface.resetActionButtons( true ); SWTInterface.resetActionButtons( true );
pm.setProgress( maxSize - 1 ); pm.setProgress( maxSize - 1 );
...@@ -949,10 +1157,12 @@ public class OnlineAlign { ...@@ -949,10 +1157,12 @@ public class OnlineAlign {
InputStreamReader isr = new InputStreamReader( httpConn.getInputStream() ); InputStreamReader isr = new InputStreamReader( httpConn.getInputStream() );
BufferedReader in = new BufferedReader( isr ); BufferedReader in = new BufferedReader( isr );
String line; String line;
StringBuffer strBuff4 = new StringBuffer();
while ((line = in.readLine()) != null) { while ((line = in.readLine()) != null) {
answer += line + "\n"; strBuff4.append( line + "\n" );
//answer += line + "\n";
} }
answer = strBuff4.toString();
in.close(); in.close();
} }
//System.out.println("answer= " + answer); //System.out.println("answer= " + answer);
...@@ -1047,4 +1257,28 @@ public class OnlineAlign { ...@@ -1047,4 +1257,28 @@ public class OnlineAlign {
return answer; return answer;
} }
public static String fileToString(File f){
String texto = "";
StringBuffer toto = new StringBuffer();
int i=0;
try{
FileReader rd = new FileReader(f);
i = rd.read();
while(i!=-1){
//texto = texto+(char)i;
toto.append((char)i);
i = rd.read();
}
} catch(IOException e){
System.err.println(e.getMessage());
}
return toto.toString();
}
} }
...@@ -155,7 +155,7 @@ public class SWTInterface extends JPanel { ...@@ -155,7 +155,7 @@ public class SWTInterface extends JPanel {
public static Hashtable<String,Alignment> alignmentTable = new Hashtable<String,Alignment>(); public static Hashtable<String,Alignment> alignmentTable = new Hashtable<String,Alignment>();
static String [] forUniqueness = new String[0]; static String [] forUniqueness = new String[0];
static int alignId = 0; static int alignId = 0;
JComponent phrases; JComponent phrases;
JTextField fileName1, fileName2, hostField, portField, serverField, methodField; JTextField fileName1, fileName2, hostField, portField, serverField, methodField;
...@@ -163,11 +163,11 @@ public class SWTInterface extends JPanel { ...@@ -163,11 +163,11 @@ public class SWTInterface extends JPanel {
JEditorPane htmlView; JEditorPane htmlView;
JButton cancelButton, discardButton, fetchButton, resButton, ontoRefresh, JButton cancelButton, discardButton, resButton, ontoRefresh,
localAlignImportButton, alignUploadButton, localAlignImportButton, alignUploadButton,
localAlignTrimButton, connButton, goButton, offlineButton, onlineButton; localAlignTrimButton, connButton, goButton, offlineButton, onlineButton;
static JButton alignStoreButton, alignImportButton, serverAlignTrimButton, mapButton, alignFindButton, allAlignButton; static JButton alignStoreButton, alignImportButton, serverAlignTrimButton, mapButton, alignFindButton, allAlignButton, fetchButton;
JDialog connDialog, matchDialog; JDialog connDialog, matchDialog;
//JPanel pane2; //JPanel pane2;
...@@ -212,11 +212,8 @@ public class SWTInterface extends JPanel { ...@@ -212,11 +212,8 @@ public class SWTInterface extends JPanel {
public File ontoFolder = null; public File ontoFolder = null;
public File alignFolder = null; public File alignFolder = null;
public static File basicFolder = null; public static File basicFolder = null;
public Frame rootFrame;
//public SWTInterface(Frame f) {
//It is needed
// rootFrame = f;
//}
public void offlineInit(boolean init){ public void offlineInit(boolean init){
//OntologyFactory.setDefaultFactory("fr.inrialpes.exmo.align.onto.owlapi2.OWLAPI2OntologyFactory"); //OntologyFactory.setDefaultFactory("fr.inrialpes.exmo.align.onto.owlapi2.OWLAPI2OntologyFactory");
online = false; online = false;
...@@ -349,9 +346,9 @@ public class SWTInterface extends JPanel { ...@@ -349,9 +346,9 @@ public class SWTInterface extends JPanel {
alignImportButton.setEnabled( flag ); alignImportButton.setEnabled( flag );
alignStoreButton.setEnabled( flag ); alignStoreButton.setEnabled( flag );
serverAlignTrimButton.setEnabled( flag ); serverAlignTrimButton.setEnabled( flag );
mapButton.setEnabled( flag ); //mapButton.setEnabled( flag );
alignFindButton.setEnabled( flag ); //alignFindButton.setEnabled( flag );
allAlignButton.setEnabled( flag ); //allAlignButton.setEnabled( flag );
} }
...@@ -361,6 +358,17 @@ public class SWTInterface extends JPanel { ...@@ -361,6 +358,17 @@ public class SWTInterface extends JPanel {
allAlignButton.setEnabled( true ); allAlignButton.setEnabled( true );
} }
public static void setFetchButton( boolean flag) {
fetchButton.setEnabled( flag );
//alignFindButton.setEnabled( flag );
//allAlignButton.setEnabled( flag );
alignImportButton.setEnabled( !flag );
alignStoreButton.setEnabled( !flag );
serverAlignTrimButton.setEnabled( !flag );
}
public void initialize() { public void initialize() {
//selectedHost = "aserv.inrialpes.fr"; //selectedHost = "aserv.inrialpes.fr";
...@@ -688,12 +696,22 @@ public class SWTInterface extends JPanel { ...@@ -688,12 +696,22 @@ public class SWTInterface extends JPanel {
JOptionPane.showMessageDialog(null, "Choose an alignment ID from list!","Warning",2); JOptionPane.showMessageDialog(null, "Choose an alignment ID from list!","Warning",2);
return; return;
} }
/*
alignIdList = new String[1]; alignIdList = new String[1];
alignIdList[0] = selectedAlign; alignIdList[0] = selectedAlign;
alignBox.removeAllItems(); alignBox.removeAllItems();
alignBox.addItem(selectedAlign); alignBox.addItem(selectedAlign);
onAlign.getRDFAlignment( selectedAlign ); onAlign.getRDFAlignment( selectedAlign );
*/
JOptionPane.showMessageDialog(null, "This operation may take a while.","Warning",2);
alignIdList = new String[1];
alignIdList[0] = selectedAlign;
alignBox.removeAllItems();
alignBox.addItem(selectedAlign);
onAlign.getRDFAlignmentMonoThread( selectedAlign );
setFetchButton( false );
} }
}; };
}); });
...@@ -726,7 +744,7 @@ public class SWTInterface extends JPanel { ...@@ -726,7 +744,7 @@ public class SWTInterface extends JPanel {
alignIdList = new String[1]; alignIdList = new String[1];
alignIdList[0] = selectedAlign; alignIdList[0] = selectedAlign;
alignBox.removeAllItems(); alignBox.removeAllItems();
alignBox.addItem(alignIdList[0]); alignBox.addItem( alignIdList[0] );
String rdfPath = alignKey + ".rdf"; String rdfPath = alignKey + ".rdf";
...@@ -736,8 +754,7 @@ public class SWTInterface extends JPanel { ...@@ -736,8 +754,7 @@ public class SWTInterface extends JPanel {
try { try {
File rdfFile = new File( rdfPath ); File rdfFile = new File( rdfPath );
//if (rdfFile.exists()) rdfFile.delete();
out = new FileWriter( rdfFile ); out = new FileWriter( rdfFile );
out.write( rdfalignStr ); out.write( rdfalignStr );
out.flush(); out.flush();
...@@ -753,7 +770,7 @@ public class SWTInterface extends JPanel { ...@@ -753,7 +770,7 @@ public class SWTInterface extends JPanel {
String[] list = offAlign.getAllAlign( ); String[] list = offAlign.getAllAlign( );
if(list!=null) { if(list != null) {
localAlignIdList = new String[1]; localAlignIdList = new String[1];
localAlignBox.removeAllItems(); localAlignBox.removeAllItems();
...@@ -882,9 +899,7 @@ public class SWTInterface extends JPanel { ...@@ -882,9 +899,7 @@ public class SWTInterface extends JPanel {
if(alignIdList.length > 0) { if(alignIdList.length > 0) {
selectedAlign = alignIdList[0]; selectedAlign = alignIdList[0];
} }
String[] list1 = offAlign.getAllAlign( ); String[] list1 = offAlign.getAllAlign( );
if(list1!=null) { if(list1!=null) {
localAlignIdList = new String[list1.length]; localAlignIdList = new String[list1.length];
...@@ -940,7 +955,7 @@ public class SWTInterface extends JPanel { ...@@ -940,7 +955,7 @@ public class SWTInterface extends JPanel {
String[] list = onAlign.findAlignForOntos(selectedOnto1, selectedOnto2); String[] list = onAlign.findAlignForOntos(selectedOnto1, selectedOnto2);
if(list == null || list.length==0) if(list == null || list.length==0)
JOptionPane.showMessageDialog(null, "Impossible connection!","Warning",2); JOptionPane.showMessageDialog(null, "No alignment is found!","Warning",2);
else { else {
//String[] list = getResultsFromAnswer(ao, "alid", null ); //String[] list = getResultsFromAnswer(ao, "alid", null );
...@@ -985,7 +1000,7 @@ public class SWTInterface extends JPanel { ...@@ -985,7 +1000,7 @@ public class SWTInterface extends JPanel {
String at = onAlign.trimAlign(selectedAlign, thres); String at = onAlign.trimAlign(selectedAlign, thres);
if(at == null || at.equals("")) if(at == null || at.equals(""))
JOptionPane.showMessageDialog(null, "Impossible connection!","Warning",2); JOptionPane.showMessageDialog(null, "No alignment is obtained!","Warning",2);
else { else {
alignIdList = new String[1]; alignIdList = new String[1];
...@@ -1084,17 +1099,27 @@ public class SWTInterface extends JPanel { ...@@ -1084,17 +1099,27 @@ public class SWTInterface extends JPanel {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getSource() == goButton) { if (e.getSource() == goButton) {
wserver = serverField.getText(); wserver = serverField.getText();
if(wserver.equals("")) wserver = null; if(wserver.equals(""))
wserver = null;
wsmethod = methodField.getText(); wsmethod = methodField.getText();
if(wsmethod.equals("")) wsmethod = null; if(wsmethod.equals(""))
wsmethod = null;
matchDialog.dispose(); matchDialog.dispose();
resetActionButtons( false ); resetActionButtons( false );
onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 ); //onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
String alignId = onAlign.getAlignIdMonoThread( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
//System.out.println("match from sji finished ");
alignIdList = new String[1];
alignIdList[0] = alignId;
selectedAlign = alignIdList[0];
alignBox.removeAllItems();
alignBox.addItem(selectedAlign);
setFetchButton( true );
} // getsource } // getsource
}; };
}); });
...@@ -1137,8 +1162,16 @@ public class SWTInterface extends JPanel { ...@@ -1137,8 +1162,16 @@ public class SWTInterface extends JPanel {
matchDialog.setVisible(true); matchDialog.setVisible(true);
} else { } else {
resetActionButtons( false ); resetActionButtons( false );
onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 ); String alignId = onAlign.getAlignIdMonoThread( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
//onAlign.getAlignId( matchMethod, wserver, wsmethod, selectedOnto1, selectedOnto2 );
alignIdList = new String[1];
alignIdList[0] = alignId;
selectedAlign = alignIdList[0];
alignBox.removeAllItems();
alignBox.addItem(selectedAlign);
setFetchButton( true );
} }
//String answer = onAlign.getAlignId( matchMethod, selectedOnto1, selectedOnto2 ); //String answer = onAlign.getAlignId( matchMethod, selectedOnto1, selectedOnto2 );
//if(answer==null || answer.equals("")) { //if(answer==null || answer.equals("")) {
// JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2); // JOptionPane.showMessageDialog(null, "Alignment is not produced.","Warning",2);
...@@ -1222,7 +1255,7 @@ public class SWTInterface extends JPanel { ...@@ -1222,7 +1255,7 @@ public class SWTInterface extends JPanel {
this.setLayout (new BorderLayout()); this.setLayout (new BorderLayout());
this.add (new JLabel ("Computing and managing ontology alignments"), BorderLayout.NORTH); this.add (new JLabel ("Computing and managing ontology alignments"), BorderLayout.NORTH);
phrases = createPhraseList(rootFrame); phrases = createPhraseList( );
phrases.setBorder(BorderFactory.createEmptyBorder (10, 5, 10, 5) ); phrases.setBorder(BorderFactory.createEmptyBorder (10, 5, 10, 5) );
JScrollPane top = new JScrollPane( phrases ); JScrollPane top = new JScrollPane( phrases );
...@@ -1242,7 +1275,7 @@ public class SWTInterface extends JPanel { ...@@ -1242,7 +1275,7 @@ public class SWTInterface extends JPanel {
} }
private JPanel createPhraseList (Frame root) { private JPanel createPhraseList ( ) {
JPanel phrasePane = new JPanel (new GridLayout (0, 1, 0, 10)); JPanel phrasePane = new JPanel (new GridLayout (0, 1, 0, 10));
......
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