[rules-users] DROOLs callback API for L-value predicate matching events

Wolfgang Laun wolfgang.laun at gmail.com
Mon Nov 5 13:10:37 EST 2012


 A White Paper containing a similar sceenario (and other material) will be
out soon on some RedHat/JBoss site.

On 5 November 2012 17:06, <GPatel at tsys.com> wrote:

> is there a place to go look at a detailed example?
>
> Thanks
> Ghanshyam
>
>
>
> From:        Wolfgang Laun <wolfgang.laun at gmail.com>
> To:        Rules Users List <rules-users at lists.jboss.org>,
> Date:        11/05/2012 05:19 AM
> Subject:        Re: [rules-users] DROOLs callback API for L-value
> predicate        matching events
> Sent by:        rules-users-bounces at lists.jboss.org
> ------------------------------
>
>
>
> "Learning the reason for failure to match" is the title of a section in my
> boot camp you missed at this year's IntelliFest a couple of weeks ago.
>
> You are getting close to the solution, but here's the outline of the
> rule programming design pattern:
>
> Write one rule (high salience) to create an auxiliary fact (Aux),
> containing a reference to the fact under investigation (Crf) and a
> Set.
>
> Write one rule each, combining Aux and Crf, restricting the latter with one
> of the required property values/range. On the RHS, add an
> identification to the set component of Aux. DO NOT MODIFY/UPDATE.
>
> Write another rule (low salience) combining Aux and Crf and see what
> Aux contains in the Set. Retract Aux.
>
> -W
>
>
>
>
> On 05/11/2012, Cotton, Ben <Ben.Cotton at morganstanley.com> wrote:
> > Could a solution be as simple as this?  Is this approach to consuming
> > "LCHUS_IRS_CURRENCY_RULE" L-value matching events sound/complete (and
> > not-vulnerable to any race condition?).  Is there any DROOLS
> EventListener
> > callback API that would be more appropriate to solve the problem?
> >
> > E.g.  I want to be able to log when each of these 5 L-value predicates
> > either "MATCHES" or "FAILS TO MATCH" (at the time of the event)
> >
> > rule "LCHUS_IRS_CURRENCY_RULE"  //XLS Item=195
> >     when
> >        IRDCurrencyRuleFact(
> >             productType == "IRS",
> >             currency=="GBP",
> > upfrontFeePaymentDate < IRDCurrencyRuleFact.terminationDate,
> >             maturity <= 18275,
> >                                          //unit = days, i.e. 50 Years
> >             notional <= 99,999,999,999.99
> >                                   //max Notional
> >        )
> >     then
> >                   System.out.println("LCHUS");
> > end
> >
> >
> > Again the objective is to be able to join a high-resolution logging
> > capability wrt to which of the specific 5 L-value predicates matched.
> > Instinctively, to this DROOLs newbie, this approach seems workable but
> not
> > ideal ....
> >
> > rule "LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_1"
> >     when
> >        IRDCurrencyRuleFact(productType == "IRS")
> >    then
> >                  System.out.println("LCHUS_IRS_CURRENCY_RULE_L-value
> event 1
> > match");  //log event  L-value predicate 1 matched
> > end
> >
> > rule "LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_2"
> >     when
> >        IRDCurrencyRuleFact(currency=="GBP")
> >    then
> >                  System.out.println("LCHUS_IRS_CURRENCY_RULE_L-value
> event 2
> > match"); //log event  L-value predicate 2 matched
> > end
> >
> > rule "LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_3"
> >     when
> >             IRDCurrencyRuleFact(upfrontFeePaymentDate <
> > IRDCurrencyRuleFact.terminationDate)
> >     then
> >                  System.out.println("LCHUS_IRS_CURRENCY_RULE_L-value
> event 3
> > match"); //log event  L-value predicate 3 matched
> > end
> >
> > rule "LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_4"
> >     when
> >             IRDCurrencyRuleFact(maturity <= 18275)
> >     then
> >                  System.out.println("LCHUS_IRS_CURRENCY_RULE_L-value
> event 4
> > match"); //log event  L-value predicate 4 matched
> > end
> >
> > rule "LCHUS_IRS_CURRENCY_RULE_LVALUE_MATCHING_EVENT_5"
> >     when
> >             IRDCurrencyRuleFact(notional <= 99,999,999,999.99)
> >     then
> >                  System.out.println("LCHUS_IRS_CURRENCY_RULE_L-value
> event 5
> > match"); //log event  L-value predicate 5 matched
> > end
> >
> >
> >
> >
> >
> > Ben D Cotton III
> > Morgan Stanley & Co.
> > OTC Derivatives Clearing Technology
> > 1221 AOTA Rockefeller Ctr - Flr 27
> > New York, NY 10020
> > (212)762.9094
> > ben.cotton at ms.com<mailto:ben.cotton at ms.com <ben.cotton at ms.com>>
> >
> >
> >
> >
> > From: rules-users-bounces at lists.jboss.org
> > [mailto:rules-users-bounces at lists.jboss.org<rules-users-bounces at lists.jboss.org>]
> On Behalf Of Cotton, Ben
> > (ISGT)
> > Sent: Saturday, November 03, 2012 8:24 AM
> > To: rules-users at lists.jboss.org
> > Cc: O'Brien, Patrick (ISGT)
> > Subject: [rules-users] DROOLs callback API for L-value predicate matching
> > events
> >
> > Hi,  Can someone please point me to compelling examples/sample code  of
> how
> > to use a DROOLs callback API for very high-resolution logging of L-value
> > predicate matching events?
> >
> > E.g.  I want to be able to log when each of these 5 L-value predicates
> > either "MATCHES" or "FAILS TO MATCH" (at the time of the event)
> >
> > rule "LCHUS_IRS_CURRENCY_RULE"  //XLS Item=195
> >     when
> >        IRDCurrencyRuleFact(
> >             productType == "IRS",
> >             currency=="GBP",
> > upfrontFeePaymentDate < IRDCurrencyRuleFact.terminationDate,
> >             maturity <= 18275,
> >                                          //unit = days, i.e. 50 Years
> >             notional <= 99,999,999,999.99
> >                                   //max Notional
> >        )
> >     then
> >                   System.out.println("LCHUS");
> > end
> >
> >
> > Ben D Cotton III
> > Morgan Stanley & Co.
> > OTC Derivatives Clearing Technology
> > 1221 AOTA Rockefeller Ctr - Flr 27
> > New York, NY 10020
> > (212)762.9094
> > ben.cotton at ms.com<mailto:ben.cotton at ms.com <ben.cotton at ms.com>>
> >
> >
> >
> > ________________________________
> >
> > NOTICE: Morgan Stanley is not acting as a municipal advisor and the
> opinions
> > or views contained herein are not intended to be, and do not constitute,
> > advice within the meaning of Section 975 of the Dodd-Frank Wall Street
> > Reform and Consumer Protection Act. If you have received this
> communication
> > in error, please destroy all electronic and paper copies and notify the
> > sender immediately. Mistransmission is not intended to waive
> confidentiality
> > or privilege. Morgan Stanley reserves the right, to the extent permitted
> > under applicable law, to monitor electronic communications. This message
> is
> > subject to terms available at the following link:
> > http://www.morganstanley.com/disclaimers If you cannot access these
> links,
> > please notify us by reply message and we will send the contents to you.
> By
> > messaging with Morgan Stanley you consent to the foregoing.
> >
> >
> > ________________________________
> >
> > NOTICE: Morgan Stanley is not acting as a municipal advisor and the
> opinions
> > or views contained herein are not intended to be, and do not constitute,
> > advice within the meaning of Section 975 of the Dodd-Frank Wall Street
> > Reform and Consumer Protection Act. If you have received this
> communication
> > in error, please destroy all electronic and paper copies and notify the
> > sender immediately. Mistransmission is not intended to waive
> confidentiality
> > or privilege. Morgan Stanley reserves the right, to the extent permitted
> > under applicable law, to monitor electronic communications. This message
> is
> > subject to terms available at the following link:
> > http://www.morganstanley.com/disclaimers If you cannot access these
> links,
> > please notify us by reply message and we will send the contents to you.
> By
> > messaging with Morgan Stanley you consent to the foregoing.
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ----------------------------------------- The information contained in
> this communication (including any attachments hereto) is confidential and
> is intended solely for the personal and confidential use of the individual
> or entity to whom it is addressed. If the reader of this message is not the
> intended recipient or an agent responsible for delivering it to the
> intended recipient, you are hereby notified that you have received this
> communication in error and that any review, dissemination, copying, or
> unauthorized use of this information, or the taking of any action in
> reliance on the contents of this information is strictly prohibited. If you
> have received this communication in error, please notify us immediately by
> e-mail, and delete the original message. Thank you
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121105/f5692a1e/attachment-0001.html 


More information about the rules-users mailing list