help
rules-users-request(a)lists.jboss.org wrote:
> Send rules-users mailing list submissions to
> rules-users(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
> rules-users-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> rules-users-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> 1. FW: how to fire a subset of rules in KB? (John Peterson)
> 2. Re: Multiple Object Referencing problem (Fnu Mahalakshmi)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 8 Jun 2010 05:54:39 -0700
> From: "John Peterson" <john.peterson.gv3k(a)statefarm.com>
> Subject: [rules-users] FW: how to fire a subset of rules in KB?
> To: <rules-users(a)lists.jboss.org>
> Message-ID:
> <D3A6E68928C9104BB815C83F43A36BDF0DA1F23A(a)WPSCV6NH.OPR.STATEFARM.ORG>
> Content-Type: text/plain; charset="us-ascii"
>
> Date: Mon, 7 Jun 2010 17:28:12 +0800
> From: "wenjinchao" <wenjinchao0418(a)gmail.com>
> Subject: [rules-users] how to fire a subset of rules in KB?
> To: "rules-users" <rules-users(a)lists.jboss.org>
> Message-ID: <201006071728086572085(a)gmail.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi all,
>
> I'm a newbie for drools.
> And i want to know how to fire a subset of rules in KB, suppose there
> are three rules named A,B,C, and I want to fire rule A only.
>
>
>
> by the way,
> suppose there is a drl file containing rule, and i have set up KB, and
> call fireAllRules through statefulKnowledgeSession. After that, the rule
> file is changed, how to load rules dynamicly?
>
> Is there any solution?
> Thanks in advance!
>
>
> best regards.
>
>
> 2010-06-07
>
>
>
> Wenjinchao
>
>
>
> Hi,
>
> I'll take a crack at you first question....
>
> Check out Agenda Filters:
>
>
http://legacy.drools.codehaus.org/Agenda
>
> The example listed is using Rule Names, but you can use the following to
> look at Meta Attribute values instead:
>
> AgendaFilter filter = new AgendaFilter() {
>
> @Override
> public boolean accept(Activation activation) {
>
> // Filter out rule Hello World from Sample.drl for execution
> if
(activation.getRule().getMetaAttribute("Purpose").equals("Print
> Hello
> World")) {
> return true;
> }
> return false;
> }
> };
>
> On your rules, you'll want to add a meta attribute for groups A, B, and
> C. Here's an example:
>
> rule "Hello World"
> @Purpose(Print Hello World) <--- THIS IS YOUR META-ATTRIBUTE
> when
> m : Message( status == Message.HELLO, myMessage :
> message )
> then
> System.out.println( myMessage );
> m.setMessage( "Goodbye cruel world" );
> m.setStatus( Message.GOODBYE );
> update( m );
> end
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 8 Jun 2010 09:28:04 -0400
> From: Fnu Mahalakshmi <FMahalakshmi(a)nyx.com>
> Subject: Re: [rules-users] Multiple Object Referencing problem
> To: "'rules-users(a)lists.jboss.org'"
<rules-users(a)lists.jboss.org>
> Message-ID:
> <994758E35590274E955FA75763C5AA5002D01086(a)MTEXMBXP01.ad.NYX.com>
> Content-Type: text/plain; charset="us-ascii"
>
>
> Hi Esteban,
>
> I am getting the error at a place where I am trying to write back from my working
memory to my output file.
> It is happening because the second rule to turn on the sprinkler does not work and as
a result a null value is getting stored.
> Is it possible that there can exists 2 different Room() objects with the same
room.name ??
> Because the room objects are getting stored from different files to the working
memory ??
> Do you think it better to store room objects in a separate list??
> I store all information into a list and load that into the memory.
> Am I going wrong here?
>
> Please help.
>
> Thank you.
> -M
> -----Original Message-----
> From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of
rules-users-request(a)lists.jboss.org
> Sent: Tuesday, June 08, 2010 8:40 AM
> To: rules-users(a)lists.jboss.org
> Subject: rules-users Digest, Vol 43, Issue 36
>
> Send rules-users mailing list submissions to
> rules-users(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
> rules-users-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> rules-users-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> 1. Re: Multiple Object Referencing problem (Esteban Aliverti)
> 2. Re: Exception using persistence (Alan.Gairey(a)tessella.com)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 8 Jun 2010 09:25:47 -0300
> From: Esteban Aliverti <esteban.aliverti(a)gmail.com>
> Subject: Re: [rules-users] Multiple Object Referencing problem
> To: Rules Users List <rules-users(a)lists.jboss.org>
> Message-ID:
> <AANLkTilCFcZwhX6uthWz3tIvkJXdtqVKXcb0uG-rqm91(a)mail.gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> Look at the line 58 of RulesTest class and you will find the problem. Try to
> always analyse the stacktrace if there are no drools classes involved, then
> it is not a Drools error. And remember, the debugger is your friend ;)
>
> Best,
>
> 2010/6/7 David Sinclair <dsinclair(a)chariotsolutions.com>
>
>> This has nothing to do with Drools. It looks like you are giving Writer bad
>> input perhaps??
>>
>> Exception in thread "main" *java.lang.NullPointerException*
>>
>> at java.io.Writer.write(Unknown Source)
>>
>> at com.org.RulesTest.main(*RulesTest.java:58*)
>>
>>
>>
>>
>> 2010/6/7 Fnu Mahalakshmi <FMahalakshmi(a)nyx.com>
>>
>>> Hi,
>>>
>>>
>>>
>>> I am trying out this example from the book :
>>>
>>> public class Room {
>>>
>>> private String name
>>>
>>> // getter and setter methods here
>>>
>>> }
>>>
>>> public classs Sprinkler {
>>>
>>> private Room room;
>>>
>>> private boolean on;
>>>
>>> // getter and setter methods here
>>>
>>> }
>>>
>>> public class Fire {
>>>
>>> private Room room;
>>>
>>> // getter and setter methods here
>>>
>>> }
>>>
>>>
>>>
>>> I load 2 input files: 1. with data of fire and Room { f1, r1;f2, r2}
>>>
>>> 2. with data of sprinkler and Room { ? ?, r1; ?
>>> ? , r2}
>>>
>>>
>>>
>>> I am writing rule ? if fire exists in room start sprinkler? { so if f1 and
>>> r1 in this case: I should get s1, r1 }
>>>
>>> when
>>>
>>> Fire($room : room)
>>>
>>> $sprinkler : Sprinkler( room == $room, modified == false )
>>>
>>> Then
>>>
>>> $sprinkler.setmodified(true);
>>>
>>> modify( $sprinkler ) { setSprinkle( ?s1? ) };
>>>
>>> end
>>>
>>>
>>>
>>> But this gives me error:
>>>
>>> Exception in thread "main" *java.lang.NullPointerException*
>>>
>>> at java.io.Writer.write(Unknown Source)
>>>
>>> at com.org.RulesTest.main(*RulesTest.java:58*)
>>>
>>>
>>>
>>> From what I observed this rule is not getting fired at all.
>>>
>>> I want this rule to be fired on the data in my second input file.
>>>
>>> The rules for my first input file get executed properly.
>>>
>>>
>>>
>>> Can any1 tell me where I am going wrong??
>>>
>>> Is there any way in which we can use the modified data { after rules are
>>> fired on the first input data and it is modified}to fire another set of
>>> rules on the same input depending on the next input file???
>>>
>>>
>>>
>>> Thank you.
>>>
>>>
>>>
>>> -M
>>>
>>> ------------------------------
>>>
>>> *Please consider the environment before printing this email.*
>>>
>>> *Visit our website at
http://www.nyse.com
>>>
*****************************************************************************
>>>
>>> Note: The information contained in this message and any attachment to it
>>> is privileged, confidential and protected from disclosure. If the reader of
>>> this message is not the intended recipient, or an employee or agent
>>> responsible for delivering this message to the intended recipient, you are
>>> hereby notified that any dissemination, distribution or copying of this
>>> communication is strictly prohibited. If you have received this
>>> communication in error, please notify the sender immediately by replying to
>>> the message, and please delete it from your system. Thank you. NYSE
>>> Euronext. *
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
>