Re: [rules-users] Drools - is dynamic change possible ?

2007-08-17 Thread pns77

Hi,

The following is the block of code that i tried

RuleBase ruleBase = readRule();
WorkingMemory workingMemory =
ruleBase.newStatefulSession(false); // to keep reference
// Create a message object
workingMemory.insert( message );
workingMemory.fireAllRules();

When i try chaning the drl file at run time the change doesnt get
reflected. Is there anything else i need to be doing here?  Any additional
jar files ?

To have this change take effect at runtime - do i need to create a new
session for each run or do i need to retain the session - i tried both
newStatefulSession(false) and newStatefulSession() - get the same result
with both.




Mark Proctor wrote:
 
 Yes this can be done at runtime. The RuleBase has a reference to each of 
 the created StatefulSessions that has not called dispose() yet and will 
 push those rule changes out to each running session.
 
 
 Mark
 pns77 wrote:
 Thanks for the response.

 Just to confirm when you say ...but you can remove a rule and add
 another
 in its place... - can this be done at runtime - i.e server is running, i
 go
 add a new rule/change the output of an existing rule. If so, can  i have
 the
 new rule take effect ?

 Also, do i need to include any specific jar file for this dynamic feature
 ?

 Am not looking at performance here - more from a
 maintenance/changeability
 point of view.


 Mark Proctor wrote:
   
 you cannot change an individual rule, but you can remove a rule and add 
 another in its place.

 Mark
 pns77 wrote:
 
 Have been able to execute/run a sample Drools file

 import com.sample.Message;
  
 rule Hello World
 when
 m : Message( status == Message.HELLO, message : message,
 testStringExternal : testStringExternal )
 then
 System.out.println( message );
 m.setMessage( Goodbye cruel world );
 System.out.println( testStringExternal + Message.HELLO );
 m.setStatus( Message.GOODBYE );
 update( m );
 end

 Now, is it possible to change the logic dynamically at runtime ? Or is
 the
 drl file used only to externalize the business logic? I tried changing
 the
 message in drl file and it didnt get reflected

 Environment - RAD 6.0/jdk 1.4

 Used the following set of jar files
 C:\Drools\libraries\drools-core.jar;
 C:\Drools\libraries\drools-compiler.jar;
 C:\Drools\libraries\mvel14.jar;
 C:\Drools\libraries\antlr-runtime.jar;
 C:\Drools\libraries\xstream.jar;
 C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
   
   
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


 

   
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users
 
 

-- 
View this message in context: 
http://www.nabble.com/Drools---is-dynamic-change-possible---tf4277622.html#a12195188
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Yuri de Wit
Scott,

not sure if it fits your problem, but you may also consider using
dynamic saliences. Yesterday I was able to convert 3.x rules to use it
worked very well.

In my case, I have facts of different sizes (some are collections of
other facts, some are individual facts) and in some rules I need to
find first MxN pairs (collection facts on both sides), then Mx1 or 1xN
pairs, and only then 1x1 pairs. In other rules I need to find first
1x1 pairs, then Mx1 or 1xN pairs and only then MxN.

Instead of writting a custom ConflictResolver, what I did was to use
one dynamic salience:

salience (1000 / (c.size * t.size))

for finding smallest pairs first, and

