Barry Kaplan wrote:
I have a set of rules that /all/ contain the following condition...

positionQuantityAllocatedToLegs : Integer(intValue < position.quantity)
        from accumulate( StrategyLeg(priority > 1, instrument == equity,
                                                 longShort ==
LongShort.LONG, legQuantity : quantity )
legsQuantity(legQuantity) ) ...the only difference being the values for the StrategyLeg.
It would be very nice if there was some way to create reusable LHS
constructs, say maybe something like:

positionQuantityAllocatedToLegs : legsAllocation(1, position.quantity,
LongShort.LONG)

Where 'legsAllocation' is replaced with the condition above. Is there such a
mechanism, or need I simply live with large amounts of duplication in my
LHS?
You can use DSLs for this already, which are like sentence templates and rules already allow mixed DSL and normal rules. So create a DSLs that encompass the shared bits and reuse them in your drl.

It would be nice to see rule extensions and rule "mixins" for code reuse. But unless it comes from the community its not going to happen any time soon. I'd be happy to chat to anyone on irc on how to do these things, if someone has the time and wants to give it a go.
thanks!

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to