Examples of CQLTermNode


Examples of org.z3950.zing.cql.CQLTermNode

            return result;
        }
        if(!(query instanceof CQLTermNode)) {
            result.addDiagnostic(SRWDiagnostic.UnsupportedBooleanOperator, null);
        }
        CQLTermNode term=(CQLTermNode) query;
        String index;
        index=term.getIndex();
        if(index.equals("oai.identifier") || index.equals("identifier")) {
            int filenameOffset=Collections.binarySearch(filenames, term.getTerm());
            if(filenameOffset>=0) {
                result.setNumberOfRecords(1);
                try {
                    byte[] b;
                    InputStream recStream=Utilities.openInputStream(filenames.get(filenameOffset), dbHome, null);
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

        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());
                    sct.setRelation(rt);
                    sct.setIndex(getQualifier(node));
                    ert.setXScanClause(sct);
                }
                else {
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

            tt.setLeftOperand(toOperandType(cbn.left));
            tt.setRightOperand(toOperandType(cbn.right));
            ot.setTriple(tt);
        }
        else if(node instanceof CQLTermNode) {
            CQLTermNode ctn=(CQLTermNode)node;
            SearchClauseType sct=new SearchClauseType();
            sct.setIndex(getQualifier(ctn));
            RelationType rt=new RelationType();
            rt.setValue(ctn.getRelation().getBase());
            sct.setRelation(rt);
            sct.setTerm(ctn.getTerm());
            ot.setSearchClause(sct);
        }
        else {
            log.error("Found a node on the parse tree of type: "+node);
        }
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

        ScanResponseType scanResponse = new ScanResponseType();
        String version=request.getVersion();
        if(version!=null && !version.equals("1.1"))
            return diagnostic(SRWDiagnostic.UnsupportedVersion, version, scanResponse);

        CQLTermNode root = null;
        int max = maxTerms,  pos = position;
        long startTime = System.currentTimeMillis();
        PositiveInteger pi = request.getMaximumTerms();
        if(pi!=null) {
            max=pi.intValue();
            pos=max/2+1;
        }
        NonNegativeInteger nni = request.getResponsePosition();
        if(nni!=null)
            pos=nni.intValue();
        String scanTerm = request.getScanClause();
        try{
            if (scanTerm!=null)
                log.info("scanTerm:\n" + Utilities.byteArrayToString(scanTerm.getBytes("UTF-8")));
        } catch (Exception e){}
        log.info("maxTerms="+max+", position="+pos);
        try {
            root = Utilities.getFirstTerm(parser.parse(scanTerm));
        } catch (CQLParseException e) {
            log.error(e);
            return diagnostic(SRWDiagnostic.QuerySyntaxError, e.getMessage(),
                scanResponse);
        } catch (IOException e) {
            log.error(e);
            return diagnostic(SRWDiagnostic.QuerySyntaxError, e.getMessage(),
                scanResponse);
        }
        if (root.getTerm().length()==0)
            // The method getQualifier() was replaced by getIndex() in version
            // 1.0 of the parser. This code ensures that either one works.
            //root = new CQLTermNode(root.getQualifier(), root.getRelation(), "$");
            root = new CQLTermNode(SRWSoapBindingImpl.getQualifier(root), root.getRelation(), "$");
        String resultSetID = root.getResultSetName();
        if (resultSetID!=null) { // you can't scan on resultSetId!
            return diagnostic(SRWDiagnostic.UnsupportedIndex,
                    "cql.resultSetId", scanResponse);
        }
        TermsType terms = new TermsType();
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

            CQLBooleanNode cbn=(CQLBooleanNode)root;
            getResultSetIds(cbn.left, resultSetIds);
            getResultSetIds(cbn.right, resultSetIds);
        }
        else {
            CQLTermNode ctn=(CQLTermNode)root;
            //if(ctn.getQualifier().equals("cql.resultSetId")) {
            if(SRWSoapBindingImpl.getQualifier(ctn).equals("cql.resultSetId")) {
                String resultSetId=ctn.getTerm();
                if(oldResultSets.get(resultSetId)==null)
                    throw new SRWDiagnostic(SRWDiagnostic.ResultSetDoesNotExist, resultSetId);
                resultSetIds.add(resultSetId);
                resetTimer(resultSetId);
                log.info("added resultSetId "+ctn.getTerm());
            }
        }
    }
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

        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.equals("tb.identifier.matrix") ) {
        results.addAll(doSearch(request, response, SearchType.byID, errors, term.getTerm()));
      } else if ( index.equals("tb.identifier.matrix.tb1") ) {
        results.addAll(doSearch(request, response, SearchType.byTB1ID, errors, term.getTerm()));
      } else if ( index.startsWith("tb.type") ) {
        results.addAll(doSearch(request, response, SearchType.byType, errors, term.getTerm()));
      } else if ( index.startsWith("tb.ntax") ) {
        results.addAll(doSearch(request, response, SearchType.byNTAX, errors, term.getTerm()));
      } else if ( index.startsWith("tb.nchar") ) {
        results.addAll(doSearch(request, response, SearchType.byNTAX, errors, term.getTerm()));
      } else {
        // issue warnings
        addMessage(request, "Unsupported index: " + index);
     
    }
View Full Code Here

Examples of org.z3950.zing.cql.CQLTermNode

        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

Examples of org.z3950.zing.cql.CQLTermNode

        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

Examples of org.z3950.zing.cql.CQLTermNode

        }
        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

Examples of org.z3950.zing.cql.CQLTermNode

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

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

        return result;
    }
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.