[rules-users] How to use for loop in drools!!!!

2011-04-19 Thread Sumeet Karawal

Hello Everybody,

I am not getting, on how to do for loop functionality in drools.

Like for instance, my functionality has  :

for(i = 0; i10; i++)
{
   c.setCustomerCount(c.getCustomerCount() + 1);
}

How to translate this code into rule language (.drl).

It would be helpful if anybody could guide me on this.

Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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


Re: [rules-users] Dynamic updates of stateful sessions

2011-04-19 Thread Mattias Avelin
Hi!

Yes, I have already implemented a KnowledgeAgentEventListener acts on 
KnowledgeBaseUpdatedEvent and ResourceCompilationFailedEvent. I use this to 
update my knowledgebase reference in my class that wraps the KnowledgeBase and 
KnowledgeAgent. Below is the code for this class (DynamicDecisionService). I 
suspect that I have missed something vital since I'm actually not getting my 
knowledgebase to update itself either but I do it myself in the listener when 
I receive a KnowledgeBaseUpdatedEvent.

Here is the code that handles the KnowledgeAgent and KnowledgeBase (I have 
stripped out some labels and comments since this belongs to the client).

Best regards

Mattias Avelin

package com.x.service;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentConfiguration;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.conf.EventProcessingOption;
import org.drools.event.knowledgeagent.KnowledgeBaseUpdatedEvent;
import org.drools.event.knowledgeagent.ResourceCompilationFailedEvent;
import org.drools.event.rule.DefaultKnowledgeAgentEventListener;
import org.drools.io.ResourceChangeScannerConfiguration;
import org.drools.io.ResourceFactory;

/**
 * {@inheritDoc}
 * p
 * This implementation of DecisionService updates the knowledgebase dynamically
 * when the underlying rules (drl-files) are updated. Therefore each call to the
 * createSession() method will return a session based on the most resent version
 * of the rules (allowing for some lag due to the intervals of the
 * resource scanner).
 * /p
 * p
 * For statefull sessions the session needs to be updated manually when the
 * KnowledgeBase has been updated.
 * /P
 * @author Mattias Avelin - mattias.ave...@netlight.se
 */
public class DynamicDecisionService implements DecisionService
{
private static Logger LOG = Logger.getLogger(DynamicDecisionService.class);

// Repository of all the application's knowledge definitions
private KnowledgeBase kBase;
// The agent that monitores the rule files (resources) for changes
private KnowledgeAgent kAgent;
// Decision service type
private DecisionSessionType type;
// When the current knowledgebase was created
private long kbaseLastUpdated;

/**
 * Create a DynamicDecisionService using a ChangeSet.
 *
 * @param changeSet - The ChangeSet referencing the rule-files to use
 *for this service. Expects a classpath reference
 *
 * @throws IllegalArgumentException if changeSet is not a valid ChangeSet.
 */
public DynamicDecisionService(
String changeSet,
DecisionSessionType type)
{
this.kBase = createKnowledgeBase(type);
// the method could reference kBase itself but I thought it
// more more clear if I actually supply it in the method invocation
this.kAgent = createKnowledgeAgent(changeSet, this.kBase);
// This should not be neccesary according to all sources I've found
// but without re-assigning the reference it doesn't work!?!?
this.kBase = kAgent.getKnowledgeBase();
this.kbaseLastUpdated = System.currentTimeMillis();
}


/**
 * {@inheritDoc}
 */
public DecisionSession createSession ()
{
return new DecisionSession(kBase.newStatefulKnowledgeSession());
}


/**
 * {@inheritDoc}
 */
public DecisionSession updateSession (DecisionSession oldSession)
{
// Create a new session from the current KnowledgeBase
DecisionSession newSession =
new DecisionSession(kBase.newStatefulKnowledgeSession());

if(oldSession != null)
{
// Clean the old session of all stateless facts before update
oldSession.removeAllStatelessKnowledge();
// Copy all remaining facts to the new session
newSession.uploadKnowledge(new ArrayList(oldSession.getAllFacts()));
}
return newSession;
}


/**
 * {@inheritDoc}
 */
public boolean isSessionStale(DecisionSession decisionSession)
{
if(decisionSession.getCreationTime()  this.kbaseLastUpdated)
{
return true;
}
else
{
return false;
}
}


/**
 * Create a KnowledgeBuilder from a ChangeSet.
 *
 * @param changeSet - The ChangeSet
 * @return A KnowledgeBuilder
 * @throws IllegalArgumentException if changeSet is not a valid ChangeSet.
 */
private KnowledgeAgent createKnowledgeAgent(
String changeSet,
KnowledgeBase kbase)
{
// Configure KnowledgeAgentFactory
configureAgentFactory();
// 

[rules-users] Fw: Some Querries on Drools

2011-04-19 Thread Sumeet Karawal

Hi Everybody,

I had posted this earlier. It would be very greatful if anybody could help
me on these queries, any suggestions or any document that I can refer to.

Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com


   
  From:   Sumeet Karawal/MUM/TCS
   

   
  To: rules-users@lists.jboss.org   
   

   
  Date:   04/18/2011 06:58 PM   
   

   
  Subject:Some Querries on Drools   
   

   




Hello All,

I have some queries regarding use of drools as rule engine for my
Application. It would be very helpful if I get some guidance regarding
these:

1) I have an application in which a user logs in, and according to his
profile he is provided with some benefits, and rule engine check for the
eligibility criteria. But if hundreds of thousands of user will log in at
same time, then what will be the performance accordingly. Like, these
concurrent users hitting the server, and so many threads will be generated
and many number of rules will be fired in the session. Will this hamper the
performance of Rule Engine.

2) Suppose I have an application using drools. I create EAR / WAR file of
that application and deploy it on some other system. Would it be still
possible for me to change the rules on the fly. Or some dependencies might
have to be managed.

