Package chemaxon.jchem.db
Class DatabaseProperties
java.lang.Object
chemaxon.jchem.db.DatabaseProperties
- All Implemented Interfaces:
TableTypeConstants
Methods for reading and writing the JChemProperties table that contains
information about the database and the structure tables. The content of the
JChemProperties table informs JChem how to
- create tables
- process chemical hashed fingerprint data
- handle cd_id values
- etc.
The table has 3 columns:
prop_name |
Key column (stores the name of each property which is used as a unique key). |
prop_value. |
Basic value column (short values are stored here). |
prop_value_ext. |
Extended value column (large values are stored here). |
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default name of the property table (JChemProperties).static final Stringstatic final StringThe name of the key column (prop_name).static final Stringstatic final StringThe name of the value column (prop_value).static final StringThe name of the value column extension (prop_value_ext).Fields inherited from interface chemaxon.jchem.db.TableTypeConstants
FP_DEFAULT_BITS_PER_PATTERN, FP_DEFAULT_LENGTH_IN_INTS, FP_DEFAULT_PATTERN_LENGTH, MYSQL_DEFAULT_TABLE_TYPE, MYSQL_FORCE_INNO_DB, MYSQL_FORCE_MYISAM, TABLE_TYPE_ANY_STRUCTURES, TABLE_TYPE_DEFAULT, TABLE_TYPE_EXPLANATIONS, TABLE_TYPE_IS_NOT_SUPPORTED, TABLE_TYPE_MARKUSH_LIBRARIES, TABLE_TYPE_MOLECULES, TABLE_TYPE_NAMES, TABLE_TYPE_QUERY_STRUCTURES, TABLE_TYPE_REACTIONS -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.DatabaseProperties(ConnectionHandler conh, boolean indexTable) Constructs an instance for use with JChem structure tables or JChem Cartridge index tables. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProperty(String name, String value) Inserts the property with the specified key and value into theJChemPropertiestable.voidclose()Should be called only if the use of prepared statements are enabled withsetUsePreparedStatement(boolean).static voidCreates a new property table for storing JChem's settings.static voidcreatePropertyTable(ConnectionHandler conh, int mySqlTableType) Creates a new property table for storing JChem's settings.voiddeleteChemTermForColumn(String tableName, String columnName) Deletes the property defining the Chemical Terms expression that should be used to compute the value for the given column.voiddeleteMDTableProperty(String tableName, String descrName, String propName) Removes MD table property from theJChemPropertiestable.voiddeleteProperty(String name) Removes the row with the specified key from theJChemPropertiestable, if it exists.voiddeleteTableProperties(String tableName) Removes all table properties related to the given structure table from theJChemPropertiestable.voiddeleteTableProperty(String tableName, String propName) Removes a table property from theJChemPropertiestable.Returns all properties in the JChem property table.Get the cache registration table name of the currently used property table.static StringGet the table name containing the registration informationchemaxon.jchem.base.storage.cache.CacheUpdaterTypegetCacheUpdaterType(String tableName) For internal use only.String[]getChemTermColumns(String tableName) Returns the name of columns with values automatically calculated based on Chemical Terms expressions.getChemTermForColumn(String tableName, String columnName) Gets the Chemical Terms expression that should be used to compute the value for the given column.intString[]getFingerprintParams(String tableName) Return the fingerprint parameters of a table.intgetIntProperty(String name) Searches for the property with the specified key in theJChemPropertiestable.String[]getMDConfigs(String tableName, String descriptorName) Retrieves the names of stored configurations associated with a certain Molecular Descriptor.
Doesn't support JChem Cartridge index tables.getMdProperties(String tableName, String descriptorID) getMDTableProperty(String tableName, String descrName, String propName) Gets MD table property from theJChemPropertiestable.String[]getMolecularDescriptorNames(String tableName) String[]getMolecularDescriptors(String tableName) Retrieves the names of MolecularDescriptors assigned to the structure table and stored in the JChem database.getProperty(String name) Searches for the property with the specified key in theJChemPropertiestable.Return the name of the JChem properties table.Returns the names of structure tables registered in theJChemPropertiestable.intgetTableIntProperty(String tableName, String propName) Gets an integer table property from theJChemPropertiestable.getTableNameWithSchema(String tableName) getTableProperties(String tableName) Return all properties for a table.getTableProperty(String tableName, String propName) Gets a table property from theJChemPropertiestable.intgetTableType(String tableName) Returns the type of the specified table.getTautomerEqualityMode(String tableName) longincrementProperty(String name) Increments the value of property with the specified key by one.booleanRetrieve whether at least one Chemical Term column is defined for any table or not.booleanReturns whether database of the current JChem property table is readonly.booleanisDuplicateFilteringOption(String tableName) Returns the state of the Duplicate Filtering table option.booleanisGenericTautomerProtectsChirality(String tableName) Deprecated, for removal: This API element is subject to removal in a future version.stereo is considered as default in tautomer regions during searching,SearchOptions.setTautomerSearch(int)with valueSearchConstants.TAUTOMER_SEARCH_ON_IGNORE_TAUTOMERSTEREOignores it.booleanRetrieve whether at least one MolecularDescriptor is defined for any table or not.booleanisSetSwitchOffAllProtectionsForTDF(String tableName) Deprecated, for removal: This API element is subject to removal in a future version.stereo is considered as default in tautomer regions during searching,SearchOptions.setTautomerSearch(int)with valueSearchConstants.TAUTOMER_SEARCH_ON_IGNORE_TAUTOMERSTEREOignores it.booleanisTautomerDuplicateFilteringEnabled(String tableName) Returns whether tautomers are considered during duplicate filtering for this table.booleanstatic booleanChecks if JChem property table exists.voidsetAbsoluteStereoOption(String tableName, boolean value) Sets the Absolute stereo table property with the specified value in theJChemPropertiestable.Set the name of the cache registration table for the current property table.voidsetCacheUpdaterType(String tableName, chemaxon.jchem.base.storage.cache.CacheUpdaterType cacheUpdaterType) Deprecated, for removal: This API element is subject to removal in a future version.voidsetChemTermForColumn(String tableName, String columnName, String expression) Sets the Chemical Terms expression that should be used to compute the value for the given column.voidsetDuplicateFilteringOption(String tableName, boolean value) Sets the Duplicate filtering table property with the specified value in theJChemPropertiestable.voidsetMDTableProperty(String tableName, String descrName, String propName, String propValue) Sets the given MD table property in theJChemPropertiestable.voidsetProperty(String name, String value) Sets the property with the specified key and value in theJChemPropertiestable.voidsetStandardizerConfigOption(String tableName, String value) Sets the standardizer configuration table property to the specified value in theJChemPropertiestable.voidsetTableProperty(String tableName, String propName, String propValue) Sets the given table property in theJChemPropertiestable.voidsetTautomerDuplicateFilteringOption(String tableName, boolean value) Sets the Tautomer duplicate checking table property with the specified value in theJChemPropertiestable.voidsetUsePreparedStatement(boolean usePreparedStatement) Specifies if PreparedStatement should be used for property lookup.voidupdateProperty(String name, String value) Updates the property with the specified key and value in theJChemPropertiestable.
-
Field Details
-
DEFAULT_PROPERTY_TABLE
The default name of the property table (JChemProperties).- See Also:
-
NAME_COLUMN
The name of the key column (prop_name).- See Also:
-
VALUE_COLUMN
The name of the value column (prop_value).- See Also:
-
VALUE_COLUMN_EXT
The name of the value column extension (prop_value_ext).- See Also:
-
MD_PROPERTY_PREFIX
- See Also:
-
PROP_READONLY_DATABASE_NAME
- See Also:
-
-
Constructor Details
-
DatabaseProperties
Deprecated.in JChem 5.8 Please useDatabaseProperties(ConnectionHandler, boolean)instead. The constructor DatabaseProperties(conh) is equivalent to DatabaseProperties(conh, false).Constructs an instance for use with JChem structure tables.- Parameters:
conh- theConnectionHandlerobject that contains at least a valid JDBC connection and property table name.- Throws:
SQLException- if encounter an sql exception
-
DatabaseProperties
Constructs an instance for use with JChem structure tables or JChem Cartridge index tables.- Parameters:
conh- theConnectionHandlerobject that contains at least a valid JDBC connection and property table name.indexTable- true if this instance is to be used with JChem Cartridge index tables, false in case of JChem structure tables.- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.0
-
-
Method Details
-
getPropertyTableName
Return the name of the JChem properties table.- Returns:
- the name of the JChem properties table
- Since:
- JChem 5.12
-
getProperty
Searches for the property with the specified key in theJChemPropertiestable. If value is null, returns the extended value.- Parameters:
name- the property key.- Returns:
- the value in this property list with the specified key value, or
nullif the property doesn't exist. - Throws:
SQLException- if encounter an sql exception
-
getIntProperty
Searches for the property with the specified key in theJChemPropertiestable.- Parameters:
name- the property key.- Returns:
- the value converted to
int, or Integer.MINVALUE, if not found in the table. - Throws:
NumberFormatException- if the property value cannot be parsed as an integerSQLException- if encounter an sql exception
-
addProperty
Inserts the property with the specified key and value into theJChemPropertiestable. If the specified value isnull, the property is deleted.- Parameters:
name- the property key.value- the property value. Ifnull, the property is deleted.- Throws:
SQLException- if encounter an sql exception
-
updateProperty
Updates the property with the specified key and value in theJChemPropertiestable. If the specified value isnull, the property is deleted.- Parameters:
name- the property key.value- the property value. Ifnull, the property is deleted.- Throws:
SQLException- if encounter an sql exception
-
setProperty
Sets the property with the specified key and value in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted. If the specified value isnull, the property is deleted.- Parameters:
name- the property key.value- the property value. Ifnull, the property is deleted.- Throws:
SQLException- if encounter an sql exception
-
setDuplicateFilteringOption
Sets the Duplicate filtering table property with the specified value in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.value- The duplicate filtering property value.- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.4
-
setAbsoluteStereoOption
Sets the Absolute stereo table property with the specified value in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.value- The absolute stereo property value.- Throws:
SQLException- if encounter an sql exception
-
setTautomerDuplicateFilteringOption
public void setTautomerDuplicateFilteringOption(String tableName, boolean value) throws SQLException Sets the Tautomer duplicate checking table property with the specified value in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.value- The tautomer duplicate checking property value.- Throws:
SQLException- if encounter an sql exception
-
setStandardizerConfigOption
Sets the standardizer configuration table property to the specified value in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.value- The standardizer configuration string.- Throws:
SQLException- if encounter an sql exception
-
setTableProperty
public void setTableProperty(String tableName, String propName, String propValue) throws SQLException Sets the given table property in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.propValue- the value of the property- Throws:
SQLException- if encounter an sql exception
-
getTableProperty
Gets a table property from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.- Returns:
- The value of table property if it is stored in the
JChemPropertiestable,nullotherwise. - Throws:
SQLException- if encounter an sql exception
-
getTableIntProperty
public int getTableIntProperty(String tableName, String propName) throws IllegalArgumentException, NumberFormatException, SQLException Gets an integer table property from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.- Returns:
- The value of table property if it is stored in the
JChemPropertiestable and can be parsed to int. - Throws:
IllegalArgumentException- if the given property is not found.NumberFormatException- if the given property cannot be parsed to int.SQLException- if encounter an sql exception
-
deleteTableProperty
Removes a table property from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.- Throws:
SQLException- if encounter an sql exception
-
deleteTableProperties
Removes all table properties related to the given structure table from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.- Throws:
SQLException- if encounter an sql exception
-
setMDTableProperty
public void setMDTableProperty(String tableName, String descrName, String propName, String propValue) throws SQLException Sets the given MD table property in theJChemPropertiestable. If the property exists with the specified name, then it is updated, otherwise a new row is inserted.- Parameters:
tableName- Name of the structure table.descrName- Name of the descriptor.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.propValue- the value of the property- Throws:
SQLException- if encounter an sql exception
-
getMDTableProperty
public String getMDTableProperty(String tableName, String descrName, String propName) throws SQLException Gets MD table property from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.descrName- Name of the descriptor.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constants defined inPropertyConstants.Table.- Returns:
- The value of table property if it is stored in the
JChemPropertiestable,nullotherwise. - Throws:
SQLException- if encounter an sql exception
-
deleteMDTableProperty
public void deleteMDTableProperty(String tableName, String descrName, String propName) throws SQLException Removes MD table property from theJChemPropertiestable.- Parameters:
tableName- Name of the structure table.descrName- Name of the descriptor.propName- Name of the property. It is case sensitive, e.g. "JChemVersion" is not the same as "jchemVersion". Use the constans defined inPropertyConstants.Table.- Throws:
SQLException- if encounter an sql exception
-
incrementProperty
Increments the value of property with the specified key by one. Value has to be in integer format. If the property doesn't exist with the specified name, then a row with the value 1 is inserted.- Parameters:
name- the property key.- Returns:
- the new value of the property
- Throws:
SQLException- if encounter an sql exception
-
deleteProperty
Removes the row with the specified key from theJChemPropertiestable, if it exists.- Parameters:
name- the property key.- Throws:
SQLException- if encounter an sql exception
-
propertyTableExists
Checks if JChem property table exists.- Parameters:
conh- must contain at minimum a live connection and a property table name- Returns:
- true if the table exists
-
createPropertyTable
Creates a new property table for storing JChem's settings. It is recommended to test first if the table exists, by callingpropertyTableExists- Parameters:
conh- it should contain at minimum a live connection and a property table name If your database server type is MySql, recommend to use the other createPropertyTable method- Throws:
SQLException- if encounter an sql exception- See Also:
-
createPropertyTable
public static void createPropertyTable(ConnectionHandler conh, int mySqlTableType) throws SQLException Creates a new property table for storing JChem's settings. It is recommended to test first if the table exists, by callingpropertyTableExists- Parameters:
conh- it should contain at minimum a live connection and a property table namemySqlTableType- table type for MySQL, for other RDBMS ignored. Accepted values:- Throws:
SQLException- if encounter an sql exception- See Also:
-
getStructureTableNames
Returns the names of structure tables registered in theJChemPropertiestable.- Returns:
- a vector of all structure table names
- Throws:
SQLException- if encounter an sql exception
-
getMolecularDescriptors
Retrieves the names of MolecularDescriptors assigned to the structure table and stored in the JChem database.- Parameters:
tableName- the name of the structure table- Returns:
- the descriptor names
- Throws:
SQLException- if encounter an sql exception
-
isMolecularDescriptorDefined
Retrieve whether at least one MolecularDescriptor is defined for any table or not.- Returns:
- true if at least one descriptor table exists
- Throws:
SQLException- if encounter an sql exception
-
getMDConfigs
Retrieves the names of stored configurations associated with a certain Molecular Descriptor.
Doesn't support JChem Cartridge index tables.- Parameters:
tableName- the name of the structure tabledescriptorName- the name of the molecular descriptor- Returns:
- the names of the configurations
- Throws:
SQLException- if encounter an sql exception
-
getMdProperties
- Throws:
SQLException
-
getMolecularDescriptorNames
- Throws:
SQLException
-
isUsePreparedStatement
public boolean isUsePreparedStatement() -
setUsePreparedStatement
public void setUsePreparedStatement(boolean usePreparedStatement) Specifies if PreparedStatement should be used for property lookup. Recommended if properties are read from the table very frequently. NOTE: If set to true,close()should be called after usage.- Parameters:
usePreparedStatement- set totrueto use preapared statements for reading data. Default isfalse
-
getChemTermColumns
Returns the name of columns with values automatically calculated based on Chemical Terms expressions.- Parameters:
tableName- the table, the Chemical Terms-based columns of which should be returned.- Returns:
- the name of columns with values automatically calculated based on Chemical Terms expressions.
- Throws:
SQLException- if encounter an sql exception- Since:
- 3.2
-
isChemTermColumnDefined
Retrieve whether at least one Chemical Term column is defined for any table or not.- Returns:
- boolean
- Throws:
SQLException- if encounter an sql exception
-
setChemTermForColumn
public void setChemTermForColumn(String tableName, String columnName, String expression) throws SQLException Sets the Chemical Terms expression that should be used to compute the value for the given column.- Parameters:
tableName- name of the table containing the columncolumnName- name fo the column with pre-computed Chemical Terms values.expression- the Chemical Terms expression that should be used to compute the value for the given column.- Throws:
SQLException- if encounter an sql exception- Since:
- 3.2
-
getChemTermForColumn
Gets the Chemical Terms expression that should be used to compute the value for the given column.- Parameters:
tableName- name of the table containing the columncolumnName- name of the column with pre-computed Chemical Terms values.- Returns:
- the Chemical Terms expression that should be used to compute the value for the given column.
- Throws:
SQLException- if encounter an sql exception- Since:
- 3.2
-
deleteChemTermForColumn
Deletes the property defining the Chemical Terms expression that should be used to compute the value for the given column.- Parameters:
tableName- name of the table containing the columncolumnName- name fo the column with pre-computed Chemical Terms values.- Throws:
SQLException- if encounter an sql exception- Since:
- 3.2
-
getTableType
Returns the type of the specified table.- Parameters:
tableName- the name of the JChem structure table- Returns:
- one of the following:
- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 3.2
-
setCacheRegistrationTableName
Set the name of the cache registration table for the current property table.- Returns:
- the newly generated table name.
- Throws:
SQLException- if encounter an sql exception
-
getCacheRegistrationTableName
Get the cache registration table name of the currently used property table.- Returns:
- the cache registration table name.
- Throws:
SQLException- if encounter an sql exception
-
isTautomerDuplicateFilteringEnabled
Returns whether tautomers are considered during duplicate filtering for this table.- Parameters:
tableName- the name of the JChem structure table- Returns:
trueif tautomer duplicate filtering is enabled for the table- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.0
-
getTautomerEqualityMode
- Throws:
SQLException
-
isGenericTautomerProtectsChirality
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isGenericTautomerProtectsChirality(String tableName) throws SQLException Deprecated, for removal: This API element is subject to removal in a future version.stereo is considered as default in tautomer regions during searching,SearchOptions.setTautomerSearch(int)with valueSearchConstants.TAUTOMER_SEARCH_ON_IGNORE_TAUTOMERSTEREOignores it.Returns whether generic tautomer protects chirality in tautomer region.- Parameters:
tableName- the name of the JChem structure table- Returns:
trueif generic tautomer protects chirality- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.2.4
-
isSetSwitchOffAllProtectionsForTDF
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isSetSwitchOffAllProtectionsForTDF(String tableName) throws SQLException Deprecated, for removal: This API element is subject to removal in a future version.stereo is considered as default in tautomer regions during searching,SearchOptions.setTautomerSearch(int)with valueSearchConstants.TAUTOMER_SEARCH_ON_IGNORE_TAUTOMERSTEREOignores it.Returns whether all protections for tautomer duplicate filtering is switched off.- Parameters:
tableName- the name of the JChem structure table- Returns:
trueif all protects are switched off- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.5
-
isDatabaseReadonly
Returns whether database of the current JChem property table is readonly.- Returns:
trueif the database is readonly- Throws:
SQLException- if encounter an sql exception- Since:
- JChem 5.3.2
-
close
Should be called only if the use of prepared statements are enabled withsetUsePreparedStatement(boolean).- Throws:
SQLException- if encounter an sql exception
-
getFingerprintParams
Return the fingerprint parameters of a table.- Parameters:
tableName- the name of the table- Returns:
- array that contains 3 elements, the first is the number of bits, the second is the number of ones, the third is the number of edges.
- Throws:
SQLException- if encounter an sql exception
-
getTableProperties
Return all properties for a table.- Parameters:
tableName- Name of the structure table- Returns:
- the property names and values
- Throws:
SQLException- if encounter an sql exception
-
isDuplicateFilteringOption
Returns the state of the Duplicate Filtering table option.- Parameters:
tableName- Name of the structure table- Returns:
- the state of the Duplicate Filtering option from the JChem Property Table.
- Throws:
SQLException- if encounter an sql exception- Since:
- Jchem 5.4
-
getAllProperties
Returns all properties in the JChem property table.- Returns:
- all property names and values in a formatted StringBuffer
- Throws:
SQLException- if encounter an sql exception
-
getCacheRegistrationTableName
Get the table name containing the registration information- Parameters:
conh- ConnectionHandler to use- Returns:
- registration table name
- Throws:
SQLException- if encounter an sql exception
-
getTableNameWithSchema
- Throws:
SQLException
-
getDbmsType
public int getDbmsType() -
getCacheUpdaterType
public chemaxon.jchem.base.storage.cache.CacheUpdaterType getCacheUpdaterType(String tableName) throws SQLException For internal use only.- Throws:
SQLException
-
setCacheUpdaterType
@SubjectToRemoval(date=JUL_01_2025) @Deprecated(forRemoval=true) public void setCacheUpdaterType(String tableName, chemaxon.jchem.base.storage.cache.CacheUpdaterType cacheUpdaterType) throws SQLException Deprecated, for removal: This API element is subject to removal in a future version.For internal use only.- Throws:
SQLException
-
DatabaseProperties(ConnectionHandler, boolean)instead.