protected QueryExpression reduceToUnderstoodExpressions(Catalog catalog, QueryExpression queryExpression) throws CatalogDictionaryException, CatalogException {
if (queryExpression instanceof QueryLogicalGroup) {
QueryLogicalGroup queryLogicalGroup = (QueryLogicalGroup) queryExpression;
List<QueryExpression> restrictedExpressions = new Vector<QueryExpression>();
for (QueryExpression qe : queryLogicalGroup.getExpressions()) {
QueryExpression restrictedQE = this.reduceToUnderstoodExpressions(catalog, qe);
if (restrictedQE == null && queryLogicalGroup.getOperator().equals(QueryLogicalGroup.Operator.AND) && this.disableIntersectingCrossCatalogQueries) {
restrictedExpressions.clear();
break;
}
if (restrictedQE != null)
restrictedExpressions.add(restrictedQE);
}
if (restrictedExpressions.size() > 0) {
if (restrictedExpressions.size() == 1) {
return restrictedExpressions.get(0);
}else {
QueryLogicalGroup restrictedQueryLogicalGroup = queryLogicalGroup.clone();
restrictedQueryLogicalGroup.setExpressions(restrictedExpressions);
return restrictedQueryLogicalGroup;
}
}else {
return null;
}
}else if (queryExpression instanceof WrapperQueryExpression) {
WrapperQueryExpression wrapperQueryExpresssion = (WrapperQueryExpression) queryExpression;
if (catalog.isInterested(queryExpression)) {
QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, wrapperQueryExpresssion.getQueryExpression());
if (qe != null) {
WrapperQueryExpression wqe = wrapperQueryExpresssion.clone();
wqe.setQueryExpression(qe);
return wqe;
}else if (wrapperQueryExpresssion.isValidWithNoSubExpression()){