edu.udo.cs.miningmart.operator
Class ConceptOperator

java.lang.Object
  extended by edu.udo.cs.miningmart.operator.ExecutableOperator
      extended by edu.udo.cs.miningmart.operator.ConceptOperator
Direct Known Subclasses:
MultipleCSOperator, SingleCSOperator

public abstract class ConceptOperator
extends ExecutableOperator

This abstract class is the superclass for all operators whose output is a concept. Operators of this type must produce at least one ColumnSet for the output concept. The parameters "TheInputConcept" and "TheOutputConcept" are provided by this class and are inherited by subclasses (using the methods getInputConcept() and getOutputConcept()).

Version:
$Id: ConceptOperator.java,v 1.15 2006/10/02 12:39:55 euler Exp $
Author:
Martin Scholz
See Also:
SingleCSOperator, MultipleCSOperator

Field Summary
static java.lang.String suffixForIntermediateViews
           
 
Fields inherited from class edu.udo.cs.miningmart.operator.ExecutableOperator
generatedSQLDefinitions
 
Constructor Summary
ConceptOperator()
           
 
Method Summary
 void compileStatement()
          Method for compiling the generated sql-statement.
protected  java.lang.String createMetadata(Feature inF, Feature outF, Columnset csForOutputConcept, java.lang.String columnExpr)
          Copy the metadata for all the BAs in the input feature to the output feature.
protected  java.lang.String createMetadataForOneBA(BaseAttribute inBA, BaseAttribute outBA, Columnset csForOutputConcept, java.lang.String columnExpr)
          Copy the metadata from the given input BA to the given output BA.
protected  Columnset createSingleColumnSet(int index)
          Since all operators of this type (ConceptOperator) create columnsets, they can use this method to do so.
 void createStatement(boolean lazy)
          Method for generating a sql-statement.
protected  java.lang.String generateColumns(Columnset csForOutputConcept)
          This method creates new Columns for the given Columnset, one for each Feature of this operator's output concept, if the method "mustCopyFeature()" for this Feature returns TRUE.
abstract  Columnset[] generateColumnSetsForOp(boolean lazy)
          Abstract method to be implemented by subclasses.
abstract  java.lang.String generateSQLDefinition(java.lang.String selectPart, int index)
          This method must return the SQL definition of the newly created ColumnSet.
 Concept getInputConcept()
          This method provides TheInputConcept for this operator.
 java.lang.String getNewCSName(int index)
          This method is used to generate the name for new Columnsets.
 Concept getOutputConcept()
          This method provides TheOutputConcept for this operator.
protected  java.lang.String getStringForSelection(Column inputColumn)
          This method returns a String to be used in the SELECT part of a view definition.
abstract  java.lang.String getTypeOfNewColumnSet(int index)
          This method must return the entry String for the M4 table "Columnset_t", indicating whether the new Columnset is a view or a table.
protected abstract  java.lang.String handleExtraOutputFeature(Feature outputFeature, Columnset csForOutputConcept)
          Abstract method to deal with output features for which there is no corresponding input feature.
protected abstract  boolean mustCopyFeature(java.lang.String nameOfFeature)
          This method is for operators that do not copy all Features of the input concept to the output concept.
protected  void setNewCSMultiStepBranch(Columnset newCS, int index)
          Set the information about the multistep branch into the Columnset that is created by this operator.
 
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
 

Field Detail

suffixForIntermediateViews

public static final java.lang.String suffixForIntermediateViews
See Also:
Constant Field Values
Constructor Detail

ConceptOperator

public ConceptOperator()
Method Detail

compileStatement

public void compileStatement()
                      throws java.sql.SQLException,
                             M4CompilerWarning,
                             M4CompilerError
Method for compiling the generated sql-statement. This method tests if the generated sql-statement is executable on the database.

Specified by:
compileStatement in class ExecutableOperator
Throws:
java.sql.SQLException
M4CompilerWarning
M4CompilerError
See Also:
edu.udo.cs.miningmart.operator.Operator#compileStatement

createStatement

public void createStatement(boolean lazy)
                     throws M4CompilerError,
                            M4CompilerWarning
Method for generating a sql-statement. This method handles the process of generating a sql-statement for an operator.

Specified by:
createStatement in class ExecutableOperator
Parameters:
lazy - If TRUE, run in lazy mode: create atmost one output ColumnSet
Throws:
M4CompilerError
M4CompilerWarning
See Also:
edu.udo.cs.miningmart.operator.Operator#createStatement

generateColumnSetsForOp

public abstract Columnset[] generateColumnSetsForOp(boolean lazy)
                                             throws M4CompilerError,
                                                    M4CompilerWarning
Abstract method to be implemented by subclasses.

Returns:
An array of ColumnSet objects
Throws:
M4CompilerError
M4CompilerWarning

getInputConcept

public Concept getInputConcept()
                        throws M4CompilerError
This method provides TheInputConcept for this operator.

Throws:
M4CompilerError

getOutputConcept

public Concept getOutputConcept()
                         throws M4CompilerError
This method provides TheOutputConcept for this operator.

Throws:
M4CompilerError

