public class Database extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
addColumn(String url,
String tablename,
String columnname)
Adds a new column to a given table of a database.
|
void |
createTable(String url,
String tableName,
String column1,
String column2)
Method creates a table with two columns (int, text) for ID and HELM in a
database.
|
void |
deleteContentFromDB(String url)
Method deletes content from a database in order to be able to overwrite it
with new content.
|
void |
fillHELMTable(String url,
String infilename,
CreateDatabaseTask createDatabase)
Fills the table with CID and HELM from an inputfile.
|
void |
fillHELMTanimotoTable(String url,
String tablename,
List<Integer> idList,
List<Double> tanimotoList)
Method fills table with tanimoto value at the corresponding ID.
|
double |
getBiggestTanimoto(String url)
Returns the maximum similarity value that is found of a notation to the
query.
|
static Database |
getInstance()
This is the static instance method.
|
List<Map<String,Object>> |
getMostSimilarNotations(String url,
String tablename,
String columnname)
Method selects ten notations with the highest similarity to the query.
|
List<Map<String,Object>> |
getNotationsWithSpecificTanimoto(String url,
String tablename,
String columnname,
double desiredTanimoto)
Selects the helm notations with a tanimoto bigger than or equal to the
desired similarity.
|
List<Map<String,Object>> |
getNotationsWithSubset(String url,
String tablename,
String columnname)
Selects the helm notations that the query notation is a subset of.
|
void |
insertFingerprints(String url,
List<BitSet> fingerprints,
List<BitSet> naturalFingerprints,
List<Integer> idList,
String tablename)
Fill table with HELM fingerprint at the corresponding ID.
|
void |
loadDriver(String drivername)
Method loads the database's driver dynamically once for entire application's
lifetime.
|
Map<Integer,String> |
readIDandHELMRecords(String url,
String tablename)
Method reads ID and HELM from table.
|
void |
setSubset(String url,
BitSet queryFingerprint,
List<Integer> idList,
List<BitSet> fingerprints)
Method checks for a list of fingerprints if the query notation is a subset of
it and stores true or false in the database for the corresponding
fingerprint.
|
public static Database getInstance()
public void loadDriver(String drivername) throws ClassNotFoundException
drivername - the drivernameClassNotFoundException - if anything goes wrongpublic void createTable(String url, String tableName, String column1, String column2) throws SQLException
url - the url of the databasetableName - the name of the tablecolumn1 - the name of the first columncolumn2 - the name of the second columnSQLException - if the sql statement goes wrongpublic void addColumn(String url, String tablename, String columnname) throws SQLException
url - the url of the databasetablename - the name of the tablecolumnname - the name of the first columnSQLException - if the sql statement goes wrongpublic void deleteContentFromDB(String url) throws SQLException
url - the url of the databaseSQLException - if the sql statement goes wrongpublic void fillHELMTable(String url, String infilename, CreateDatabaseTask createDatabase) throws SQLException, IOException
url - the url of the databaseinfilename - the input filenamecreateDatabase - createDatabaseTaskSQLException - if the sql statement goes wrongIOException - if anything goes wrongpublic void insertFingerprints(String url, List<BitSet> fingerprints, List<BitSet> naturalFingerprints, List<Integer> idList, String tablename) throws SQLException
url - the url of the databasefingerprints - fingerprint of a HELM notationnaturalFingerprints - natural fingerprint of HELM notationidList - the list of iDs of HELMtablename - the name of the tableSQLException - if anything goes wrongpublic void fillHELMTanimotoTable(String url, String tablename, List<Integer> idList, List<Double> tanimotoList) throws SQLException
url - the url of the databasetablename - the name of the tableidList - the list of iDs of HELMtanimotoList - the list of tanimoto valuesSQLException - if the sql statement goes wrongpublic Map<Integer,String> readIDandHELMRecords(String url, String tablename) throws SQLException
url - the url of the databasetablename - the name of the tableSQLException - if the sql statement goes wrongpublic List<Map<String,Object>> getMostSimilarNotations(String url, String tablename, String columnname) throws SQLException
url - the url of the databasetablename - the name of the tablecolumnname - the name of the columnSQLException - if the sql statement goes wrongpublic List<Map<String,Object>> getNotationsWithSpecificTanimoto(String url, String tablename, String columnname, double desiredTanimoto) throws SQLException
url - the url of the databasetablename - the name of the tablecolumnname - the name of the columndesiredTanimoto - the desired minimum tanimoto valueSQLException - if the sql statement goes wrongpublic List<Map<String,Object>> getNotationsWithSubset(String url, String tablename, String columnname) throws SQLException
url - the url of the databasetablename - the name of the tablecolumnname - the name of the columnSQLException - if the sql statement goes wrongpublic void setSubset(String url, BitSet queryFingerprint, List<Integer> idList, List<BitSet> fingerprints) throws SQLException
url - the url of the databasequeryFingerprint - the query fingerprintidList - the list of idsfingerprints - the list of fingerprintsSQLException - if the sql statement goes wrongpublic double getBiggestTanimoto(String url) throws SQLException
url - the url of the databaseSQLException - if the sql statement goes wrongCopyright © 2018. All rights reserved.