[rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread dec
Due to a bug we came up with the following rule:

/*
Rule intriguing
when
   $foo: Foo( $foo.getBar() == null )
then
   ...
*/

Our original intention was to actually generate the rule like so:

/*
Rule intended
when
   $foo: Foo( bar == null )
then
   ...
*/

In most cases the intriguing rule actually seem to behave much like the
intended.
We are unsure way.
Moreover, we suspect that sometime we get wrong, or rather unexpected
results when firing up this rule.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Wolfgang Laun
Please don't write any more posts like this.

You aren't asking a question, as far as I can see - so why do you post?

You write, darkly,  about suspicions of wrong or unexpected results
(which, to be sure, isn't the same thing). This is a big help.

-W


On 22/05/2014, dec roni.frant...@gmail.com wrote:
 Due to a bug we came up with the following rule:

 /*
 Rule intriguing
 when
$foo: Foo( $foo.getBar() == null )
 then
...
 */

 Our original intention was to actually generate the rule like so:

 /*
 Rule intended
 when
$foo: Foo( bar == null )
 then
...
 */

 In most cases the intriguing rule actually seem to behave much like the
 intended.
 We are unsure way.
 Moreover, we suspect that sometime we get wrong, or rather unexpected
 results when firing up this rule.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Wolfgang Laun
1. The constraints are equivalent. $foo is bound to the Foo object, and
the getter does what the getter is supposed to do, and it's (probably)
visible - so why shouldn't it compile. Version 5.3 or maybe even 5.2 has
introduced general boolean expressions - are you using an older version?

I don't know what you mean by being conditioned upon - do you
understand the concept of binding?

2. Randomness should not matter.

3. Not seeing code that reproduces the issue, discussion is rather fruitless.

-W


On 22 May 2014 17:07, dec roni.frant...@gmail.com wrote:
 Apologies,
 I had wanted to know:
 1. Is it expected that this two rules would behave the same given the same
 input?
 Not sure I understand how would it even compile and how would the var be
 conditioned upon before  being assigned .

 2. The input was just some random string.

 3. The results are unexpected as we are getting a hit on this row even
 though the field is populated with some string. BUT what is suspicious is
 that it would seem we very rarely get this sort of behaviour. We also
 suspect if it has something to do with concurrency or multiple sessions
 concurrently executing.

 Most importantly, I would like to understand 1) - how is this even possible
 to come up with such a pattern and is it expected to behave like the
 intended rule



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647p4029654.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users