Package gov.loc.www.zing.srw

Examples of gov.loc.www.zing.srw.TermType


    }

    public TermList getTermList(CQLTermNode term, int position, int maxTerms, ScanRequestType request) {
        String index=term.getIndex();
        TermList termList=new TermList();
        TermType tt=null;
        ArrayList<String> terms;
        ArrayList<TermType> tts=new ArrayList<TermType>();
        if(index.equals("oai.identifier") || index.equals("identifier"))
            terms=filenames;
        else {
            termList.addDiagnostic(SRWDiagnostic.UnsupportedIndex, index);
            return termList;
        }

        for(String t:terms) {
            if(tts.isEmpty())
                tts.add(tt=new TermType(t, new NonNegativeInteger("1"), t, TermTypeWhereInList.first, null));
            else if(t.equals(tt.getValue())) {
                tt.setNumberOfRecords(new NonNegativeInteger(Integer.toString(tt.getNumberOfRecords().intValue()+1)));
            }
            else
                tts.add(tt=new TermType(t, new NonNegativeInteger("1"), t, TermTypeWhereInList.inner, null));
        }
        if(tts.size()==1)
            tt.setWhereInList(TermTypeWhereInList.only);
        else
            tt.setWhereInList(TermTypeWhereInList.last);
        termList.setTerms(tts.toArray(new TermType[0]));
        return termList;
    }
View Full Code Here


        }
        else {
            pos=1;
        }
        terms=new TermType[1];
        terms[0]=new TermType(term, new NonNegativeInteger("0"), term, null, null);
    }
View Full Code Here

                    scanRequest.setResponsePosition(new NonNegativeInteger(Integer.toString(responsePosition)));
                    ScanResponseType scanResponse = db.doRequest(scanRequest);
                    if(scanResponse != null) {
                        TermsType terms = scanResponse.getTerms();
                        if(terms != null) {
                            TermType term[] = terms.getTerm();
                            System.out.println(term.length + " terms returned");
                            for(i = 0; i < term.length; i++)
                                System.out.println(term[i].getValue() + "(" + term[i].getNumberOfRecords().intValue() + ")");

                        } else
View Full Code Here

    public TestTermList() {
    }

    @Override
    public TermType[] getTerms() {
        TermType  term[]=new TermType[6];
        term[0]=new TermType();
        term[0].setValue("levan");
        term[0].setNumberOfRecords(new PositiveInteger("1"));
        term[1]=new TermType();
        term[1].setValue("ralph");
        term[1].setNumberOfRecords(new PositiveInteger("1"));
        term[2]=new TermType();
        term[2].setValue("record");
        term[2].setNumberOfRecords(new PositiveInteger("1"));
        term[3]=new TermType();
        term[3].setValue("srw");
        term[3].setNumberOfRecords(new PositiveInteger("1"));
        term[4]=new TermType();
        term[4].setValue("test");
        term[4].setNumberOfRecords(new PositiveInteger("1"));
        term[5]=new TermType();
        term[5].setValue("test001");
        term[5].setNumberOfRecords(new PositiveInteger("1"));
        return term;
    }
View Full Code Here

    TermType[] terms;
    public TermList() {
    }

    public TermList(TermType[] terms) {
        TermType t;
        this.terms=new TermType[terms.length];
        for(int i=0; i<terms.length; i++) {
            t=terms[i];
            this.terms[i]=new TermType(t.getValue(), t.getNumberOfRecords(), t.getDisplayTerm(), TermTypeWhereInList.inner, null);
        }
    }
View Full Code Here

    public TermList(String[] terms) {
        String t;
        this.terms=new TermType[terms.length];
        for(int i=0; i<terms.length; i++) {
            t=terms[i];
            this.terms[i]=new TermType(t, null, t, TermTypeWhereInList.inner, null);
        }
    }
View Full Code Here

TOP

Related Classes of gov.loc.www.zing.srw.TermType

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.