ZQL/ASS‎ > ‎Clients‎ > ‎

javadoc

 Class  Tree  Deprecated  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ZQLClient

java.lang.Object

  |

  +--ZQLClient


public class ZQLClient
extends java.lang.Object

A toolkit for communicating with a ZodQueryLanguage-Server


Constructor Summary
ZQLClient()
           
 
Method Summary
 int addData(java.lang.String data, int[] keyword_ids)
          Add a new data to database
 int addKeyword(java.lang.String keyword)
          Add a new keyword to database
 boolean delData(int data_id)
          Remove a data from database
 boolean delKeyword(int keyword_id)
          Remove a keyword from database
 void finalize()
          Close connection to ZQL-Server
 java.lang.String getData(int data_id)
          get the content of a data
 java.lang.String getKeyword(int keyword_id)
          get the name of a keyword
 int[] listDataKeywords(int data_id)
          List keywords linked to data_id
 int[] listDataResults(int[] keyword_ids, int result_length)
          List datas associated to keyword_ids
 int[] listKeywordResults(int[] keyword_ids, boolean average, int result_length)
          List keywords associated to keyword_ids
 int[] listKeywords(int result_length)
          List keywords, sorted by alphabet or popularity. 0 means sort by alphabet
 int[] searchKeyword(java.lang.String keyword)
          search for a keyword
 void ZQLClient(java.lang.String host, int port)
          Connect to the ZQL-Server
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZQLClient

public ZQLClient()
Method Detail

ZQLClient

public void ZQLClient(java.lang.String host,
                      int port)
               throws java.lang.Exception
Connect to the ZQL-Server
Parameters:
host - the internet address where the server is running
port - the port number on which the server is listening
Throws:
java.lang.Exception - if the connection to the server is lost

finalize

public void finalize()
              throws java.lang.Exception
Close connection to ZQL-Server
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Exception - if the connection to the server is lost

addKeyword

public int addKeyword(java.lang.String keyword)
               throws java.lang.Exception
Add a new keyword to database
Parameters:
keyword - the name of the new keyword
Returns:
the index of the new keyword
Throws:
java.lang.Exception - if the connection to the server is lost

addData

public int addData(java.lang.String data,
                   int[] keyword_ids)
            throws java.lang.Exception
Add a new data to database
Parameters:
data - the content of the new data
keyword_ids - indexes of keywords linked to the new data
Returns:
the index of the new data
Throws:
java.lang.Exception - if the connection to the server is lost

delKeyword

public boolean delKeyword(int keyword_id)
                   throws java.lang.Exception
Remove a keyword from database
Parameters:
keyword_id - index of the keyword to be removed
Returns:
true
Throws:
java.lang.Exception - if the connection to the server is lost

delData

public boolean delData(int data_id)
                throws java.lang.Exception
Remove a data from database
Parameters:
data_id - index of the data to be removed
Returns:
true
Throws:
java.lang.Exception - if the connection to the server is lost

listKeywords

public int[] listKeywords(int result_length)
                   throws java.lang.Exception
List keywords, sorted by alphabet or popularity. 0 means sort by alphabet
Parameters:
result_length - maximum amount of results returned. all if 0
Returns:
an array of indexes to keywords
Throws:
java.lang.Exception - if the connection to the server is lost

listKeywordResults

public int[] listKeywordResults(int[] keyword_ids,
                                boolean average,
                                int result_length)
                         throws java.lang.Exception
List keywords associated to keyword_ids
Parameters:
keyword_ids - the search query
average - score calculation method (read documentation)
result_length - maximum amount of results returned
Returns:
an array of indexes to keywords
Throws:
java.lang.Exception - if the connection to the server is lost

listDataResults

public int[] listDataResults(int[] keyword_ids,
                             int result_length)
                      throws java.lang.Exception
List datas associated to keyword_ids
Parameters:
keyword_ids - the search query
result_length - maximum amount of results returned
Returns:
an array of indexes to datas
Throws:
java.lang.Exception - if the connection to the server is lost

listDataKeywords

public int[] listDataKeywords(int data_id)
                       throws java.lang.Exception
List keywords linked to data_id
Parameters:
data_id - the search query
Returns:
an array of indexes to keywords
Throws:
java.lang.Exception - if the connection to the server is lost

getKeyword

public java.lang.String getKeyword(int keyword_id)
                            throws java.lang.Exception
get the name of a keyword
Parameters:
keyword_id - the search query
Returns:
the name of the keyword
Throws:
java.lang.Exception - if the connection to the server is lost

getData

public java.lang.String getData(int data_id)
                         throws java.lang.Exception
get the content of a data
Parameters:
data_id - the search query
Returns:
the content of the data
Throws:
java.lang.Exception - if the connection to the server is lost

searchKeyword

public int[] searchKeyword(java.lang.String keyword)
                    throws java.lang.Exception
search for a keyword
Parameters:
keyword - the search query
Returns:
an array of indexes to keywords containing the search query
Throws:
java.lang.Exception - if the connection to the server is lost

 Class  Tree  Deprecated  Index  Help 
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Comments