de.unidu.is.retrieval.pire.dt
Class AbstractDT

java.lang.Object
  extended byde.unidu.is.retrieval.pire.dt.AbstractDT
All Implemented Interfaces:
DT
Direct Known Subclasses:
NameDT, NumberDT, TextDT, TextGermanDT

public abstract class AbstractDT
extends java.lang.Object
implements DT

An abstract class for IR datatypes.

Since:
2003-09-23
Version:
$Revision: 1.12 $, $Date: 2005/03/14 17:33:13 $
Author:
Henrik Nottelmann

Constructor Summary
AbstractDT()
           
 
Method Summary
 void addProbRules(Index index, java.lang.String queryID, java.lang.String subqueryID, java.lang.String operator, java.util.List addList)
          Computes probabilities of relevance based on the RSVs (probabilities of inference).
 void addRSVRules(Index index, java.lang.String queryID, java.lang.String subqueryID, java.lang.String operator, double weight, java.lang.Object value, java.util.List addList)
          Adds and evaluates a query condition.
 void addToIndex(Index index, java.lang.String docID, java.lang.String operator, java.lang.Object value)
          Add the document content of the specified index.
 void computeIndex(Index index, java.lang.String operator)
          Computes the indexing weights for the specified index and the operator.
 java.lang.String convertOperator(java.lang.String operator)
          Converts the operator name into an identifier.
protected abstract  Filter getFilter(java.lang.String operator)
          Returns a filter for converting a document value into tokens/token frequency tuples.
 java.util.Iterator getIndexTokens(Index index, java.lang.String operator)
          Returns an iterator over all tokens for whom the indexing weight moments have to be computed.
protected  java.lang.String getProbsTemplate(Index index, java.lang.String queryID, java.lang.String subqueryID, java.lang.String operator)
          Returns a template for computing probabilities of relevance.
protected abstract  Filter getQueryFilter(java.lang.String operator)
          Returns a filter for converting a condition comparison value into tokens/token frequency tuples.
 void removeIndex(Index index, java.lang.String operator)
          Removes the index.
 boolean storedRSVs(java.lang.String operator)
          Tests whether the RSVs are already stored in the weight table, or if they are computed from outside.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDT

public AbstractDT()
Method Detail

getFilter

protected abstract Filter getFilter(java.lang.String operator)
Returns a filter for converting a document value into tokens/token frequency tuples.

Parameters:
operator - operator name
Returns:
filter

getQueryFilter

protected abstract Filter getQueryFilter(java.lang.String operator)
Returns a filter for converting a condition comparison value into tokens/token frequency tuples.

Parameters:
operator - operator name
Returns:
filter

convertOperator

public java.lang.String convertOperator(java.lang.String operator)
Converts the operator name into an identifier.

This implementation returns the operator name. Subclasses can override this behaviour.

Specified by:
convertOperator in interface DT
Parameters:
operator - operator name
Returns:
identifier for operator

addToIndex

public void addToIndex(Index index,
                       java.lang.String docID,
                       java.lang.String operator,
                       java.lang.Object value)
Add the document content of the specified index.

The specified value is applied to the filter corresponding to the operator filter, and the resulting tokens are added to the tf relation (together with the document id and the frequency of the token).

Specified by:
addToIndex in interface DT
Parameters:
index - underlying index
docID - document id
operator - operator name
value - attribute value

computeIndex

public void computeIndex(Index index,
                         java.lang.String operator)
Computes the indexing weights for the specified index and the operator.

This implementation uses a binary weighting scheme. Subclasses can use another weighting scheme by overriding this method.

Specified by:
computeIndex in interface DT
Parameters:
index - underlying index
operator - operator name

getIndexTokens

public java.util.Iterator getIndexTokens(Index index,
                                         java.lang.String operator)
Returns an iterator over all tokens for whom the indexing weight moments have to be computed.

The default implementation returns null, specifying that all tokens which stored in the index should be used. Other implementations can override this behaviour. TODO: really useful?

Specified by:
getIndexTokens in interface DT
Parameters:
index - underlying index
operator - operator name
Returns:
iterator over all tokens

removeIndex

public void removeIndex(Index index,
                        java.lang.String operator)
Removes the index.

Specified by:
removeIndex in interface DT
Parameters:
index - underlying index
operator - search operator name

storedRSVs

public boolean storedRSVs(java.lang.String operator)
Tests whether the RSVs are already stored in the weight table, or if they are computed from outside.

The default implemenation returns true. TODO: really useful?

Specified by:
storedRSVs in interface DT
Parameters:
operator - search operator
Returns:
true, if the RSVs are already stored

addRSVRules

public void addRSVRules(Index index,
                        java.lang.String queryID,
                        java.lang.String subqueryID,
                        java.lang.String operator,
                        double weight,
                        java.lang.Object value,
                        java.util.List addList)
Adds and evaluates a query condition.

This implementation adds a rule for using the indexing weight directly for the RSV.

Specified by:
addRSVRules in interface DT
Parameters:
index - underlying index
queryID - query id
subqueryID - subquery id
operator - search operator name
weight - condition weight
value - comparison value
addList - list to where the condition has to be added

getProbsTemplate

protected java.lang.String getProbsTemplate(Index index,
                                            java.lang.String queryID,
                                            java.lang.String subqueryID,
                                            java.lang.String operator)
Returns a template for computing probabilities of relevance.

The template string is an expression which contains the key PROB.

Parameters:
index - underlying index
queryID - query id
subqueryID - subquery id
operator - operator name
Returns:
template for computing probabilities of relevance

addProbRules

public void addProbRules(Index index,
                         java.lang.String queryID,
                         java.lang.String subqueryID,
                         java.lang.String operator,
                         java.util.List addList)
Computes probabilities of relevance based on the RSVs (probabilities of inference).

Specified by:
addProbRules in interface DT
Parameters:
index - underlying index
queryID - query id
subqueryID - subquery id
operator - search operator
addList - list to which rules can be appended