Zeke | 1 Apr 03:54 2012
Picon

Re: ClassCastException when comparing date type with literal

Thanks for your kindly reply. For the "mitigated restriction", do you mean I can use Order( eval( $msg.getDate().compareTo( new Date(...) ) ) ) # in 5.2.0 and 5.3.0? Can you give me any example or tell me any manual I can reference to?

Thank you!

On 31 March 2012 13:06, Wolfgang Laun <wolfgang.laun <at> gmail.com> wrote:
On 31/03/2012, Zeke <xanadu860122 <at> gmail.com> wrote:
> It is just a test case used to bring up the issue. The real rule condition
> in my business logic is more complex, like
> Order( id == '...', $msg.date > '...', num == $msg.num ). Of course I can
> change to use Message as Pattern to work aournd, but it is too tricky,
> right? And no matter the usage is weird or not, it is legal, right?
>

I can't really say what was legal in 4.0.7, but
  $msg: Message()
  Order( $msg.date > '...' )
was not legal in 5.1.1. For any constraint, the left hand side would have to
be a reference to a field of the fact where it occurs.
  Order(Id == '...') # is OK
You can refer to fields of another fact on the RHS:
 Order(num == $msg.num ) # is OK
Any other expression would have to be written in clean Java (or MVEL)
but enclosed in eval()
 Order( eval( $msg.getDate().compareTo( new Date(...) ) == 1 ) ) # or
similar ;-)

Starting with 5.2.0, this restriction was mitigated and by 5.3.0 and
certainly in 5.4.0 a wide range of (boolean) expressions is
acceptable.

However, I should emphasize that postponing the use of a constraint
into a later pattern is an antipattern for rule coding. Consider
   $msg: Message()
This matches any fact of type Message, and the Engine must needs keep
track of this. Contrariwise,
  $msg: Message( date > "...")
narrows this effort down. Putting a constraint where it belongs is not
a "workaround", it's best practice :)

-W


> I am using Drools 4.0.7. If later release fixes this bug, I may try to
> upgrade. I don't want to change LHS. It will bring much effort in my
> project.
>
>
> On 30 March 2012 14:09, FrankVhh <frank.vanhoenshoven <at> agserv.eu> wrote:
>
>> Let me rephrase my question:
>>
>> As date is an attribute of message, why don't you use:
>>
>>               $msg : Message( date > "...")
>>
>> Constraining an attribute of Message in the Order pattern seems a weird
>> thing to do.
>>
>>
>>
>> Zeke-3 wrote
>> >
>> > It seems not work.
>> > When I try
>> > *$msg : Message($date : date)
>> > Order ( $date > "Mar-01-2012" )*
>> > I meet error "Unable to create Field Extractor for '$date' of
>> > '[ClassObjectType class=org.drools.examples.HelloWorldExample$Second]'
>> > in
>> > rule 'default' : [Rule name=default, agendaGroup=MAIN, salience=0,
>> > no-loop=false]"
>> >
>> > When I try
>> > *$msg : Message($date : date)
>> > eval ( $date > "Mar-01-2012" )*
>> > If the dialect is "java", I meet error "Rule Compilation error : [Rule
>> > name=default, agendaGroup=MAIN, salience=0, no-loop=false]
>> >     org/drools/examples/test/Rule_default_0.java (8:354) : The operator
>> > >
>> > is undefined for the argument type(s) Date, String"
>> > If the dialect is "mvel", I meet the same ClassCastException.
>> >
>> > On 29 March 2012 22:28, FrankVhh &lt;frank.vanhoenshoven <at> &gt; wrote:
>> >
>> >> This may sound a bit rude, but... why would you want to do such a
>> >> thing?
>> >>
>> >> If there is a constraint on the message, then why not put that
>> constraint
>> >> in
>> >> the message structure?
>> >>
>> >> Btw, I think it would work by using eval($date < "...") but see no use
>> >> for
>> >> it either.
>> >>
>> >>
>> >> Joe Zendle wrote
>> >> >
>> >> > did you try:
>> >> >
>> >> >  *$msg : Message($date : date)
>> >> > Order ( $date > "Mar-01-2012" )*
>> >> >
>> >> >
>> >> >
>> >> > 2012/3/29 Zeke &lt;xanadu860122 <at> &gt;
>> >> >
>> >> >> Hi, guys:
>> >> >>   I meet a strange issue and need your help again... I am using
>> Drools
>> >> >> 4.0.7.
>> >> >>   When my rule condition is as *Message( date > "Mar-01-2012" )*,
>> >> >> everything is OK. But if I change it to be as below:
>> >> >>   *$msg : Message()
>> >> >>   Order ( $msg.date > "Mar-01-2012" )*
>> >> >>   I will meet "java.lang.String cannot be cast to java.util.Date"
>> >> >> ClassCastException. "Order" is another fact. I attach the exception
>> >> call
>> >> >> stack. Please check it. It looks like a bug to me. Do we fix it in
>> >> later
>> >> >> release? If so, can you tell me which release contains the fix?
>> >> Thanks!
>> >> >>
>> >> >> _______________________________________________
>> >> >> rules-users mailing list
>> >> >> rules-users <at> .jboss
>> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >>
>> >> >>
>> >> >
>> >> > _______________________________________________
>> >> > rules-users mailing list
>> >> > rules-users <at> .jboss
>> >> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://drools.46999.n3.nabble.com/rules-users-ClassCastException-when-comparing-date-type-with-literal-tp3867229p3867832.html
>> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >> _______________________________________________
>> >> rules-users mailing list
>> >> rules-users <at> .jboss
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users <at> .jboss
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/rules-users-ClassCastException-when-comparing-date-type-with-literal-tp3867229p3870029.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
Jervis Liu | 1 Apr 07:33 2012
Picon

