Package org.z3950.zing.cql

Examples of org.z3950.zing.cql.CQLParser


        resultsLeft = resultsUnion;
      }
      results = resultsLeft;
    }   
    else if ( node instanceof CQLTermNode ) {
      CQLTermNode term = (CQLTermNode)node;
      String index = term.getIndex();
      if ( index.startsWith("tb.title") ) {
        results.addAll(doSearch(request, response, SearchType.byTitle, errors, term.getTerm()));
      } else if ( index.startsWith("tb.identifier") ) {
        results.addAll(doSearch(request, response, SearchType.byID, errors, term.getTerm()));
      } else if ( index.startsWith("tb.type") ) {
        results.addAll(doSearch(request, response, SearchType.byType, errors, term.getTerm()));
      } else if ( index.startsWith("tb.kind") ) {
        results.addAll(doSearch(request, response, SearchType.byKind, errors, term.getTerm()));
      } else if ( index.startsWith("tb.quality") ) {
        results.addAll(doSearch(request, response, SearchType.byQuality, errors, term.getTerm()));
      } else if ( index.startsWith("tb.ntax") ) {
        results.addAll(doSearch(request, response, SearchType.byNTAX, errors, term.getTerm()));
      } else {
        // issue warnings
        addMessage(request, "Unsupported index: " + index);
      }
    }
View Full Code Here


        resultsLeft = resultsUnion;
      }
      results = resultsLeft;
   
    else if ( node instanceof CQLTermNode ) {
        CQLTermNode term = (CQLTermNode)node;
        String index = term.getIndex();
        if ( index.startsWith("tb.identifier") ) {
          if ( index.endsWith("ncbi") ) {
            Collection<PhyloTree> trees = doSearch(request, response, errors, term.getTerm());
            if ( null != trees ) {
              results.addAll(trees);
            }
          }
          else {
View Full Code Here

        }
        else if (node instanceof CQLTermNode)
        {
            logger.warn("FIXME: CQLTermNode will not be translated properly");

            CQLTermNode cqlTermNode = (CQLTermNode) node;
            QueryModelAPTNode attributePlusTermNode = new QueryModelAPTNode();
            attributePlusTermNode.setTerm(cqlTermNode.getTerm());

            if ((cqlTermNode.getQualifier() != null) && (cqlTermNode.getQualifier().length() > 0))
            {
                logger.debug("Using supplied qualifier: " + cqlTermNode.getQualifier());
                attributePlusTermNode.setAttribute("bib-1.1", cqlTermNode.getQualifier());
            }
            else
            {
                logger.debug("Using default qualifier: " + DEFAULT_QUALIFIER);
                attributePlusTermNode.setAttribute("bib-1.1", DEFAULT_QUALIFIER);
            }

            CQLRelation relation = cqlTermNode.getRelation();

            if (relation != null)
            {
                if (relation.getBase() != null)
                {
View Full Code Here

            if (accessPointNode != null)
            {
                qualifier = accessPointNode.toString();
            }

            result = new CQLTermNode(qualifier, relation, attributPlusTermNode.getTerm().toString());
        }

        return result;
    }
View Full Code Here

        resultsLeft = resultsUnion;
      }
      results = resultsLeft;
    }   
    else if ( node instanceof CQLTermNode ) {
      CQLTermNode term = (CQLTermNode)node;
      boolean exactMatch = term.getRelation().getBase().equals("==");
      CQLRelation relation = term.getRelation();
      String index = term.getIndex();
      if ( index.startsWith("tb.title") ) {
        results.addAll(doSearch(request, response, SearchType.byTitle, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.equals("tb.identifier.study") ) {
        results.addAll(doSearch(request, response, SearchType.byID, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("dcterms.contributor") ) {
        results.addAll(doSearch(request, response, SearchType.byAuthorName, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("dcterms.abstract") ) {
        results.addAll(doSearch(request, response, SearchType.inAbstract, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("dcterms.subject") ) {
        results.addAll(doSearch(request, response, SearchType.byKeyword, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("dcterms.bibliographicCitation") ) {
        results.addAll(doSearch(request, response, SearchType.inCitation, errors, term.getTerm(),exactMatch,relation));       
      } else if ( index.equals("tb.identifier.study.tb1") ) {
        results.addAll(doSearch(request, response, SearchType.byLegacyID, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("prism.publicationName") ) {
        results.addAll(doSearch(request, response, SearchType.byJournal, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("dc.date") ) {
        results.addAll(doSearch(request,response, SearchType.byLastModifiedDate, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("prism.creationDate") ) {
        results.addAll(doSearch(request,response, SearchType.byCreationDate, errors, term.getTerm(),exactMatch,relation));
      } else if ( index.startsWith("prism.publicationDate") ) {
        results.addAll(doSearch(request,response, SearchType.byPublicationDate, errors, term.getTerm(),exactMatch,relation))
      } else if ( index.startsWith("prism.modificationDate") ) {
        results.addAll(doSearch(request,response, SearchType.byLastModifiedDate, errors, term.getTerm(),exactMatch,relation));               
      } else if ( index.startsWith("prism.doi") ) {
        results.addAll(doSearch(request,response,SearchType.byDOI, errors, term.getTerm(), exactMatch,relation));
      }
      else {
        // issue warnings
        addMessage(request, "Unsupported index: " + index);
      }   
View Full Code Here

        resultsLeft = resultsUnion;
      }
      results = resultsLeft;
    }
    else if ( node instanceof CQLTermNode ) {
      CQLTermNode term = (CQLTermNode)node;
      String index = term.getIndex();
     
      // CQL predicate is a title, will do a text search
      if ( index.startsWith("tb.title") ) {
        boolean exactMatch = term.getRelation().getBase().equals("==");
        SearchTable searchTable = null;
        if ( index.endsWith("taxonLabel") ) {
          searchTable = SearchTable.TAXONLABEL;
        }
        else if ( index.endsWith("taxonVariant") ) {
          searchTable = SearchTable.TAXONVARIANT;
        }
        else if ( index.endsWith("taxon") ) {
          searchTable = SearchTable.TAXON;
        }
        boolean caseSensitive = true;
        if ( ! term.getRelation().getModifiers().isEmpty() ) {
          caseSensitive = ! term.getRelation().getModifiers().firstElement().getType().equalsIgnoreCase("ignoreCase");
        }
        results.addAll(doTextSearch(term.getTerm(), caseSensitive, exactMatch, searchTable));
      }
     
      // CQL predicate is an identifier, will do id search
      else if ( index.startsWith("tb.identifier") ) {
        NamingAuthority namingAuthority = null;
        if ( index.endsWith("ncbi") ) {
          namingAuthority = NamingAuthority.NCBI;
        }
        else if ( index.endsWith("ubio") ) {
          namingAuthority = NamingAuthority.UBIO;
        }
        else {
          namingAuthority = NamingAuthority.TREEBASE;
        }
        results.addAll(doIdentifierSearch(request, term.getTerm(), namingAuthority, index));
      } else {
        // issue warnings
        addMessage(request, "Unsupported index: " + index);
      }
     
View Full Code Here

      CQLRelation relation = ((CQLTermNode)node).getRelation();
      Map<String,String> mapping = getPredicateMapping();
      for ( String key : mapping.keySet() ) {
        index = index.replaceAll(key, mapping.get(key));
      }
      return new CQLTermNode(index,relation,term);
    }
    logger.debug(node);
    return node;
 
View Full Code Here

TOP

Related Classes of org.z3950.zing.cql.CQLParser

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.