Class KiePMMLDroolsRule.Builder
- java.lang.Object
-
- org.kie.pmml.models.drools.ast.KiePMMLDroolsRule.Builder
-
- Enclosing class:
- KiePMMLDroolsRule
public static class KiePMMLDroolsRule.Builder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected KiePMMLDroolsRuletoBuild
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String name, java.lang.String statusToSet, java.util.List<org.dmg.pmml.OutputField> outputFields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KiePMMLDroolsRulebuild()KiePMMLDroolsRule.BuilderwithAccumulation(java.lang.Number toAccumulate)Accumulate the given number to theStatusHolderKiePMMLDroolsRule.BuilderwithAccumulationResult(boolean accumulationResult)If true, return the result of the overall accumulationKiePMMLDroolsRule.BuilderwithActivationGroup(java.lang.String activationGroup)Set the Activation Group of the ruleKiePMMLDroolsRule.BuilderwithAgendaGroup(java.lang.String agendaGroup)Set the Agenda Group of the ruleKiePMMLDroolsRule.BuilderwithAndConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)KiePMMLDroolsRule.BuilderwithFocusedAgendaGroup(java.lang.String focusedAgendaGroup)Set the AgendaGroup to be focusedKiePMMLDroolsRule.BuilderwithIfBreak(java.lang.String ifBreakField, java.lang.String ifBreakOperator, java.lang.Object ifBreakValue)Add a break statement to the lhs of the rule (e.g. ifBreakField = "SEPAL_WIDTH"; ifBreakOperator = ">="; ifBreakValue = 5.45 generatesKiePMMLDroolsRule.BuilderwithInConstraints(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> constraints)KiePMMLDroolsRule.BuilderwithNotConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)KiePMMLDroolsRule.BuilderwithNotInConstraints(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> constraints)KiePMMLDroolsRule.BuilderwithOrConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)KiePMMLDroolsRule.BuilderwithReasonCodeAndValue(KiePMMLReasonCodeAndValue reasonCodeAndValue)Add the given reasonCode to the ordered map of matched reason codes.KiePMMLDroolsRule.BuilderwithResult(java.lang.Object result)Set the result to be returnedKiePMMLDroolsRule.BuilderwithResultCode(org.kie.pmml.api.enums.ResultCode resultCode)Set the result code to be returnedKiePMMLDroolsRule.BuilderwithStatusConstraint(java.lang.String constraint)The required status to fire the given ruleKiePMMLDroolsRule.BuilderwithXorConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)
-
-
-
Field Detail
-
toBuild
protected KiePMMLDroolsRule toBuild
-
-
Method Detail
-
withStatusConstraint
public KiePMMLDroolsRule.Builder withStatusConstraint(java.lang.String constraint)
The required status to fire the given rule(lhs)
$statusHolder : KiePMMLStatusHolder( status == "_constraint_" )- Parameters:
constraint-- Returns:
-
withAndConstraints
public KiePMMLDroolsRule.Builder withAndConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)
- Parameters:
constraints- The key of the map is the name of the generated type, while the value is theList<KiePMMLOperatorValue>to use for evaluation. Implicitly, the latter is evaluated with the value field of the former (e.g entry "OUTLOOK"/List(KiePMMLOperatorValue("==", "sunny")) generates
)OUTLOOK(value == "sunny")(e.g entry "TEMPERATURE"/List(KiePMMLOperatorValue("<", 90), KiePMMLOperatorValue(">", 50)) generates
)TEMPERATURE( value < 90 && value > 50 )- Returns:
-
withOrConstraints
public KiePMMLDroolsRule.Builder withOrConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)
- Parameters:
constraints- The key of the map is the name of the generated type, while the value is theList<KiePMMLOperatorValue>to use for evaluation. Implicitly, the latter is evaluated with the value field of the former (e.g entry "OUTLOOK"/List(KiePMMLOperatorValue("==", "sunny")) generates
)OUTLOOK(value == "sunny")(e.g entry "TEMPERATURE"/List(KiePMMLOperatorValue("<", 90), KiePMMLOperatorValue(">", 50)) generates
)TEMPERATURE( value < 90 && value > 50 )- Returns:
-
withXorConstraints
public KiePMMLDroolsRule.Builder withXorConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)
- Parameters:
constraints- TheList<KiePMMLOperatorValue>to use for evaluation. Implicitly, the "operator" and the "value" fields are evaluated with the value field of the former (e.g entry KiePMMLOperatorValue("OUTLOOK", "==", "sunny")) generates
)OUTLOOK(value == "sunny")(e.g entry KiePMMLOperatorValue("TEMPERATURE", "<", 90), KiePMMLOperatorValue("TEMPERATURE",">", 50)) generates
)TEMPERATURE( value < 90) TEMPERATURE( value > 50 )- Returns:
-
withNotConstraints
public KiePMMLDroolsRule.Builder withNotConstraints(java.util.List<KiePMMLFieldOperatorValue> constraints)
- Parameters:
constraints- The key of the map is the name of the generated type, while the value is theList<KiePMMLOperatorValue>to use for evaluation. Implicitly, the latter is evaluated with the value field of the former (e.g entry "OUTLOOK"/List(KiePMMLOperatorValue("==", "sunny")) generates
)not(OUTLOOK(value == "sunny")(e.g entry "TEMPERATURE"/List(KiePMMLOperatorValue("<", 90), KiePMMLOperatorValue(">", 50)) generates
)not(TEMPERATURE( value < 90 && value > 50 )- Returns:
-
withInConstraints
public KiePMMLDroolsRule.Builder withInConstraints(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> constraints)
- Parameters:
constraints- The key of the map is the name of the generated type, while the value is theList<Object>to use for evaluation. Implicitly, the latter is evaluated with the value field of the former (e.g entry "INPUT1"/List(-5, 0.5, 1, 10) generates
)INPUT1(value in (-5, 0.5, 1, 10)- Returns:
-
withNotInConstraints
public KiePMMLDroolsRule.Builder withNotInConstraints(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> constraints)
- Parameters:
constraints- The key of the map is the name of the generated type, while the value is theList<Object>to use for evaluation. Implicitly, the latter is evaluated with the value field of the former (e.g entry "INPUT2"/List(3, 8.5) generates
)not(INPUT2(value in(3, 8.5))- Returns:
-
withIfBreak
public KiePMMLDroolsRule.Builder withIfBreak(java.lang.String ifBreakField, java.lang.String ifBreakOperator, java.lang.Object ifBreakValue)
Add a break statement to the lhs of the rule (e.g. ifBreakField = "SEPAL_WIDTH"; ifBreakOperator = ">="; ifBreakValue = 5.45 generates$inputField: SEPAL_WIDTH()if ($inputField.getValue() >= 5.45) break[match]- Parameters:
ifBreakField-ifBreakOperator-ifBreakValue-- Returns:
-
withResultCode
public KiePMMLDroolsRule.Builder withResultCode(org.kie.pmml.api.enums.ResultCode resultCode)
Set the result code to be returned(rhs)
$pmml4Result.setResultCode(_resultCode_);- Parameters:
resultCode-- Returns:
-
withResult
public KiePMMLDroolsRule.Builder withResult(java.lang.Object result)
Set the result to be returned(rhs)
$pmml4Result.addResultVariable($pmml4Result.getResultObjectName(), _result_);- Parameters:
result-- Returns:
-
withAgendaGroup
public KiePMMLDroolsRule.Builder withAgendaGroup(java.lang.String agendaGroup)
Set the Agenda Group of the rule(lhs)
agenda-group "_agendaGroup_"- Parameters:
agendaGroup-- Returns:
-
withActivationGroup
public KiePMMLDroolsRule.Builder withActivationGroup(java.lang.String activationGroup)
Set the Activation Group of the rule(lhs)
activation-group "_activationGroup_"- Parameters:
activationGroup-- Returns:
-
withFocusedAgendaGroup
public KiePMMLDroolsRule.Builder withFocusedAgendaGroup(java.lang.String focusedAgendaGroup)
Set the AgendaGroup to be focused(rhs)
kcontext.getKieRuntime().getAgenda().getAgendaGroup( "_focusedAgendaGroup_").setFocus();- Parameters:
focusedAgendaGroup-- Returns:
-
withAccumulation
public KiePMMLDroolsRule.Builder withAccumulation(java.lang.Number toAccumulate)
Accumulate the given number to theStatusHolder(rhs)
$statusHolder.accumulate("_toAccumulate_");- Parameters:
toAccumulate-- Returns:
-
withAccumulationResult
public KiePMMLDroolsRule.Builder withAccumulationResult(boolean accumulationResult)
If true, return the result of the overall accumulation(rhs)
$pmml4Result.addResultVariable($pmml4Result.getResultObjectName(), $statusHolder.getAccumulator());- Parameters:
accumulationResult-- Returns:
-
withReasonCodeAndValue
public KiePMMLDroolsRule.Builder withReasonCodeAndValue(KiePMMLReasonCodeAndValue reasonCodeAndValue)
Add the given reasonCode to the ordered map of matched reason codes.(rhs)
- Parameters:
reasonCodeAndValue-- Returns:
-
build
public KiePMMLDroolsRule build()
-
-