[rules-users] decision table problem Reg:

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jan 11 06:51:12 EST 2011


2011/1/11 Murali Venugopal <murali.venugopal at sifycorp.com>

>  Hi Wolffgang,
>
> Thanks for your quick response. I did as you say. now my rule file when
> generated from excel sheet and printed in console looks like this.
>
> package alertRouting;
> #generated from Decision Table
> import com.sify.beacon.events.RouteEvent;
> import com.sify.beacon.events.trapevent.Varbind;
> #From row number: 10
>
> rule "210.210.122.100 GroupA"
>
>     when
>         $event : RouteEvent(nodeIp == "210.210.122.100")
>         $varbind : Varbind(oid == "1.3.6.1.2.1.2.2.1.1" && value == "5")
>         from $event.varbindings
>     then
>         event.setGroup("GroupA");
>         System.out.println("set to Group A");
>
> end
>
> it seems that the "from" clause is in the next line as a separate
> condition. so, drools have considered it as a separate condition.
>

DRL is free form, so line breaks don't matter.


>
> the error message is
>
>  error java.lang.RuntimeException: Rule Compilation error : [Rule
> name='210.210.122.100 GroupA']
>     alertRouting/Rule_210_210_122_100_GroupA_0.java (7:397) : event cannot
> be resolved
>

"event" is the culprit. Now where is this "event"? Has it been declared?
Where? Perhaps a typo?...


>
> also, i don't understand about implementing the dependency to the cell in
> left. i tried logical, mathematical dependency conditions. sorry for my
> ignorance.
>

This requires spreadsheet functions, e.g.
   =IF( D12="","","X" )
would be in E12. The cell reference is relative, so copying it dowm
automatically changes D12 to D13, etc.

-W


>
> please help me resolve this issue.
>
>  _ _     _ _ |.
> | | ||_|| (_|||  \/
>
>
> On 01/11/2011 01:56 PM, Wolfgang Laun wrote:
>
> There is a limit to what can be implemented using decision tables. Some
> constructs are possible with hacks.
>
> In your case, you cannot have constraints with parameters and "from" in the
> same column. You need 2 adjacent columns.
>
> CONDITION
> $varbind : Varbind
> oid == $1 && value == $2
> the pattern and constraints
> ".1.3.6.1.2.1.2.2.1.1.0","5"
> ----------------------------------------------------------------
> CONDITION
>
> from $event.varbindings
> the from clause
> x
> ------------------------------------------------------------------
>
> Note the blank cell below CONDITION. The 'x' triggers the insertion of the
> from clause. (It should be possible to implement the dependency on the cell
> to the left by a simple spreadsheet formula.)
>
> -W
>
>
>
>
> 2011/1/11 Murali Venugopal <murali.venugopal at sifycorp.com>
> >
> > hi,
> >
> > i'm facing a problem with decision tables. i've got a .drl working file.
> but when i happen to take that into a .xls file ( decision table ) it throws
> some errors.
> >
> > my actual rule in .drl file has got something like this.
> >
> > when
> >
> >     $event : RouteEvent( nodeIp == "192.168.1.12 )
> >     $varbind : Varbind ( oid == ".1.3.6.1.2.1.2.2.1.1.0" && value == "5"
> ) from $event.varbindings
> >
> > then
> >
> >     System.out.println("some text")
> >
> > here in my decision table, my first cell would have the first condition
> >
> > $event : RouteEvent
> > nodeIp == "$param"
> > that is, i've to omit my "(" and ")" braces.
> >
> > so now, my second condition is
> >
> > $varbind : Varbind
> > ( oid == "$1" && value == "$2" ) from $event.varbindings
> >
> > here i don't know how to omit the "(" and ")" braces. or should i add and
> other layer of those braces.
> >
> > anyway, the decision table is not working, where as my rule file does.
> >
> > the error message is
> >
> >  error java.lang.RuntimeException: [10,55]: [ERR 102] Line 10:55
> mismatched input 'FROM' expecting ')' in rule "210.210.122.100 GroupA" in
> pattern Varbind[10,77]: [ERR 102] Line 10:77 mismatched input ')' expecting
> 'then' in rule "210.210.122.100 GroupA"
> >
> > my doubt is,
> > in the first case all my condition expression is contained with in
> braces. where as in second case, it's not. so how do i've to handle this. do
> i've have to omit the braces in the second case or not.
> >
> > please help me. i've been struggling to solve this error. also, i
> couldn't find references in the documentation.
> > thanks in advace.
> >
> >  _ _     _ _ |.
> > | | ||_|| (_|||  \/
> >
> > Whoever wants to be happy, let him be so: of tomorrow there's no knowing
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://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/20110111/ab47e909/attachment.html 


More information about the rules-users mailing list