3) How can we manage sessions in drools? Suppose we are having different
stateful sessions in our application, but time consumption when we
fireAllRules() exceeds the expected time. So is there a mechanism to kill,
restart the session in drools. Could I get some help/document regarding
session Management on drools.


Thanks  Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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


Re: [rules-users] how to get a list of incomplete workitems after e.g server/process crash?

2011-04-19 Thread gs76pl
i tried to load the session from a store like below and then query it for
work items/nodes but it doesn't give me an access to e.g. workItem
parameters as this value is empty.

Is there any API that would provide this information or should i somehow
duplicate drools flow and try to use NodeListeners? I'm sure there must be
some way of querying crashed process where it was so it could be resumed
using workItem.complete api

StatefulKnowledgeSession session = kbase.loadStatefulKnowledgeSession()
for (NodeInstance n : ((WorkflowProcessInstance)
getKnowledgeSession().getProcessInstance(1)).getNodeInstances()){
WorkItem w = ((WorkItemNodeInstance)n).getWorkItem();
//w is null here so i don't have an access to its parameters
}

--
View this message in context: 
http://drools.46999.n3.nabble.com/how-to-get-a-list-of-incomplete-workitems-if-one-of-them-crashed-e-g-server-restart-tp2835230p2838237.html
Sent from the Drools: User forum 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] Problem in compiling each rule separately

2011-04-19 Thread saurabh maheshwari
Hi sir ,

I have 10 rules . rules are created dynamically .Now if any of them is
causing problem so none of them runs
so  I want to compile each rule separately , so that i can create knowledge
base  with rules which have no errors
but can i do this ?

I am not finding the way how i can do it . is it possible ?

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


[rules-users] Trying to compare int and String objects

2011-04-19 Thread Manuel Ortiz
Hello everybody:

I'm trying to write rules in which fact int attributes and fact String
attributes should be compared in condition elements. When I compare them,
let's say from int to String,

rule
 when
 Fact1($intAttr : attrInt1)
 Fact2(attrString == $intAttr)


the rule seems to behave OK, whereas when I compare them from String to int,

rule
 when
 Fact1($stringAttr : attrString1)
 Fact2(attrInt == $stringAttr)


I get a RuntimeDroolsException( Conversion to long not supported from
java.lang.String).

I've taken a look at the code which throws the exception,
BaseObjectClassField.getLongValue() and found that it only accepts Number
and Date objects to be converted to long.

...
if ( value instanceof Number ) {
return ((Number) value).longValue();
} else if ( value instanceof Date ) {
return ((Date) value).getTime();
}
...

Is it possible to add String to long conversion via Long.parseLong(str) or
is there any reason not to allow this conversion?.

Thank you again for your time.

Best regards,

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


Re: [rules-users] Dynamic updates of stateful sessions

