Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.udo.cs.miningmart.operator
Class ModelApplier

    java.lang.Object
      edu.udo.cs.miningmart.operator.ExecutableOperator
          edu.udo.cs.miningmart.operator.ConceptOperator
              edu.udo.cs.miningmart.operator.SingleCSOperator
                  edu.udo.cs.miningmart.operator.ModelApplier

Direct Known Subclasses:
  TupleWiseModelApplier, YaleModelApplier

    public abstract class ModelApplier

extends SingleCSOperator

This class is the abstract super-class for model-applying operators. It cares about creating an intermediate table in the business data schema linked to the original data by the keys specified, creates the meta-data and ensures integrity of the parameters. The abstract method `predict()` has to read the data from the database, apply the model(s) and update the intermediate table accordingly.

Version:
  $Id: ModelApplier.java,v 1.6 2006/10/02 08:58:56 euler Exp $
Author:
  Martin Scholz

Field Summary

Fields inherited from class edu.udo.cs.miningmart.operator.ConceptOperator
`suffixForIntermediateViews`

Fields inherited from class edu.udo.cs.miningmart.operator.ExecutableOperator
`generatedSQLDefinitions`

Constructor Summary
`ModelApplier()`

Method Summary
`protected void` | `createPredictedAttributeInDb(int loop)` Helper method adding a new attribute to the newly created database table for the attribute values created in the specified loop.
`protected Columnset` | `createSingleColumnSet(int index)` Method overridden to create `Column`s for the newly created attributes.
`static BaseAttribute` | `findCorrespondingBaInConcept(BaseAttribute ba, Concept concept)` Helper method: The keys are part of the output concept, but the input concept's key columns are necessary when copying virtual columns.
`java.lang.String` | `generateSQLDefinition(java.lang.String selectPart)` This method must return the SQL definition of the newly created ColumnSet.
`protected abstract java.lang.String` | `getDatabaseDtForNewColumn(BaseAttribute ba)` Specifies the relational datatype for the new Columns based on their BaseAttribute.
`protected java.lang.String` | `getDatabaseQueryForRows(java.lang.Long fromRowNum, java.lang.Long toRowNum)` Builds a database query on the input `Columnset` projected to the set of keys and predicting attributes.
`Concept` | `getInputConcept()` This method provides TheInputConcept for this operator.
`java.util.Vector` | `getKeyColumnNames()` Similar to `getKeyColumns()`, but returns the Column names, only.
`java.util.Vector` | `getKeyColumns()` After initialization at the beginning of `generateSQLDefinition` this method returns a `Collection` of the `InputConcept`'s current key `Column`s.
`Concept` | `getOutputConcept()` This method provides TheOutputConcept for this operator.
`BaseAttribute` | `getPredictedAttribute(int loop)`
`java.util.Vector` | `getPredictionColumnNames()` Similar to `getPredictionColumns()`, but returns the Column names, only.
`java.util.Vector` | `getPredictionColumns()` After initialization at the beginning of `generateSQLDefinition` this method returns a `Collection` of the `InputConcept`'s current `Column` that might be exploited for predicting values.
`protected abstract java.lang.String` | `getRelationalDtForNewColumn(BaseAttribute ba)` Specifies the relational datatype for the new Columns based on their BaseAttribute.
`protected java.lang.String` | `getSelectStatementOfKeys()` This method cares about creating a well-formed select part to read the key attributes from the input `Columnset`.
`protected java.lang.String` | `getSelectStatementOfPredAttribs()` This method is similar to `getSelectStatementOfKeys()`, but creates a select part for the predicting columns specified as parameters.
`protected java.lang.String` | `getTargetTableName()` The name of the helper table with primary keys and target value is chosen here.
`java.util.Collection` | `getTheKeys()`
`Feature[]` | `getThePredictingAttributes()`
`java.lang.String` | `getTypeOfNewColumnSet()` This operator creates a view joining the InputConcept with a new table holding the predicted values.
`protected boolean` | `mustCopyFeature(java.lang.String nameOfFeature)` All Columns of the InputConcept need to be copied to the OutputConcept.
`protected abstract void` | `predict()` Predicts the values applying the specified models.
`protected static java.lang.String` | `stringCollectionToCommaSeparatedString(java.util.Collection columnNames)` Service method turning a `Collection` of `Column` names or other attributes or SQL definitions into a comma separated format usuable within SQL statements.

Methods inherited from class edu.udo.cs.miningmart.operator.SingleCSOperator
`generateColumnSetsForOp, generateSQLDefinition, getNewCSName, getTypeOfNewColumnSet, handleExtraOutputFeature`

