de.unidu.is.retrieval.pire
Interface Index

All Known Implementing Classes:
PDatalogIndex

public interface Index

This interface encapsulates a document index, represented by specific relations.

Standard relations:

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

Field Summary
static java.lang.String DF_RELATION
          Name of the document frequency relation.
static java.lang.String DOCID_RELATION
          Name of the docid relation.
static java.lang.String EXPECTATION_RELATION
          Name of the expectation relation.
static java.lang.String IDB_RD_RELATION
          Name of the IDB rd relation (values computed by rules).
static java.lang.String PROB_RELATION
          Prefix of the result relations.
static java.lang.String RD_RELATION
          Name of the rd relation.
static java.lang.String RSV_RELATION
          Prefix of the rsv relations.
static java.lang.String TF_RELATION
          Name of the token relation.
static java.lang.String VARIANCE_RELATION
          Name of the variance relation.
static java.lang.String WEIGHT_RELATION
          Name of the indexing weight relation.
 
Method Summary
 void add(Fact fact)
          Adds the fact to the knowledge base.
 EDBRelation addEDBRelation(java.lang.String name, int arity, boolean create)
          Creates a new EDB relation.
 IDBRelation addIDBRelation(java.lang.String name, int arity, boolean create)
          Creates a new IDB relation.
 void addMomentsCondition(java.lang.String queryID, double weight, java.lang.Object value, java.util.List addList)
          Adds a query condition for computing moments.
 void addRule(java.lang.String queryID, java.lang.String[] relations, double prob, java.util.List addList)
          Add a rule with the given relations and a single argument to the specified list.
 void closeQuery(java.lang.String queryID)
          Finishes the processing of this query and frees used resources.
 void completeRelation(java.lang.String name)
          Signals that the specified relation is complete.
 void compute(IDBRelation relation, java.util.Collection rules)
          Computes the result of the specified rules (all corresponding to the specified IDB relation).
 void compute(Rule rule)
          Computes the result of the specified rule.
 void computeDisjoint(IDBRelation relation, java.util.Collection rules)
          Computes the result of the specified rules (all corresponding to the specified IDB relation).
 void computeDisjoint(java.lang.String relationName, int arity, java.util.Collection rules)
          Computes the result of the specified rules (all corresponding to the specified IDB relation).
 void computeMoments()
          Computes the moments of the indexing weights.
 void computeMoments(java.lang.String queryID, java.util.List ruleList)
          Finishes the computation of the moments.
 void computeProbs(java.lang.String queryID, java.util.List addList, boolean computeDisjoint)
          Computes the probabilities of relevance for the given query based on the RSVs specified by the list of rules.
 java.lang.String convert(java.lang.String relationName)
          Converts a relative relation name into an absolute one, using the collection name and the index key as a prefix.
 java.lang.String convertCollection(java.lang.String relationName)
          Converts a relative relation name into an absolute one, using only the collection name as a prefix.
 double getMax(java.lang.String relation)
          Returns the maximum probability for the specified relation.
 double getMaxRSV(java.lang.String queryID, java.lang.String conditionID)
          Returns the maximum RSV for the specified query.
 java.lang.String getProbRelation(java.lang.String queryID, java.lang.String subqueryID)
           
 java.util.List getProbs(java.lang.String queryID, int numDocs)
          Returns the document ids and probabilities of relevance of the first documents.
 double getRD(java.lang.String key)
          Returns the value corresponding to the specified key in the rd relation.
 double getRD(java.lang.String key, double defaultValue)
          Returns the value corresponding to the specified key in the rd relation or a default value if no entry is found.
 java.lang.String getRSVRelation(java.lang.String queryID, java.lang.String subqueryID)
           
 void init()
          Inits the index.
 void initQuery(java.lang.String queryID)
          Initialises the relation for the specified query.
 void insert(java.lang.String docID)
          Inserts the document id to the corresponding table.
 void insert(java.lang.String docID, java.lang.String token, int tokencount)
          Inserts the specified value into the given document.
 java.util.Iterator iterator(java.lang.String relation)
          Returns an iterator over the specified relation.
 void remove()
          Removes the index.
 void removeRelation(java.lang.String name)
          Removes the specified relation from this index.
 void setRD(java.lang.String key, double value)
          Sets the value corresponding to the specified key in the rd relation.
 