salience (-1000 / (c.size * t.size)

for finding the largest pairs first.

The 1000 is to get around the fact that saliences are integers and not
float/double (afaik)

Hope it helps,

-- yuri


On 8/17/07, Manjax23 [EMAIL PROTECTED] wrote:

 Salience salience = new SalienceInteger( Integer.parseInt( salienceText ) );
 rule.setSalience( salience );

 Cheers,
 manjax23


 Scott Reed-4 wrote:
 
  My 3.1 app has a mechanism that allowed the user to change the salience of
  some rules before running
  them, before loading up WorkingMemory. This was quite simple,
  rule.getSalience() returned a rule's
  int salience value and rule.setSalience(int) set it. Now in 4.0 I see
  salience is no longer just an
  int, but a Salience object with a simple constructor and complicated
  getValue(Tuple,WorkingMemory)
  method to access the int value.
 
  It appears to be still easy to set the salience of a rule:
  rule.setSalience( new
  SalienceInteger(int)) but getting the int salience from a Salience object
  seems to have been removed
  from joe-blow coder's reach.
 
  I would be very grateful if someone would provide me with an example that
  gets the int salience
  associated with a rule. I have no idea where or why I need to get the
  Tuple and WorkingMemory. Can I
  just pass nulls in for those two arguments?
 
  Thanks,
 Scott
  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
 
 

 --
 View this message in context: 
 http://www.nabble.com/programmatic-manipulation-of-4.0-salience--tf4283735.html#a12194345
 Sent from the drools - user mailing list archive at Nabble.com.

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Scott Reed
I guess I could add my own salience field to all my working memory objects, but it seems like 
overkill when I don't want to change the salience during a run. I just want to be able to set it as 
a constant salience before the rules are loaded and run.


Yuri de Wit's message received 8/17/2007 6:41 AM:

Scott,

not sure if it fits your problem, but you may also consider using
dynamic saliences. Yesterday I was able to convert 3.x rules to use it
worked very well.

In my case, I have facts of different sizes (some are collections of
other facts, some are individual facts) and in some rules I need to
find first MxN pairs (collection facts on both sides), then Mx1 or 1xN
pairs, and only then 1x1 pairs. In other rules I need to find first
1x1 pairs, then Mx1 or 1xN pairs and only then MxN.

Instead of writting a custom ConflictResolver, what I did was to use
one dynamic salience:

salience (1000 / (c.size * t.size))

for finding smallest pairs first, and

salience (-1000 / (c.size * t.size)

for finding the largest pairs first.

The 1000 is to get around the fact that saliences are integers and not
float/double (afaik)

Hope it helps,

-- yuri


On 8/17/07, Manjax23 [EMAIL PROTECTED] wrote:

Salience salience = new SalienceInteger( Integer.parseInt( salienceText ) );
rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:

My 3.1 app has a mechanism that allowed the user to change the salience of
some rules before running
them, before loading up WorkingMemory. This was quite simple,
rule.getSalience() returned a rule's
int salience value and rule.setSalience(int) set it. Now in 4.0 I see
salience is no longer just an
int, but a Salience object with a simple constructor and complicated
getValue(Tuple,WorkingMemory)
method to access the int value.

It appears to be still easy to set the salience of a rule:
rule.setSalience( new
SalienceInteger(int)) but getting the int salience from a Salience object
seems to have been removed
from joe-blow coder's reach.

I would be very grateful if someone would provide me with an example that
gets the int salience
associated with a rule. I have no idea where or why I need to get the
Tuple and WorkingMemory. Can I
just pass nulls in for those two arguments?

Thanks,
   Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
View this message in context: 
http://www.nabble.com/programmatic-manipulation-of-4.0-salience--tf4283735.html#a12194345
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Scott Reed
Thanks, but I want to know how to find out the salience of a Rule object that has been already 
parsed from DRL.


Manjax23's message received 8/17/2007 1:44 AM:

Salience salience = new SalienceInteger( Integer.parseInt( salienceText ) );
rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:

My 3.1 app has a mechanism that allowed the user to change the salience of
some rules before running 
them, before loading up WorkingMemory. This was quite simple,
rule.getSalience() returned a rule's 
int salience value and rule.setSalience(int) set it. Now in 4.0 I see
salience is no longer just an 
int, but a Salience object with a simple constructor and complicated
getValue(Tuple,WorkingMemory) 
method to access the int value.


It appears to be still easy to set the salience of a rule:
rule.setSalience( new 
SalienceInteger(int)) but getting the int salience from a Salience object
seems to have been removed 
from joe-blow coder's reach.


I would be very grateful if someone would provide me with an example that
gets the int salience 
associated with a rule. I have no idea where or why I need to get the
Tuple and WorkingMemory. Can I 
just pass nulls in for those two arguments?


Thanks,
   Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Function Call in LHS

2007-08-17 Thread Rafael Alcemar
Hello guys! This is my first question for the list. I've defined a function
in my DRL file to evaluate if a user can do a specific operation in my
system. This function returns a boolean result. My question is if I can use
this function in the test of LHS.

For example:

rule Cliente pode alugar
when
eval(teste)
then
System.out.println(XX);
 end


function boolean teste( ) {
return true;
}


Please, if anybody has some help, send me.

Thanks!
Rafael Alcemar
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Function Call in LHS

2007-08-17 Thread Kris Verlaenen
You should also use the parentheses for functions, as in normal Java code:

eval ( teste() )

Of course you can add parameters etc. to your functions like this as well.

Kris

  - Original Message - 
  From: Rafael Alcemar 
  To: rules-users@lists.jboss.org 
  Sent: Friday, August 17, 2007 4:02 PM
  Subject: [rules-users] Function Call in LHS


  Hello guys! This is my first question for the list. I've defined a function 
in my DRL file to evaluate if a user can do a specific operation in my system. 
This function returns a boolean result. My question is if I can use this 
function in the test of LHS. 

  For example:

  rule Cliente pode alugar
  when
  eval(teste)
  then
  System.out.println(XX);
   end


  function boolean teste( ) {
  return true; 
  }


  Please, if anybody has some help, send me.

  Thanks!
  Rafael Alcemar



--


  ___
  rules-users mailing list
  rules-users@lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: Function Call in LHS

2007-08-17 Thread Rafael Alcemar
I'm receiving the message bellow:

org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Cliente pode alugar, agendaGroup=MAIN, salience=0, no-loop=false]
vcAluga/Rule_Cliente_pode_alugar_0.java (10:319) : teste cannot be
resolved
at org.drools.rule.Package.checkValidity(Package.java:408)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java
:288)
at
rules.AluguelImediatoAspect.ajc$around$rules_AluguelImediatoAspect$1$55327fd6
(AluguelImediatoAspect.aj:31)
at controller.CtrlLocaoImediata.doRental(CtrlLocaoImediata.java:127)
at controller.CtrlLocaoImediata.EventHandler(CtrlLocaoImediata.java:284)
at controller.CtrlLocaoImediata.actionPerformed(CtrlLocaoImediata.java
:299)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
...

