John, please see my previous e-mails about the effect of using "or".
Regarding samples, in the integration tests folder, in the
drools-compiler source, you can see several samples of rules. Using
"or", I may just point you to:
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/3.0.x/drools-compiler/src/test/resources/org/drools/integrationtests/or_test.drl
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/3.0.x/drools-compiler/src/test/resources/org/drools/integrationtests/test_LogicalAssertions2.drl
About nesting operators, they shall work just fine. If you are
having any problem, please report and we can take a look if something
need to be fixed. What is complex when nesting operators is the variable
binding process, as all possible logical outcomes must have all
variables bound to avoid runtime errors.
Anyway, a simple example:
package com.sample
import com.sample.Cheese;
import com.sample.Person;
rule "Nested Cheese"
when
( Cheese( type == "stilton", price < 10 ) or
( Cheese( type == "muzzarella", price < 5 ) and Person( likes ==
"muzzarella" ) ) )
then
System.out.println("Found cheese");
end
Hope it helps.
[]s
Edson
John Cocktolstoy wrote:
Hi,
Documentation says about grouping that:
"Grouping is similar to using parentheses in algebra, it makes the
order of operations explicit."
It doesn't say about nesting ANDs and ORs. It is not clear if it is
possible or not in Drools.
I didn't manage to create a working example of rule that has nested
ANDs and ORs. Did anyone?
--
---
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
IT executives: Red Hat still #1 for value
http://www.redhat.com/promo/vendor/
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email