Methods inherited from class edu.udo.cs.miningmart.operator.ConceptOperator
`compileStatement, createMetadata, createMetadataForOneBA, createStatement, generateColumns, getNewCSName, getStringForSelection, setNewCSMultiStepBranch`

Methods inherited from class edu.udo.cs.miningmart.operator.ExecutableOperator
`autoPrint, checkConditions, doPrint, doPrint, execute, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getArtificalColumnName, getBusinessDbms, getHighestLoopNr, getM4Db, getM4Dbms, getM4ObjectFromCache, getName, getNextM4SequenceValue, getNumberOfLoops, getOperator, getOpParamsIterator, getParameter, getParameter, getParameterObjectsOfAllLoops, getSingleParameter, getSingleParameter, getStep, giveWarningForChangedInputData, handleAssertions, isDeselectedParameter, isLoopable, isManual, isStepable, load, print, putM4ObjectToCache, showCreateStatement, storedProceduresAvailable`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ModelApplier

    public ModelApplier()

Method Detail

### getKeyColumns

    public java.util.Vector getKeyColumns()

  After initialization at the beginning of `generateSQLDefinition` this method returns a `Collection` of the `InputConcept`'s current key `Column`s.

  Returns:
    a `Collection` of `Column`s

### getKeyColumnNames

    public java.util.Vector getKeyColumnNames()

  Similar to `getKeyColumns()`, but returns the Column names, only.

  Returns:
    a `Collection` of `String`s

### getPredictionColumns

    public java.util.Vector getPredictionColumns()

  After initialization at the beginning of `generateSQLDefinition` this method returns a `Collection` of the `InputConcept`'s current `Column` that might be exploited for predicting values. The `Column`s correspond to the parameter PredictingAttributes.

  Returns:
    a `Collection` of `Column`s

### getPredictionColumnNames

    public java.util.Vector getPredictionColumnNames()

  Similar to `getPredictionColumns()`, but returns the Column names, only.

  Returns:
    a `Collection` of `String`s

### getTypeOfNewColumnSet

    public java.lang.String getTypeOfNewColumnSet()

  This operator creates a view joining the InputConcept with a new table holding the predicted values.

  Specified by:
    `getTypeOfNewColumnSet` in class `SingleCSOperator`
  Returns:
    The type of the new Columnset, either "V" or "T".
  See Also:
    `SingleCSOperator.getTypeOfNewColumnSet()`

### generateSQLDefinition

    public java.lang.String generateSQLDefinition(java.lang.String selectPart)
                                           throws M4CompilerError

  Description copied from class: `SingleCSOperator`
  This method must return the SQL definition of the newly created ColumnSet.

  Specified by:
    `generateSQLDefinition` in class `SingleCSOperator`
  Parameters:
    `selectPart` - The SQL string between "SELECT" and "FROM" for the SQL definition to be returned.
  Returns:
    The SQL definition for the new ColumnSet.
  Throws:
    `M4CompilerError`
  See Also:
    `SingleCSOperator.generateSQLDefinition(String)`

### createPredictedAttributeInDb

    protected void createPredictedAttributeInDb(int loop)
                                         throws M4CompilerError

  Helper method adding a new attribute to the newly created database table for the attribute values created in the specified loop.

  Parameters:
    `loop` - the loop number sepcifying the attribute to be predicted
  Throws:
    `M4CompilerError`

### getSelectStatementOfKeys

    protected java.lang.String getSelectStatementOfKeys()

  This method cares about creating a well-formed select part to read the key attributes from the input `Columnset`. It is relevant for creating the joint output view, but is also useful for the `predict()` part.

  Returns:
    the select-part of the key(s) of the input columnset. The `String` contains the part between SELECT and FROM if you would only want to select the keys from the `Columnset`.

### getSelectStatementOfPredAttribs

    protected java.lang.String getSelectStatementOfPredAttribs()

  This method is similar to `getSelectStatementOfKeys()`, but creates a select part for the predicting columns specified as parameters. This method is a service method for the `predict()` part to be implemented by the non-abstract `ModelAppliers`.

  Returns:
    the select-part of the attributes available for predicting, part of the input columnset. The `String` contains the part between SELECT and FROM if you would only want to select these attributes from the `Columnset`.

### stringCollectionToCommaSeparatedString

    protected static java.lang.String stringCollectionToCommaSeparatedString(java.util.Collection columnNames)

  Service method turning a `Collection` of `Column` names or other attributes or SQL definitions into a comma separated format usuable within SQL statements.

  Parameters:
    `columnNames` - a `Collection` of `Column` names
  Returns:
    a comma separated `String` of these names.