Any idea?

Thanks!
Rafael Alcemar

On 8/17/07, Rafael Alcemar [EMAIL PROTECTED] wrote:

 Hello guys! This is my first question for the list. I've defined a
 function in my DRL file to evaluate if a user can do a specific operation in
 my system. This function returns a boolean result. My question is if I can
 use this function in the test of LHS.

 For example:

 rule Cliente pode alugar
 when
 eval(teste)
 then
 System.out.println(XX);
  end


 function boolean teste( ) {
 return true;
 }


 Please, if anybody has some help, send me.

 Thanks!
 Rafael Alcemar

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Realtime audit view

2007-08-17 Thread hypnosat7

Hi,

   What is the realtime audit view ?
-- 
View this message in context: 
http://www.nabble.com/Realtime-audit-view-tf4286417.html#a12201671
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Tutorial

2007-08-17 Thread Saleem Lakhani
Hi,

 

I am wondering how someone gets start with writing DRLs  DSLs without
any tutorials or guidelines. If there is one then please share it with
me.

It is urgent. I am using Drools 4.0.

 

Saleem Lakhani

 

 

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Cryptic error message: [EMAIL PROTECTED]

2007-08-17 Thread Scott Reed
I have converted my 3.1 DRL to 4.0, think I have the dependencies worked out (removed 
antlr-30ea8.jar) and now I am getting a cryptic error message from the DRL compiler:


Rules.getRuleBase. [EMAIL PROTECTED]
org.drools.rule.InvalidRulePackage: [EMAIL PROTECTED]
at org.drools.rule.Package.checkValidity(Package.java:412)
at 
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:292)
...

Am I missing something with the plugin, is my DRL so badly munged the compiler can't explain what's 
wrong, or what?


Thanks,
  Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Realtime audit view

2007-08-17 Thread Mark Proctor

Actually that is incomplete, it should have been disabled.

The current audit view only shows data at the end when you call write(). 
The realtime audit view streams data so you can look at the execution 
flow in the audit view at debug time, i.e. mid execution.