Field Detail

DOCID_RELATION

public static final java.lang.String DOCID_RELATION
Name of the docid relation.

See Also:
Constant Field Values

TF_RELATION

public static final java.lang.String TF_RELATION
Name of the token relation.

See Also:
Constant Field Values

DF_RELATION

public static final java.lang.String DF_RELATION
Name of the document frequency relation.

See Also:
Constant Field Values

RD_RELATION

public static final java.lang.String RD_RELATION
Name of the rd relation.

See Also:
Constant Field Values

IDB_RD_RELATION

public static final java.lang.String IDB_RD_RELATION
Name of the IDB rd relation (values computed by rules).

See Also:
Constant Field Values

WEIGHT_RELATION

public static final java.lang.String WEIGHT_RELATION
Name of the indexing weight relation.

See Also:
Constant Field Values

EXPECTATION_RELATION

public static final java.lang.String EXPECTATION_RELATION
Name of the expectation relation.

See Also:
Constant Field Values

VARIANCE_RELATION

public static final java.lang.String VARIANCE_RELATION
Name of the variance relation.

See Also:
Constant Field Values

RSV_RELATION

public static final java.lang.String RSV_RELATION
Prefix of the rsv relations.

See Also:
Constant Field Values

PROB_RELATION

public static final java.lang.String PROB_RELATION
Prefix of the result relations.

See Also:
Constant Field Values
Method Detail

convert

public java.lang.String convert(java.lang.String relationName)
Converts a relative relation name into an absolute one, using the collection name and the index key as a prefix.

Parameters:
relationName - relative name of the relation
Returns:
absolute name of the relation

convertCollection

public java.lang.String convertCollection(java.lang.String relationName)
Converts a relative relation name into an absolute one, using only the collection name as a prefix.

Parameters:
relationName - relative name of the relation
Returns:
absolute name of the relation

init

public void init()
Inits the index.


insert

public void insert(java.lang.String docID)
Inserts the document id to the corresponding table.

Parameters:
docID - document id

insert

public void insert(java.lang.String docID,
                   java.lang.String token,
                   int tokencount)
Inserts the specified value into the given document.

Parameters:
docID - document id
token - token
tokencount - number of occurences of the value

computeMoments

public void computeMoments()
Computes the moments of the indexing weights.


remove

public void remove()
Removes the index.


initQuery

public void initQuery(java.lang.String queryID)
Initialises the relation for the specified query.

Parameters:
queryID - query id

addRule

public void addRule(java.lang.String queryID,
                    java.lang.String[] relations,
                    double prob,
                    java.util.List addList)
Add a rule with the given relations and a single argument to the specified list.

Parameters:
queryID - query id
relations - array of relation names
prob - probability of the rule
addList - list to which the rule is added

computeProbs

public void computeProbs(java.lang.String queryID,
                         java.util.List addList,
                         boolean computeDisjoint)
Computes the probabilities of relevance for the given query based on the RSVs specified by the list of rules.

Parameters:
queryID - query id
addList - list of rules for computing the probabilities of relevance
computeDisjoint - if true, disjointness is assumed

getMaxRSV

public double getMaxRSV(java.lang.String queryID,
                        java.lang.String conditionID)
Returns the maximum RSV for the specified query.

Parameters:
queryID - query id
conditionID - condition identifier (in the relation name)
Returns:
maximum RSV for the specified query

getMax

public double getMax(java.lang.String relation)
Returns the maximum probability for the specified relation.

