[rules-users] expand rules with dsl

Michal Bali michalbali at gmail.com
Mon Dec 1 05:25:14 EST 2008


Hi,

You can do both ways:
1)
in DSL:
There is a Message that=msg : Message(payload : payload)
in DSLR:
There is a Message that
xpathEquals "/Root/aaaa" "bbb"
xpathEquals "/Root/cccc" "dddd"

2)
in DSL:
xpathEquals "{path}" "{value}"=msg : Message(payload : payload) and eval
(DOMUtil.xpathEquals(payload, "{path}", "{value}"))
andXpathEquals "{path}" "{value}"=eval (DOMUtil.xpathEquals(payload,
"{path}", "{value}"))
in DSLR:
xpathEquals "/Root/aaaa" "bbb"
andXpathEquals "/Root/cccc" "dddd"

On Mon, Dec 1, 2008 at 8:56 AM, Thierry B <jboss-rules at tbzone.org> wrote:

> Hello,
>
> I've a question about drl and dsl with drools 4.0.
>
> I've this rule :
>
> rule "Contexte1"
>        when
>           msg : Message(payload : payload)
>           eval (DOMUtil.xpathEquals(payload, "/Root/aaaa", "bbb"))
>           eval (DOMUtil.xpathEquals(payload, "/Root/cccc", "dddd"))
>        then
>           System.out.println ("Contexte 1 ************* : OK");
> end
>
> I use a dsl, to make it work, so now my drl is like that :
>
> rule "Contexte1"
>        when
>                >msg : Message(payload : payload)
>                xpathEquals "/Root/aaaa" "bbb"
>                xpathEquals "/Root/cccc" "dddd"
>        then
>                Log : "Contexte 1 ************* : OK";
> end
>
> I was forced to make an ">" at the line "msg : Message(payload : payload)"
> otherwise, he tells me that he can't expand that line.
>
> There is a way to :
> - avoid to put the ">" even if I have to add something else to the dsl ?
> - avoid the line "msg : Message(payload : payload)" in my drl and simplify
> my dsl so that xPathEquals "know" that the "payload" variable come from
> any object Message in Working Memory ?
>
> Thanks :-)
>
> _______________________________________________
> 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/20081201/e71022df/attachment.html 


More information about the rules-users mailing list