Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

StructQueryRep.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2002 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.cs.cmu.edu/~lemur/license.html
00008  *
00009  *==========================================================================
00010 */
00011 /*
00012   author: fff
00013 */
00014 
00015 #ifndef _STRUCTQUERYREP_HPP
00016 #define _STRUCTQUERYREP_HPP
00017 
00018 #include "RetrievalMethod.hpp"
00019 #include "Document.hpp"
00020 #include "Index.hpp"
00021 #include "QueryNode.hpp"
00022 
00023 //------------------------------------------------------------
00024 //      Abstract Interface for Structured Query 
00025 //------------------------------------------------------------
00026 
00028 class StructQuery : public Query {
00029 public:
00030   StructQuery(Document &doc) : d(doc) {}
00031   virtual ~StructQuery() {}
00032 
00033   virtual char *id() { return d.getID();}
00034   virtual void startTermIteration() { d.startTermIteration();}
00035   virtual bool hasMore() { return d.hasMore();}
00036   virtual TokenTerm *nextTerm() { return d.nextTerm();}
00037 private:
00038   Document &d;
00039 };
00040 
00041 
00046 class StructQueryRep : public QueryRep {
00047 public:
00049   StructQueryRep(StructQuery &qry, Index &dbIndex, 
00050                  double dbelief = 0);
00051 
00052   virtual ~StructQueryRep() {
00053     delete(topNode);
00054   }
00056   virtual QueryNode * topnode() {return topNode;}
00058   virtual void setTopnode(QueryNode *qn) {topNode = qn;}
00059   
00060 private:
00062   typedef QueryNode *(StructQueryRep::*getFunc)(StructQuery &, TokenTerm *, 
00063                                                 double);
00065   QnList * getChildren(StructQuery &qry, getFunc fn, 
00066                                bool weigh = false);
00068   QueryNode * getQryNode(StructQuery &qry, TokenTerm *tok, double w);
00070   QueryNode * getProxQryNode(StructQuery &qry, TokenTerm *tok,
00071                                      double w = 1.0);
00073   QueryNode *topNode;
00075   QueryNode *qStack[100]; 
00076 
00077   int topqStack;
00079   double dw;
00081   Index &ind;
00083   int numDocs;
00084 };
00085 #endif /* _STRUCTQUERYREP_HPP */
00086 

Generated on Fri Feb 6 07:11:49 2004 for LEMUR by doxygen1.2.16