Parameters:
relation - relation name
Returns:
maximum probability for the specified relation

getProbs

public java.util.List getProbs(java.lang.String queryID,
                               int numDocs)
Returns the document ids and probabilities of relevance of the first documents.

Parameters:
queryID - query id
numDocs - number of documents to be retrieved
Returns:
list of ProbDoc instances

closeQuery

public void closeQuery(java.lang.String queryID)
Finishes the processing of this query and frees used resources.

Parameters:
queryID - query id

addMomentsCondition

public void addMomentsCondition(java.lang.String queryID,
                                double weight,
                                java.lang.Object value,
                                java.util.List addList)
Adds a query condition for computing moments. This method can apply the condition directly (i.e., it computes the moments for that condition) or store it for later reference in computeMoments.

Parameters:
queryID - query id
weight - condition weight
value - comparison value

computeMoments

public void computeMoments(java.lang.String queryID,
                           java.util.List ruleList)
Finishes the computation of the moments.

Parameters:
queryID - query id

getRD

public double getRD(java.lang.String key)
Returns the value corresponding to the specified key in the rd relation.

Parameters:
key - value key
Returns:
value

getRD

public double getRD(java.lang.String key,
                    double defaultValue)
Returns the value corresponding to the specified key in the rd relation or a default value if no entry is found.

Parameters:
key - value key
defaultValue - default value used if no value is found
Returns:
value for the specified key

setRD

public void setRD(java.lang.String key,
                  double value)
Sets the value corresponding to the specified key in the rd relation.

Parameters:
key - value key
value - value

add

public void add(Fact fact)
Adds the fact to the knowledge base.

Parameters:
fact - fact to be added

compute

public void compute(Rule rule)
Computes the result of the specified rule.

Parameters:
rule - single rule for target relation

compute

public void compute(IDBRelation relation,
                    java.util.Collection rules)
Computes the result of the specified rules (all corresponding to the specified IDB relation).

Parameters:
relation - target relation
rules - collection of rules for target relation

computeDisjoint

public void computeDisjoint(IDBRelation relation,
                            java.util.Collection rules)
Computes the result of the specified rules (all corresponding to the specified IDB relation). The results from the single rules are considered to be disjoint.

Parameters:
relation - target relation
rules - collection of rules for target relation

computeDisjoint

public void computeDisjoint(java.lang.String relationName,
                            int arity,
                            java.util.Collection rules)
Computes the result of the specified rules (all corresponding to the specified IDB relation). The results from the single rules are considered to be disjoint.

Parameters:
relationName - target relation name
arity - arity
rules - collection of rules for target relation

iterator

public java.util.Iterator iterator(java.lang.String relation)
Returns an iterator over the specified relation.

Parameters:
relation - relation name
Returns:
iterator over the specified relation (Fact instances)

addEDBRelation

public EDBRelation addEDBRelation(java.lang.String name,
                                  int arity,
                                  boolean create)
Creates a new EDB relation.

Parameters:
name - name of the relation
arity - arity of the relation
create - if true, the relation is physically created
Returns:
new EDB relation

addIDBRelation

public IDBRelation addIDBRelation(java.lang.String name,
                                  int arity,
                                  boolean create)
Creates a new IDB relation.

Parameters:
name - name of the relation
arity - arity of the relation
create - if true, the relation is physically created
Returns:
new IDB relation

removeRelation

public void removeRelation(java.lang.String name)
Removes the specified relation from this index.

Parameters:
name - relation name

completeRelation

public void completeRelation(java.lang.String name)
Signals that the specified relation is complete.

Parameters:
name - relation name

getRSVRelation

public java.lang.String getRSVRelation(java.lang.String queryID,
                                       java.lang.String subqueryID)
Parameters:
queryID -
subqueryID -

getProbRelation

public java.lang.String getProbRelation(java.lang.String queryID,
                                        java.lang.String subqueryID)
Parameters:
queryID -
subqueryID -