Class KiePMMLDroolsRule.Builder
- java.lang.Object
-
- org.kie.pmml.models.drools.ast.KiePMMLDroolsRule.Builder
-
- Enclosing class:
- KiePMMLDroolsRule
public static class KiePMMLDroolsRule.Builder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected KiePMMLDroolsRuletoBuild
-
Method Summary
-
-
-
Field Detail
-
toBuild
protected KiePMMLDroolsRule toBuild
-
-
Method Detail
-
withStatusConstraint
public KiePMMLDroolsRule.Builder withStatusConstraint(String constraint)
The required status to fire the given rule(lhs)
$statusHolder : KiePMMLStatusHolder( status == "_constraint_" )- Parameters:
constraint-- Returns:
-
withAndConstraints
public KiePMMLDroolsRule.Builder withAndConstraints(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(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(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(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(Map<String,List<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(Map<String,List<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(String ifBreakField, String ifBreakOperator, 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(Object result)
Set the result to be returned(rhs)
$pmml4Result.addResultVariable($pmml4Result.getResultObjectName(), _result_);- Parameters:
result-- Returns:
-
withAgendaGroup
public KiePMMLDroolsRule.Builder withAgendaGroup(String agendaGroup)
Set the Agenda Group of the rule(lhs)
agenda-group "_agendaGroup_"- Parameters:
agendaGroup-- Returns:
-
withActivationGroup
public KiePMMLDroolsRule.Builder withActivationGroup(String activationGroup)
Set the Activation Group of the rule(lhs)
activation-group "_activationGroup_"- Parameters:
activationGroup-- Returns:
-
withFocusedAgendaGroup
public KiePMMLDroolsRule.Builder withFocusedAgendaGroup(String focusedAgendaGroup)
Set the AgendaGroup to be focused(rhs)
kcontext.getKieRuntime().getAgenda().getAgendaGroup( "_focusedAgendaGroup_").setFocus();- Parameters:
focusedAgendaGroup-- Returns:
-
withAccumulation
public KiePMMLDroolsRule.Builder withAccumulation(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()
-
-