Examples of QueryExpression


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

  final public QueryExpression PriorityQueryExpression(Vector<String> bucketNames) throws ParseException {
/*@bgen(jjtree) PriorityQueryExpression */
        SimpleNode jjtn000 = new SimpleNode(JJTPRIORITYQUERYEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);QueryExpression qe = null;
    try {
      jj_consume_token(OPEN_PARENS);
      qe = Query(bucketNames);
      jj_consume_token(CLOSE_PARENS);
      jjtree.closeNodeScope(jjtn000, true);
View Full Code Here

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

      try {
        int totalResults = 0;
        LinkedHashMap<String, Integer> catalogToSizeOfMap = new LinkedHashMap<String, Integer>();
        for (String catalogId : catalogIds) {
          Catalog catalog = this.getCatalog(catalogId);
          QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
          if (qe != null) {
            int catalogResultSize = catalog.sizeOf(qe);
            totalResults += catalogResultSize;
            catalogToSizeOfMap.put(catalogId, catalogResultSize);
          }
        }
       
        LOG.log(Level.INFO, "Routing query to catalogs as non-cross catalog intersecting queries . . .");
        if (totalResults <= this.crossCatalogResultSortingThreshold) {
          List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
          for (String catalogId : catalogToSizeOfMap.keySet()) {
            Catalog catalog = this.getCatalog(catalogId);
            QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
            if (qe != null)
              catalogReceipts.addAll(catalog.query(qe));
          }
          List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
          LOG.log(Level.INFO, "Sorting Query Results . . . ");
          Collections.sort(transactionReceipts, new Comparator<TransactionReceipt>() {
            public int compare(TransactionReceipt o1,
                TransactionReceipt o2) {
              return o2.getTransactionDate().compareTo(o1.getTransactionDate());
            }
          });
          QueryPager queryPager = new QueryPager(transactionReceipts);
          queryPager.setPageInfo(pageInfo);
          return this.getPage(queryExpression, catalogIds, queryPager);
        }else {
          int currentIndex = 0;
          int desiredStartingIndex = pageInfo.getPageNum() * pageInfo.getPageSize();
          List<CatalogReceipt> pageOfReceipts = new Vector<CatalogReceipt>();
          for (Entry<String, Integer> entry : catalogToSizeOfMap.entrySet()) {
            if (desiredStartingIndex - currentIndex <= entry.getValue()) {
              Catalog catalog = this.getCatalog(entry.getKey());
              QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
              if (qe != null) {
                List<CatalogReceipt> receipts = catalog.query(qe, desiredStartingIndex - currentIndex, Math.min((desiredStartingIndex - currentIndex) + pageInfo.getPageSize(), entry.getValue()));
                pageOfReceipts.addAll(receipts);
                if (pageOfReceipts.size() >= pageInfo.getPageSize())
                  break;
View Full Code Here

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

      if (queryResult.getCatalogReceipts() == null && queryResult.getInterestedCatalogs() != null) {
        for (Catalog catalog : this.getCurrentCatalogList()) {
          try {
            if (queryResult.getInterestedCatalogs().contains(catalog.getId())) {
              LOG.log(Level.INFO, "Restricting query to understood terms for Catalog '" + catalog + "'");
              QueryExpression reducedExpression = this.reduceToUnderstoodExpressions(catalog, queryExpression);
              LOG.log(Level.INFO, "Querying Catalog '" + catalog + "' with query '" + reducedExpression + "'");
              catalogReceipts.addAll(catalog.query(reducedExpression));
            }
          }catch (Exception e) {
            if (this.oneCatalogFailsAllFail)
View Full Code Here

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

      // check for catalogs interested in wrapper query expression
      restrictToCatalogIds.retainAll(getInterestedCatalogs(queryExpression, restrictToCatalogIds));
     
      // check for catalogs interested in wrapped query expression
      QueryResult wrapperExprQueryResult = null;
      QueryExpression wrapperQE = ((WrapperQueryExpression) queryExpression).getQueryExpression();
      if (wrapperQE instanceof QueryLogicalGroup) {
        wrapperExprQueryResult = this.queryRecur((QueryLogicalGroup) wrapperQE, restrictToCatalogIds);
      }else {
        wrapperExprQueryResult = new QueryResult(wrapperQE);
        wrapperExprQueryResult.interestedCatalogs = getInterestedCatalogs(wrapperQE, restrictToCatalogIds);
View Full Code Here

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

  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()){
View Full Code Here

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

  protected String query;
  protected Set<String> catalogIds;
  protected List<String> termNames;
 
  public void performAction(CatalogServiceClient csClient) throws Exception {
    QueryExpression queryExpression = QueryParser.parseQueryExpression(query);
    QueryPager queryPager = null;
    if (catalogIds == null)
      queryPager = csClient.query(queryExpression);
    else
      queryPager = csClient.query(queryExpression, catalogIds);
View Full Code Here

Examples of org.apache.ws.resource.properties.query.QueryExpression

      if ( request.isSetInitialTerminationTime(  ) )
      {
         initialTerminationTime = request.getInitialTerminationTime(  );
      }

      QueryExpression precondition = null;
      if ( request.isSetPrecondition(  ) )
      {
         precondition = new XmlBeansQueryExpression( request.getPrecondition(  ) );
      }

      QueryExpression selector = null;
      if ( request.isSetSelector(  ) )
      {
         selector = new XmlBeansQueryExpression( request.getSelector(  ) );
      }
View Full Code Here

Examples of org.datanucleus.store.mapped.expression.QueryExpression

     * @return The query statement
     */
    public QueryExpression getExistsSubquery(QueryExpression qs, JavaTypeMapping mapping,
            LogicSetExpression ownerTe, DatastoreIdentifier collectionTableAlias)
    {
        QueryExpression stmt = dba.newQueryStatement(containerTable, collectionTableAlias,
            qs.getClassLoaderResolver());
        stmt.setParent(qs);

        // Join for the owner
        ScalarExpression ownerExpr = mapping.newScalarExpression(stmt, ownerTe);
        ScalarExpression ownerInCollectionExpr = ownerMapping.newScalarExpression(stmt,
            stmt.getTableExpression(collectionTableAlias));
        stmt.andCondition(ownerExpr.eq(ownerInCollectionExpr));

        // Select id mapping of element
        stmt.select(collectionTableAlias, elementMapping);

        return stmt;
    }
View Full Code Here

Examples of org.exolab.castor.persist.spi.QueryExpression

       
        if (!handler.hasNext()) {
            // Create "SELECT seq_val FROM seq_table WHERE seq_key='table'"
            // with database-dependent keyword for lock
            // Note: Some databases (InstantDB, HypersonicSQL) don't support such locks.
            QueryExpression query = _factory.getQueryExpression();
            query.addColumn(_seqTable, _seqValue);
            query.addCondition(_seqTable, _seqKey, QueryExpression.OP_EQUALS, JDBCSyntax.PARAMETER);
            String lockSQL = query.getStatement(true);
           
            // For the case that "SELECT FOR UPDATE" is not supported, perform dirty checking
            String updateSQL = "UPDATE " +  _seqTable
                + " SET " + _seqValue + "=" + JDBCSyntax.PARAMETER
                + JDBCSyntax.WHERE + _seqKey + QueryExpression.OP_EQUALS + JDBCSyntax.PARAMETER
View Full Code Here

Examples of org.exolab.castor.persist.spi.QueryExpression

            if (factory == null) {
            throw new DTXException("dtx.NoFactory");
            }

            QueryExpression expr = factory.getQueryExpression();

            if (expr == null) {
            throw new DTXException("dtx.NoQueryExpression");
            }

            initQuery(_clsMapping, expr);

            if (token.hasMoreTokens()) {
            if (!token.nextToken().equalsIgnoreCase("WHERE")) {
                throw new DTXException("Missing WHERE clause");
            }
            addField(_clsMapping, token, expr);
            while (token.hasMoreTokens()) {
                if (!token.nextToken().equals("AND")) {
                throw new QueryException("Only AND supported in WHERE clause");
                }
                addField(_clsMapping, token, expr);
            }
            }

            String sql = expr.getStatement(false);

            sql = sql + " ORDER BY ";

            for (java.util.Iterator it = _ids.iterator(); it.hasNext(); ) {
            String id = (String) it.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.