Each rule is represented by a row, new line characters are replaced by spaces, even in string constants.
To add comments, start a line in a (condition) cell with
//
(comments can not be placed in the same line as a rule). Anything after //
will not be interpreted as a rule.
Rules consist
of a condition part (antecedent), which must evaluate to
true or false, and an outcome (consequent, after the =>
symbol) which is
put into the new column if the rule matches.
The outcome of a rule may be any of the following: a string (between quotes
"
or /
), a number, a boolean constant, a reference to another column or the value of
a flow variable value.
The type of the outcome column is the common super type of all possible outcomes (including the rules
that can never match). If no rule matches, the outcome is a missing value unless a default value
is specified.
Columns are given by their name surrounded by $, numbers are given in the usual decimal representation. Note that strings must not contain (double-) quotes. Flow variables are represented by $${TypeCharacterAndFlowVarName}$$. (Column references are not supported for PMML outputs.) The TypeCharacter should be 'D' for double (real) values, 'I' for integer values and 'S' for strings.
The logical expressions can be grouped with parentheses. The precedence rules for them are the
following:
NOT
binds most,
AND
,
XOR
and finally
OR
the least. Comparison operators always take precedence over logical connectives. All operators (and
their names) are case-sensitive.
The
ROWID
represents the row key string, the
ROWINDEX
is the index of the row (first row has
0
value), while
ROWCOUNT
stands for the number of rows in the table. (These are not available for PMML.)
Some example rules (each should be in one row):
// This is a comment $Col0$ > 0 => "Positive"When the values in Col0 are greater than 0, we assign Positive to the result column value (if no previous rule matched).
$Col0$ = "Active" AND $Col1$ <= 5 => "Outlier"You can combine conditions.
$Col0$ LIKE "Market Street*" AND ($Col1$ IN ("married", "divorced") OR $Col2$ > 40) => "Strange" $Col0$ MATCHES $${SFlowVar0}$$ OR $$ROWINDEX$$ < $${IFlowVar1}$$ => $Col0$With parentheses you can combine multiple conditions. The result in the second case comes from one of the columns.
$Col0$ > 5 => $${SCol1}$$The result can also come from a flow variable.
The following comparisons result true (other values are neither less, nor greater or equal to missing and NaN values):
//
- conditions. In case it contains missing value for non-comment conditions, the output type will be
String!) For String columns the outcome should not be quoted (by
"
or by
/
)$
are not treated as string constants with that value, but are tried to be parsed as references to flow variables, columns or table properties.recordCount
(and if
Validation column
is selected, also
nbCorrect
) is computed for the PMML output.nbCorrect
value will be computed.)You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.
To use this node in KNIME, install the extension KNIME Javasnippet from the below update site following our NodePit Product and Node Installation Guide:
A zipped version of the software site can be downloaded here.
Deploy, schedule, execute, and monitor your KNIME workflows locally, in the cloud or on-premises – with our brand new NodePit Runner.
Try NodePit Runner!Do you have feedback, questions, comments about NodePit, want to support this platform, or want your own nodes or workflows listed here as well? Do you think, the search results could be improved or something is missing? Then please get in touch! Alternatively, you can send us an email to mail@nodepit.com.
Please note that this is only about NodePit. We do not provide general support for KNIME — please use the KNIME forums instead.