org.knime.core.node.port.pmml.preproc
Class DerivedFieldMapper

java.lang.Object
  extended by org.knime.core.node.port.pmml.preproc.DerivedFieldMapper

public class DerivedFieldMapper
extends Object

Creates a map of data column names to PMML derived field names for a PMML document and vice versa. This is necessary for preprocessing operations in KNIME that do not offer to append an additional column but replace an existing column. In PMML there is no concept of overriding a field, but there is always a new name created.

Author:
Dominik Morent, KNIME.com, Zurich, Switzerland

Constructor Summary
DerivedFieldMapper(org.dmg.pmml40.DerivedFieldDocument.DerivedField[] derivedFields)
           
DerivedFieldMapper(org.dmg.pmml40.PMMLDocument pmmlDoc)
           
DerivedFieldMapper(PMMLPortObject pmmlPort)
           
 
Method Summary
 String createDerivedFieldName(String columnName)
          Creates a new unique derived field name and stores the mapping.
 String getColumnName(String fieldName)
           
 Map<String,String> getDerivedFieldMap()
           
 String getDerivedFieldName(String columnName)
           
static org.dmg.pmml40.DerivedFieldDocument.DerivedField[] getDerivedFields(org.dmg.pmml40.PMMLDocument.PMML pmml)
           
 Set<String> getDerivedNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerivedFieldMapper

public DerivedFieldMapper(org.dmg.pmml40.PMMLDocument pmmlDoc)
Parameters:
pmmlDoc - the PMML document used for initialization

DerivedFieldMapper

public DerivedFieldMapper(PMMLPortObject pmmlPort)
Parameters:
pmmlPort - the PMMLPortObject used for initialization

DerivedFieldMapper

public DerivedFieldMapper(org.dmg.pmml40.DerivedFieldDocument.DerivedField[] derivedFields)
Parameters:
derivedFields - the derived fields used for initialization
Method Detail

getDerivedFieldName

public String getDerivedFieldName(String columnName)
Parameters:
columnName - the column name to find the derived field name for
Returns:
the name of the derived field for the column or the column name if no derived field exists for it

getColumnName

public String getColumnName(String fieldName)
Parameters:
fieldName - the name of the field to find the column name for
Returns:
the name of the column of the field

createDerivedFieldName

public String createDerivedFieldName(String columnName)
Creates a new unique derived field name and stores the mapping.

Parameters:
columnName - the column name to create a unique derived field name for.
Returns:
the created derived field name

getDerivedNames

public Set<String> getDerivedNames()
Returns:
all column names that have a mapping to a derived field name

getDerivedFieldMap

public Map<String,String> getDerivedFieldMap()
Returns:
a mapping of column names to derived field names

getDerivedFields

public static org.dmg.pmml40.DerivedFieldDocument.DerivedField[] getDerivedFields(org.dmg.pmml40.PMMLDocument.PMML pmml)
Parameters:
pmml - the pmml document to retrieve the derived fields from
Returns:
all derived fields from the transformation dictionary as well as of all local transformation elements, or an empty array if no derived fields are defined.


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.