gov.nist.nlpir.irf.index
Class IdxIntern

java.lang.Object
  |
  +--gov.nist.nlpir.irf.index.IdxIntern
Direct Known Subclasses:
IdfIdxIntern, KeyWordIdxIntern

public abstract class IdxIntern
extends java.lang.Object
implements java.io.Serializable

Base class for the internal representation of an Index.

Objects of this class contain several sets that together provide the structure necessary to support an Index. It mainly contains a PersistentDualKeyContainer for this purpose. Subclasses of this class may override methods for calculating retrieval status values (RSV), etc.

Version:
$Revision: 1.10 $
Author:
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.
See Also:
Index, IdfIdxIntern, KeyWordIdxIntern, DeIntern, IoAddrIntern, IndexingFeature, DataElem, PersistentDualKeyContainer, Serialized Form

Field Summary
private  boolean flagUpToDate
          This flag is set when the Index is up-to-date - does not need for Update to be run.
private  PersistentDualKeyContainer indexingFeatures
          Main part of the IdxIntern.
(package private) static long serialVersionUID
          serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects
 
Constructor Summary
IdxIntern()
          Only here for serializarion's needs.
IdxIntern(java.lang.String location, java.lang.String name)
          Constructor which allocates the initial data structures for IdxIntern.
 
Method Summary
 void addIndexingFeatures(java.util.Vector idxFeats)
          Creates an indexing feature in the Index Intern.
abstract  void calcInputForRSV(ResultForDocMatchingQueryCondition aResult)
          Calculates the retrieval status value
 int calcNrOfSources()
          Calculates number of sources in index and return that value.
abstract  double calcRSV(ResultForDocMatchingQueryModalityUnit aResult)
          Calculates the retrieval status value
 void clear()
          Resets data structures
 java.util.Vector evalQueryCondition(QueryCondition condition)
          Evaluates a query condition.
 java.util.Vector evalQueryCondition(QueryCondition condition, java.util.Vector setIndexingFeatures)
          Generates a vector of results that match the features in the specified query condition.
 java.util.Vector evalQueryModalityUnit(QueryModalityUnit qmu, java.util.Vector IFs)
          Evaluates a Query Modality Unit.
 int existsSource(ProxyDocument aSource)
          Returns number of indexing features for a source.
 IoAddrIntern getActualSource(ProxyDocument source)
          In order to retrieve the IoAddrIntern associated to the given document, this method should be called.
 DeIntern getFeature(DataElem aDE)
          Gets the feature for a DataElement.
 DeIntern getFeature(DeIntern aDeI)
          Gets the feature for a DeIntern.
 java.util.Enumeration getFeatures()
          Returns the features for which indexing features have been stored.
 java.util.Vector getFeatures(java.util.Dictionary someIF)
          Gets features out of a collection of IndexingFeatures which is a subclass of Dictionary (Hashtable, PolyKeyHashtable).
 java.util.Vector getFeatures(IoAddrIntern aSource)
          Gets features that are present in supplied source
 java.util.Vector getFeatures(ProxyFeatureList someIF)
          Gest features out of a vector of IndexingFeatures
