dragon.ir.query
Class AbstractPredicate

java.lang.Object
  |
  +--dragon.ir.query.AbstractIRQuery
        |
        +--dragon.ir.query.AbstractPredicate
All Implemented Interfaces:
IRQuery, Predicate
Direct Known Subclasses:
BoolQualifierPredicate, BoolRelationPredicate, BoolTermPredicate, SimpleRelationPredicate, SimpleTermPredicate

public abstract class AbstractPredicate
extends AbstractIRQuery
implements Predicate

Abstract class of predicate

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Field Summary
protected  Expression constraint
           
protected  int expressionType
           
protected  int predicateType
           
protected  double weight
           
 
Fields inherited from class dragon.ir.query.AbstractIRQuery
children, optr
 
Fields inherited from interface dragon.ir.query.Predicate
PREDICATE_BOOL, PREDICATE_QUALIFIER, PREDICATE_RELATION, PREDICATE_SIMPLE, PREDICATE_TERM
 
Constructor Summary
AbstractPredicate()
           
 
Method Summary
 IRQuery getChild(int index)
           
 int getChildNum()
           
 Expression getConstraint()
           
 Operator getOperator()
           
 double getSelectivity()
           
 double getWeight()
           
 boolean isBoolPredicate()
           
 boolean isCompoundQuery()
          If the current query denotes a simple predicate, this method returns false, otherwise true.
 boolean isPredicate()
          A predicate always begins with a ltter T (term predicate), R(relation predicate), or M(modifier predicate)
 boolean isQualifierPredicate()
           
 boolean isRelationPredicate()
           
 boolean isSimplePredicate()
           
 boolean isTermPredicate()
           
 boolean parse(java.lang.String predicate)
           
protected abstract  void parse(java.lang.String[] predicate)
           
 void setWeight(double weight)
           
 
Methods inherited from class dragon.ir.query.AbstractIRQuery
getQueryKey, getTokenList, isRelBoolQuery, isRelSimpleQuery, setQueryKey, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dragon.ir.query.Predicate
toSQLExpression, toString
 
Methods inherited from interface dragon.ir.query.IRQuery
getQueryKey, isRelBoolQuery, isRelSimpleQuery, setQueryKey
 

Field Detail

weight

protected double weight

predicateType

protected int predicateType

expressionType

protected int expressionType

constraint

protected Expression constraint
Constructor Detail

AbstractPredicate

public AbstractPredicate()
Method Detail

parse

public boolean parse(java.lang.String predicate)
Specified by:
parse in interface IRQuery
Overrides:
parse in class AbstractIRQuery
Parameters:
predicate - the query string
Returns:
a structured query

getOperator

public Operator getOperator()
Specified by:
getOperator in interface IRQuery
Overrides:
getOperator in class AbstractIRQuery

isPredicate

public boolean isPredicate()
Description copied from interface: IRQuery
A predicate always begins with a ltter T (term predicate), R(relation predicate), or M(modifier predicate)

Specified by:
isPredicate in interface IRQuery
Overrides:
isPredicate in class AbstractIRQuery
Returns:
true if the the current query denotes a simple predicate, otherwise false.

isCompoundQuery

public boolean isCompoundQuery()
Description copied from interface: IRQuery
If the current query denotes a simple predicate, this method returns false, otherwise true.

Specified by:
isCompoundQuery in interface IRQuery
Overrides:
isCompoundQuery in class AbstractIRQuery
Returns:
false if the the current query denotes a simple predicate, otherwise true.

getChild

public IRQuery getChild(int index)
Specified by:
getChild in interface IRQuery
Overrides:
getChild in class AbstractIRQuery

getChildNum

public int getChildNum()
Specified by:
getChildNum in interface IRQuery
Overrides:
getChildNum in class AbstractIRQuery

getSelectivity

public double getSelectivity()
Specified by:
getSelectivity in interface Predicate
Overrides:
getSelectivity in class AbstractIRQuery
Returns:
a double socre indicating how specific the query predicate is.

getWeight

public double getWeight()
Specified by:
getWeight in interface Predicate

setWeight

public void setWeight(double weight)
Specified by:
setWeight in interface Predicate

getConstraint

public Expression getConstraint()
Specified by:
getConstraint in interface Predicate
Returns:
the underlying expression of the current predicate

isSimplePredicate

public boolean isSimplePredicate()
Specified by:
isSimplePredicate in interface Predicate

isBoolPredicate

public boolean isBoolPredicate()
Specified by:
isBoolPredicate in interface Predicate

isTermPredicate

public boolean isTermPredicate()
Specified by:
isTermPredicate in interface Predicate

isRelationPredicate

public boolean isRelationPredicate()
Specified by:
isRelationPredicate in interface Predicate

isQualifierPredicate

public boolean isQualifierPredicate()
Specified by:
isQualifierPredicate in interface Predicate

parse

protected abstract void parse(java.lang.String[] predicate)
Specified by:
parse in class AbstractIRQuery