Search in sources :

Example 6 with RuleFactory

use of org.knime.base.node.rules.engine.RuleFactory in project knime-core by knime.

the class PMMLRuleEditorNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    RuleEngineSettings res = new RuleEngineSettings();
    res.loadSettings(settings);
    RuleFactory ruleFactory = RuleFactory.getInstance(RuleNodeSettings.PMMLRule).cloned();
    ruleFactory.disableColumnChecks();
    ruleFactory.disableFlowVariableChecks();
    Map<String, FlowVariable> flowVars = getAvailableInputFlowVariables();
    for (String rule : res.rules()) {
        try {
            ruleFactory.parse(rule, null, flowVars);
        } catch (ParseException e) {
            throw new InvalidSettingsException(e.getMessage(), e);
        }
    }
}
Also used : RuleFactory(org.knime.base.node.rules.engine.RuleFactory) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) ParseException(java.text.ParseException) RuleEngineSettings(org.knime.base.node.rules.engine.RuleEngineSettings) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Aggregations

ParseException (java.text.ParseException)6 RuleFactory (org.knime.base.node.rules.engine.RuleFactory)6 ArrayList (java.util.ArrayList)4 Rule (org.knime.base.node.rules.engine.Rule)4 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)4 FlowVariable (org.knime.core.node.workflow.FlowVariable)3 DataCell (org.knime.core.data.DataCell)2 DataRow (org.knime.core.data.DataRow)2 DataType (org.knime.core.data.DataType)2 StringValue (org.knime.core.data.StringValue)2 PortObject (org.knime.core.node.port.PortObject)2 MutableLong (org.apache.commons.lang3.mutable.MutableLong)1 SimpleRule (org.dmg.pmml.SimpleRuleDocument.SimpleRule)1 Condition (org.knime.base.node.rules.engine.Condition)1 RuleEngineSettings (org.knime.base.node.rules.engine.RuleEngineSettings)1 VariableProvider (org.knime.base.node.rules.engine.VariableProvider)1 DataColumnSpec (org.knime.core.data.DataColumnSpec)1 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)1 DataTableSpec (org.knime.core.data.DataTableSpec)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1