About setFilterQuery

User 7c5047cd7b

12-04-2006 10:09:00

Hello,





I would like to know whether you have any bug report about setFilterQuery. It doesn't work in my tool.


The following is my code.


I would appreciate your advice.


-------------------------------------------------


con = getConnection();


conHandler = new ConnectionHandler();


searcher = new JChemSearch();


JChemSearch.clearCache();


conHandler.setConnection(con);





searcher.setConnectionHandler(conHandler);





String structureTableName = "SC_MOL_SA";


if(editBean.getDbID() != null)


{


String filterSQL = "select cd_id from " + structureTableName + " where cd_link_id = " + editBean.getDbID() ;


searcher.setFilterQuery(filterSQL);


}


else


{


return CHECK_OK;


}





searcher.setQueryStructure(editBean.getSaMol());


searcher.setSearchType(JChemSearch.EXACT);


searcher.setStructureTable(structureTableName);


searcher.setReturnsNonHits(false);


searcher.setWaitingForResult(true);





searcher.run();


----------------------------------------------------------------


My Jchem is 3.1.6


My DB is MySQL 4.1.3

ChemAxon 9c0afc9aaf

13-04-2006 06:48:51

Hi,





We could successfully reproduce the problem.


It seems it is specific to EXACT search (SUBSTRUCTURE works as expected in this case).


It will be fixed in the next JChem version (3.1.7) which is expected soon.





Thank you for the bug report.





Best regards,





Szilard





PS: I assume you called "JChemSearch.clearCache(); " only for debug purposes. Calling this before every search would result in a full cache reload every time slowing the search a lot.

User 7c5047cd7b

13-04-2006 10:06:36

Dear Szilard





Thank you for your help.





I have another question about the following method





public void setQueryStructure(Molecule queryMol)





I found it would modify the queryMol.


It could change benzene from dearomatize to aromatize.


----------------------------------


:


Molecule a = msketch.getMol();


String molStrBef = a.toFormat("mol");


setQueryStructure(a);


:


searcher.run();


String molStrAft = a.toFormat("mol");


-----------------------------------


molStrBef is a dearomatic benzene.


molStrAft is an aromatic benzene.





Could you give me any information about this case?

ChemAxon 9c0afc9aaf

13-04-2006 13:04:33

Hi,





For graph searches the query structure must be standardized.


The basic (default) standardization is aromatization.


You can also set your custom standardization rules at table creation or regeneration by specifying a Standardizer XML configuration.


Please see:





http://www.chemaxon.com/jchem/doc/user/Query.html#noteonaromatic


http://www.chemaxon.com/jchem/doc/user/Standardizer.html





The problem in this case is that we work on the same object that you provide, that's why the changes are reflected.


(I guess it never occurred to us that someone may want to use the query structure for further purposes)





The solution is to clone the molecule, so only one of the two instances will be altered:





Code:
Molecule queryMol= ... ;


Molecule copy = (Molecule) queryMol.clone();






We will mention this behavior in the API documentation.





Best regards,





Szilard