Mark
hypnosat7 wrote:

Hi,

   What is the realtime audit view ?
  


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] 4.0 Dependencies

2007-08-17 Thread Fernando Meyer

The readme_dependencies.txt is at trunk root directory
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/ 
README_DEPENDENCIES.txt


you are missing the antlr runtime library


On Aug 17, 2007, at 1:36 PM, Scott Reed wrote:

1) Please tell me where I can find the definitive list of  
dependencies for the 4.0 release.


The manual lists them but also says to look for  
README_DEPENDENCIES.txt in the lib dir but I do not see it.

I am getting the following error:

Exception in thread main java.lang.NoSuchMethodError:  
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S

at org.drools.lang.DRLParser.clinit(DRLParser.java:7223)
at org.drools.compiler.DrlParser.getParser(DrlParser.java:204)
at org.drools.compiler.DrlParser.parse(DrlParser.java:60)
	at org.drools.compiler.PackageBuilder.addPackageFromDrl 
(PackageBuilder.java:158)


My classpath has antlr-3.0ea8.jar.
2) What am I missing?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] 4.0 Dependencies

2007-08-17 Thread Scott Reed

1) Please tell me where I can find the definitive list of dependencies for the 
4.0 release.

The manual lists them but also says to look for README_DEPENDENCIES.txt in the lib dir but I do not 
see it.

I am getting the following error:

Exception in thread main java.lang.NoSuchMethodError: 
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S

at org.drools.lang.DRLParser.clinit(DRLParser.java:7223)
at org.drools.compiler.DrlParser.getParser(DrlParser.java:204)
at org.drools.compiler.DrlParser.parse(DrlParser.java:60)
at 
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:158)

My classpath has antlr-3.0ea8.jar.
2) What am I missing?
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Cryptic error message: [EMAIL PROTECTED]

2007-08-17 Thread Scott Reed
It appears that the plugin is not recompiling the file when I edit it, but it says it is Unable to 
parse rules to build Rete tree if I select that view.


I could really use some help here.
Shouldn't the compiler be telling mere where the syntax errors are?

Scott Reed's message received 8/17/2007 1:20 PM:

By the way, the Eclipse plugin is not complaining about this file.

Scott Reed's message received 8/17/2007 1:15 PM:
I have converted my 3.1 DRL to 4.0, think I have the dependencies 
worked out (removed antlr-30ea8.jar) and now I am getting a cryptic 
error message from the DRL compiler:


Rules.getRuleBase. [EMAIL PROTECTED]
org.drools.rule.InvalidRulePackage: 
[EMAIL PROTECTED]

at org.drools.rule.Package.checkValidity(Package.java:412)
at 
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:292)

...

Am I missing something with the plugin, is my DRL so badly munged the 
compiler can't explain what's wrong, or what?


Thanks,
  Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] kranthi kumar has invited you to mGinger

2007-08-17 Thread nvkranthikumardalai
Title: mGinger Invite


  
  


  

  

  


  
  


  kranthi kumar has invited you to join mGinger.com

  
  


  
  
  


  
  

  

  
		Hi,
			
			I have created my network on mGinger.com & thought I'd invite you to join as well.
			I believe it's a cool, fun way to be informed about new products and discounts in your city.
			
			mGinger.com is free to join, you shouldn't miss out.
			
		 	By joining mGinger:
			
			You will receive discount coupons and offers based on your interests.
			
			You get SMS ads of only those products that you want to buy (no spam!!)
			
			You get ads at your convenience (only in the time you specify)
			
			And to top it all, you will make some pocket money too.
			
  

  

  

  Join kranthi's Network

  


  


If clicking the above link does not work, you may type or copy and paste the link below into your Web browser. Make sure you copy the link exactly and do not add extra spaces.
  
		  
http://mGinger.com/index.jsp?inviteId=887153
		  


		
		If you don't want to receive invites from mGinger, please click here to block further invites.
		
		
			http://mGinger.com/[EMAIL PROTECTED]
		
		
		

  

  
  


  


  
  
  


  


  
  
  


  

  

  


  

  
