com.rapidminer.operator.preprocessing.filter
Class Date2Nominal

java.lang.Object
  extended by com.rapidminer.tools.AbstractObservable<Operator>
      extended by com.rapidminer.operator.Operator
          extended by com.rapidminer.operator.AbstractExampleSetProcessing
              extended by com.rapidminer.operator.preprocessing.AbstractDataProcessing
                  extended by com.rapidminer.operator.preprocessing.filter.AbstractDateDataProcessing
                      extended by com.rapidminer.operator.preprocessing.filter.Date2Nominal
All Implemented Interfaces:
ConfigurationListener, PreviewListener, ResourceConsumer, ParameterHandler, LoggingHandler, Observable<Operator>

public class Date2Nominal
extends AbstractDateDataProcessing

This operator transforms the specified date attribute and writes a new nominal attribute in a user specified format. This might be useful for time base OLAP to change the granularity of the time stamps from day to week or month.

The date format can be specified by the date_format parameter like described in the following.

Date and Time Patterns

Date and time formats are specified by date and time pattern strings in the date_format parameter. Within date and time pattern strings, unquoted letters from 'A' to 'Z' and from 'a' to 'z' are interpreted as pattern letters representing the components of a date or time string. Text can be quoted using single quotes (') to avoid interpretation. "''" represents a single quote. All other characters are not interpreted; they're simply copied into the output string during formatting or matched against the input string during parsing.

The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):

Pattern letters are usually repeated, as their number determines the exact presentation:

This operator also supports localized date and time pattern strings by defining the locale parameter. In these strings, the pattern letters described above may be replaced with other, locale dependent, pattern letters.

Examples

The following examples show how date and time patterns are interpreted in the U.S. locale. The given date and time are 2001-07-04 12:08:56 local time in the U.S. Pacific Time time zone.

Author:
Ingo Mierswa

Field Summary
static java.lang.String PARAMETER_ATTRIBUTE_NAME
           
static java.lang.String PARAMETER_DATE_FORMAT
           
static java.lang.String PARAMETER_KEEP_OLD_ATTRIBUTE
           
static java.lang.String PARAMETER_LOCALE
           
 
Fields inherited from class com.rapidminer.operator.preprocessing.filter.AbstractDateDataProcessing
availableLocaleNames, availableLocales, DAY, DAY_RELATIVE_TO_EPOCH, DAY_RELATIVE_TO_MONTH, DAY_RELATIVE_TO_WEEK, DAY_RELATIVE_TO_YEAR, defaultLocale, HALF_YEAR, HALF_YEAR_RELATIVE_TO_EPOCH, HALF_YEAR_RELATIVE_TO_YEAR, HOUR, HOUR_RELATIVE_TO_DAY, HOUR_RELATIVE_TO_EPOCH, MILLISECOND, MILLISECOND_RELATIVE_TO_EPOCH, MILLISECOND_RELATIVE_TO_SECOND, MINUTE, MINUTE_RELATIVE_TO_DAY, MINUTE_RELATIVE_TO_EPOCH, MINUTE_RELATIVE_TO_HOUR, MONTH, MONTH_RELATIVE_TO_EPOCH, MONTH_RELATIVE_TO_QUARTER, MONTH_RELATIVE_TO_YEAR, PARAMETERS_RELATIVE_TO, QUARTER, QUARTER_RELATIVE_TO_EPOCH, QUARTER_RELATIVE_TO_YEAR, RELATIVE_TO_DEFAULTS, RELATIVE_TO_MODES, SECOND, SECOND_RELATIVE_TO_DAY, SECOND_RELATIVE_TO_EPOCH, SECOND_RELATIVE_TO_HOUR, SECOND_RELATIVE_TO_MINUTE, TIME_UNITS, WEEK, WEEK_RELATIVE_TO_EPOCH, WEEK_RELATIVE_TO_MONTH, WEEK_RELATIVE_TO_YEAR, YEAR, YEAR_RELATIVE_TO_EPOCH, YEAR_RELATIVE_TO_ERA
 
Constructor Summary
Date2Nominal(OperatorDescription description)
           
 
Method Summary
 ExampleSet apply(ExampleSet exampleSet)
          Delegate for the apply method.
 java.util.List<ParameterType> getParameterTypes()
          Returns a list of ParameterTypes describing the parameters of this operator.
 ResourceConsumptionEstimator getResourceConsumptionEstimator()
          Subclasses can override this method if they are able to estimate the consumed resources (CPU time and memory), based on their input.
protected  MetaData modifyMetaData(ExampleSetMetaData metaData)
          Subclasses might override this method to define the meta data transformation performed by this operator.
 boolean writesIntoExistingData()
          This method indicates whether the operator will perform a write operation on a cell in an existing column of the example set's ExampleTable.
 
Methods inherited from class com.rapidminer.operator.AbstractExampleSetProcessing
doWork, getExampleSetInputPort, getExampleSetOutputPort, getInputPort, getRequiredMetaData, shouldAutoConnect
 
