[rules-users] Re-usability of rules

Michael Anstis michael.anstis at gmail.com
Wed Sep 5 05:46:24 EDT 2012


Sounds like a plan :)

On 5 September 2012 10:43, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

> On 05/09/2012, Michael Anstis <michael.anstis at gmail.com> wrote:
> > I assume, the OP has a bunch of rules that validate Addresses.
> >
> > The Addresses could be on TaxPayer, NonTaxPayer, Payee, Employee etc etc.
>
> This would require rules for extracting Address(es) from NonTaxPayer,
> Payee, Employee etc etc.
>
>
> >
> > I also assume the OP did not want to repeat the Address validation in
> rules
> > containing the source of the Address.
>
> In that case, all the -ayers and ayees should have a common interface,
> e.g., Addressable and then you have one rule to fix them all.
>
> -W
>
>
> >
> > As with all assumptions I might be wrong :)
> >
> > Perhaps the OP can provide more detail.
> >
> > On 5 September 2012 10:05, Wolfgang Laun <wolfgang.laun at gmail.com>
> wrote:
> >
> >> Why not use
> >>
> >>   when
> >>      TaxPayer( $addrList : addressList )
> >>      Address( zipCode == null) from $addrList
> >>  then
> >>      // report missing zip code because: if it is null, it is not
> >> invalid - just missing ;-)
> >>  end
> >>
> >> -W
> >>
> >> On 05/09/2012, Michael Anstis <michael.anstis at gmail.com> wrote:
> >> > If your rules look something like this:-
> >> >
> >> > when
> >> >     Address( zipCode == null )
> >> > then
> >> >     //Report an invalid zipCode
> >> > end
> >> >
> >> > You will need to extract the Address from the TaxPayer:-
> >> >
> >> > when
> >> >     TaxPayer( $a : address )
> >> > then
> >> >     insert( $a );
> >> > end
> >> >
> >> > You will need to consider how to correlate the Address with the
> >> > TaxPayer
> >> > (to know which TaxPayer has an invalid Address).
> >> >
> >> > On 5 September 2012 09:50, Suvek <suvek.shah at gmail.com> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I have set of rules defined for Address validation.
> >> >> How do I reuse these rules when the Taxpayer object is passed in as
> >> >> fact
> >> >> which contains Address as one of the field (list to be precise)?
> >> >> Do I somehow need to extract and add addresses to working memory
> >> >> within
> >> >> the
> >> >> drl file?
> >> >>
> >> >> thanks
> >> >> S.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://drools.46999.n3.nabble.com/Re-usability-of-rules-tp4019580.html
> >> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
> >> >> _______________________________________________
> >> >> rules-users mailing list
> >> >> rules-users at lists.jboss.org
> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >> >>
> >> >
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> _______________________________________________
> 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/20120905/b3cc92d3/attachment.html 


More information about the rules-users mailing list