messif.operations.query
Class TopCombinedQueryOperation

java.lang.Object
  extended by messif.operations.AbstractOperation
      extended by messif.operations.QueryOperation<RankedAbstractObject>
          extended by messif.operations.RankingQueryOperation
              extended by messif.operations.query.AggregationFunctionQueryOperation
                  extended by messif.operations.query.TopCombinedQueryOperation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Clearable

public class TopCombinedQueryOperation
extends AggregationFunctionQueryOperation

Top-k combined query operation. Allows to retrieve the best-matching k objects from several sorted lists (usually results of k-nearest neighbor queries). The aggregation function for combining the distances in respective sorted lists can be specified as a "plug-in".

The threshold algorithm is used to actualy evaluate this query.

See Also:
MetaObject, AggregationFunction, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class messif.operations.AbstractOperation
AbstractOperation.DataEqualOperation, AbstractOperation.OperationConstructor, AbstractOperation.OperationName
 
Field Summary
protected  java.lang.Class<? extends QueryOperation> initialSAQueryClass
          Query operation to execute for sorted accesses
protected  int numberOfInitialSA
          Number of sorted access objects to retrieve
protected  boolean numberOfInitialSAProgressive
          Progressive flag for the number of initial sorted accesses.
protected  int numberOfRandomAccesses
          Number of random accesses to execute
 
Fields inherited from class messif.operations.query.AggregationFunctionQueryOperation
aggregationFunction, k, queryObject
 
Fields inherited from class messif.operations.QueryOperation
answerType
 
Fields inherited from class messif.operations.AbstractOperation
errValue, operID, suppData
 
Constructor Summary
TopCombinedQueryOperation(LocalAbstractObject queryObject, int k, int numberOfInitialSA, boolean numberOfInitialSAProgressive, int numberOfRandomAccesses, java.lang.Class<? extends QueryOperation> initialSAQueryClass, AggregationFunction aggregationFunction)
          Creates a new instance of TopCombinedQueryOperation.
 
Method Summary
 void clearSurplusData()
          Clear non-messif data stored in operation.
protected  boolean dataEqualsImpl(AbstractOperation obj)
          Indicates whether some other operation has the same data as this one.
 int dataHashCode()
          Returns a hash code value for the data of this operation.
 java.lang.Object getArgument(int index)
          Returns argument that was passed while constructing instance.
 int getArgumentCount()
          Returns number of arguments that were passed while constructing this instance.
 java.lang.Class<? extends QueryOperation> getInitialSAQueryClass()
          Returns the class of the query operation to execute for initial sorted accesses.
 int getNumberOfInitialSA()
          Returns the number of initial sorted access objects to retrieve.
 int getNumberOfRandomAccesses()
          Returns the number of random accesses to execute.
 boolean isNumberOfInitialSAProgressive()
          Returns the progressive flag for the number of initial sorted accesses.
 
Methods inherited from class messif.operations.query.AggregationFunctionQueryOperation
evaluate, getK, getQueryObject, getThresholdFunction
 
Methods inherited from class messif.operations.RankingQueryOperation
addToAnswer, addToAnswer, clone, getAnswer, getAnswer, getAnswerClass, getAnswerCount, getAnswerDistance, getAnswerObjects, getAnswerThreshold, getLastAnswer, isAnswerFull, isStoringMetaDistances, resetAnswer, setAnswerCollection, updateFrom, updateFrom
 
Methods inherited from class messif.operations.QueryOperation
appendErrorCode, endOperation, getAnswerType, wasSuccessful
 
Methods inherited from class messif.operations.AbstractOperation
appendArguments, createOperation, dataEquals, endOperation, equals, getAnnotatedConstructor, getAnnotatedConstructor, getConstructorArgumentDescriptions, getConstructorArgumentDescriptions, getConstructorArguments, getConstructorArguments, getConstructorDescription, getErrorCode, getName, getName, getOperationID, hashCode, isFinished, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

