* @param selection selection criteria
* @return collection of terms
*/
public Terms search(QueryCriteria queryCriteria, Selection selection) {
Terms terms = new Terms();
OntModelUtil ontModelUtil = new OntModelUtil(ontCtx.getModel());
OntClass search = ontCtx.getModel().getOntClass(
ontModelUtil.getCode(queryCriteria.getTerm(), locale));
if (search == null) {
log.fine("Query: " + queryCriteria + " returned no results.");
return terms;
}
// process categories
if (selection.isCategories()) {
processCategories(ontModelUtil, queryCriteria, search, terms);
}
// process neighbors
if (selection.isNeighbors()) {
processNeighbors(ontModelUtil, queryCriteria, search, terms);
}
terms.removeByThreshold(queryCriteria.getThreshold());
terms.sortByCount();
return terms;
}