createSingleColumnSet

protected Columnset createSingleColumnSet(int index)
                                   throws M4CompilerError,
                                          M4CompilerWarning
Since all operators of this type (ConceptOperator) create columnsets, they can use this method to do so. This method calls generateSQLDefinition(), to be implemented by subclasses, to find the SQL String for the new columnset. This method may be overridden by some subclasses.

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

setNewCSMultiStepBranch

protected void setNewCSMultiStepBranch(Columnset newCS,
                                       int index)
                                throws M4CompilerError
Set the information about the multistep branch into the Columnset that is created by this operator.

Parameters:
newCS - the Columnset that is created by this operator
index - An index for MulipleCSOperators.
Throws:
M4CompilerError

getTypeOfNewColumnSet

public abstract java.lang.String getTypeOfNewColumnSet(int index)
This method must return the entry String for the M4 table "Columnset_t", indicating whether the new Columnset is a view or a table. Use the constants in the class Columnset, either CS_TYPE_TABLE or CS_TYPE_VIEW.

Parameters:
index - An index for MulipleCSOperators.
Returns:
The type of the new Columnset, either Columnset.CS_TYPE_TABLE or Columnset.CS_TYPE_VIEW.

generateColumns

protected java.lang.String generateColumns(Columnset csForOutputConcept)
                                    throws M4CompilerError
This method creates new Columns for the given Columnset, one for each Feature of this operator's output concept, if the method "mustCopyFeature()" for this Feature returns TRUE. This method may be overridden by some subclasses.

Parameters:
csForOutputConcept - The ColumnSet for which Columns are to be produced.
Returns:
A String for the "SELECT"-part of the view definition for the given ColumnSet.
Throws:
M4CompilerError

handleExtraOutputFeature

protected abstract java.lang.String handleExtraOutputFeature(Feature outputFeature,
                                                             Columnset csForOutputConcept)
                                                      throws M4CompilerError
Abstract method to deal with output features for which there is no corresponding input feature. Subclasses implementing this method must return a String that can be added to the SELECT part of the view definition created by this ConceptOperator. It is possible to return the empty String.

Parameters:
outputFeature - Feature to be dealt with
csForOutputConcept - Columnset that was created for the output concept
Returns:
a String with a column definition
Throws:
M4CompilerError

createMetadata

protected java.lang.String createMetadata(Feature inF,
                                          Feature outF,
                                          Columnset csForOutputConcept,
                                          java.lang.String columnExpr)
                                   throws M4CompilerError
Copy the metadata for all the BAs in the input feature to the output feature.

Parameters:
inF - A Feature from the input concept
outF - The corresponding Feature from the output concept
csForOutputConcept - The current Columnset from the output concept
The - so-far created String for the Select part of the SQL statement
Returns:
An extended String for the Select part of the SQL statement
Throws:
M4CompilerError

createMetadataForOneBA

protected java.lang.String createMetadataForOneBA(BaseAttribute inBA,
                                                  BaseAttribute outBA,
                                                  Columnset csForOutputConcept,
                                                  java.lang.String columnExpr)
                                           throws M4CompilerError
Copy the metadata from the given input BA to the given output BA. Add the necessary SQL to the given String and return it.

Parameters:
inBA - A BaseAttribute from the input concept
outBA - The corresponding BaseAttribute from the output concept
csForOutputConcept - The current Columnset from the output concept
The - so-far created String for the Select part of the SQL statement
Returns:
An extended String for the Select part of the SQL statement
Throws:
M4CompilerError

getStringForSelection

protected java.lang.String getStringForSelection(Column inputColumn)
This method returns a String to be used in the SELECT part of a view definition. The returned String will indicate the name of the output column that corresponds to the given input column. This method may be overwritten by subclasses.

Parameters:
inputColumn - the given input column
Returns:
a String for the SELECT part of a view definition

getNewCSName

public java.lang.String getNewCSName(int index)
                              throws M4CompilerError
This method is used to generate the name for new Columnsets. If an operator needs to generate specific names, this method should be overwritten. The index may be used to signal, that this operator creates more than one Columnset, so a suffix needs to be part of the name. The Step ID should always be part of the name, because otherwise during parallel execution of Cases intermediate results of one Case could be overwritten by another.

Parameters:
the - index of the columnset to get the name for. -1 specifies, that only a single columnset is created.
Returns:
the name
Throws:
M4CompilerError

mustCopyFeature

protected abstract boolean mustCopyFeature(java.lang.String nameOfFeature)
                                    throws M4CompilerError
This method is for operators that do not copy all Features of the input concept to the output concept.

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

generateSQLDefinition

public abstract java.lang.String generateSQLDefinition(java.lang.String selectPart,
                                                       int index)
                                                throws M4CompilerError,
                                                       M4CompilerWarning
This method must return the SQL definition of the newly created ColumnSet.

Parameters:
selectPart - The String for the SELECT-part of the SQL definition to be created.
index - An index for MultipleCSOperators.
Returns:
The SQL definition for the new ColumnSet.
Throws:
M4CompilerError
M4CompilerWarning


Copyright © 2001-2005