2011-04-19 Thread Esteban Aliverti
There is no need to update your kbase in the listener. The agent will apply
all the changes to the provided kbase. If you already have a stateful
ksession from that kbase, then the changes in the kbase should be
reflected immediately.
Could you please post the log output of the kagent?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Apr 19, 2011 at 4:24 AM, Mattias Avelin
mattias.ave...@netlight.sewrote:

 Hi!

 Yes, I have already implemented a KnowledgeAgentEventListener acts on
 KnowledgeBaseUpdatedEvent and ResourceCompilationFailedEvent. I use this to
 update my knowledgebase reference in my class that wraps the KnowledgeBase
 and KnowledgeAgent. Below is the code for this class
 (DynamicDecisionService). I suspect that I have missed something vital
 since I'm actually not getting my knowledgebase to update itself either but
 I do it myself in the listener when I receive a KnowledgeBaseUpdatedEvent.

 Here is the code that handles the KnowledgeAgent and KnowledgeBase (I have
 stripped out some labels and comments since this belongs to the client).

 Best regards

 Mattias Avelin

 package com.x.service;

 import java.util.ArrayList;
 import org.apache.log4j.Logger;
 import org.drools.KnowledgeBase;
 import org.drools.KnowledgeBaseConfiguration;
 import org.drools.KnowledgeBaseFactory;
 import org.drools.agent.KnowledgeAgent;
 import org.drools.agent.KnowledgeAgentConfiguration;
 import org.drools.agent.KnowledgeAgentFactory;
 import org.drools.builder.KnowledgeBuilderError;
 import org.drools.builder.KnowledgeBuilderErrors;
 import org.drools.conf.EventProcessingOption;
 import org.drools.event.knowledgeagent.KnowledgeBaseUpdatedEvent;
 import org.drools.event.knowledgeagent.ResourceCompilationFailedEvent;
 import org.drools.event.rule.DefaultKnowledgeAgentEventListener;
 import org.drools.io.ResourceChangeScannerConfiguration;
 import org.drools.io.ResourceFactory;

 /**
  * {@inheritDoc}
  * p
  * This implementation of DecisionService updates the knowledgebase
 dynamically
  * when the underlying rules (drl-files) are updated. Therefore each call
 to the
  * createSession() method will return a session based on the most resent
 version
  * of the rules (allowing for some lag due to the intervals of the
  * resource scanner).
  * /p
  * p
  * For statefull sessions the session needs to be updated manually when
 the
  * KnowledgeBase has been updated.
  * /P
  * @author Mattias Avelin - mattias.ave...@netlight.se
  */
 public class DynamicDecisionService implements DecisionService
 {
private static Logger LOG =
 Logger.getLogger(DynamicDecisionService.class);

// Repository of all the application's knowledge definitions
private KnowledgeBase kBase;
// The agent that monitores the rule files (resources) for changes
private KnowledgeAgent kAgent;
// Decision service type
private DecisionSessionType type;
// When the current knowledgebase was created
private long kbaseLastUpdated;

/**
 * Create a DynamicDecisionService using a ChangeSet.
 *
 * @param changeSet - The ChangeSet referencing the rule-files to use
 *for this service. Expects a classpath reference
 *
 * @throws IllegalArgumentException if changeSet is not a valid
 ChangeSet.
 */
public DynamicDecisionService(
String changeSet,
DecisionSessionType type)
{
this.kBase = createKnowledgeBase(type);
// the method could reference kBase itself but I thought it
// more more clear if I actually supply it in the method
 invocation
this.kAgent = createKnowledgeAgent(changeSet, this.kBase);
// This should not be neccesary according to all sources I've found
// but without re-assigning the reference it doesn't work!?!?
this.kBase = kAgent.getKnowledgeBase();
this.kbaseLastUpdated = System.currentTimeMillis();
}


/**
 * {@inheritDoc}
 */
public DecisionSession createSession ()
{
return new DecisionSession(kBase.newStatefulKnowledgeSession());
}


/**
 * {@inheritDoc}
 */
public DecisionSession updateSession (DecisionSession oldSession)
{
// Create a new session from the current KnowledgeBase
DecisionSession newSession =
new DecisionSession(kBase.newStatefulKnowledgeSession());

if(oldSession != null)
{
// Clean the old session of all stateless facts before update
oldSession.removeAllStatelessKnowledge();
// Copy all remaining facts to the new session
newSession.uploadKnowledge(new
 ArrayList(oldSession.getAllFacts()));
}
return newSession;
}


/**
 * {@inheritDoc}
 */
public boolean isSessionStale(DecisionSession decisionSession)
{

Re: [rules-users] Fw: Some Querries on Drools

2011-04-19 Thread Randhish Raghavan
Hi,

I am quite new to drools but I will try to answer your questions.

I don't think Drools will cause your application to crash if you ensure
1. You develop rules that will not result in infinite loops.
2. Dispose sessions if you are using Stateful sessions.

Basically, you would want to create the Knowledge base once i.e. during 
application startup. You will create a new Session (not an expensive operation) 
for every request. In this scenario it will be better to use stateless sessions 
as you do not have to worry about disposing them.

However, if you want to use statefull sessions, you might want to write a set 
of wrapper classes that provide api's to manage the statefull session and 
execute rules. Developers will only be allowed to access api's that execute 
rules and will not have access to api's that create and dispose a session.

To you next question on making changes to rules,

You have to create a KnowledgeAgent that checks if the rule resource has been 
modified at configured intervals. The rule resource (drl,pkg etc) can exist on 
the file system or you want to try to configure rules in guvnor. Guvnor is a 
GUI tool that allows you to manage rules.

Regards,
Randhish

-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Sumeet Karawal
Sent: Tuesday, April 19, 2011 2:53 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Fw: Some Querries on Drools


Hi Everybody,

I had posted this earlier. It would be very greatful if anybody could help
me on these queries, any suggestions or any document that I can refer to.

Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com


  From:   Sumeet Karawal/MUM/TCS

  To: rules-users@lists.jboss.org

  Date:   04/18/2011 06:58 PM

  Subject:Some Querries on Drools





Hello All,

I have some queries regarding use of drools as rule engine for my
Application. It would be very helpful if I get some guidance regarding
these:

1) I have an application in which a user logs in, and according to his
profile he is provided with some benefits, and rule engine check for the
eligibility criteria. But if hundreds of thousands of user will log in at
same time, then what will be the performance accordingly. Like, these
concurrent users hitting the server, and so many threads will be generated
and many number of rules will be fired in the session. Will this hamper the
performance of Rule Engine.

2) Suppose I have an application using drools. I create EAR / WAR file of
that application and deploy it on some other system. Would it be still
possible for me to change the rules on the fly. Or some dependencies might
have to be managed.

3) How can we manage sessions in drools? Suppose we are having different
stateful sessions in our application, but time consumption when we
fireAllRules() exceeds the expected time. So is there a mechanism to kill,
restart the session in drools. Could I get some help/document regarding
session Management on drools.


Thanks  Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



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



http://www.mindtree.com/email/disclaimer.html

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


[rules-users] Drools-Guvnor – question about build and deploy packages

2011-04-19 Thread Patricia Bogoevici

I am using Drools-Guvnor 5.1 release in
an enterprise application. The rules created are separated per
packages, and for each package there is a snapshot package called
LATEST. The KnowledgeAgent polls the snapshot packages
to get the latest data and load into the rule engine. Whenever there is a new 
rule, or
updates to an existing one, the application triggers the process of
re-creating the package snapshot: builds all the rules within the
package, and creates a new snapshot for the package.



The main problem with this approach is
that the time to build the package rules, increases quite a lot as
the number if rules gets higher. This creates a serious performance
hit in the real-time app whenever there is a change to the rules.



I sneaked a bit to the source code, and
noticed that when build package is called, Guvnor builds a new binary for all 
the rules within a
package even though not all of them are modified. Would it be possible to 
incrementally create/update the package binary? This would speed up
things a lot when the package has lots of rules but only one rule
changes at the time.



What is the best approach for creating
the package snapshots? The approach we've taken is to build all the
rules within a package into one snapshot, and we ran into this performance 
issue. 




Any ideas/suggestions is much
appreciated.



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


Re: [rules-users] Drools-Guvnor ­ question about build and deploy packages

2011-04-19 Thread David Faulkner
Patricia,

My understanding (which is certainly open to being corrected) is that in 
general there is no way to do an incremental compilation of rules. The entire 
package is analyzed together and significant optimizations are performed to 
combine common items between rules (which is one of the big reasons why the 
engine executes so well!). So, generally, what you are doing is the best 
practice.

When you say that you are experiencing a performance hit, are you talking about 
a delay in seeing the updates appear in your production application, or 
something else? Generally, the compilation is a one-time step, and even during 
compilation your enterprise application that is actually using the rules should 
continue to perform quite reasonably, since the compilation is going on in a 
separate application.

David

From: Patricia Bogoevici 
patriciabogoev...@yahoo.commailto:patriciabogoev...@yahoo.com
Reply-To: Rules Users List 
rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org
Date: Tue, 19 Apr 2011 10:45:59 -0500
To: Rules Users List 
rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org
Subject: [rules-users] Drools-Guvnor – question about build and deploy packages



