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

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


  protected int pageSize;
  protected String query;
  protected Set<String> catalogIds;
 
  public void performAction(CatalogServiceClient csClient) throws Exception {
    QueryExpression queryExpression = QueryParser.parseQueryExpression(query);
    Page page = null;
    if (catalogIds == null)
      page = csClient.getPage(new PageInfo(pageSize, pageNum), queryExpression);
    else
      page = csClient.getPage(new PageInfo(pageSize, pageNum), queryExpression, catalogIds);
View Full Code Here


    }
    return queryExpression;
  }
 
  public static void main(String[] args) throws ParseException, TokenMgrError {
    QueryExpression qe = QueryParser.parseQueryExpression("{bucketNames = 'joe,tim' ; Name == 'Tim,Joe' AND City == 'Upland' AND State == 'CA'}");
    System.out.println(qe.toString());
    System.out.println(simplifyQuery(qe).toString());
    System.out.println("");
    qe = QueryParser.parseQueryExpression("Name == 'Tim,Joe' AND (City == 'Upland' AND State == 'CA')");
    System.out.println(qe.toString());
    System.out.println(simplifyQuery(qe).toString());
  }
View Full Code Here

  protected String query;
  protected Set<String> catalogIds;
  protected List<String> termNames;
 
  public void performAction(CatalogServiceClient csClient) throws Exception {
    QueryExpression queryExpression = QueryParser.parseQueryExpression(query);
    Page page = null;
    if (catalogIds == null)
      page = csClient.getPage(new PageInfo(pageSize, pageNum), queryExpression);
    else
      page = csClient.getPage(new PageInfo(pageSize, pageNum), queryExpression, catalogIds);
View Full Code Here

  protected String query;
  protected Set<String> catalogIds;
 
  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

  final public QueryExpression parseInput() throws ParseException {
/*@bgen(jjtree) parseInput */
        SimpleNode jjtn000 = new SimpleNode(JJTPARSEINPUT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);QueryExpression qe = null;
    try {
      qe = Query(null);
      jj_consume_token(0);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
View Full Code Here

  final public QueryExpression Query(Vector<String> bucketNames) throws ParseException {
/*@bgen(jjtree) Query */
        SimpleNode jjtn000 = new SimpleNode(JJTQUERY);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);QueryExpression qe1 = null;
        QueryExpression qe2 = null;
        Token operator = null;
    try {
      qe1 = QueryExpression(bucketNames);
      label_1:
      while (true) {
View Full Code Here

  final public QueryExpression QueryExpression(Vector<String> bucketNames) throws ParseException {
/*@bgen(jjtree) QueryExpression */
        SimpleNode jjtn000 = new SimpleNode(JJTQUERYEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);QueryExpression qe = null;
    try {
      if (jj_2_2(2147483647)) {
        qe = PriorityQueryExpression(bucketNames);
      } else if (jj_2_3(2147483647)) {
        qe = StdQueryExpression();
View Full Code Here

  final public QueryExpression StdQueryExpression() throws ParseException {
/*@bgen(jjtree) StdQueryExpression */
        SimpleNode jjtn000 = new SimpleNode(JJTSTDQUERYEXPRESSION);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);QueryExpression qe = null;
        Vector<String> bucketNames = new Vector<String>();
    try {
      jj_consume_token(OPEN_BRACES);
      label_2:
      while (true) {
View Full Code Here

  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

      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

TOP

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

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.