Package org.apache.oodt.cas.catalog.query

Examples of org.apache.oodt.cas.catalog.query.QueryLogicalGroup


    return catalogReceipts;
  }

  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;
          }
View Full Code Here


        bucketNameFilter += "bucket_name = '" + queryExpression.getBucketNames().iterator().next() + "' AND ";
      else if (queryExpression.getBucketNames().size() > 1)
        bucketNameFilter += "(bucket_name = '" + StringUtils.join(queryExpression.getBucketNames().iterator(), "' OR bucket_name = '") + "') AND ";
    }
        if (queryExpression instanceof QueryLogicalGroup) {
          QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
            sqlQuery = "(" + this.getSqlQuery(qlg.getExpressions().get(0));
            String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
            for (int i = 1; i < qlg.getExpressions().size(); i++)
                sqlQuery += ") " + op + " (" + this.getSqlQuery(qlg.getExpressions().get(i));
            sqlQuery += ")";
        }else if (queryExpression instanceof ComparisonQueryExpression){
          ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
          String operator = null;
            if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
View Full Code Here

      jjtree.closeNodeScope(jjtn000, true);
      jjtc000 = false;
        if (qe2 == null) {
                {if (true) return qe1;}
        }else {
                QueryLogicalGroup queryLogicalGroup = new QueryLogicalGroup();
                if (bucketNames != null)
                        queryLogicalGroup.setBucketNames(new HashSet<String>(bucketNames));
                queryLogicalGroup.setOperator(QueryLogicalGroup.Operator.valueOf(operator.image.trim().toUpperCase()));
                queryLogicalGroup.addExpression(qe1);
                queryLogicalGroup.addExpression(qe2);
                {if (true) return queryLogicalGroup;}
        }
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
View Full Code Here

    return catalogReceipts;
  }

  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;
          }
View Full Code Here

  }
 
    private String getSqlQuery(QueryExpression queryExpression) throws QueryServiceException, UnsupportedEncodingException {
        String sqlQuery = null;
        if (queryExpression instanceof QueryLogicalGroup) {
          QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
            sqlQuery = "(" + this.getSqlQuery(qlg.getExpressions().get(0));
            String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
            for (int i = 1; i < qlg.getExpressions().size(); i++)
                sqlQuery += ") " + op + " (" + this.getSqlQuery(qlg.getExpressions().get(i));
            sqlQuery += ")";
        }else if (queryExpression instanceof ComparisonQueryExpression){
          ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
          String operator = null;
            if (cqe.getOperator().equals(ComparisonQueryExpression.Operator.EQUAL_TO)) {
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.catalog.query.QueryLogicalGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.