private Query expandTerm(String term) {
BooleanQuery bq = new BooleanQuery();
Set<String> myOntIDs = OBOOntology.getInstance().getIdsForTermWithDescendants(term);
if(myOntIDs != null && myOntIDs.size() > 0) {
OntologyQuery oq = new OntologyQuery(myOntIDs);
bq.add(new BooleanClause(oq.getLuceneQuery(), Occur.SHOULD));
}
Matcher m = similarPattern.matcher(term);
try {
if(m.matches()) {
String name = m.group(3);
String smiles = lis.getSmilesFromName(name);
ChemQuery cq = lis.makeChemQueryFromSMILES(smiles, "similarity", m.group(1));
bq.add(new BooleanClause(cq.getLuceneQuery(), BooleanClause.Occur.SHOULD));
} else {
String inchi = lis.getInchiFromName(term);
if(inchi != null) {
bq.add(new BooleanClause(new TermQuery(new Term("InChI", inchi)), BooleanClause.Occur.SHOULD));
}
}
} catch (Exception e) {
e.printStackTrace();
return null;