Re: migrating modified files from one Guvnor webdav repository to another using python modules

On 2012/4/1 4:59, vadlam wrote:
> Hi, we were looking into the process of copying files and packages from one
> Guvnor webdav repository to another on a daily basis.
>
> as part of that, we were looking into python modules that would help with
> accessing the webdav directories and files .
>
> any suggestions on ways to copy files and packages from one webdav directory
> to another?
>
> if using python, any webdav modules that we use to accomplish this?
>
> I came across PyDAV, but have not tried it out yet.
Hi, hope someone else can help with python question.  A different way to 
approach your requirement is to download and upload packages from one 
Guvnor repository to another repository using REST interface. For 
example, this doc shows how to publish Drools artifacts from a dev 
repository to a production repository: 
https://community.jboss.org/wiki/PublishDroolsartifactsfromaproductionenvironment

Hope this helps,
Jervis

>
> -----
> Ram
> --
> View this message in context: http://drools.46999.n3.nabble.com/migrating-modified-files-from-one-Guvnor-webdav-repository-to-another-using-python-modules-tp3874154p3874154.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

Wolfgang Laun | 1 Apr 09:29 2012
Picon

Re: ClassCastException when comparing date type with literal

Surely you don't need examples for boolean expressions written in Java.

As for eval(), consult the Drools "Expert" manual, but there's not
much to say about it. Just note that you aren't in the context of a
pattern where "naked" fields can be used; within eval it's variables
bound to facts and getters.

-W