### findCorrespondingBaInConcept

    public static BaseAttribute findCorrespondingBaInConcept(BaseAttribute ba,
                                                             Concept concept)
                                                      throws M4Exception

  Helper method: The keys are part of the output concept, but the input concept's key columns are necessary when copying virtual columns. This method find a corresponding BaseAttribute in the InputConcept when given the BaseAttribute of another Concept. If no corresponding BaseAttribute is found then null is returned.

  Throws:
    `M4Exception`

### getTargetTableName

    protected java.lang.String getTargetTableName()
                                           throws M4CompilerError

  The name of the helper table with primary keys and target value is chosen here.

  Throws:
    `M4CompilerError`

### mustCopyFeature

    protected boolean mustCopyFeature(java.lang.String nameOfFeature)
                               throws M4CompilerError

  All Columns of the InputConcept need to be copied to the OutputConcept.

  Specified by:
    `mustCopyFeature` in class `ConceptOperator`
  Parameters:
    `nameOfFeature` - Name of the feature in question.
  Returns:
    TRUE if this feature should be copied to the output concept, FALSE if not.
  Throws:
    `M4CompilerError`
  See Also:
    `ConceptOperator.mustCopyFeature(String)`

### createSingleColumnSet

    protected Columnset createSingleColumnSet(int index)
                                       throws M4CompilerError,
                                              M4CompilerWarning

  Method overridden to create `Column`s for the newly created attributes.

  Overrides:
    `createSingleColumnSet` in class `ConceptOperator`
  Parameters:
    `index` - For MultipleCSOperators, the number of the columnset to be created, starting with 0. For SingleCSOperators, this parameter must be -1.
  Returns:
    A new Columnset object.
  Throws:
    `M4CompilerError`
    `M4CompilerWarning`

### getDatabaseQueryForRows

    protected java.lang.String getDatabaseQueryForRows(java.lang.Long fromRowNum,
                                                       java.lang.Long toRowNum)
                                                throws M4CompilerError

  Builds a database query on the input `Columnset` projected to the set of keys and predicting attributes. The parameters specify a possible ROWNUM-restriction, to read only a block of tuples.

  Parameters:
    `fromRowNum` - the first row number to be returned or `null` for unrestricted
    `toRowNum` - the last row number to be returned or `null` for unrestricted
  Returns:
    an SQL-query `String`
  Throws:
    `M4CompilerError`

### getInputConcept

    public Concept getInputConcept()
                            throws M4CompilerError

  Description copied from class: `ConceptOperator`
  This method provides TheInputConcept for this operator.

  Overrides:
    `getInputConcept` in class `ConceptOperator`
  Returns:
    the input concept
  Throws:
    `M4CompilerError`

### getOutputConcept

    public Concept getOutputConcept()
                             throws M4CompilerError

  Description copied from class: `ConceptOperator`
  This method provides TheOutputConcept for this operator.

  Overrides:
    `getOutputConcept` in class `ConceptOperator`
  Returns:
    the output concept
  Throws:
    `M4CompilerError`

### getThePredictingAttributes

    public Feature[] getThePredictingAttributes()
                                         throws M4CompilerError

  Returns:
    the array of `BaseAttribute`s used to make the prediction
  Throws:
    `M4CompilerError`

### getPredictedAttribute

    public BaseAttribute getPredictedAttribute(int loop)
                                        throws M4CompilerError

  Returns:
    the `BaseAttribute` to be predicted by the model.
  Throws:
    `M4CompilerError`

### getTheKeys

    public java.util.Collection getTheKeys()
                                    throws M4CompilerError

  Returns:
    a Collection of `BaseAttribute`s that form the primary key of the input concept
  Throws:
    `M4CompilerError`

### getRelationalDtForNewColumn

    protected abstract java.lang.String getRelationalDtForNewColumn(BaseAttribute ba)

  Specifies the relational datatype for the new Columns based on their BaseAttribute.

  Parameters:
    `ba` - the BaseAttribute of a Column to be predicted
  Returns:
    the relational datatype of the Column in String representation, e.g. `NUMBER` or `String`.

### getDatabaseDtForNewColumn

    protected abstract java.lang.String getDatabaseDtForNewColumn(BaseAttribute ba)
                                                           throws M4CompilerError

  Specifies the relational datatype for the new Columns based on their BaseAttribute.

  Parameters:
    `ba` - the BaseAttribute of a Column to be predicted
  Returns:
    the database datatype of the Column in String representation, e.g. `VARCHAR2(10)`.
  Throws:
    `M4CompilerError`

### predict

    protected abstract void predict()
                             throws M4Exception,
                                    M4CompilerError

  Predicts the values applying the specified models. Please note that the operator has to care about loops, the method is called just once for all loops!

  Throws:
    `M4Exception`
    `M4CompilerError`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005