Vlad,
The constructions are semantically different. In 3.0.x as default,
JBoss Rules will not allow the same fact to match more than one column.
So if you write:
Column(f1=='v1')
Column(f2=='v2')
Your rule will only match if there are 2 different objects that each
match one of the constraints. While, if you write:
Column(f1=='v1', f2=='v2')
It will require a single object that matches both constraints.
Also, the optimizations (indexing, hashing, etc) are done on a field
constraint basis.
So, if you have one rule with :
Column(f1=='v1', f2=='ONE_VAL')
And another rule with:
Column(f1=='v1', f2=='ANOTHER_VAL')
The constraint f1=='v1' will be evaluated only once. Although, to
help optimization, you must keep the constraints that repeat over
multiple patterns as the first constraints for each collumn, in the same
order.
[]s
Edson
Olenin, Vladimir (MOH) wrote:
Hi,
I wonder what is the difference (performance-wise, etc) between these two
constructs:
Column(f1=='v1', f2=='v2')
And
Column(f1=='v1')
Column(f2=='v2')
?
Both of them should select the same 'Column' facts (where Column.f1=='v1'
&&
Column.f2='v2'), correct? Is one construct more preferable then another one?
Does JBossRules hash only the evaluation result of the 'full column' OR
individual field constraints as well? From what I understand, only the full
'Column' is defined as an (alpha?) node while individual constraints within
the node can not be further optimized, correct?
Meaning, if I have another condition somewhere like this:
Column(f1=='v1', f2=='ANOTHER_VAL')
[f1=='v1'] constraint would have to be reevaluated again, while if I define
constraints through two 'separate' columns and the new constraint as
Column(f1=='v1)
Column(f2=='ANOTHER_VAL')
only the new constraint would have to be reevaluated. Do I understand it
right?
Thanks!
Vlad
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @
www.jboss.com