Methods inherited from class com.rapidminer.operator.Operator
acceptsInput, addError, addError, addValue, addWarning, apply, apply, assumePreconditionsSatisfied, checkAll, checkAllExcludingMetaData, checkDeprecations, checkForStop, checkIO, checkProperties, clear, clearErrorList, cloneOperator, collectErrors, createExperimentTree, createExperimentTree, createFromXML, createFromXML, createFromXML, createMarkedExperimentTree, createMarkedProcessTree, createProcessTree, createProcessTree, disconnectPorts, execute, fireUpdate, freeMemory, getAddOnlyAdditionalOutput, getApplyCount, getCompatibilityLevel, getDeliveredOutputClasses, getDeprecationInfo, getDesiredInputClasses, getDOMRepresentation, getEncoding, getErrorList, getExecutionUnit, getExperiment, getIncompatibleVersionChanges, getInput, getInput, getInput, getInputClasses, getInputDescription, getInputPorts, getIODescription, getLog, getLogger, getName, getNumberOfBreakpoints, getOperatorClassName, getOperatorDescription, getOutputClasses, getOutputPorts, getParameter, getParameterAsBoolean, getParameterAsChar, getParameterAsColor, getParameterAsDouble, getParameterAsFile, getParameterAsFile, getParameterAsInputStream, getParameterAsInt, getParameterAsMatrix, getParameterAsRepositoryLocation, getParameterAsString, getParameterHandler, getParameterList, getParameters, getParameterTupel, getParameterType, getParent, getPortOwner, getProcess, getRoot, getStartTime, getTransformer, getUserDescription, getValue, getValues, getXML, getXML, getXML, hasBreakpoint, hasBreakpoint, hasInput, inApplyLoop, isDebugMode, isDirty, isEnabled, isExpanded, isParallel, isParameterSet, isRunning, log, log, logError, logNote, logWarning, lookupOperator, makeDirty, makeDirtyOnUpdate, notifyRenaming, performAdditionalChecks, preAutoWire, processFinished, processStarts, producesOutput, propagateDirtyness, register, registerOperator, remove, removeAndKeepConnections, rename, resume, setBreakpoint, setCompatibilityLevel, setEnabled, setEnclosingProcess, setExpanded, setInput, setListParameter, setPairParameter, setParameter, setParameters, setUserDescription, shouldAutoConnect, shouldStopStandaloneExecution, toString, transformMetaData, unregisterOperator, updateExecutionOrder, walk, writeXML, writeXML
 
Methods inherited from class com.rapidminer.tools.AbstractObservable
addObserver, addObserverAsFirst, fireUpdate, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETER_ATTRIBUTE_NAME

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

PARAMETER_DATE_FORMAT

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

PARAMETER_LOCALE

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

PARAMETER_KEEP_OLD_ATTRIBUTE

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

Date2Nominal

public Date2Nominal(OperatorDescription description)
Method Detail

modifyMetaData

protected MetaData modifyMetaData(ExampleSetMetaData metaData)
                           throws UndefinedParameterError
Description copied from class: AbstractExampleSetProcessing
Subclasses might override this method to define the meta data transformation performed by this operator.

Overrides:
modifyMetaData in class AbstractExampleSetProcessing
Throws:
UndefinedParameterError

apply

public ExampleSet apply(ExampleSet exampleSet)
                 throws OperatorException
Description copied from class: AbstractExampleSetProcessing
Delegate for the apply method. The given ExampleSet is already a clone of the input example set so that changing this examples set does not affect the original one. Subclasses should avoid cloning again unnecessarily.

Specified by:
apply in class AbstractExampleSetProcessing
Throws:
OperatorException

getParameterTypes

public java.util.List<ParameterType> getParameterTypes()
Description copied from class: Operator
Returns a list of ParameterTypes describing the parameters of this operator. The default implementation returns an empty list if no input objects can be retained and special parameters for those input objects which can be prevented from being consumed. ATTENTION! This will create new parameterTypes. For calling already existing parameter types use getParameters().getParameterTypes();

Specified by:
getParameterTypes in interface ParameterHandler
Overrides:
getParameterTypes in class Operator

writesIntoExistingData

public boolean writesIntoExistingData()
Description copied from class: AbstractExampleSetProcessing
This method indicates whether the operator will perform a write operation on a cell in an existing column of the example set's ExampleTable. If yes, the original example will be completely copied in memory if the original port is used.

Specified by:
writesIntoExistingData in class AbstractExampleSetProcessing

getResourceConsumptionEstimator

public ResourceConsumptionEstimator getResourceConsumptionEstimator()
Description copied from class: Operator
Subclasses can override this method if they are able to estimate the consumed resources (CPU time and memory), based on their input. The default implementation returns null.

Specified by:
getResourceConsumptionEstimator in interface ResourceConsumer
Overrides:
getResourceConsumptionEstimator in class Operator


Copyright © 2001-2009 by Rapid-I