[rules-users] counting facts of a kind

Wolfgang Laun wolfgang.laun at gmail.com
Tue Aug 24 01:44:46 EDT 2010


2010/8/24 Edson Tirelli <tirelli at post.com>

>
>     Wolfgang,
>
>     The requirement for serializable classes even when not using
> persistence was a "mistake" made several versions ago and I believed it was
> fixed. What version of Drools are you using? If that is trunk, we need to
> fix it.
>
> The latest official release 5.1.



>     Anyway, workaround: for count(), you can simply write "count(1)"
> instead of using the actual variable,
>

Good to know. OTOH, is there any good reason for count() having an argument
at all? Just because all others have an argument? Nowadays, the uniform
signature could be (Object... objs) which would, e.g., permit you to write
count() without the dummy argument. Others, such as sum, average and
especially min and max could easily handle more than one argument. Not a
bonanza, but being general is not a bad thing...

-W



>
>     Edson
>
> 2010/8/23 Wolfgang Laun <wolfgang.laun at gmail.com>
>
> No, not knowingly :-) I'm using the simplest possible setup for
>> KnowledgeBase, KnowledgeBuilder, StatefulKnowledgeSession.
>>
>> Why should accumulate/count effect persistence?
>>
>> -W
>>
>>
>> 2010/8/23 Swindells, Thomas <TSwindells at nds.com>
>>
>>>   You’ve probably configured your system to be using persistence?
>>>
>>> In which case what you are persisting needs to be serializable so that it
>>> can be persisted
>>>
>>>
>>>
>>> Thomas
>>>
>>>
>>>
>>> *From:* rules-users-bounces at lists.jboss.org [mailto:
>>> rules-users-bounces at lists.jboss.org] *On Behalf Of *Wolfgang Laun
>>> *Sent:* 23 August 2010 12:17
>>> *To:* Rules Users List
>>> *Subject:* [rules-users] counting facts of a kind
>>>
>>>
>>>
>>> As simple as it gets:
>>>
>>> rule countHigh
>>> when
>>>     $n : Number() from accumulate ( $sgc : StartGoalConn() count( $sgc )
>>> )
>>> then
>>>     System.out.println( "plain routes: " + $n );
>>> end
>>>
>>> And yet, it fails:
>>>
>>> Exception in thread "main" org.drools.RuntimeDroolsException:
>>> java.lang.ClassCastException: rss.ixl.route.TrainStartGoalConn cannot be
>>> cast to java.io.Serializable
>>>
>>> Sure, adding "implements Serializable" to StartGoalConn fixes this. But
>>> why is this necessary?
>>>
>>> FYI, StartGoalConn is abstract superclass of TrainStartGoalConn - just in
>>> case this has some bearing on this issue.
>>>
>>> Best
>>> -W
>>>
>>> ------------------------------
>>>
>>>
>>> **************************************************************************************
>>> This message is confidential and intended only for the addressee. If you
>>> have received this message in error, please immediately notify the
>>> postmaster at nds.com and delete it from your system as well as any copies.
>>> The content of e-mails as well as traffic data may be monitored by NDS for
>>> employment and security purposes. To protect the environment please do not
>>> print this e-mail unless necessary.
>>>
>>> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
>>> 4EX, United Kingdom. A company registered in England and Wales. Registered
>>> no. 3080780. VAT no. GB 603 8808 40-00
>>>
>>> **************************************************************************************
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> 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/20100824/9dc527d0/attachment.html 


More information about the rules-users mailing list