On 01/04/2012, Zeke <xanadu860122 <at> gmail.com> wrote:
> Thanks for your kindly reply. For the "mitigated restriction", do you mean
> I can use Order( eval( $msg.getDate().compareTo( new Date(...) ) ) ) # in
> 5.2.0 and 5.3.0? Can you give me any example or tell me any manual I can
> reference to?
>
> Thank you!
>
> On 31 March 2012 13:06, Wolfgang Laun <wolfgang.laun <at> gmail.com> wrote:
>
>> On 31/03/2012, Zeke <xanadu860122 <at> gmail.com> wrote:
>> > It is just a test case used to bring up the issue. The real rule
>> condition
>> > in my business logic is more complex, like
>> > Order( id == '...', $msg.date > '...', num == $msg.num ). Of course I
>> > can
>> > change to use Message as Pattern to work aournd, but it is too tricky,
>> > right? And no matter the usage is weird or not, it is legal, right?
>> >
>>
>> I can't really say what was legal in 4.0.7, but
>>   $msg: Message()
>>   Order( $msg.date > '...' )
>> was not legal in 5.1.1. For any constraint, the left hand side would have
>> to
>> be a reference to a field of the fact where it occurs.
>>   Order(Id == '...') # is OK
>> You can refer to fields of another fact on the RHS:
>>  Order(num == $msg.num ) # is OK
>> Any other expression would have to be written in clean Java (or MVEL)
>> but enclosed in eval()
>>  Order( eval( $msg.getDate().compareTo( new Date(...) ) == 1 ) ) # or
>> similar ;-)
>>
>> Starting with 5.2.0, this restriction was mitigated and by 5.3.0 and
>> certainly in 5.4.0 a wide range of (boolean) expressions is
>> acceptable.
>>
>> However, I should emphasize that postponing the use of a constraint
>> into a later pattern is an antipattern for rule coding. Consider
>>    $msg: Message()
>> This matches any fact of type Message, and the Engine must needs keep
>> track of this. Contrariwise,
>>    $msg: Message( date > "...")
>> narrows this effort down. Putting a constraint where it belongs is not
>> a "workaround", it's best practice :)
>>
>> -W
>>
>>
>> > I am using Drools 4.0.7. If later release fixes this bug, I may try to
>> > upgrade. I don't want to change LHS. It will bring much effort in my
>> > project.
>> >
>> >
>> > On 30 March 2012 14:09, FrankVhh <frank.vanhoenshoven <at> agserv.eu> wrote:
>> >
>> >> Let me rephrase my question:
>> >>
>> >> As date is an attribute of message, why don't you use:
>> >>
>> >>               $msg : Message( date > "...")
>> >>
>> >> Constraining an attribute of Message in the Order pattern seems a weird
>> >> thing to do.
>> >>
>> >>
>> >>
>> >> Zeke-3 wrote
>> >> >
>> >> > It seems not work.
>> >> > When I try
>> >> > *$msg : Message($date : date)
>> >> > Order ( $date > "Mar-01-2012" )*
>> >> > I meet error "Unable to create Field Extractor for '$date' of
>> >> > '[ClassObjectType
>> >> > class=org.drools.examples.HelloWorldExample$Second]'
>> >> > in
>> >> > rule 'default' : [Rule name=default, agendaGroup=MAIN, salience=0,
>> >> > no-loop=false]"
>> >> >
>> >> > When I try
>> >> > *$msg : Message($date : date)
>> >> > eval ( $date > "Mar-01-2012" )*
>> >> > If the dialect is "java", I meet error "Rule Compilation error :
>> >> > [Rule
>> >> > name=default, agendaGroup=MAIN, salience=0, no-loop=false]
>> >> >     org/drools/examples/test/Rule_default_0.java (8:354) : The
>> operator
>> >> > >
>> >> > is undefined for the argument type(s) Date, String"
>> >> > If the dialect is "mvel", I meet the same ClassCastException.
>> >> >
>> >> > On 29 March 2012 22:28, FrankVhh &lt;frank.vanhoenshoven <at> &gt; wrote:
>> >> >
>> >> >> This may sound a bit rude, but... why would you want to do such a
>> >> >> thing?
>> >> >>
>> >> >> If there is a constraint on the message, then why not put that
>> >> constraint
>> >> >> in
>> >> >> the message structure?
>> >> >>
>> >> >> Btw, I think it would work by using eval($date < "...") but see no
>> use
>> >> >> for
>> >> >> it either.
>> >> >>
>> >> >>
>> >> >> Joe Zendle wrote
>> >> >> >
>> >> >> > did you try:
>> >> >> >
>> >> >> >  *$msg : Message($date : date)
>> >> >> > Order ( $date > "Mar-01-2012" )*
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > 2012/3/29 Zeke &lt;xanadu860122 <at> &gt;
>> >> >> >
>> >> >> >> Hi, guys:
>> >> >> >>   I meet a strange issue and need your help again... I am using
>> >> Drools
>> >> >> >> 4.0.7.
>> >> >> >>   When my rule condition is as *Message( date > "Mar-01-2012" )*,
>> >> >> >> everything is OK. But if I change it to be as below:
>> >> >> >>   *$msg : Message()
>> >> >> >>   Order ( $msg.date > "Mar-01-2012" )*
>> >> >> >>   I will meet "java.lang.String cannot be cast to java.util.Date"
>> >> >> >> ClassCastException. "Order" is another fact. I attach the
>> exception
>> >> >> call
>> >> >> >> stack. Please check it. It looks like a bug to me. Do we fix it
>> >> >> >> in
>> >> >> later
>> >> >> >> release? If so, can you tell me which release contains the fix?
>> >> >> Thanks!
>> >> >> >>
>> >> >> >> _______________________________________________
>> >> >> >> rules-users mailing list
>> >> >> >> rules-users <at> .jboss
>> >> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > rules-users mailing list
>> >> >> > rules-users <at> .jboss
>> >> >> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >> >
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://drools.46999.n3.nabble.com/rules-users-ClassCastException-when-comparing-date-type-with-literal-tp3867229p3867832.html
>> >> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >> >> _______________________________________________
>> >> >> rules-users mailing list
>> >> >> rules-users <at> .jboss
>> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >>
>> >> >
>> >> > _______________________________________________
>> >> > rules-users mailing list
>> >> > rules-users <at> .jboss
>> >> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >> >
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://drools.46999.n3.nabble.com/rules-users-ClassCastException-when-comparing-date-type-with-literal-tp3867229p3870029.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

senyatur | 1 Apr 15:04 2012

Drools NOW

