chemaxon.jchem.db
Class MDTableHandler

java.lang.Object
  extended by chemaxon.jchem.db.MDTableHandler

public class MDTableHandler
extends java.lang.Object

Class for handling Molecular Descriptor tables

Since:
JChem 2.0
Author:
Szilard Dorant

Constructor Summary
MDTableHandler(ConnectionHandler conh, java.lang.String strucTableName)
          Creates a new instance of MDTableHandler
 
Method Summary
 MolecularDescriptor createMD(java.lang.String mdName)
          Creates an MolecularDescriptor based on settings stored in the database
 MDSet createMDSet(java.lang.String[] mdNames)
          Creates an MDSet based on settings stored in the database
 void createMDTable(java.lang.String descriptorName, java.lang.String descType, java.lang.String descSettings, java.lang.String descComment)
          Creates a Molecular Descriptor Table.
 void createMDTable(java.lang.String descriptorName, java.lang.String descType, java.lang.String descSettings, java.lang.String descComment, boolean updateOnInsert)
          Creates a Molecular Descriptor Table.
 void deleteMDConfig(java.lang.String mdName, java.lang.String configName)
          Deletes the specified MolecularDescriptor setting
 void deleteMDTable(java.lang.String descriptorName)
          Deletes a Molecular Descriptor Table.
 java.lang.String getMDComment(java.lang.String mdName)
          Gets the value of the Comment property of the MolecularDescriptor specified by its name from the property table of the JChem database.
 java.lang.String getMDConfig(java.lang.String mdName, java.lang.String configName)
          Retrieves the value of the specified MolecularDescriptor configuration
 java.lang.String[] getMDConfigs(java.lang.String descriptorName)
          Retrieves the names of stored configurations associated with a certain Molecular Descriptor
 java.lang.String getMDSettings(java.lang.String mdName)
          Gets the value of the Settings property of the MolecularDescriptor specified by its name from the property table of the JChem database.
static java.lang.String getMDTableName(java.lang.String strucTableName, java.lang.String descriptorName)
          Generates table name for storing Molecular Descriptors
 java.lang.String[] getMDTables()
          Retrieves the names of Molecular Descriptor tables assigned to the structure table and stored in the JChem database.
 java.lang.String getMDType(java.lang.String mdName)
          Gets the Type property of the MolecularDescriptor specified by its name.
 boolean getMDUpdateOnInsert(java.lang.String mdName)
          Gets the value of the UpdateOnInsert property of the MolecularDescriptor specified by its name from the property table of the JChem database.
 java.lang.String[] getMolecularDescriptors()
          Retrieves the names of MolecularDescriptors assigned to the structure table and stored in the JChem database.
 void incRegenerateDescriptorTable(java.lang.String descriptorName)
          Calculates missing lines in MD table
 boolean isMDTableValid(java.lang.String descriptorName)
          Tests, if a given MD table is valid or not.
 boolean isMDTableValidByAllIDs(java.lang.String descriptorName)
          Tests, whether a given MD table is valid.
 void setMDConfig(java.lang.String mdName, java.lang.String configName, java.lang.String config)
          Sets the value of the specified MolecularDescriptor configuration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MDTableHandler

public MDTableHandler(ConnectionHandler conh,
                      java.lang.String strucTableName)
               throws java.sql.SQLException
Creates a new instance of MDTableHandler

Parameters:
conh - ConnectionHanlder opened to the database
strucTableName - the name of the strucure table, the Molecular Descriptors were created using these structures
Throws:
java.sql.SQLException
Method Detail

getMDTableName

public static java.lang.String getMDTableName(java.lang.String strucTableName,
                                              java.lang.String descriptorName)
Generates table name for storing Molecular Descriptors

Parameters:
strucTableName - the name of the structure table
descriptorName - the name of the descriptor
Returns:
the MD table name generated according to conventions

createMDTable

public void createMDTable(java.lang.String descriptorName,
                          java.lang.String descType,
                          java.lang.String descSettings,
                          java.lang.String descComment)
                   throws java.sql.SQLException
Creates a Molecular Descriptor Table. Creates table named "<strucTableName>_MD_<descriptorName>", and stores creation parameters in the property table

Parameters:
descriptorName - the name of the Molecular Descriptor
descType - the type of the descriptor as a fully qualified class name
descSettings - the descriptor settings to be used for descriptor generation
descComment - a comment text for the descriptor table
Throws:
java.sql.SQLException

createMDTable

public void createMDTable(java.lang.String descriptorName,
                          java.lang.String descType,
                          java.lang.String descSettings,
                          java.lang.String descComment,
                          boolean updateOnInsert)
                   throws java.sql.SQLException
Creates a Molecular Descriptor Table. Creates table named "<strucTableName>_MD_<descriptorName>", and stores creation parameters in the property table

Parameters:
descriptorName - the name of the Molecular Descriptor
descType - the type of the descriptor as a fully qualified class name
descSettings - the descriptor settings to be used for descriptor generation
descComment - a comment text for the descriptor table
updateOnInsert - if set to true, the descripors will be automatically added for inserted structures. The default setting is false.
Throws:
java.sql.SQLException

deleteMDTable

public void deleteMDTable(java.lang.String descriptorName)
                   throws java.sql.SQLException
Deletes a Molecular Descriptor Table. Deletes table named "<strucTableName>_MD_<descriptorName>". Also removes entry from the property table

Parameters:
descriptorName - the name of the Molecular Descriptor
Throws:
java.sql.SQLException

isMDTableValid

public boolean isMDTableValid(java.lang.String descriptorName)
                       throws java.sql.SQLException
Tests, if a given MD table is valid or not.
Only tests, whether the maximum value of cd_id is bigger in the structure table than in the MD table (invalid) , or equal (valid)

Parameters:
descriptorName - the name of the Molecular Descriptor
Returns:
true if every row has a pair in the two tables
false if the structure table contains rows not listed in the MD table (import occured after generation, regeneration is necessary)
Throws:
java.sql.SQLException - in case of database error, or if there are rows in the MD table that are not represented in the structure table (this shouldn't occur)

isMDTableValidByAllIDs

public boolean isMDTableValidByAllIDs(java.lang.String descriptorName)
                               throws java.sql.SQLException
Tests, whether a given MD table is valid.
Checks if every row in structure table has a pair in the MD table. (this may take some time)

Parameters:
descriptorName - the name of the Molecular Descriptor
Returns:
true if every row has a pair in the two tables
false if the structure table contains rows not listed in the MD table (import occured after generation, regeneration is necessary)
Throws:
java.sql.SQLException - in case of database error, or if there are rows in the MD table that are not represented in the structure table (this shouldn't occur)

incRegenerateDescriptorTable

public void incRegenerateDescriptorTable(java.lang.String descriptorName)
                                  throws java.sql.SQLException
Calculates missing lines in MD table

Parameters:
descriptorName - the name of the Molecular Descriptor
Throws:
java.sql.SQLException

getMolecularDescriptors

public java.lang.String[] getMolecularDescriptors()
                                           throws java.sql.SQLException
Retrieves the names of MolecularDescriptors assigned to the structure table and stored in the JChem database.

Returns:
the desctiptor names
Throws:
java.sql.SQLException

getMDConfigs

public java.lang.String[] getMDConfigs(java.lang.String descriptorName)
                                throws java.sql.SQLException
Retrieves the names of stored configurations associated with a certain Molecular Descriptor

Parameters:
descriptorName - the name of the molecular descriptor
Returns:
the names of the configurations
Throws:
java.sql.SQLException

getMDConfig

public java.lang.String getMDConfig(java.lang.String mdName,
                                    java.lang.String configName)
                             throws java.sql.SQLException
Retrieves the value of the specified MolecularDescriptor configuration

Parameters:
mdName - symbolic (user defined) name of the molecular descriptor
configName - the name of the configuration
Returns:
the retreived configuration string
Throws:
java.sql.SQLException

setMDConfig

public void setMDConfig(java.lang.String mdName,
                        java.lang.String configName,
                        java.lang.String config)
                 throws java.sql.SQLException
Sets the value of the specified MolecularDescriptor configuration

Parameters:
mdName - symbolic (user defined) name of the molecular descriptor
configName - the name of the configuration
config - the configuration string
Throws:
java.sql.SQLException

deleteMDConfig

public void deleteMDConfig(java.lang.String mdName,
                           java.lang.String configName)
                    throws java.sql.SQLException
Deletes the specified MolecularDescriptor setting

Parameters:
mdName - symbolic (user defined) name of the molecular descriptor
configName - the name of the configuration
Throws:
java.sql.SQLException

getMDSettings

public java.lang.String getMDSettings(java.lang.String mdName)
                               throws java.sql.SQLException
Gets the value of the Settings property of the MolecularDescriptor specified by its name from the property table of the JChem database.

Parameters:
mdName - name of the MolecularDescriptor
Returns:
the value of the Settings property
Throws:
java.sql.SQLException

getMDType

public java.lang.String getMDType(java.lang.String mdName)
                           throws java.sql.SQLException
Gets the Type property of the MolecularDescriptor specified by its name.

Parameters:
mdName - name of the MolecularDescriptor
Returns:
type of the MolecularDescriptor
Throws:
java.sql.SQLException

getMDComment

public java.lang.String getMDComment(java.lang.String mdName)
                              throws java.sql.SQLException
Gets the value of the Comment property of the MolecularDescriptor specified by its name from the property table of the JChem database.

Parameters:
mdName - name of the MolecularDescriptor
Returns:
optional comment given by the user when the descriptor was created and stored
Throws:
java.sql.SQLException

getMDUpdateOnInsert

public boolean getMDUpdateOnInsert(java.lang.String mdName)
                            throws java.sql.SQLException
Gets the value of the UpdateOnInsert property of the MolecularDescriptor specified by its name from the property table of the JChem database.

Parameters:
mdName - name of the MolecularDescriptor
Returns:
true if the descriptor should be updated on insert.
Throws:
java.sql.SQLException

createMDSet

public MDSet createMDSet(java.lang.String[] mdNames)
                  throws java.sql.SQLException
Creates an MDSet based on settings stored in the database

Parameters:
mdNames - the names of the Molecular Descriptors
Returns:
the generated MDSet, contains descriptors initialized with their stored settings
Throws:
java.sql.SQLException

createMD

public MolecularDescriptor createMD(java.lang.String mdName)
                             throws java.sql.SQLException
Creates an MolecularDescriptor based on settings stored in the database

Parameters:
mdName - the name of the Molecular Descriptor
Returns:
the generated descriptor, initialized with its stored settings
Throws:
java.sql.SQLException

getMDTables

public java.lang.String[] getMDTables()
                               throws java.sql.SQLException
Retrieves the names of Molecular Descriptor tables assigned to the structure table and stored in the JChem database.

Returns:
the names of the descriptor tables
Throws:
java.sql.SQLException