[From nobody Fri Apr 20 09:03:38 2012 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [rules-users] Drools basic questions. Date: Thu, 17 May 2007 09:13:04 +0100 Message-ID: <6CE83AFC8500B641AE00AC1674A3B4AC0164BDFB@eu1wam08.warley.ford.com> In-Reply-To: <10658753.post@talk.nabble.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [rules-users] Drools basic questions. Thread-Index: AceYUy01C62SgTUeR6SRPDF1zBXw0AABxpcg From: "Anstis, Michael \(M.\)" <manstis1@ford.com> To: "Rules Users List" <rules-users@lists.jboss.org> Hi, 1. The dollar sign has no significance. What appears to the left of the colon is simply an identifier binding the object\field to a variable. Some people prefix their identifiers with dollar signs so that identifiers are easier to see in code. $stilton : Cheese( type =3D=3D "stilton" ) Cheesery( cheeses contains $stilton ) stilton : Cheese( type =3D=3D "stilton" ) Cheesery( cheeses contains stilton ) some_identifier : Cheese( type =3D=3D "stilton" ) Cheesery( cheeses contains some_identifier ) 2.=20 - cheapStilton : Cheese( type =3D=3D "stilton", price < 10 ) Binds a variable "cheapStilton" to a Fact (Object) of type Cheese where it's field "type" equals "stilton"=20 and it's field "price" is less than 10. Both "type" and "price" are compared to literals. - cheapStilton : Cheese( type =3D=3D "stilton", price < newPrice) Binds a variable "cheapStilton" to a Fact (Object) of type Cheese where it's field "type" equals "stilton" and it's field "price" is less than another identifier "newPrice". "Type" is compared to a literal and "price" is compared to a variable. The variable would need to have been bound somewhere else in the rule; for example:- Price( newPrice : price ) cheapStilton : Cheese( type =3D=3D "stilton", price < newPrice) With kind regards, Mike -----Original Message----- From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mithun Sent: 17 May 2007 06:04 To: rules-users@lists.jboss.org Subject: [rules-users] Drools basic questions. I am new to drools, so i have some basic doubts.=20 1. what does the dollar sign represent in the following rule? what is the difference when u prefix and dont prefix a variable with the dollar sign? - $stilton : Cheese( type =3D=3D "stilton" ) Cheesery( cheeses contains $stilton ) 2. what is the difference between the following rule statements ? - cheapStilton : Cheese( type =3D=3D "stilton", price < 10 ) and - cheapStilton : Cheese( type =3D=3D "stilton", price < newPrice) how does the rule base get access to the variable newPrice, in the above rule statement? Please help. Thank you. --=20 View this message in context: http://www.nabble.com/Drools-basic-questions.-tf3770003.html#a10658753 Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ]