Package org.z3950.zing.cql

Examples of org.z3950.zing.cql.CQLParser


  protected ModelAndView handleQueryRequest(HttpServletRequest request,
      HttpServletResponse response, BindException errors, String query)
      throws CQLParseException, IOException, InstantiationException {
    //
    CQLParser parser = new CQLParser();
    CQLNode root = parser.parse(query);
    root = normalizeParseTree(root);
    HashSet<PhyloTree> queryResults = doCQLQuery(root, new HashSet<PhyloTree>(),request, response, errors);
    TreeSearchResults tsr = new TreeSearchResults(queryResults);
    saveSearchResults(request, tsr);
   
View Full Code Here


        return new CqlQuery(createCQLNode(model.toQueryModel(), null, null, complexSupport));
    }

    public static CQLNode createCQLNode(QueryModelNode node, String sourceNamespace, String targetNamespace, boolean complexSupport)
    {
        CQLNode result = null;

        if (node instanceof QueryModel)
        {
            result = createCQLNode(((QueryModel) node).getRoot(), sourceNamespace, targetNamespace, complexSupport);
        }
View Full Code Here

  protected ModelAndView handleQueryRequest(HttpServletRequest request,
      HttpServletResponse response, BindException errors,String query)
      throws CQLParseException, IOException, InstantiationException, ParseException {
    //String query = request.getParameter("query");           
    CQLParser parser = new CQLParser();
    CQLNode root = parser.parse(query);
    root = normalizeParseTree(root);
    Set<Study> queryResults = doCQLQuery(root, new HashSet<Study>(),request, response, errors);
    StudySearchResults tsr = new StudySearchResults(queryResults);
    if ( TreebaseUtil.isEmpty(request.getParameter("format")) || ! request.getParameter("format").equals("rss1") ) {
      saveSearchResults(request, tsr);
View Full Code Here

  protected ModelAndView handleQueryRequest(HttpServletRequest request,
      HttpServletResponse response, BindException errors, String query)
      throws CQLParseException, IOException, InstantiationException {
    //String query = request.getParameter("query");
    CQLParser parser = new CQLParser();
    CQLNode root = parser.parse(query);
    root = normalizeParseTree(root);
    Set<Taxon> queryResults = doCQLQuery(root, new HashSet<Taxon>(),request);
    TaxonSearchResults tsr = new TaxonSearchResults(queryResults);
    saveSearchResults(request, tsr);
    if ( TreebaseUtil.isEmpty(request.getParameter("format")) ||
View Full Code Here

      request.getSession().setAttribute("phyloWSPath", phyloWSPath);
      if ( null != request.getParameter("query") ) {     
        String query = request.getParameter("query");           
        if ( ! TreebaseUtil.isEmpty(query) ) {
          CQLParser parser = new CQLParser();
          CQLNode root = parser.parse(query);     
          request.getSession().setAttribute("normalizedCQLQuery", URLEncoder.encode(root.toCQL(),"UTF-8"));
        }
      }
    }
    return new ModelAndView("searchResultsAsRDF");
  }
View Full Code Here

                result = new CQLOrNode(createCQLNode(((QueryModelComplexNode) node).getLhs(), sourceNamespace, targetNamespace, complexSupport), createCQLNode(((QueryModelComplexNode) node).getRhs(), sourceNamespace, targetNamespace, complexSupport));

                break;

            case 3:
                result = new CQLNotNode(createCQLNode(((QueryModelComplexNode) node).getLhs(), sourceNamespace, targetNamespace, complexSupport), createCQLNode(((QueryModelComplexNode) node).getRhs(), sourceNamespace, targetNamespace, complexSupport));

                break;

            default:
                logger.warn("FIXME: Proximity-Operator not yet handled");
View Full Code Here

                result = new CQLAndNode(createCQLNode(((QueryModelComplexNode) node).getLhs(), sourceNamespace, targetNamespace, complexSupport), createCQLNode(((QueryModelComplexNode) node).getRhs(), sourceNamespace, targetNamespace, complexSupport));

                break;

            case 2:
                result = new CQLOrNode(createCQLNode(((QueryModelComplexNode) node).getLhs(), sourceNamespace, targetNamespace, complexSupport), createCQLNode(((QueryModelComplexNode) node).getRhs(), sourceNamespace, targetNamespace, complexSupport));

                break;

            case 3:
                result = new CQLNotNode(createCQLNode(((QueryModelComplexNode) node).getLhs(), sourceNamespace, targetNamespace, complexSupport), createCQLNode(((QueryModelComplexNode) node).getRhs(), sourceNamespace, targetNamespace, complexSupport));
View Full Code Here

        title=dbProperties.getProperty("SRWFileSystemDatabase.title");
        schemaName=dbProperties.getProperty("SRWFileSystemDatabase.schemaName");
        schemaID=dbProperties.getProperty("SRWFileSystemDatabase.schemaID");
        schemaLocation=dbProperties.getProperty("SRWFileSystemDatabase.schemaLocation");
        directory=new File(dbHome);
        parser=new CQLParser(CQLParser.V1POINT1);
        getFilenames();
        log.debug("leaving SRWFileSystemDatabase.init");
        return;
    }
View Full Code Here

        String scanClause=request.getScanClause();
        log.info("scanClause="+scanClause);
        if(scanClause!=null) {
            ert.setScanClause(scanClause);
            try {
                CQLTermNode node=Utilities.getFirstTerm(new CQLParser(CQLParser.V1POINT1).parse(scanClause));
                if(node!=null) {
                    SearchClauseType sct=new SearchClauseType();
                    sct.setTerm(node.getTerm());
                    RelationType rt=new RelationType();
                    rt.setValue(node.getRelation().getBase());
View Full Code Here

    /**
     * Test of getFirstTerm method, of class ORG.oclc.os.SRW.Utilities.
     */
    public void testGetFirstTerm() throws Exception {
        CQLParser parser = new CQLParser();       
        CQLNode rootNode=parser.parse("dog");
        assertEquals("dog", Utilities.getFirstTerm(rootNode).getTerm());

        rootNode=parser.parse("dog or cat and mouse");
        assertEquals("dog", Utilities.getFirstTerm(rootNode).getTerm());
    }
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.