Created a JIRA.
-W
On 24/06/2013, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
Below is a self-contained DRL file where Drools crashes during
evaluation
at runtime, even though it compiles and appears to be correct.
package pythagoras;
rule "kickoff"
salience 100
when
then
for( Integer i: new Integer[]{3,4,5,12,13 } ){
insert( i );
}
end
rule "find triple forward"
when
Integer( $a: intValue )
Integer( $b: intValue > $a )
Integer( $c: intValue > $b )
eval( $a*$a + $b*$b == $c*$c )
then
System.out.println( "fwd: " + $a + " " + $b + " " + $c
);
end
query isTriple( Integer $a, Integer $b, Integer $c )
Integer( intValue == $a )
Integer( intValue == $b && > $a )
Integer( intValue == $c && > $b )
eval( $a*$a + $b*$b == $c*$c )
end
rule "find triple backward"
when
isTriple( $a, $b, $c; )
then
System.out.println( "bwd: " + $a + " " + $b + " " + $c
);
end
On 21/06/2013, Mark Proctor <mproctor(a)codehaus.org> wrote:
> Can you submit a pull request against master, 6.x, with the test. Put it
> in
> BackwardChainingTest. We'll back port the test and fix to 5.x.
>
> thanks
>
> Mark
> On 21 Jun 2013, at 16:00, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
>
>> Trying to use eval in a query for backward chaining causes a runtime
>> crash running Drools 5.5.0. Looks like a bug. The details:
>>
>> Given some Integer objects as facts,
>> rule "find triple forward"
>> when
>> Integer( $a: intValue )
>> Integer( $b: intValue > $a )
>> Integer( $c: intValue > $b )
>> eval( $a*$a + $b*$b == $c*$c )
>> then
>> System.out.println( "fwd: " + $a + " " + $b + "
" + $c );
>> end
>> finds Pythagorean triples.
>>
>> But
>> query isTriple( Integer $a, Integer $b, Integer $c )
>> Integer( intValue == $a )
>> Integer( intValue == $b && > $a )
>> Integer( intValue == $c && > $b )
>> eval( $a*$a + $b*$b == $c*$c )
>> end
>> intended to be used in combination with
>> rule "find triple backward"
>> when
>> isTriple( $a, $b, $c; )
>> then
>> System.out.println( "bwd: " + $a + " " + $b + "
" + $c );
>> end
>> causes a nasty runtime error (although DRL compilation succeeds):
>> Exception in thread "main" java.lang.NoSuchMethodError:
>> pythagoras.Rule_isTriple_17ac16f7237046ee9562afce35dfe174.eval0(III)Z
>> at
>>
pythagoras.Rule_isTriple_17ac16f7237046ee9562afce35dfe174Eval0InvokerGenerated.evaluate(Unknown
>> Source)
>> at
>>
pythagoras.Rule_isTriple_17ac16f7237046ee9562afce35dfe174Eval0Invoker.evaluate(Unknown
>> Source)
>> at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114)
>> at
>> org.drools.reteoo.EvalConditionNode.assertLeftTuple(EvalConditionNode.java:176)
>> at
>>
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:196)
>> at
>>
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:71)
>> at org.drools.reteoo.JoinNode.propagateFromRight(JoinNode.java:159)
>> at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:148)
>> at
>>
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
>> at
>>
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
>> at
>> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
>> at
>> org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
>> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
>> at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
>> at
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
>> at
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
>> at
>>
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
>> at pythagoras.Main.makeFacts(Main.java:94)
>> at pythagoras.Main.execute(Main.java:78)
>> at pythagoras.Main.main(Main.java:103)
>>
>> -W
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>