Expression containing bound variables cannot be bound to a new bound variable in constraint binding.

Solution Unverified - Updated -

Issue

When I use a pattern like (*1-1) below in LHS (when part) of my DRL rule, an error like (*e1) or (*e2) occurred when I build the rule.

(*1) Problematic rule

rule "Rule 1"
    when
        Fact1( $value1 : value )
        Fact2( $value2 : (value + $value1) )  // ..... (*1-1)
    then
        ...
end
// "value" is int-type property of the classes above (Fact1, Fact2).

(*e1) the error when I build the rule in non-executable model

[ERROR] Unable to build KieBaseModel:kbase-rules
Variables can not be used inside bindings. Variable [$value1] is being used in binding '(value + $value1)' : [Rule name='Rule 1']

(*e2) the error when I build the rule in executable model

[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel (default-generateModel) on project reproducer_bound_var_in_binding_2a: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00019:generateModel failed: [com/example/reproducer/Rules4f5d48b9a1eb487e8b5f6ed099d88e27RuleMethods0.java (28:2410) : The method bind(Variable<A>, Function1<Fact2,A>, PatternDSL.ReactOn) in the type PatternDSL.PatternDef<Fact2> is not applicable for the arguments (Variable<Integer>, LambdaExtractorB8ED3A4E46B8281C066336A911BE2810, PatternDSL.ReactOn)] -> [Help 1]

Environment

  • Red Hat Decision Manager (RHDM)
    • 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content