Hi
We are using Drools for events processing and lots of times there is a need
to compare the date/time property of the object to current time. What is the
best way to implement it with Drools rules?
Thanks
Senya Touretski

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-NOW-tp3875148p3875148.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

Wolfgang Laun | 1 Apr 15:41 2012
Picon

Re: Drools NOW

Have you looked at window:time, asw described in the Drools "Fusion" manual?
-W

On 01/04/2012, senyatur <senya.touretski <at> emc.com> wrote:
> Hi
> We are using Drools for events processing and lots of times there is a need
> to compare the date/time property of the object to current time. What is the
> best way to implement it with Drools rules?
> Thanks
> Senya Touretski
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-NOW-tp3875148p3875148.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

vadlam | 1 Apr 18:47 2012
Picon

Re: migrating modified files from one Guvnor webdav repository to another using python modules

Jervis,

Thank You for forwarding that link. I have successfully used that  in the
past to download binary packages, but I assume I can use it to copy all the
rules ,model jar ,processes etc as well to another repository.

I will try it out while continuing to look for a python solution too.
perhaps I should look for a Rest module for Python that can do something
similar

Thanks,

Ram

-----
Ram
--
View this message in context: http://drools.46999.n3.nabble.com/migrating-modified-files-from-one-Guvnor-webdav-repository-to-another-using-python-modules-tp3874154p3875494.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

Wolfgang Laun | 1 Apr 21:42 2012
Picon

Re: Possible "memory leak" in 5.3 with update?

Did you compare the described scenario to one where you don't insert
and update facts but just store and replace objects in a Map: key -> object?
-W

On 01/04/2012, thenim <thenim <at> gmail.com> wrote:
> I'm using a stateful session (in a slightly odd way - obviously this is the
> problem), I have a stream of "messages" coming into my system and each
> message one of a set of unique keys. Now my rules test various attibutes of
> this message and makes some changes (to the messages) etc. (the rules aren't
> the problem here - infact in my test case, I have no rules).
>
> I tested the "normal" approach where each message is inserted and the fact
> handle retained, and subsequently after firing, the handle is removed (yes
> this sounds like a good case for Fusion, except for the making changes bit.)
> I noticed that I could get better throughput, if took the following
> approach:
>
> 1. On the first time the unique key is detected, the handle is saved
> 2. Then each time a message with that key is received, "update" is called
> with the handle for that key
>
> Now, the important thing here is that the "fact" is a *different* object not
> an updated version of the original associated with the handle.
>
> Now with this approach, I was getting better numbers, however every so often
> there would be a "pause", with GC details being printed out, I see
> immediately that it's sitting there doing full GC's very frequently, and
> switching to the concurrent collector, I can see mode failures regularly
> (i.e. full GCs). With a low message rate, I didn't notice it initially, but
> with higher message rates, this is a serious issue.
>
> It appears that the approach I've taken highlights a "leak". I wanted to
> find out if others have encountered this before digging around in the code,
> for the moment, I will "fix" my approach so that I update the "same object"
> - but is "update" not meant to be used this way?
>
> Thanks,
> Nim
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Possible-memory-leak-in-5-3-with-update-tp3874271p3874271.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

ionutmx | 2 Apr 00:28 2012
Picon

Re: Web application with drools -Error on fireAllRules()

Hi,

The problem whose that I used in output project jar''s from drools 5. When I
have replaced those jar with those from drools 4 all worked fine!

Good luck to all !

--
View this message in context: http://drools.46999.n3.nabble.com/Web-application-with-drools-Error-on-fireAllRules-tp3875466p3876328.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

Davide Sottara | 2 Apr 03:53 2012
Picon

Re: Interface and <at> key in declare

It is indeed a bug, I have opened a JIRA ticket (JBRULES-3441). 
The fix should be included in the CR1 which will be released in the next
hours.
Thanks for reporting
Davide

--
View this message in context: http://drools.46999.n3.nabble.com/Interface-and-key-in-declare-tp3868085p3876569.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

Davide Sottara | 2 Apr 04:02 2012
Picon

Re: ontologies

Hi Olfa, the code to do so is VERY experimental... the success of the
operation will depend on the ontology
and some configurations I'm still experimenting with. If you want to become
an alpha-tester, I will be more than happy to assist you. However, I would
need to see the ontology to determine whether it can be imported by the
current code or not. 
Look for me in the IRC channel in the next days. Meanwhile, you can take a
look at the "official" test and example here:

https://github.com/droolsjbpm/drools-chance/tree/master/drools-shapes/drools-shapes-examples/conyard-example

Best
Davide

--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-ontologies-tp3871053p3876584.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


Gmane