private static java.util.Vector getFeaturesFromEnumeration(java.util.Enumeration theEnum)
          Factorizes the common code of getFeatures(*).
 int getFeaturesNumber()
          Returns the number of features that have been stored (NOT Indexing Features) in this IdxIntern.
 boolean getFlagUpToDate()
          Returns the value of the flag uptodate.
 ProxyFeatureList getIFsWithFeature(DeIntern aFeature)
          Gets the indexing features with this feature.
 java.util.Vector getIFsWithFeature(DeIntern aFeature, java.lang.String docType, java.lang.String attributeName)
          Gets the indexing features with this feature and the correct docType and attributeName.
 ProxyFeatureList getIFsWithSource(IoAddrIntern aSource)
          Gets the indexing features of a source.
 PersistentDualKeyContainer getIndexingFeatures()
          Exposes the inner structure of the IdxIntern It is mainly used to pass methods to the PersistentDualKeyContainer for probe purpose: showing statistics for example, or getting a display.
 int getNrOfFeatures()
          Gets the number of features.
 int getNrOfFeatures(IoAddrIntern aSource)
          Gets the number of features for a source.
 int getNrOfIndexingFeatures()
          Gets the number of indexing features.
 int getNrOfSources()
          Gets the number of sources.
 int getNrOfSources(DeIntern aFeature)
          Gets the number of sources for a feature.
 int getNrOfUniqueFeatures(IoAddrIntern aSource)
          Gets the number of unique features for a source.
 int getNrOfUniqueSources(DeIntern aFeature)
          Gets the number of unique sources for a feature.
 int getNrOfUniqueSources0(DeIntern aFeature)
          Gets the number of unique sources for a feature.
 java.util.Enumeration getSources()
          Returns the sources for which indexing features have been stored.
 java.util.Hashtable getSources(DeIntern aFeature)
          Gets the Indexing Features containing all of the sources which have the supplied feature.
 int getSourcesNumber()
          Returns the number of sources that have been stored for this IdxIntern.
 void init()
          Initializes this instance of IdxIntern.
 java.util.Vector makeQueryConditions(QueryModalityUnit qm, java.util.Vector idxFeats)
          Generates a set of query conditions.
 java.util.Vector makeResultForDocMatchingQueryCondition(QueryCondition condition, java.util.Hashtable setBRR)
          Generates a vector of results for a given query condition
 java.util.Vector makeResultsForDocMatchingQueryModalityUnit(QueryModalityUnit qmu, java.util.Vector collPR, int numQueryFeatures, int numUniqueQueryFeatures)
          Generates a vector of results for a given query modality unit This method takes a vector of ResultForDocMatchingQueryConditions (called partial results) and groups these by source document to form a combined result vector of ResultForDocMatchingQueryModalityUnits (called combined results), exactly one of the latter combined Results for each source referred to in the partial results of* the incoming vector.
 void present()
          Displays an ascii representation of the Class.
 void presentFeatures()
          Displays an ascii representation of the features in the Index (members of features).
 void presentSources()
          Displays an ascii representation of the sources.
 void presentStatistics()
          Generates a report on the number of sources, features and indexing features.
 void update()
          Updates the index.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects

flagUpToDate

private boolean flagUpToDate
This flag is set when the Index is up-to-date - does not need for Update to be run.

indexingFeatures

private PersistentDualKeyContainer indexingFeatures
Main part of the IdxIntern.
Constructor Detail

IdxIntern

public IdxIntern(java.lang.String location,
                 java.lang.String name)
Constructor which allocates the initial data structures for IdxIntern.
Parameters:
location - information about the location of the PDKC
name - name of the index being supported

IdxIntern

public IdxIntern()
Only here for serializarion's needs.
Method Detail

init

public void init()
Initializes this instance of IdxIntern.

present

public void present()
Displays an ascii representation of the Class.

presentFeatures

public void presentFeatures()
Displays an ascii representation of the features in the Index (members of features).

presentSources

public void presentSources()
Displays an ascii representation of the sources.

presentStatistics

public void presentStatistics()
Generates a report on the number of sources, features and indexing features.

calcNrOfSources

public final int calcNrOfSources()
Calculates number of sources in index and return that value.
Returns:
number of sources in index.

makeQueryConditions

public java.util.Vector makeQueryConditions(QueryModalityUnit qm,
                                            java.util.Vector idxFeats)
Generates a set of query conditions.
Parameters:
qm - Query Modality Unit.
idxFeats - Collection of indexing features.
Returns:
set of query conditions.

evalQueryModalityUnit

public java.util.Vector evalQueryModalityUnit(QueryModalityUnit qmu,
                                              java.util.Vector IFs)
Evaluates a Query Modality Unit.
Parameters:
qmu - Query Modality Unit
IFs - Collection of IndexingFeatures
Returns:
set of query conditions

evalQueryCondition