I am using Drools-Guvnor 5.1 release in an enterprise application. The rules 
created are separated per packages, and for each package there is a snapshot 
package called LATEST. The KnowledgeAgent polls the snapshot packages to get 
the latest data and load into the rule engine. Whenever there is a new rule, or 
updates to an existing one, the application triggers the process of re-creating 
the package snapshot: builds all the rules within the package, and creates a 
new snapshot for the package.


The main problem with this approach is that the time to build the package 
rules, increases quite a lot as the number if rules gets higher. This creates a 
serious performance hit in the real-time app whenever there is a change to the 
rules.


I sneaked a bit to the source code, and noticed that when build package is 
called, Guvnor builds a new binary for all the rules within a package even 
though not all of them are modified. Would it be possible to incrementally 
create/update the package binary? This would speed up things a lot when the 
package has lots of rules but only one rule changes at the time.


What is the best approach for creating the package snapshots? The approach 
we've taken is to build all the rules within a package into one snapshot, and 
we ran into this performance issue.


Any ideas/suggestions is much appreciated.


Thanks,

Patricia

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


Re: [rules-users] How to use for loop in drools!!!!

2011-04-19 Thread Sumeet Karawal
Thanks Esteban!!. I got you point. But how to make the rule to run
according to a condition, in a loop.

Also, how can we trigger the firing of one rule from another rule. Like
when the Condition part of a rule satisfies then, in the Action part a
particular rule is triggered and after that the control resumes to the
previous rule, just as we do in nested if else statement.


Thanks  Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com




   
  From:   Esteban Aliverti esteban.alive...@gmail.com 
   

   
  To: Rules Users List rules-users@lists.jboss.org
   

   
  Date:   04/19/2011 05:41 PM   
   

   
  Subject:Re: [rules-users] How to use for loop in drools   
   

   
  Sent by:rules-users-boun...@lists.jboss.org   
   

   





Drools is an inference engine and it let you express your knowledge using
rules.
A rule has 2 parts: CONDITION par and ACTION part.
The CONDITION part is expressed in a drools' proprietary syntax, but in the
ACTION part you can use plain java code.
What you have described looks like an action that needs to be executed when
certain constraints are meet.
So, in your case, you can just write those lines in you action part. They
should work fine.

I recommend you to read the documentation:
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html


Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Tue, Apr 19, 2011 at 3:13 AM, Sumeet Karawal sumeet.kara...@tcs.com
wrote:
  for(i = 0; i10; i++)
  {
    c.setCustomerCount(c.getCustomerCount() + 1);
  }
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




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


Re: [rules-users] Fw: Some Querries on Drools

2011-04-19 Thread Sumeet Karawal


Thanks a lot Randhish!!!

Stateful sessions will have to be disposed. But what if the sessions are
taking too long, same with the case of stateless sessions, then what to do
in that case.

Also in the multi- threaded environment, if I have 10 - 100 Ks of threads,
will the rule engines performance be still better.

Thanks  Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com



   
  From:   Randhish Raghavan randhish_ragha...@mindtree.com
   

   
  To: Rules Users List rules-users@lists.jboss.org
   

   
  Date:   04/19/2011 08:51 PM   
   

   
  Subject:Re: [rules-users] Fw: Some Querries on Drools 
   

   
  Sent by:rules-users-boun...@lists.jboss.org   
   

   





Hi,

I am quite new to drools but I will try to answer your questions.

I don't think Drools will cause your application to crash if you ensure
1. You develop rules that will not result in infinite loops.
2. Dispose sessions if you are using Stateful sessions.

Basically, you would want to create the Knowledge base once i.e. during
application startup. You will create a new Session (not an expensive
operation) for every request. In this scenario it will be better to use
stateless sessions as you do not have to worry about disposing them.

However, if you want to use statefull sessions, you might want to write a
set of wrapper classes that provide api's to manage the statefull session
and execute rules. Developers will only be allowed to access api's that
execute rules and will not have access to api's that create and dispose a
session.

To you next question on making changes to rules,

You have to create a KnowledgeAgent that checks if the rule resource has
been modified at configured intervals. The rule resource (drl,pkg etc) can
exist on the file system or you want to try to configure rules in guvnor.
Guvnor is a GUI tool that allows you to manage rules.

Regards,
Randhish

-Original Message-
From: rules-users-boun...@lists.jboss.org [
mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Sumeet Karawal
Sent: Tuesday, April 19, 2011 2:53 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Fw: Some Querries on Drools


Hi Everybody,

I had posted this earlier. It would be very greatful if anybody could help
me on these queries, any suggestions or any document that I can refer to.

Thanks and Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com


  From:   Sumeet Karawal/MUM/TCS

  To: rules-users@lists.jboss.org

  Date:   04/18/2011 06:58 PM

  Subject:Some Querries on Drools





Hello All,

I have some queries regarding use of drools as rule engine for my
Application. It would be very helpful if I get some guidance regarding
these:

1) I have an application in which a user logs in, and according to his
profile he is provided with some benefits, and rule engine check for the
eligibility criteria. But if hundreds of thousands of user will log in at
same time, then what will be the performance accordingly. Like, these
concurrent users hitting the server, and so many threads will be generated
and many number of rules will be fired in the session. Will this hamper the
performance of Rule Engine.

2) Suppose I have an application using drools. I create EAR / WAR file of
that application and deploy it on some other system. Would it be still
possible for me to change the rules on the fly. Or some dependencies might
have to be managed.

3) How can we manage sessions in drools? Suppose we are having different
stateful sessions in our application, but time consumption when we
fireAllRules() exceeds the expected time. So is there a mechanism to kill,
restart the session in drools. Could I get some help/document regarding
session Management on drools.


Thanks  Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the 

Re: [rules-users] How to use for loop in drools!!!!

2011-04-19 Thread Tihomir Surdilovic
Hi Samarat, as Esteban suggested, please read the documentation as for 
example your question is answered there very early on in chapter 2.2.1. 
Methods versus Rules.

Tihomir

On 4/19/11 12:06 PM, Sumeet Karawal wrote:
 Thanks Esteban!!. I got you point. But how to make the rule to run
 according to a condition, in a loop.

 Also, how can we trigger the firing of one rule from another rule. Like
 when the Condition part of a rule satisfies then, in the Action part a
 particular rule is triggered and after that the control resumes to the
 previous rule, just as we do in nested if else statement.


 Thanks  Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com




From:   Esteban Alivertiesteban.alive...@gmail.com

To: Rules Users Listrules-users@lists.jboss.org

Date:   04/19/2011 05:41 PM

Subject:Re: [rules-users] How to use for loop in drools

Sent by:rules-users-boun...@lists.jboss.org






 Drools is an inference engine and it let you express your knowledge using
 rules.
 A rule has 2 parts: CONDITION par and ACTION part.
 The CONDITION part is expressed in a drools' proprietary syntax, but in the
 ACTION part you can use plain java code.
 What you have described looks like an action that needs to be executed when
 certain constraints are meet.
 So, in your case, you can just write those lines in you action part. They
 should work fine.

 I recommend you to read the documentation:
 http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html


 Best Regards,

 

 Esteban Aliverti
 - Developer @ http://www.plugtree.com
 - Blog @ http://ilesteban.wordpress.com


 On Tue, Apr 19, 2011 at 3:13 AM, Sumeet Karawalsumeet.kara...@tcs.com
 wrote:
for(i = 0; i10; i++)
{
  c.setCustomerCount(c.getCustomerCount() + 1);
}
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you




 ___
 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] How to use for loop in drools!!!!

2011-04-19 Thread Tihomir Surdilovic
Sorry about the name typo in my previous reply Sumeet.

On 4/19/11 12:14 PM, Tihomir Surdilovic wrote:
 Hi Samarat, as Esteban suggested, please read the documentation as for
 example your question is answered there very early on in chapter 2.2.1.
 Methods versus Rules.

 Tihomir

 On 4/19/11 12:06 PM, Sumeet Karawal wrote:
 Thanks Esteban!!. I got you point. But how to make the rule to run
 according to a condition, in a loop.

 Also, how can we trigger the firing of one rule from another rule. Like
 when the Condition part of a rule satisfies then, in the Action part a
 particular rule is triggered and after that the control resumes to the
 previous rule, just as we do in nested if else statement.


 Thanks   Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com




 From:   Esteban Alivertiesteban.alive...@gmail.com

 To: Rules Users Listrules-users@lists.jboss.org

 Date:   04/19/2011 05:41 PM

 Subject:Re: [rules-users] How to use for loop in drools

 Sent by:rules-users-boun...@lists.jboss.org






 Drools is an inference engine and it let you express your knowledge using
 rules.
 A rule has 2 parts: CONDITION par and ACTION part.
 The CONDITION part is expressed in a drools' proprietary syntax, but in the
 ACTION part you can use plain java code.
 What you have described looks like an action that needs to be executed when
 certain constraints are meet.
 So, in your case, you can just write those lines in you action part. They
 should work fine.

 I recommend you to read the documentation:
 http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html


 Best Regards,

 

 Esteban Aliverti
 - Developer @ http://www.plugtree.com
 - Blog @ http://ilesteban.wordpress.com


 On Tue, Apr 19, 2011 at 3:13 AM, Sumeet Karawalsumeet.kara...@tcs.com
 wrote:
 for(i = 0; i10; i++)
 {
   c.setCustomerCount(c.getCustomerCount() + 1);
 }
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you




 ___
 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] Drools-Guvnor ­ question about build and deploy packages

2011-04-19 Thread Patricia Bogoevici
Thanks David for your reply.
To clarify: the performance problem is specifically related to the build 
package. This task takes longer as the package has more and more rules. The 
build package process is complex, and performs also rule validation. That's why 
I asked if there is a way to incrementally update the package binary.
The app I am working on, we streamlined the process of creating a new rule, 
including building and deploying a new snapshot package to propagate the 
changes quick. Because the build task takes longer (as the package has more and 
more rules), it is a problem for the end user, as it feels that nothing happens 
for a while when saves a rule.
Once the new snapshot package is created, the KnowledgeAgent propagates the 
updates into the app without problems.
So, coming back to the build package task: what is the best strategy to create 
snapshot packages, so that the build time does not take a long time when there 
are lots of rules in the package? 
One possible solution I see, is to create a snapshot package for each rule 
within a package, using a custom selector. I haven't tried it, but this 
approach will keep the build time short. However, it doesn't seem natural to me 
to have so many snapshot packages...
thanks,Patricia 


--- On Tue, 4/19/11, David Faulkner david.faulk...@amentra.com wrote:

From: David Faulkner david.faulk...@amentra.com
Subject: Re: [rules-users] Drools-Guvnor ­ question about build and deploy 
packages
To: Rules Users List rules-users@lists.jboss.org
Date: Tuesday, April 19, 2011, 11:51 AM


Patricia,
My understanding (which is certainly open to being corrected) is that in 
general there is no way to do an incremental compilation of rules. The entire 
package is analyzed together and significant optimizations are performed to 
combine common items between rules (which is one of the big reasons why the 
engine executes so well!). So, generally, what you are doing is the best 
practice. 
When you say that you are experiencing a performance hit, are you talking about 
a delay in seeing the updates appear in your production application, or 
something else? Generally, the compilation is a one-time step, and even during 
compilation your enterprise application that is actually using the rules should 
continue to perform quite reasonably, since the compilation is going on in a 
separate application. 
David
From:  Patricia Bogoevici patriciabogoev...@yahoo.com
Reply-To:  Rules Users List rules-users@lists.jboss.org
Date:  Tue, 19 Apr 2011 10:45:59 -0500
To:  Rules Users List rules-users@lists.jboss.org
Subject:  [rules-users] Drools-Guvnor – question about build and deploy packages


I am using Drools-Guvnor 5.1 release in
an enterprise application. The rules created are separated per
packages, and for each package there is a snapshot package called
LATEST. The KnowledgeAgent polls the snapshot packages
to get the latest data and load into the rule engine. Whenever there is a new 
rule, or
updates to an existing one, the application triggers the process of
re-creating the package snapshot: builds all the rules within the
package, and creates a new snapshot for the package.
The main problem with this approach is
that the time to build the package rules, increases quite a lot as
the number if rules gets higher. This creates a serious performance
hit in the real-time app whenever there is a change to the rules.
I sneaked a bit to the source code, and
noticed that when build package is called, Guvnor builds a new binary for all 
the rules within a
package even though not all of them are modified. Would it be possible to 
incrementally create/update the package binary? This would speed up
things a lot when the package has lots of rules but only one rule
changes at the time.
What is the best approach for creating
the package snapshots? The approach we've taken is to build all the
rules within a package into one snapshot, and we ran into this performance 
issue. 

Any ideas/suggestions is much
appreciated.
Thanks,Patricia 

-Inline Attachment Follows-

___
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] How to use for loop in drools!!!!

2011-04-19 Thread rouvas
Sumeet Karawal wrote:
 Thanks Esteban!!. I got you point. But how to make the rule to run
 according to a condition, in a loop.

 Also, how can we trigger the firing of one rule from another rule. Like
 when the Condition part of a rule satisfies then, in the Action part a
 particular rule is triggered and after that the control resumes to the
 previous rule, just as we do in nested if else statement.

You're thinking procedural. You won't go far this way.
Rules based engined require a different way of approaching problems.
Familiarize yourself with these differences and you will find out that in
most cases you do not need loops or nested conditions.
The keyword here is predicate logic.

-Stathis



 Thanks  Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com




   From:   Esteban Aliverti esteban.alive...@gmail.com

   To: Rules Users List rules-users@lists.jboss.org

   Date:   04/19/2011 05:41 PM

   Subject:Re: [rules-users] How to use for loop in drools

   Sent by:rules-users-boun...@lists.jboss.org






 Drools is an inference engine and it let you express your knowledge using
 rules.
 A rule has 2 parts: CONDITION par and ACTION part.
 The CONDITION part is expressed in a drools' proprietary syntax, but in
 the
 ACTION part you can use plain java code.
 What you have described looks like an action that needs to be executed
 when
 certain constraints are meet.
 So, in your case, you can just write those lines in you action part. They
 should work fine.

 I recommend you to read the documentation:
 http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html


 Best Regards,

 

 Esteban Aliverti
 - Developer @ http://www.plugtree.com
 - Blog @ http://ilesteban.wordpress.com


 On Tue, Apr 19, 2011 at 3:13 AM, Sumeet Karawal sumeet.kara...@tcs.com
 wrote:
   for(i = 0; i10; i++)
   {
     c.setCustomerCount(c.getCustomerCount() + 1);
   }
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you




 ___
 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] Dynamic updates of stateful sessions

2011-04-19 Thread Wolfgang Laun
I have recently looked into Knowledge Agent and I don't think that this will
update the
Knowledge Base of an existing Stateful Knowledge Session.

For a Stateful KS you do a kAgent.getKnowledgeBase() to get the new KBase
and start a new KS from it.

For a Stateless KS that has been created with
kAgent.newStatelessKnowledgeSession(), the KBase is updated automatically
and the next kSession.execute() will reflect the new KBase.

If this is not correct, I'd appreciate pointers where it is documented
otherwise.

I haven't tested this exhaustively, but what I did test did not contradict
the above.

-W



2011/4/19 Esteban Aliverti esteban.alive...@gmail.com

 There is no need to update your kbase in the listener. The agent will apply
 all the changes to the provided kbase. If you already have a stateful
 ksession from that kbase, then the changes in the kbase should be
 reflected immediately.
 Could you please post the log output of the kagent?

 Best Regards,

 

 Esteban Aliverti
 - Developer @ http://www.plugtree.com
 - Blog @ http://ilesteban.wordpress.com


 On Tue, Apr 19, 2011 at 4:24 AM, Mattias Avelin 
 mattias.ave...@netlight.se wrote:

 Hi!

 Yes, I have already implemented a KnowledgeAgentEventListener acts on
 KnowledgeBaseUpdatedEvent and ResourceCompilationFailedEvent. I use this to
 update my knowledgebase reference in my class that wraps the KnowledgeBase
 and KnowledgeAgent. Below is the code for this class
 (DynamicDecisionService). I suspect that I have missed something vital
 since I'm actually not getting my knowledgebase to update itself either but
 I do it myself in the listener when I receive a KnowledgeBaseUpdatedEvent.

 Here is the code that handles the KnowledgeAgent and KnowledgeBase (I have
 stripped out some labels and comments since this belongs to the client).

 Best regards

 Mattias Avelin

 package com.x.service;

 import java.util.ArrayList;
 import org.apache.log4j.Logger;
 import org.drools.KnowledgeBase;
 import org.drools.KnowledgeBaseConfiguration;
 import org.drools.KnowledgeBaseFactory;
 import org.drools.agent.KnowledgeAgent;
 import org.drools.agent.KnowledgeAgentConfiguration;
 import org.drools.agent.KnowledgeAgentFactory;
 import org.drools.builder.KnowledgeBuilderError;
 import org.drools.builder.KnowledgeBuilderErrors;
 import org.drools.conf.EventProcessingOption;
 import org.drools.event.knowledgeagent.KnowledgeBaseUpdatedEvent;
 import org.drools.event.knowledgeagent.ResourceCompilationFailedEvent;
 import org.drools.event.rule.DefaultKnowledgeAgentEventListener;
 import org.drools.io.ResourceChangeScannerConfiguration;
 import org.drools.io.ResourceFactory;

 /**
  * {@inheritDoc}
  * p
  * This implementation of DecisionService updates the knowledgebase
 dynamically
  * when the underlying rules (drl-files) are updated. Therefore each call
 to the
  * createSession() method will return a session based on the most resent
 version
  * of the rules (allowing for some lag due to the intervals of the
  * resource scanner).
  * /p
  * p
  * For statefull sessions the session needs to be updated manually when
 the
  * KnowledgeBase has been updated.
  * /P
  * @author Mattias Avelin - mattias.ave...@netlight.se
  */
 public class DynamicDecisionService implements DecisionService
 {
private static Logger LOG =
 Logger.getLogger(DynamicDecisionService.class);

// Repository of all the application's knowledge definitions
private KnowledgeBase kBase;
// The agent that monitores the rule files (resources) for changes
private KnowledgeAgent kAgent;
// Decision service type
private DecisionSessionType type;
// When the current knowledgebase was created
private long kbaseLastUpdated;

/**
 * Create a DynamicDecisionService using a ChangeSet.
 *
 * @param changeSet - The ChangeSet referencing the rule-files to use
 *for this service. Expects a classpath reference
 *
 * @throws IllegalArgumentException if changeSet is not a valid
 ChangeSet.
 */
public DynamicDecisionService(
String changeSet,
DecisionSessionType type)
{
this.kBase = createKnowledgeBase(type);
// the method could reference kBase itself but I thought it
// more more clear if I actually supply it in the method
 invocation
this.kAgent = createKnowledgeAgent(changeSet, this.kBase);
// This should not be neccesary according to all sources I've found
// but without re-assigning the reference it doesn't work!?!?
this.kBase = kAgent.getKnowledgeBase();
this.kbaseLastUpdated = System.currentTimeMillis();
}


/**
 * {@inheritDoc}
 */
public DecisionSession createSession ()
{
return new DecisionSession(kBase.newStatefulKnowledgeSession());
}


/**
 * {@inheritDoc}
 */
public DecisionSession updateSession (DecisionSession oldSession)
{
  

Re: [rules-users] Fw: Some Querries on Drools

2011-04-19 Thread Wolfgang Laun
100K concurrent threads tends to be a problem, with or without Drools. There
are
several strategies for limiting this, but this is not a Drools topic.

Hint 1: You can limit connects on sockets.
Hint 2: Java thread pool, a design pattern.

-W



On 19 April 2011 18:13, Sumeet Karawal sumeet.kara...@tcs.com wrote:



 Thanks a lot Randhish!!!

 Stateful sessions will have to be disposed. But what if the sessions are
 taking too long, same with the case of stateless sessions, then what to do
 in that case.

 Also in the multi- threaded environment, if I have 10 - 100 Ks of threads,
 will the rule engines performance be still better.

 Thanks  Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com



   From:   Randhish Raghavan randhish_ragha...@mindtree.com

  To: Rules Users List rules-users@lists.jboss.org

  Date:   04/19/2011 08:51 PM

  Subject:Re: [rules-users] Fw: Some Querries on Drools

  Sent by:rules-users-boun...@lists.jboss.org






 Hi,

 I am quite new to drools but I will try to answer your questions.

 I don't think Drools will cause your application to crash if you ensure
 1. You develop rules that will not result in infinite loops.
 2. Dispose sessions if you are using Stateful sessions.

 Basically, you would want to create the Knowledge base once i.e. during
 application startup. You will create a new Session (not an expensive
 operation) for every request. In this scenario it will be better to use
 stateless sessions as you do not have to worry about disposing them.

 However, if you want to use statefull sessions, you might want to write a
 set of wrapper classes that provide api's to manage the statefull session
 and execute rules. Developers will only be allowed to access api's that
 execute rules and will not have access to api's that create and dispose a
 session.

 To you next question on making changes to rules,

 You have to create a KnowledgeAgent that checks if the rule resource has
 been modified at configured intervals. The rule resource (drl,pkg etc) can
 exist on the file system or you want to try to configure rules in guvnor.
 Guvnor is a GUI tool that allows you to manage rules.

 Regards,
 Randhish

 -Original Message-
 From: rules-users-boun...@lists.jboss.org [
 mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Sumeet Karawal
 Sent: Tuesday, April 19, 2011 2:53 PM
 To: rules-users@lists.jboss.org
 Subject: [rules-users] Fw: Some Querries on Drools


 Hi Everybody,

 I had posted this earlier. It would be very greatful if anybody could help
 me on these queries, any suggestions or any document that I can refer to.

 Thanks and Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com


  From:   Sumeet Karawal/MUM/TCS

  To: rules-users@lists.jboss.org

  Date:   04/18/2011 06:58 PM

  Subject:Some Querries on Drools





 Hello All,

 I have some queries regarding use of drools as rule engine for my
 Application. It would be very helpful if I get some guidance regarding
 these:

 1) I have an application in which a user logs in, and according to his
 profile he is provided with some benefits, and rule engine check for the
 eligibility criteria. But if hundreds of thousands of user will log in at
 same time, then what will be the performance accordingly. Like, these
 concurrent users hitting the server, and so many threads will be generated
 and many number of rules will be fired in the session. Will this hamper the
 performance of Rule Engine.

 2) Suppose I have an application using drools. I create EAR / WAR file of
 that application and deploy it on some other system. Would it be still
 possible for me to change the rules on the fly. Or some dependencies might
 have to be managed.

 3) How can we manage sessions in drools? Suppose we are having different
 stateful sessions in our application, but time consumption when we
 fireAllRules() exceeds the expected time. So is there a mechanism to kill,
 restart the session in drools. Could I get some help/document regarding
 session Management on drools.


 Thanks  Regards,
 Sumeet Karawal
 Mailto: sumeet.kara...@tcs.com

 =-=-=
 Notice: The information contained in this e-mail
 message and/or attachments to it may contain
 confidential or privileged information. If you are
 not the intended recipient, any dissemination, use,
 review, distribution, printing or copying of the
 information contained in this e-mail message
 and/or attachments to it are strictly prohibited. If
 you have received this communication in error,
 please notify us by reply e-mail or telephone and
 immediately and permanently delete the message
 and any attachments. Thank you



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

 

 http://www.mindtree.com/email/disclaimer.html

 ___
 

[rules-users] Sequential mode and partial propagations

2011-04-19 Thread Vincent LEGENDRE
Hi All 

This post is to continue an interresting (to me) discussion started there : 
https://issues.jboss.org/browse/JBRULES-46 

This was about my remark about a backward-chaining mode that could be used to 
allow sequential mode to handle some kind of RETE updates (first rules could 
then trigger subsequent rules). 

There are some number of answers after that, but I am not sure if I can answer 
them in the JIRA, so this post ... 


To Mark : 
Currently our sequential mode works as single pass, but it has no inference as 
rete join memory is turned off. So it produces all the conflict set more 
efficiently, and then it uses rule order for the execution order of the 
conflict set. However changes in the current rule are not recognised by the 
later rules. That is planned though by partinioning the sequential engine 
around the modify statements. The advantage to this is we keep a single 
algorithm that is just configured slightly to provide different behaviours. 
Rather than two competely different engines. 

I think this is a very good solution, far much better (more efficient and far 
more clear to predict how rules will fire) than handling propagation for each 
individual rule's update. But I did not understand if it is already done in 
trunk in some way, or if it is something planned for future. And if so, the 
question after that is do you have an idea of when this could be done ? ... or 
if is quite affordable for someone not involved directly in drools 
developement? (like me for instance, as you speak of  sligth configuration ). 


To Michael : 
You propose some new rules, by binding the something field in condition 
rather than calling getSomething() in action (and you change the object to 
which is applied the update, which is an error I think). 
To me that changes nothing, the rule will loop as one of its binded value is 
changed ($value, and now $something..). And a no-loop property won't change 
this too ... 


To summarize a bit, the use-case I present in the JIRA (create counters, fill 
them, validate them) could really take advantage (perfs, simplicity in 
authoring/design) of a sequential mode that could handle a partial inference 
(driven by a flow for instance, which seems quite natural for everyone (dev or 
BA)). 

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


Re: [rules-users] Sequential mode and partial propagations

2011-04-19 Thread Mark Proctor

On 19/04/2011 18:58, Vincent LEGENDRE wrote:

Hi All

First : sorry for the misplaced reply to another thread

This post is to continue an interresting (to me) discussion started 
there : https://issues.jboss.org/browse/JBRULES-46
This was about my remark about a backward-chaining mode that could be 
used to allow sequential mode to handle some kind of RETE updates 
(first rules could then trigger subsequent rules).


There are some number of answers after that, but I am not sure if I 
can answer them in the JIRA, so this post ...



*To Mark :*
/Currently our sequential mode works as single pass, but it has no 
inference as rete join memory is turned off. So it produces all the 
conflict set more efficiently, and then it uses rule order for the 
execution order of the conflict set. However changes in the current 
rule are not recognised by the later rules. That is planned though by 
partinioning the sequential engine around the modify statements. The 
advantage to this is we keep a single algorithm that is just 
configured slightly to provide different behaviours. Rather than two 
competely different engines./


I think this is a very good solution, far much better (more efficient 
and far more clear to predict how rules will fire) than handling 
propagation for each individual rule's update. But I did not 
understand if it is already done in trunk in some way, or if it is 
something planned for future. And if so, the question after that is do 
you have an idea of when this could be done ? ... or if is quite 
affordable for someone not involved directly in drools developement? 
(like me for instance, as you speak of sligth configuration).
Sequential mode as in that text above is done. What is not done is the 
modify partitioning such that  later constraints see the updated values 
in the single pass - similar to what other products do. there are 
advantages and disadvantages to modify partitioning, but it's good to 
allow the user to have both :)



To Michael :
You propose some new rules, by binding the something field in 
condition rather than calling getSomething() in action (and you change 
the object to which is applied the update, which is an error I think).
To me that changes nothing, the rule will loop as one of its binded 
value is changed ($value, and now $something..). And a no-loop 
property won't change this too ...



To summarize a bit, the use-case I present in the JIRA (create 
counters, fill them, validate them) could really take advantage 
(perfs, simplicity in authoring/design) of a sequential mode that 
could handle a partial inference (driven by a flow for instance, which 
seems quite natural for everyone (dev or BA)).



___
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] First Order Logic - METHODS in Drools

2011-04-19 Thread Arjun Dhar
According to First order Logic, (from a rule perspective), one can represent
their statements using:
PREDICATES, METHODS, CONNECTORS (including existential quantifiers)

..while PREDICATES can be synonymous with Object and Object expressions; the
only way of using methods  has been via eval (AFAIK, as per my outdated
knowledge); and this is discouraged for the fact that evals perhaps dont fit
in the RETE-OO scheme of things.
Please note: By methods I dont bean Bean getter/setters; but work horse
service layer methods.

..however, to be true to FOL, using methods directly should be supported.
Q1) If it is, can one show or state an example? 
Q2) If not, for METHODS that return a specific type of Object, cant they be
useful in RETE-OO evaluation?
Q3) I've used from for DAO's , conceptually does from address this
fully? In FOL (imo) PREDICATES  METHODS can be exchanged freely, not sure
if from gives that freedom.

thanks




--
View this message in context: 
http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2841531p2841531.html
Sent from the Drools: User forum 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] Encrypt password in repository.xml

2011-04-19 Thread Boban Abraham
We use mysql to store the data, hence mysql db credentials are mentioned in
repository.xml

The DB user password in repository.xml is not encrypted currently.

What are the options available to place encrypted password in
repository.xml?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Encrypt-password-in-repository-xml-tp2841654p2841654.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users