Copyright 2007 mGinger. All rights reserved.
  

  




___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Scott Reed

For lack of any better suggestion I am getting the int salience using
Integer.parse(rule.getPriority().toString()).
Of course this is a huge hack since it depends on the undocumented toString() function returning the 
string value of the integer salience.


I am still very interested to hear how the designers thought we should use the API to get the 
salience value.


Scott Reed's message received 8/17/2007 8:52 AM:

I guess the question here is, where do you get that salinceText from?
I am using DRL to define the rules.

Manjax23's message received 8/17/2007 1:44 AM:
Salience salience = new SalienceInteger( Integer.parseInt( 
salienceText ) );

rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:
My 3.1 app has a mechanism that allowed the user to change the 
salience of
some rules before running them, before loading up WorkingMemory. This 
was quite simple,
rule.getSalience() returned a rule's int salience value and 
rule.setSalience(int) set it. Now in 4.0 I see
salience is no longer just an int, but a Salience object with a 
simple constructor and complicated

getValue(Tuple,WorkingMemory) method to access the int value.

It appears to be still easy to set the salience of a rule:
rule.setSalience( new SalienceInteger(int)) but getting the int 
salience from a Salience object

seems to have been removed from joe-blow coder's reach.

I would be very grateful if someone would provide me with an example 
that
gets the int salience associated with a rule. I have no idea where or 
why I need to get the
Tuple and WorkingMemory. Can I just pass nulls in for those two 
arguments?


Thanks,
   Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Re: Drools 4.0 problem: insert (drl) not reflected StatefulSession.

2007-08-17 Thread Michael Waluk
I found my problem, in case anyone else has this same issue (until
4.0.1which may have this fixed):

The ClassObjectFilter's accept method works like this:

public boolean accept(Object object) {
return object.getClass().isAssignableFrom( this.clazz );
}

which is opposite of what I expected.  I want to find all the objects in
working memory that implement a particular interface.  So I created my own
ObjectFilter that works like you'd expect:

public boolean accept(Object object) {
return this.clazz.isAssignableFrom(object.getClass());
}

Hope it helps someone,
Michael


On 8/16/07, Michael Waluk [EMAIL PROTECTED] wrote:

 The log file also shows that the BenefitsProgramEvent was inserted
 properly.  So why wouldn't it appear in the working memory?  Do I need to do
 something special or is somehow inserted in another working memory?

 Thanks for any suggestions,
 Michael

 object-stream
   list
 org.drools.audit.event.ActivationLogEvent
   activationIdRecognizeBenefitsProgramEvent [1]/activationId
   ruleRecognizeBenefitsProgramEvent/rule
   declarations$edit=
 [EMAIL PROTECTED]
 (1)/declarations
   type6/type
 /org.drools.audit.event.ActivationLogEvent
 org.drools.audit.event.ObjectLogEvent
   factId84/factId
   objectToString
 [EMAIL PROTECTED]
 []/objectToString
   type1/type
 /org.drools.audit.event.ObjectLogEvent
 org.drools.audit.event.ActivationLogEvent
   activationIdRecognizeBenefitsProgramEvent [1]/activationId
   ruleRecognizeBenefitsProgramEvent/rule
   declarations$edit=
 [EMAIL PROTECTED]
 (1)/declarations
   type7/type
 /org.drools.audit.event.ActivationLogEvent
   /list
 /object-stream




 On 8/15/07, Michael Waluk [EMAIL PROTECTED] wrote:
 
  I just upgraded to Drools 4.0 and changed my assertObject calls to
  insert.  I also switched from WorkingMemory to StatefulSession.  The rules
  seem to be fine, but I am not able to retrieve any inserted objects from the
  working memory for some reason.  Here is what I'm doing.  I'd appreciate any
  suggestions...
 
  StatefulSession *workingMemory* = getActiveWorkingMemories(id);
  *workingMemory*.fireAllRules();
 
  // Here is the rule that fires:
  *
 
  rule
  *RecognizeBenefitsProgramEvent *
  **  when* $edit: BenefitsProgramModelEdit()
  *  then*
  *insert* (*new* *BenefitsProgramEvent*(BenefitsProgramEvent,
  $edit.getValidFrom(), AnnualEnrollmentEvent)); *
  **System*.out.println(Rule RecognizeBenefitsProgramEvent fired  );
  *
  **end*
 
  I see the print statement in the console but the inserted object is not
  actually in the working memory.  I look using this:
 
  Iterator events = *workingMemory*.iterateObjects(new ClassObjectFilter(
  BenefitsProgramEvent.class));
 
  This iterator is empty.  I also debug and look at the assetMap inside
  workingMemory and it never changes.
 
  Thanks,
 
  Michael
 


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Mark Proctor
Integer.parseInt( salienceText ) is only needed if your source is a 
string, otherwise  new SalienceInteger( 10 ) is fine. Take a look at the 
SalienceInteger to understand how it works, tuple, workingMemory are 
ignored for non dynamic environments:

http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/SalienceInteger.java

Mark
Scott Reed wrote:

For lack of any better suggestion I am getting the int salience using
Integer.parse(rule.getPriority().toString()).
Of course this is a huge hack since it depends on the undocumented 
toString() function returning the string value of the integer salience.


I am still very interested to hear how the designers thought we should 
use the API to get the salience value.


Scott Reed's message received 8/17/2007 8:52 AM:

I guess the question here is, where do you get that salinceText from?
I am using DRL to define the rules.

Manjax23's message received 8/17/2007 1:44 AM:
Salience salience = new SalienceInteger( Integer.parseInt( 
salienceText ) );

rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:
My 3.1 app has a mechanism that allowed the user to change the 
salience of
some rules before running them, before loading up WorkingMemory. 
This was quite simple,
rule.getSalience() returned a rule's int salience value and 
rule.setSalience(int) set it. Now in 4.0 I see
salience is no longer just an int, but a Salience object with a 
simple constructor and complicated

getValue(Tuple,WorkingMemory) method to access the int value.

It appears to be still easy to set the salience of a rule:
rule.setSalience( new SalienceInteger(int)) but getting the int 
salience from a Salience object

seems to have been removed from joe-blow coder's reach.

I would be very grateful if someone would provide me with an 
example that
gets the int salience associated with a rule. I have no idea where 
or why I need to get the
Tuple and WorkingMemory. Can I just pass nulls in for those two 
arguments?


Thanks,
   Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] programmatic manipulation of 4.0 salience?

2007-08-17 Thread Scott Reed

Mark,
  I think you misunderstood the issue. I know how to set the salience. The problem is that the way 
to *get* the salience of a SalienceInteger is to pass in a Tuple and WorkingMemory and there is no 
explanation of where the Tuple and WorkingMemory are supposed to come from. The only way I could 
figure out how to get the salience as I did in 3.0 is to parse the toString() result value which 
bites but works for now.
  As I asked before, will it work to call IntegerSalience.getSalience(null,null) to get a constant 
salience? If so, it would be helpful to say that in the javadocs. Also helpful, perhaps, would be a 
IntegerSalience.getValue() method with no args that would wrap Salience.getSalience( null, null ).
  I find it a little troubling that the API docs are so unreliable that users are expected to read 
the source code to understand how to use it. It would make some sense if I wanted to use the dynamic 
salience programmatically but since I am only concerned with the simple, constant case, like most 
users I expect, it seems like a lot of effort and time for something that should be easy and quick.
  I can see the benefits of dynamic salience, but I would appreciate the feature more if it hadn't 
made the simple, static case more complex.

  Thanks,
Scott

Mark Proctor's message received 8/17/2007 5:13 PM:
Integer.parseInt( salienceText ) is only needed if your source is a 
string, otherwise  new SalienceInteger( 10 ) is fine. Take a look at the 
SalienceInteger to understand how it works, tuple, workingMemory are 
ignored for non dynamic environments:
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/SalienceInteger.java 



Mark
Scott Reed wrote:

For lack of any better suggestion I am getting the int salience using
Integer.parse(rule.getPriority().toString()).
Of course this is a huge hack since it depends on the undocumented 
toString() function returning the string value of the integer salience.


I am still very interested to hear how the designers thought we should 
use the API to get the salience value.


Scott Reed's message received 8/17/2007 8:52 AM:

I guess the question here is, where do you get that salinceText from?
I am using DRL to define the rules.

Manjax23's message received 8/17/2007 1:44 AM:
Salience salience = new SalienceInteger( Integer.parseInt( 
salienceText ) );

rule.setSalience( salience );

Cheers,
manjax23


Scott Reed-4 wrote:
My 3.1 app has a mechanism that allowed the user to change the 
salience of
some rules before running them, before loading up WorkingMemory. 
This was quite simple,
rule.getSalience() returned a rule's int salience value and 
rule.setSalience(int) set it. Now in 4.0 I see
salience is no longer just an int, but a Salience object with a 
simple constructor and complicated

getValue(Tuple,WorkingMemory) method to access the int value.

It appears to be still easy to set the salience of a rule:
rule.setSalience( new SalienceInteger(int)) but getting the int 
salience from a Salience object

seems to have been removed from joe-blow coder's reach.

I would be very grateful if someone would provide me with an 
example that
gets the int salience associated with a rule. I have no idea where 
or why I need to get the
Tuple and WorkingMemory. Can I just pass nulls in for those two 
arguments?


Thanks,
   Scott
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users






___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Drools 4.0 problem: insert (drl) not reflected StatefulSession.

2007-08-17 Thread Edson Tirelli
   Michael,

   Yes, this is fixed in trunk. Latest snapshot can be downloaded from here:

http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

   Thanks for reporting and providing fix.

   []s
   Edson

2007/8/17, Michael Waluk [EMAIL PROTECTED]:

 I found my problem, in case anyone else has this same issue (until 4.0.1which 
 may have this fixed):

 The ClassObjectFilter's accept method works like this:

 public boolean accept(Object object) {
 return object.getClass().isAssignableFrom( this.clazz );
 }

 which is opposite of what I expected.  I want to find all the objects in
 working memory that implement a particular interface.  So I created my own
 ObjectFilter that works like you'd expect:

 public boolean accept(Object object) {
 return this.clazz.isAssignableFrom(object.getClass());
 }

 Hope it helps someone,
 Michael


 On 8/16/07, Michael Waluk [EMAIL PROTECTED] wrote:
 
  The log file also shows that the BenefitsProgramEvent was inserted
  properly.  So why wouldn't it appear in the working memory?  Do I need to do
  something special or is somehow inserted in another working memory?
 
  Thanks for any suggestions,
  Michael
 
  object-stream
list
  org.drools.audit.event.ActivationLogEvent
activationIdRecognizeBenefitsProgramEvent [1]/activationId
ruleRecognizeBenefitsProgramEvent/rule
declarations$edit=
  [EMAIL PROTECTED]
  (1)/declarations
type6/type
  /org.drools.audit.event.ActivationLogEvent
  org.drools.audit.event.ObjectLogEvent
factId84/factId
objectToString
  [EMAIL PROTECTED]
  []/objectToString
type1/type
  /org.drools.audit.event.ObjectLogEvent
  org.drools.audit.event.ActivationLogEvent
activationIdRecognizeBenefitsProgramEvent [1]/activationId
ruleRecognizeBenefitsProgramEvent/rule
declarations$edit=
  [EMAIL PROTECTED]
  (1)/declarations
type7/type
  /org.drools.audit.event.ActivationLogEvent
/list
  /object-stream
 
 
 
 
  On 8/15/07, Michael Waluk [EMAIL PROTECTED] wrote:
  
   I just upgraded to Drools 4.0 and changed my assertObject calls to
   insert.  I also switched from WorkingMemory to StatefulSession.  The rules
   seem to be fine, but I am not able to retrieve any inserted objects from 
   the
   working memory for some reason.  Here is what I'm doing.  I'd appreciate 
   any
   suggestions...
  
   StatefulSession *workingMemory* = getActiveWorkingMemories(id);
   *workingMemory*.fireAllRules();
  
   // Here is the rule that fires:
   *
  
   rule
   *RecognizeBenefitsProgramEvent *
   **   when* $edit: BenefitsProgramModelEdit()
   *  then*
   *insert* (*new* *BenefitsProgramEvent*(BenefitsProgramEvent,
   $edit.getValidFrom(), AnnualEnrollmentEvent)); *
   **System*.out.println(Rule RecognizeBenefitsProgramEvent fired  );
   *
   **end*
  
   I see the print statement in the console but the inserted object is
   not actually in the working memory.  I look using this:
  
   Iterator events = *workingMemory*.iterateObjects(new
   ClassObjectFilter(BenefitsProgramEvent.class));
  
   This iterator is empty.  I also debug and look at the assetMap inside
   workingMemory and it never changes.
  
   Thanks,
  
   Michael
  
 
 

 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Eclipse plugin not compiling

2007-08-17 Thread Scott Reed
I am not getting notified of compiler errors in the Rule Editor, only when I execute the rule 
engine. I am running Eclipse 3.2 and Drools plugin 4.0.0. Any ideas what might be wrong or is this 
how it works now?

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Eclipse plugin not compiling

2007-08-17 Thread Scott Reed

Scott Reed's message received 8/17/2007 8:55 PM:
I am not getting notified of compiler errors in the Rule Editor, only 
when I execute the rule engine. I am running Eclipse 3.2 and Drools 
plugin 4.0.0. Any ideas what might be wrong or is this how it works now?

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



There is nothing in the Eclipse log if I just save my edits, but if I switch to Rete View I see the 
following:


!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.715
!MESSAGE Internal error in Drools Plugin:
!STACK 0
org.drools.rule.InvalidRulePackage: [EMAIL PROTECTED]
at org.drools.rule.Package.checkValidity(Package.java:408)
at 
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:288)
at org.drools.eclipse.editors.rete.ReteViewer.getRuleBase(Unknown 
Source)
at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown 
Source)
at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.715
!MESSAGE Internal error in Drools Plugin:
!STACK 0
java.lang.Exception: Unable to parse rules to show RETE view!
at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown 
Source)
at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.731
!MESSAGE Internal error in Drools Plugin:
!STACK 0
java.lang.reflect.InvocationTargetException
at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Caused by: java.lang.Exception: Unable to parse rules to show RETE view!
at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown 
Source)
... 2 more
Root exception:
java.lang.Exception: Unable to parse rules to show RETE view!
at org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown 
Source)
at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Eclipse plugin not compiling

2007-08-17 Thread Mark Proctor
Looked like it has a problem parsing the functions in your drl. Not sure 
why this isn't showing up in the main drl error view though :(


Mark
Scott Reed wrote:

Scott Reed's message received 8/17/2007 8:55 PM:
I am not getting notified of compiler errors in the Rule Editor, only 
when I execute the rule engine. I am running Eclipse 3.2 and Drools 
plugin 4.0.0. Any ideas what might be wrong or is this how it works now?

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



There is nothing in the Eclipse log if I just save my edits, but if I 
switch to Rete View I see the following:


!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.715
!MESSAGE Internal error in Drools Plugin:
!STACK 0
org.drools.rule.InvalidRulePackage: 
[EMAIL PROTECTED]

at org.drools.rule.Package.checkValidity(Package.java:408)
at 
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:288)
at org.drools.eclipse.editors.rete.ReteViewer.getRuleBase(Unknown 
Source)
at 
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)

at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) 



!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.715
!MESSAGE Internal error in Drools Plugin:
!STACK 0
java.lang.Exception: Unable to parse rules to show RETE view!
at 
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)

at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) 



!ENTRY org.drools.eclipse 4 120 2007-08-17 21:13:00.731
!MESSAGE Internal error in Drools Plugin:
!STACK 0
java.lang.reflect.InvocationTargetException
at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) 


Caused by: java.lang.Exception: Unable to parse rules to show RETE view!
at 
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)

... 2 more
Root exception:
java.lang.Exception: Unable to parse rules to show RETE view!
at 
org.drools.eclipse.editors.rete.ReteViewer.loadReteModel(Unknown Source)

at org.drools.eclipse.editors.DRLRuleEditor2$3.run(Unknown Source)
at 
org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) 


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users