edu.udo.cs.miningmart.operator
Class Pivotize

java.lang.Object
  extended byedu.udo.cs.miningmart.operator.ExecutableOperator
      extended byedu.udo.cs.miningmart.operator.ConceptOperator
          extended byedu.udo.cs.miningmart.operator.SingleCSOperator
              extended byedu.udo.cs.miningmart.operator.Pivotize

public class Pivotize
extends SingleCSOperator

This operator denormalizes or flattens out certain attributes, which is called Pivotizing. This means that for each value that occurs in the column of one or two "index" attributes, a new attribute is created. This new attribute contains the aggregation over those values of the "pivot" attribute where the index attribute(s) took the value that corresponds to the new attribute. Example where aggregation is done by summing up (I = index attribute, P = pivotised attribute): Input Output I | P P_M | P_F ------ ---------- M | 4 => 6 | 5 M | 2 F | 5

Version:
$Id: Pivotize.java,v 1.6 2006/05/19 16:24:05 euler Exp $
Author:
Timm Euler

Nested Class Summary
 class Pivotize.AttributeValueCombination
           
 
Field Summary
static java.lang.String NO_AGGREGATION_VALUE
           
static java.lang.String PARAMETER_AGGREGATION
           
static java.lang.String PARAMETER_GROUPBY_ATTR
           
static java.lang.String PARAMETER_INDEX_ATTR
           
static java.lang.String PARAMETER_NULLORZERO
           
static java.lang.String PARAMETER_PIVOT_ATTR
           
static java.lang.String PARAMETER_VALUES
           
 
Fields inherited from class edu.udo.cs.miningmart.operator.ExecutableOperator
generatedSQLDefinitions
 
Constructor Summary
Pivotize()
           
 
Method Summary
protected  java.lang.String generateColumns(Columnset csForOutputConcept)
          This method is overridden because this operator uses a mapping to fill the output BaseAttributes.
 java.lang.String generateSQLDefinition(java.lang.String selectPart)
          This method must return the SQL definition of the newly created ColumnSet.
static java.util.Collection getCombinations(java.lang.String[] indexValues, BaseAttribute[] indexAttrs, BaseAttribute pivotAttr)
           
static java.lang.String getNameOfOutputAttribute(java.lang.String[] indexValue, java.lang.String pivotAttrName)
           
 java.lang.String getTypeOfNewColumnSet()
          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  boolean mustCopyFeature(java.lang.String nameOfFeature)
          This method is never called.
 
Methods inherited from class edu.udo.cs.miningmart.operator.SingleCSOperator
generateColumnSetsForOp, generateSQLDefinition, getNewCSName, getTypeOfNewColumnSet
 
Methods inherited from class edu.udo.cs.miningmart.operator.ConceptOperator
compileStatement, createMetadata, createMetadataForOneBA, createSingleColumnSet, createStatement, estimateStatistics, getInputConcept, getNewCSName, getOutputConcept, 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, getSingleParameter, getSingleParameter, getStep, 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

PARAMETER_GROUPBY_ATTR

public static final java.lang.String PARAMETER_GROUPBY_ATTR
See Also:
Constant Field Values

PARAMETER_INDEX_ATTR

public static final java.lang.String PARAMETER_INDEX_ATTR
See Also:
Constant Field Values

PARAMETER_PIVOT_ATTR

public static final java.lang.String PARAMETER_PIVOT_ATTR
See Also:
Constant Field Values

PARAMETER_VALUES

public static final java.lang.String PARAMETER_VALUES
See Also:
Constant Field Values

PARAMETER_AGGREGATION

public static final java.lang.String PARAMETER_AGGREGATION
See Also:
Constant Field Values

PARAMETER_NULLORZERO

public static final java.lang.String PARAMETER_NULLORZERO
See Also:
Constant Field Values

NO_AGGREGATION_VALUE

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

Pivotize

public Pivotize()
Method Detail

getTypeOfNewColumnSet

public java.lang.String getTypeOfNewColumnSet()
Description copied from class: SingleCSOperator
This method must return the entry String for the M4 table "Columnset_t", indicating whether the new Columnset is a view or a table.

Specified by:
getTypeOfNewColumnSet in class SingleCSOperator
Returns:
The type of the new Columnset, either "V" or "T".
See Also:
miningmart.compiler.operator.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)

generateColumns

protected java.lang.String generateColumns(Columnset csForOutputConcept)
                                    throws M4CompilerError
This method is overridden because this operator uses a mapping to fill the output BaseAttributes.

Overrides:
generateColumns in class ConceptOperator
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
See Also:
edu.udo.cs.miningmart.m4.operator.ConceptOperator#generateColumns(Columnset)

mustCopyFeature

protected boolean mustCopyFeature(java.lang.String nameOfFeature)
                           throws M4CompilerError
This method is never called.

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:
miningmart.compiler.operator.ConceptOperator#mustCopyFeature(String)

getCombinations

public static java.util.Collection getCombinations(java.lang.String[] indexValues,
                                                   BaseAttribute[] indexAttrs,
                                                   BaseAttribute pivotAttr)
                                            throws M4Exception
Throws:
M4Exception

getNameOfOutputAttribute

public static java.lang.String getNameOfOutputAttribute(java.lang.String[] indexValue,
                                                        java.lang.String pivotAttrName)


Copyright © 2001-2005