public java.util.Vector evalQueryCondition(QueryCondition condition)
Evaluates a query condition. The result is a vector of ResultForDocMatchingQueryCondition.
Parameters:
condition - The Query Condition.
Returns:
Vector of ResultForDocMatchingQueryCondition.

evalQueryCondition

public java.util.Vector evalQueryCondition(QueryCondition condition,
                                           java.util.Vector setIndexingFeatures)
Generates a vector of results that match the features in the specified query condition.
Parameters:
condition - Query Condition.
setIndexingFeatures - Vector of IndexingFeatures.
Returns:
Vectorof ResultForDocMatchingQueryCondition.

makeResultForDocMatchingQueryCondition

public java.util.Vector makeResultForDocMatchingQueryCondition(QueryCondition condition,
                                                               java.util.Hashtable setBRR)
Generates a vector of results for a given query condition
Parameters:
condition - Query Condition.
setBRR - Basic Retrieval Result.
Returns:
a vector

makeResultsForDocMatchingQueryModalityUnit

public java.util.Vector makeResultsForDocMatchingQueryModalityUnit(QueryModalityUnit qmu,
                                                                   java.util.Vector collPR,
                                                                   int numQueryFeatures,
                                                                   int numUniqueQueryFeatures)
Generates a vector of results for a given query modality unit This method takes a vector of ResultForDocMatchingQueryConditions (called partial results) and groups these by source document to form a combined result vector of ResultForDocMatchingQueryModalityUnits (called combined results), exactly one of the latter combined Results for each source referred to in the partial results of* the incoming vector.
Parameters:
qmu - Query Modality Unit
collPR - Partial Retrieval Result.
Returns:
a vector

calcInputForRSV

public abstract void calcInputForRSV(ResultForDocMatchingQueryCondition aResult)
Calculates the retrieval status value
Parameters:
aResult - result for document matching query condition.
See Also:
IdfIdxIntern, KeyWordIdxIntern

calcRSV

public abstract double calcRSV(ResultForDocMatchingQueryModalityUnit aResult)
Calculates the retrieval status value
Parameters:
aResult - result for document matching query modality unit.
Returns:
Retrieval Status Value
See Also:
IdfIdxIntern, KeyWordIdxIntern

getIndexingFeatures

public PersistentDualKeyContainer getIndexingFeatures()
Exposes the inner structure of the IdxIntern It is mainly used to pass methods to the PersistentDualKeyContainer for probe purpose: showing statistics for example, or getting a display. Should never be used to give instructions to the PDKC as this class is supposed to wrap it entirely.

getNrOfFeatures

public final int getNrOfFeatures()
Gets the number of features.
Returns:
number of features

getNrOfSources

public final int getNrOfSources()
Gets the number of sources.
Returns:
number of sources

getNrOfUniqueSources

public int getNrOfUniqueSources(DeIntern aFeature)
Gets the number of unique sources for a feature.
Parameters:
aFeature - a feature
Returns:
number of unique sources

getNrOfUniqueSources0

public int getNrOfUniqueSources0(DeIntern aFeature)
Gets the number of unique sources for a feature.
Parameters:
aFeature - a feature
Returns:
number of unique sources

getNrOfUniqueFeatures

public int getNrOfUniqueFeatures(IoAddrIntern aSource)
Gets the number of unique features for a source.
Parameters:
aSource - a source
Returns:
number of unique features

getNrOfSources

public final int getNrOfSources(DeIntern aFeature)
Gets the number of sources for a feature.
Parameters:
aFeature - a feature
Returns:
number of sources

getNrOfFeatures

public final int getNrOfFeatures(IoAddrIntern aSource)
Gets the number of features for a source.
Parameters:
aSource - a source
Returns:
number of features

getFeature

public final DeIntern getFeature(DataElem aDE)
Gets the feature for a DataElement.
Parameters:
aDE - a DataElement.
Returns:
The feature if it exists, null otherwise.

getFeature

public final DeIntern getFeature(DeIntern aDeI)
Gets the feature for a DeIntern.
Parameters:
aDeI - a DeIntern
Returns:
the feature. It is the real DeIntern stored for this feature (aDE should be another one created from the same DataElem).

getIFsWithFeature

public final ProxyFeatureList getIFsWithFeature(DeIntern aFeature)
Gets the indexing features with this feature.
Parameters:
aFeature - a feature
Returns:
the indexing features if there are some,
an empty Vector otherwise.

getIFsWithFeature

public java.util.Vector getIFsWithFeature(DeIntern aFeature,
                                          java.lang.String docType,
                                          java.lang.String attributeName)
Gets the indexing features with this feature and the correct docType and attributeName.
Parameters:
aFeature - a feature
docType - the type of the document.
attributeName - name of the attribute.
Returns:
the indexing features

getIFsWithSource

public final ProxyFeatureList getIFsWithSource(IoAddrIntern aSource)
Gets the indexing features of a source.
Parameters:
aSource - a source
Returns:
The indexing features corresponding to the source as a Vector. The result is empty if no indexing feature exists for this source.

getNrOfIndexingFeatures

public final int getNrOfIndexingFeatures()
Gets the number of indexing features.
Returns:
the number indexing features

addIndexingFeatures

public void addIndexingFeatures(java.util.Vector idxFeats)
Creates an indexing feature in the Index Intern. Update() has to be called before the IdxIntern is stable.
Parameters:
a - set of Indexing Features
See Also:
IndexingFeature

existsSource

public final int existsSource(ProxyDocument aSource)
Returns number of indexing features for a source.
Parameters:
aSource - source document address
Returns:
number of Indexing Features for a source.

update

public void update()
Updates the index. This is a default implementation that does nothing at all except setting the flagUpToDate to true. It must be redefined to manage all particular aspects of specialized IdxIndexes.

clear

public void clear()
Resets data structures

getSources

public java.util.Hashtable getSources(DeIntern aFeature)
Gets the Indexing Features containing all of the sources which have the supplied feature.
Parameters:
aFeature - feature to use as key.
Returns:
a hashtable of indexing features

getFeatures

public java.util.Vector getFeatures(IoAddrIntern aSource)
Gets features that are present in supplied source
Parameters:
aSource - reference to source document
Returns:
collection of features

getFeatures

public final java.util.Vector getFeatures(ProxyFeatureList someIF)
Gest features out of a vector of IndexingFeatures
Parameters:
someIF - collection of IndexingFeatures
Returns:
collection of features

getFeatures

public final java.util.Vector getFeatures(java.util.Dictionary someIF)
Gets features out of a collection of IndexingFeatures which is a subclass of Dictionary (Hashtable, PolyKeyHashtable).
Parameters:
someIF - collection of IndexingFeatures
Returns:
collection of features

getFeaturesFromEnumeration

private static final java.util.Vector getFeaturesFromEnumeration(java.util.Enumeration theEnum)
Factorizes the common code of getFeatures(*).
Parameters:
theEnum - The enumeration of IndexingFeatures.
Returns:
The result of getFeatures(*)

getFeatures

public final java.util.Enumeration getFeatures()
Returns the features for which indexing features have been stored.
Returns:
The Enumeration of Objects (should be DeIntern) used as features in this IdxIntern.

getSources

public final java.util.Enumeration getSources()
Returns the sources for which indexing features have been stored.
Returns:
The Enumeration of Objects (should be IoAddrIntern) used as sources in this IdxIntern.

getFlagUpToDate

public final boolean getFlagUpToDate()
Returns the value of the flag uptodate.
Returns:
true if the IdxIntern is uptodate, false otherwise.

getSourcesNumber

public final int getSourcesNumber()
Returns the number of sources that have been stored for this IdxIntern.

getFeaturesNumber

public final int getFeaturesNumber()
Returns the number of features that have been stored (NOT Indexing Features) in this IdxIntern.

getActualSource

public IoAddrIntern getActualSource(ProxyDocument source)
In order to retrieve the IoAddrIntern associated to the given document, this method should be called.
See Also:
PersistentIrfHashtable.getActualKey(java.lang.Object)