numberOfInitialSA

protected final int numberOfInitialSA
Number of sorted access objects to retrieve


numberOfInitialSAProgressive

protected final boolean numberOfInitialSAProgressive
Progressive flag for the number of initial sorted accesses. If set to true, the number of numberOfInitialSA is multiplied by k.


numberOfRandomAccesses

protected final int numberOfRandomAccesses
Number of random accesses to execute


initialSAQueryClass

protected final java.lang.Class<? extends QueryOperation> initialSAQueryClass
Query operation to execute for sorted accesses

Constructor Detail

TopCombinedQueryOperation

public TopCombinedQueryOperation(LocalAbstractObject queryObject,
                                 int k,
                                 int numberOfInitialSA,
                                 boolean numberOfInitialSAProgressive,
                                 int numberOfRandomAccesses,
                                 java.lang.Class<? extends QueryOperation> initialSAQueryClass,
                                 AggregationFunction aggregationFunction)
Creates a new instance of TopCombinedQueryOperation. The query object should be MetaObject in order to query multiple lists. The parameter names for the aggregation should match the names in the MetaObject.

Parameters:
queryObject - the query object
k - the number of results to retrieve
numberOfInitialSA - the number of initial sorted access objects
numberOfInitialSAProgressive - flag whether the numberOfInitialSA is a multiplier of k (true) or an absolute number (false)
numberOfRandomAccesses - the maximal number of random accesses
initialSAQueryClass - the query operation used to retrieve sorted access objects
aggregationFunction - the aggregation function for combining the distances from sorted lists
Method Detail

getArgument

public java.lang.Object getArgument(int index)
                             throws java.lang.IndexOutOfBoundsException
Returns argument that was passed while constructing instance. If the argument is not stored within operation, null is returned.

Overrides:
getArgument in class AggregationFunctionQueryOperation
Parameters:
index - index of an argument passed to constructor
Returns:
argument that was passed while constructing instance
Throws:
java.lang.IndexOutOfBoundsException - if index parameter is out of range

getArgumentCount

public int getArgumentCount()
Returns number of arguments that were passed while constructing this instance.

Overrides:
getArgumentCount in class AggregationFunctionQueryOperation
Returns:
number of arguments that were passed while constructing this instance

getNumberOfInitialSA

public int getNumberOfInitialSA()
Returns the number of initial sorted access objects to retrieve.

Returns:
the number of initial sorted access objects to retrieve

isNumberOfInitialSAProgressive

public boolean isNumberOfInitialSAProgressive()
Returns the progressive flag for the number of initial sorted accesses. If set to true, the number of numberOfInitialSA is multiplied by k.

Returns:
the progressive flag for the number of initial sorted accesses

getNumberOfRandomAccesses

public int getNumberOfRandomAccesses()
Returns the number of random accesses to execute.

Returns:
the number of random accesses to execute

getInitialSAQueryClass

public java.lang.Class<? extends QueryOperation> getInitialSAQueryClass()
Returns the class of the query operation to execute for initial sorted accesses.

Returns:
the class of the query operation to execute for initial sorted accesses

clearSurplusData

public void clearSurplusData()
Clear non-messif data stored in operation. This method is intended to be called whenever the operation is sent back to client in order to minimize problems with unknown classes after deserialization.

Specified by:
clearSurplusData in interface Clearable
Overrides:
clearSurplusData in class AggregationFunctionQueryOperation

dataEqualsImpl

protected boolean dataEqualsImpl(AbstractOperation obj)
Indicates whether some other operation has the same data as this one.

Overrides:
dataEqualsImpl in class AggregationFunctionQueryOperation
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object has the same data as the obj argument; false otherwise.

dataHashCode

public int dataHashCode()
Returns a hash code value for the data of this operation.

Overrides:
dataHashCode in class AggregationFunctionQueryOperation
Returns:
a hash code value for the data of this operation