In old-style (ie, traditional lisp/cambridge-prefix) rules engine, that defines a rule that finds cousins.
The "(defrule cousin" starts the rule, and names it. It's followed by 3 patterns that define what matches the rule. The first two patterns are asserting a parent/child relationship: (parent ?j ?s) This matches anytime you assert the some 's' is the parent of some 'j'. (parent ?p ?g) This matches anytime you assert that same 'g' is the parent of some 'p'. Since both of those patterns are roughly identical, each assertion of parentage will actually match both patterns. It's the last pattern of siblings that connect it all together. For previous valus of 's' and 'g' (in the above (parent) patterns), if they have been asserted to be siblings, then fire the rule, which asserts that 'j' and 'p' are cousins. So, once you have that rule defined in your system, you'd then assert facts, such as these: fact 1: (parent 'bob 'bill) fact 2: (parent 'al 'ted) fact 3: (siblings 'ted 'bill) In this case, the following variables are matching: j == bob s == bill p == al g == ted Given those bindings, and the patterns asserted, the rule wil match, and now the rule-engine itself will assert fact 4: fact 4: (cousin 'bob 'al) Hope that helps. -bob On Mon, 27 May 2002, Maheedhar (STP) wrote: > Hi > can any body explain me the following example using the drools rete > network taking some facts. > > (defrule cousin > (parent ?j ?s) > (parent ?p ?g) > (sibling ?s ?g) > => > (assert (cousin ?j ?p))) > > Thank you, > Maheedhar Vishwanathula. > > > > > _______________________________________________________________ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > _______________________________________________ > drools-interest mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/drools-interest > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ drools-interest mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/drools-interest