Re: [rules-users] agenda-groups

2012-05-07 Thread Vincent LEGENDRE
It reminds me some discussion here about rule base partitionning ...

I am not part of dev team, but I am quite sure that agenda-group (as for 
ruleflow groups) behaves just like any other agenda filter.
All candidates rules are added to the agenda (so yes, taking all facts in 
account, ie evaluate the whole RETE network), but only some (those with the 
current group) can be executed.

The big difference with a basic agenda filter is relative to "which is the next 
current group" method :
  - agenda-group : once the agenda has no more rules of this group, the current 
group is popped thus the previous current group become the new current one (if 
stack is empty, go back to MAIN group)
  - ruleflow-group : once the agenda has no more rules of this group, the 
ruleflow is used to set the next current group



- Mail original -
De: "gboro54" 
À: rules-users@lists.jboss.org
Envoyé: Lundi 7 Mai 2012 15:30:48
Objet: [rules-users] agenda-groups

If you specify agenda-groups on rules, then in the rule set have rules which
will set focus onto that agenda-group does the group of rules only use the
facts which cause the group to be pushed to the stack or does it evaluate
all objects in working memory? 

--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] agenda-groups

2012-05-07 Thread gboro54
This is what I figured. I am having an issue where I have a catch all
retraction rule setup as the lowest salience. I see activations created for
the facts but they are never fired.  Any thoughts on why this may happen?
The session is run on a separate thread with fireAllRules called every 1/2
second. I have tried syncronizing inserts on the session so that thread
would not be in the middle of firing when new facts come in but that does
not seem to do anything


Vincent Legendre wrote
> 
> It reminds me some discussion here about rule base partitionning ...
> 
> I am not part of dev team, but I am quite sure that agenda-group (as for
> ruleflow groups) behaves just like any other agenda filter.
> All candidates rules are added to the agenda (so yes, taking all facts in
> account, ie evaluate the whole RETE network), but only some (those with
> the current group) can be executed.
> 
> The big difference with a basic agenda filter is relative to "which is the
> next current group" method :
>   - agenda-group : once the agenda has no more rules of this group, the
> current group is popped thus the previous current group become the new
> current one (if stack is empty, go back to MAIN group)
>   - ruleflow-group : once the agenda has no more rules of this group, the
> ruleflow is used to set the next current group
> 
> 
> 
> - Mail original -
> De: "gboro54" 
> À: rules-users@.jboss
> Envoyé: Lundi 7 Mai 2012 15:30:48
> Objet: [rules-users] agenda-groups
> 
> If you specify agenda-groups on rules, then in the rule set have rules
> which
> will set focus onto that agenda-group does the group of rules only use the
> facts which cause the group to be pushed to the stack or does it evaluate
> all objects in working memory? 
> 
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3968650.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


Re: [rules-users] agenda-groups

2012-05-07 Thread Vincent LEGENDRE
> I am having an issue where I have a catch all
> retraction rule setup as the lowest salience.

Not sure to understand that (note that I am not english native ...)

> I see activations created for the facts but they are never fired.  Any 
> thoughts on why this may happen?

Send some rules. Activations never fired is just too vague to have a single 
answer.
If you use agenda groups, may be that the group is simply not on focus ... 
Add a first rule that set the focus, or set auto-focus for all your "low 
salience" rules, or don't set agenda group for them (their group will be the 
MAIN group).

> The session is run on a separate thread with fireAllRules called every 1/2
> second. I have tried syncronizing inserts on the session so that thread
> would not be in the middle of firing when new facts come in but that does
> not seem to do anything

Why not using fireUntilHalt instead ?
Run your session.fireUntilHalt in a separate thread, and insert things in that 
session. 
insert (or update or retract) will wake up the session.

Of course, one day, you have to call halt() on your session to get out.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
I am not currently using agenda-groups. I believe my issue right now is one
of thread safety. A little background: I currently have a thread pulling
messages from a database running on the main thread. In several other
threads, I have drools session being fired every so often. It appears that
there may be a some type of deadlock caused by invoking fireAllRules on one
thread, while another is trying to insert. I am working through right now to
debug the issue. Has anyone else experienced this issue?


Vincent Legendre wrote
> 
>> I am having an issue where I have a catch all
>> retraction rule setup as the lowest salience.
> 
> Not sure to understand that (note that I am not english native ...)
> 
>> I see activations created for the facts but they are never fired.  Any
>> thoughts on why this may happen?
> 
> Send some rules. Activations never fired is just too vague to have a
> single answer.
> If you use agenda groups, may be that the group is simply not on focus ... 
> Add a first rule that set the focus, or set auto-focus for all your "low
> salience" rules, or don't set agenda group for them (their group will be
> the MAIN group).
> 
>> The session is run on a separate thread with fireAllRules called every
>> 1/2
>> second. I have tried syncronizing inserts on the session so that thread
>> would not be in the middle of firing when new facts come in but that does
>> not seem to do anything
> 
> Why not using fireUntilHalt instead ?
> Run your session.fireUntilHalt in a separate thread, and insert things in
> that session. 
> insert (or update or retract) will wake up the session.
> 
> Of course, one day, you have to call halt() on your session to get out.
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.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


Re: [rules-users] agenda-groups

2012-05-08 Thread Wolfgang Laun
Periodically calling fireAllRules() in a thread running parallel to the one(s)
doing insertions doesn't make sense to me.

-W

On 08/05/2012, gboro54  wrote:
> I am not currently using agenda-groups. I believe my issue right now is one
> of thread safety. A little background: I currently have a thread pulling
> messages from a database running on the main thread. In several other
> threads, I have drools session being fired every so often. It appears that
> there may be a some type of deadlock caused by invoking fireAllRules on one
> thread, while another is trying to insert. I am working through right now
> to
> debug the issue. Has anyone else experienced this issue?
>
>
> Vincent Legendre wrote
>>
>>> I am having an issue where I have a catch all
>>> retraction rule setup as the lowest salience.
>>
>> Not sure to understand that (note that I am not english native ...)
>>
>>> I see activations created for the facts but they are never fired.  Any
>>> thoughts on why this may happen?
>>
>> Send some rules. Activations never fired is just too vague to have a
>> single answer.
>> If you use agenda groups, may be that the group is simply not on focus ...
>>
>> Add a first rule that set the focus, or set auto-focus for all your "low
>> salience" rules, or don't set agenda group for them (their group will be
>> the MAIN group).
>>
>>> The session is run on a separate thread with fireAllRules called every
>>> 1/2
>>> second. I have tried syncronizing inserts on the session so that thread
>>> would not be in the middle of firing when new facts come in but that
>>> does
>>> not seem to do anything
>>
>> Why not using fireUntilHalt instead ?
>> Run your session.fireUntilHalt in a separate thread, and insert things in
>> that session.
>> insert (or update or retract) will wake up the session.
>>
>> Of course, one day, you have to call halt() on your session to get out.
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
What do you recommend?  firUntilHalt seems to get locked out after
sometime... I am running out of ideas and have posted this question before.
I believe we talked about periodically using fireAllRules on a separate
thread.


laune wrote
> 
> Periodically calling fireAllRules() in a thread running parallel to the
> one(s)
> doing insertions doesn't make sense to me.
> 
> -W
> 
> On 08/05/2012, gboro54  wrote:
>> I am not currently using agenda-groups. I believe my issue right now is
>> one
>> of thread safety. A little background: I currently have a thread pulling
>> messages from a database running on the main thread. In several other
>> threads, I have drools session being fired every so often. It appears
>> that
>> there may be a some type of deadlock caused by invoking fireAllRules on
>> one
>> thread, while another is trying to insert. I am working through right now
>> to
>> debug the issue. Has anyone else experienced this issue?
>>
>>
>> Vincent Legendre wrote
>>>
 I am having an issue where I have a catch all
 retraction rule setup as the lowest salience.
>>>
>>> Not sure to understand that (note that I am not english native ...)
>>>
 I see activations created for the facts but they are never fired.  Any
 thoughts on why this may happen?
>>>
>>> Send some rules. Activations never fired is just too vague to have a
>>> single answer.
>>> If you use agenda groups, may be that the group is simply not on focus
>>> ...
>>>
>>> Add a first rule that set the focus, or set auto-focus for all your "low
>>> salience" rules, or don't set agenda group for them (their group will be
>>> the MAIN group).
>>>
 The session is run on a separate thread with fireAllRules called every
 1/2
 second. I have tried syncronizing inserts on the session so that thread
 would not be in the middle of firing when new facts come in but that
 does
 not seem to do anything
>>>
>>> Why not using fireUntilHalt instead ?
>>> Run your session.fireUntilHalt in a separate thread, and insert things
>>> in
>>> that session.
>>> insert (or update or retract) will wake up the session.
>>>
>>> Of course, one day, you have to call halt() on your session to get out.
>>> ___
>>> rules-users mailing list
>>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971245.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


Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
Here is the code I am using to manage the running session(switched to
fireUntilHalt()). This seems to lockup after sometime. Any thoughts why?



import org.apache.log4j.Logger;
import org.drools.audit.WorkingMemoryFileLogger;
import org.drools.runtime.ObjectFilter;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.FactHandle;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;

/**
 * *Description:* RuleRunner is responsible for managing a drools session
 * running on another thread. The thread will allow insertion of facts and
 * global during it's execution.
 * 
 * @author Michael Weiss
 * 
 */
public class RuleRunner implements Runnable {

private static final Logger logger = Logger.getLogger(RuleRunner.class);

private StatefulKnowledgeSession session;

private WorkingMemoryFileLogger sessionLogger;

private boolean running;

private ImmutableList filters;

private String runningThreadName;

/**
 * *Description: * Construct a RuleRunner object with the given drools
 * stateful session
 * 
 * @param session
 *- The {@link org.drools.runtime.StatefulKnowledgeSession
 *StatefulKnowledgeSession} to be managed by the RuleRunner.
All
 *facts will be passed into this session for drools 
evaluation
 */
public RuleRunner(StatefulKnowledgeSession session) {
this.session = session;
this.running = false;
}

/**
 * *Description: * Construct a RuleRunner object with the given drools
 * stateful session
 * 
 * @param session
 *- The {@link org.drools.runtime.StatefulKnowledgeSession
 *StatefulKnowledgeSession} to be managed by the RuleRunner.
All
 *facts will be passed into this session for drools 
evaluation
 * 
 * @param filters
 *- An immutable list of {@link 
org.drools.runtime.ObjectFilter
 *object filters} which will be used to determine if the
session
 *is still processing.
 * 
 */
public RuleRunner(StatefulKnowledgeSession session,
ImmutableList filters) {
this.session = session;
this.filters = filters;
this.running = false;

}

/*
 * (non-Javadoc)
 * 
 * @see java.lang.Runnable#run()
 */
@Override
public void run() {
this.runningThreadName = Thread.currentThread().getName();
if (logger.isDebugEnabled()) {
logger.debug("Rule Runner has been kicked off on "
+ this.runningThreadName);
}
running = true;
while (running) {
session.fireUntilHalt();
}
logger.info("Disposing session");
session.halt();
if (sessionLogger != null) {
sessionLogger.writeToDisk();
sessionLogger = null;
}
this.session.dispose();

}

/**
 * *Description: * Insert's or update's the object based on weather the
 * object already exists in the currently active drools session.
 * 
 * @param fact
 *- The object to be inserted or updated.
 */
public synchronized void insertOrUpdate(Object fact) {
insert(fact);
}

private synchronized void insert(Object fact) {
if (!running) {
logger.warn("Inserting objects into non-running rules 
session");
}
Preconditions.checkNotNull(fact);
FactHandle factHandle = this.session.getFactHandle(fact);
if (factHandle == null) {
this.session.insert(fact);
} else {
this.session.update(factHandle, fact);
}
}

/**
 * *Description: * Add a global object with the given id to the drools
 * session. It is important to note that globals should not be used for 
an
 * object which needs to be evaluation by the drools session each time 
it
is
 * modified. A global placed in the drools session will not cause the 
rule
 * session to reevaluate. However globals are a great way to keep track 
of
 * information that may be needed to be retrieved from the running 
session.
 * 
 * @param identifier
 *- The identifier of the global as defined in the rules
 * @param value
 *- The global object
 */

Re: [rules-users] agenda-groups

2012-05-08 Thread Wolfgang Laun
What about executing insert(s) followed by fireAllRules() in one thread?
-W

On 08/05/2012, gboro54  wrote:
> What do you recommend?  firUntilHalt seems to get locked out after
> sometime... I am running out of ideas and have posted this question before.
> I believe we talked about periodically using fireAllRules on a separate
> thread.
>
>
> laune wrote
>>
>> Periodically calling fireAllRules() in a thread running parallel to the
>> one(s)
>> doing insertions doesn't make sense to me.
>>
>> -W
>>
>> On 08/05/2012, gboro54  wrote:
>>> I am not currently using agenda-groups. I believe my issue right now is
>>> one
>>> of thread safety. A little background: I currently have a thread pulling
>>> messages from a database running on the main thread. In several other
>>> threads, I have drools session being fired every so often. It appears
>>> that
>>> there may be a some type of deadlock caused by invoking fireAllRules on
>>> one
>>> thread, while another is trying to insert. I am working through right
>>> now
>>> to
>>> debug the issue. Has anyone else experienced this issue?
>>>
>>>
>>> Vincent Legendre wrote

> I am having an issue where I have a catch all
> retraction rule setup as the lowest salience.

 Not sure to understand that (note that I am not english native ...)

> I see activations created for the facts but they are never fired.  Any
> thoughts on why this may happen?

 Send some rules. Activations never fired is just too vague to have a
 single answer.
 If you use agenda groups, may be that the group is simply not on focus
 ...

 Add a first rule that set the focus, or set auto-focus for all your
 "low
 salience" rules, or don't set agenda group for them (their group will
 be
 the MAIN group).

> The session is run on a separate thread with fireAllRules called every
> 1/2
> second. I have tried syncronizing inserts on the session so that
> thread
> would not be in the middle of firing when new facts come in but that
> does
> not seem to do anything

 Why not using fireUntilHalt instead ?
 Run your session.fireUntilHalt in a separate thread, and insert things
 in
 that session.
 insert (or update or retract) will wake up the session.

 Of course, one day, you have to call halt() on your session to get out.
 ___
 rules-users mailing list
 rules-users@.jboss
 https://lists.jboss.org/mailman/listinfo/rules-users

>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971245.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
The point is to be able to stream a large volume of messages into the rule
session without tying up that thread. In addition I don't want there to be
millions of messages in a session at a given point, thus the point of
executing the rules on a different thread while inserting facts from
another. 


laune wrote
> 
> What about executing insert(s) followed by fireAllRules() in one thread?
> -W
> 
> On 08/05/2012, gboro54  wrote:
>> What do you recommend?  firUntilHalt seems to get locked out after
>> sometime... I am running out of ideas and have posted this question
>> before.
>> I believe we talked about periodically using fireAllRules on a separate
>> thread.
>>
>>
>> laune wrote
>>>
>>> Periodically calling fireAllRules() in a thread running parallel to the
>>> one(s)
>>> doing insertions doesn't make sense to me.
>>>
>>> -W
>>>
>>> On 08/05/2012, gboro54  wrote:
 I am not currently using agenda-groups. I believe my issue right now is
 one
 of thread safety. A little background: I currently have a thread
 pulling
 messages from a database running on the main thread. In several other
 threads, I have drools session being fired every so often. It appears
 that
 there may be a some type of deadlock caused by invoking fireAllRules on
 one
 thread, while another is trying to insert. I am working through right
 now
 to
 debug the issue. Has anyone else experienced this issue?


 Vincent Legendre wrote
>
>> I am having an issue where I have a catch all
>> retraction rule setup as the lowest salience.
>
> Not sure to understand that (note that I am not english native ...)
>
>> I see activations created for the facts but they are never fired. 
>> Any
>> thoughts on why this may happen?
>
> Send some rules. Activations never fired is just too vague to have a
> single answer.
> If you use agenda groups, may be that the group is simply not on focus
> ...
>
> Add a first rule that set the focus, or set auto-focus for all your
> "low
> salience" rules, or don't set agenda group for them (their group will
> be
> the MAIN group).
>
>> The session is run on a separate thread with fireAllRules called
>> every
>> 1/2
>> second. I have tried syncronizing inserts on the session so that
>> thread
>> would not be in the middle of firing when new facts come in but that
>> does
>> not seem to do anything
>
> Why not using fireUntilHalt instead ?
> Run your session.fireUntilHalt in a separate thread, and insert things
> in
> that session.
> insert (or update or retract) will wake up the session.
>
> Of course, one day, you have to call halt() on your session to get
> out.
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
>


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

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


--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971305.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


Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
Perhaps a blocking queue which has facts put on from other threads, the
thread then inserts x number of facts and fires the rule set?


gboro54 wrote
> 
> The point is to be able to stream a large volume of messages into the rule
> session without tying up that thread. In addition I don't want there to be
> millions of messages in a session at a given point, thus the point of
> executing the rules on a different thread while inserting facts from
> another. 
> 
> 
> laune wrote
>> 
>> What about executing insert(s) followed by fireAllRules() in one thread?
>> -W
>> 
>> On 08/05/2012, gboro54  wrote:
>>> What do you recommend?  firUntilHalt seems to get locked out after
>>> sometime... I am running out of ideas and have posted this question
>>> before.
>>> I believe we talked about periodically using fireAllRules on a separate
>>> thread.
>>>
>>>
>>> laune wrote

 Periodically calling fireAllRules() in a thread running parallel to the
 one(s)
 doing insertions doesn't make sense to me.

 -W

 On 08/05/2012, gboro54  wrote:
> I am not currently using agenda-groups. I believe my issue right now
> is
> one
> of thread safety. A little background: I currently have a thread
> pulling
> messages from a database running on the main thread. In several other
> threads, I have drools session being fired every so often. It appears
> that
> there may be a some type of deadlock caused by invoking fireAllRules
> on
> one
> thread, while another is trying to insert. I am working through right
> now
> to
> debug the issue. Has anyone else experienced this issue?
>
>
> Vincent Legendre wrote
>>
>>> I am having an issue where I have a catch all
>>> retraction rule setup as the lowest salience.
>>
>> Not sure to understand that (note that I am not english native ...)
>>
>>> I see activations created for the facts but they are never fired. 
>>> Any
>>> thoughts on why this may happen?
>>
>> Send some rules. Activations never fired is just too vague to have a
>> single answer.
>> If you use agenda groups, may be that the group is simply not on
>> focus
>> ...
>>
>> Add a first rule that set the focus, or set auto-focus for all your
>> "low
>> salience" rules, or don't set agenda group for them (their group will
>> be
>> the MAIN group).
>>
>>> The session is run on a separate thread with fireAllRules called
>>> every
>>> 1/2
>>> second. I have tried syncronizing inserts on the session so that
>>> thread
>>> would not be in the middle of firing when new facts come in but that
>>> does
>>> not seem to do anything
>>
>> Why not using fireUntilHalt instead ?
>> Run your session.fireUntilHalt in a separate thread, and insert
>> things
>> in
>> that session.
>> insert (or update or retract) will wake up the session.
>>
>> Of course, one day, you have to call halt() on your session to get
>> out.
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
>
 ___
 rules-users mailing list
 rules-users@.jboss
 https://lists.jboss.org/mailman/listinfo/rules-users

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


--
View this message in context: 
http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971415.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


Re: [rules-users] agenda-groups

2012-05-08 Thread Wolfgang Laun
On 8 May 2012 16:04, gboro54  wrote:

> Perhaps a blocking queue which has facts put on from other threads, the
> thread then inserts x number of facts and fires the rule set?
>

Yes, I'd say that's more like it.

If these zillions of facts aren't related, they can be processed by
disjoint sessions. So,
if you want to feed more than one CPU, run several sessions like that.

It might be desirable to have small batches of facts inserted and processed
by a single
call. You should know whether there is a way to do that...

-W


>
> gboro54 wrote
> >
> > The point is to be able to stream a large volume of messages into the
> rule
> > session without tying up that thread. In addition I don't want there to
> be
> > millions of messages in a session at a given point, thus the point of
> > executing the rules on a different thread while inserting facts from
> > another.
> >
> >
> > laune wrote
> >>
> >> What about executing insert(s) followed by fireAllRules() in one thread?
> >> -W
> >>
> >> On 08/05/2012, gboro54  wrote:
> >>> What do you recommend?  firUntilHalt seems to get locked out after
> >>> sometime... I am running out of ideas and have posted this question
> >>> before.
> >>> I believe we talked about periodically using fireAllRules on a separate
> >>> thread.
> >>>
> >>>
> >>> laune wrote
> 
>  Periodically calling fireAllRules() in a thread running parallel to
> the
>  one(s)
>  doing insertions doesn't make sense to me.
> 
>  -W
> 
>  On 08/05/2012, gboro54  wrote:
> > I am not currently using agenda-groups. I believe my issue right now
> > is
> > one
> > of thread safety. A little background: I currently have a thread
> > pulling
> > messages from a database running on the main thread. In several other
> > threads, I have drools session being fired every so often. It appears
> > that
> > there may be a some type of deadlock caused by invoking fireAllRules
> > on
> > one
> > thread, while another is trying to insert. I am working through right
> > now
> > to
> > debug the issue. Has anyone else experienced this issue?
> >
> >
> > Vincent Legendre wrote
> >>
> >>> I am having an issue where I have a catch all
> >>> retraction rule setup as the lowest salience.
> >>
> >> Not sure to understand that (note that I am not english native ...)
> >>
> >>> I see activations created for the facts but they are never fired.
> >>> Any
> >>> thoughts on why this may happen?
> >>
> >> Send some rules. Activations never fired is just too vague to have a
> >> single answer.
> >> If you use agenda groups, may be that the group is simply not on
> >> focus
> >> ...
> >>
> >> Add a first rule that set the focus, or set auto-focus for all your
> >> "low
> >> salience" rules, or don't set agenda group for them (their group
> will
> >> be
> >> the MAIN group).
> >>
> >>> The session is run on a separate thread with fireAllRules called
> >>> every
> >>> 1/2
> >>> second. I have tried syncronizing inserts on the session so that
> >>> thread
> >>> would not be in the middle of firing when new facts come in but
> that
> >>> does
> >>> not seem to do anything
> >>
> >> Why not using fireUntilHalt instead ?
> >> Run your session.fireUntilHalt in a separate thread, and insert
> >> things
> >> in
> >> that session.
> >> insert (or update or retract) will wake up the session.
> >>
> >> Of course, one day, you have to call halt() on your session to get
> >> out.
> >> ___
> >> rules-users mailing list
> >> rules-users@.jboss
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> > --
> > View this message in context:
> >
> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > ___
> > rules-users mailing list
> > rules-users@.jboss
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>  ___
>  rules-users mailing list
>  rules-users@.jboss
>  https://lists.jboss.org/mailman/listinfo/rules-users
> 
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971245.html
> >>> Sent from the Drools: User forum mailing list archive at Nabble.com.
> >>> ___
> >>> rules-users mailing list
> >>> rules-users@.jboss
> >>> https://lists.jboss.org/mailman/listinfo/rules-users
> >>>
> >> ___
> >> rules-users mailing list
> >> rules-users@.jboss
> >> https://lists.jboss.org/mailman/listinfo/r

Re: [rules-users] agenda-groups

2012-05-08 Thread gboro54
Thanks! I am working out the details now on getting this running(having some
issues with the queue which is not related to drools)...Thanks!


laune wrote
> 
> On 8 May 2012 16:04, gboro54  wrote:
> 
>> Perhaps a blocking queue which has facts put on from other threads, the
>> thread then inserts x number of facts and fires the rule set?
>>
> 
> Yes, I'd say that's more like it.
> 
> If these zillions of facts aren't related, they can be processed by
> disjoint sessions. So,
> if you want to feed more than one CPU, run several sessions like that.
> 
> It might be desirable to have small batches of facts inserted and
> processed
> by a single
> call. You should know whether there is a way to do that...
> 
> -W
> 
> 
>>
>> gboro54 wrote
>> >
>> > The point is to be able to stream a large volume of messages into the
>> rule
>> > session without tying up that thread. In addition I don't want there to
>> be
>> > millions of messages in a session at a given point, thus the point of
>> > executing the rules on a different thread while inserting facts from
>> > another.
>> >
>> >
>> > laune wrote
>> >>
>> >> What about executing insert(s) followed by fireAllRules() in one
>> thread?
>> >> -W
>> >>
>> >> On 08/05/2012, gboro54  wrote:
>> >>> What do you recommend?  firUntilHalt seems to get locked out after
>> >>> sometime... I am running out of ideas and have posted this question
>> >>> before.
>> >>> I believe we talked about periodically using fireAllRules on a
>> separate
>> >>> thread.
>> >>>
>> >>>
>> >>> laune wrote
>> 
>>  Periodically calling fireAllRules() in a thread running parallel to
>> the
>>  one(s)
>>  doing insertions doesn't make sense to me.
>> 
>>  -W
>> 
>>  On 08/05/2012, gboro54  wrote:
>> > I am not currently using agenda-groups. I believe my issue right
>> now
>> > is
>> > one
>> > of thread safety. A little background: I currently have a thread
>> > pulling
>> > messages from a database running on the main thread. In several
>> other
>> > threads, I have drools session being fired every so often. It
>> appears
>> > that
>> > there may be a some type of deadlock caused by invoking
>> fireAllRules
>> > on
>> > one
>> > thread, while another is trying to insert. I am working through
>> right
>> > now
>> > to
>> > debug the issue. Has anyone else experienced this issue?
>> >
>> >
>> > Vincent Legendre wrote
>> >>
>> >>> I am having an issue where I have a catch all
>> >>> retraction rule setup as the lowest salience.
>> >>
>> >> Not sure to understand that (note that I am not english native
>> ...)
>> >>
>> >>> I see activations created for the facts but they are never fired.
>> >>> Any
>> >>> thoughts on why this may happen?
>> >>
>> >> Send some rules. Activations never fired is just too vague to have
>> a
>> >> single answer.
>> >> If you use agenda groups, may be that the group is simply not on
>> >> focus
>> >> ...
>> >>
>> >> Add a first rule that set the focus, or set auto-focus for all
>> your
>> >> "low
>> >> salience" rules, or don't set agenda group for them (their group
>> will
>> >> be
>> >> the MAIN group).
>> >>
>> >>> The session is run on a separate thread with fireAllRules called
>> >>> every
>> >>> 1/2
>> >>> second. I have tried syncronizing inserts on the session so that
>> >>> thread
>> >>> would not be in the middle of firing when new facts come in but
>> that
>> >>> does
>> >>> not seem to do anything
>> >>
>> >> Why not using fireUntilHalt instead ?
>> >> Run your session.fireUntilHalt in a separate thread, and insert
>> >> things
>> >> in
>> >> that session.
>> >> insert (or update or retract) will wake up the session.
>> >>
>> >> Of course, one day, you have to call halt() on your session to get
>> >> out.
>> >> ___
>> >> rules-users mailing list
>> >> rules-users@.jboss
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >
>> >
>> > --
>> > View this message in context:
>> >
>> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971147.html
>> > Sent from the Drools: User forum mailing list archive at
>> Nabble.com.
>> > ___
>> > rules-users mailing list
>> > rules-users@.jboss
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>>  ___
>>  rules-users mailing list
>>  rules-users@.jboss
>>  https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://drools.46999.n3.nabble.com/agenda-groups-tp3968541p3971245.html
>> >>> Sent from the Drools: User forum m

Re: [rules-users] Agenda Groups basic question

2009-11-02 Thread Edson Tirelli
   You need to set the focus for an agenda group to execute.

   []s
   Edson

2009/11/2 Rongala, Kanthi 

>  Hi,
>
>
>
> I am new to Drools and trying my hands out at Drools 5. I cann’t figure out
> how to use agenda- groups. I have a small drl file with two agenda groups
> and one rule per agenda-group. This doesn’t seem to work. However if I
> happen to comment out the agenda-group attribute, the results are as
> expected.
>
>
>
> Please let me know what I am missing.
>
>
>
> *package* com.mscibarra.examples.drools.controllers;
>
>
>
> *import* com.mscibarra.examples.drools.domainentities.*;
>
>
>
>
>
> *rule* "Detect and Remove Duplicate Shelves"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
>   $universe : LibraryUniverse()
>
>   $shelf : Shelf() *from* $universe.shelves
>
>   $shelf2 : Shelf(*this* != $shelf) *from*$universe.shelves
>
> *then*
>
>   System.out.println("Duplicate Shelves found::"+$shelf);
>
>   // without the modify(), drools is not alerted about changes
>
>   // $universe.shelves.remove($shelf);
>
>   /*
>
>   *modify*($universe) {
>
> shelves.remove($shelf);
>
>   };
>
>   */
>
>
>
> *end*
>
>
>
> *rule* "Singleton Shelf Detector"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
>   $universe : LibraryUniverse(shelves.size > 1)
>
> *then*
>
>   System.out.println("Multiple Shelves found::"+$universe.shelves.size);
>
>
> *End*
>
>
>
>
>
>
>
> With Regards,
>
> Kanthi Swaroop Rongala
>
> * *
>
>
>
> --
> NOTICE: If received in error, please destroy and notify sender. Sender does
> not intend to waive confidentiality or privilege. Use of this email is
> prohibited when received in error.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Agenda Groups basic question

2009-11-02 Thread Costigliola Joel (EXT)
Hello,

Maybe a typo mistake but both of your rules have the same agenda group (Phase1)

Regards,

Joel

De : rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] De la part de Rongala, Kanthi
Envoyé : lundi 2 novembre 2009 15:54
À : rules-users@lists.jboss.org
Objet : [rules-users] Agenda Groups basic question

Hi,

I am new to Drools and trying my hands out at Drools 5. I cann't figure out how 
to use agenda- groups. I have a small drl file with two agenda groups and one 
rule per agenda-group. This doesn't seem to work. However if I happen to 
comment out the agenda-group attribute, the results are as expected.

Please let me know what I am missing.

package com.mscibarra.examples.drools.controllers;

import com.mscibarra.examples.drools.domainentities.*;


rule "Detect and Remove Duplicate Shelves"
agenda-group "Phase1"
lock-on-active
dialect "mvel"
when
  $universe : LibraryUniverse()
  $shelf : Shelf() from $universe.shelves
  $shelf2 : Shelf(this != $shelf) from $universe.shelves
then
  System.out.println("Duplicate Shelves found::"+$shelf);
  // without the modify(), drools is not alerted about changes
  // $universe.shelves.remove($shelf);
  /*
  modify($universe) {
shelves.remove($shelf);
  };
  */

end

rule "Singleton Shelf Detector"
agenda-group "Phase1"
lock-on-active
dialect "mvel"
when
  $universe : LibraryUniverse(shelves.size > 1)
then
  System.out.println("Multiple Shelves found::"+$universe.shelves.size);
End



With Regards,
Kanthi Swaroop Rongala




NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error. 



 
Ce courriel et toutes les pièces jointes sont confidentiels et peuvent être 
couverts par un privilège ou une protection légale. Il est établi à l'attention 
exclusive de ses destinataires. Toute utilisation de ce courriel non conforme à 
sa destination, toute diffusion ou toute publication, totale ou partielle, est 
interdite, sauf autorisation expresse préalable. Toutes opinions exprimées dans 
ce courriel ne sauraient nécessairement refléter celle de Natixis, de ses 
filiales. Elles sont aussi susceptibles de modification sans notification 
préalable. Si vous recevez ce courriel par erreur, merci de le détruire et d'en 
avertir immédiatement l'expéditeur. L'Internet ne permettant pas d'assurer 
l'intégrité de ce courriel, Natixis décline toute responsabilité s'il a été 
altéré, déformé ou falsifié et chaque destinataire qui utilise ce mode de 
communication est supposé en accepter les risques.
 
This email and any attachment are confidential and may be legally privileged or 
otherwise protected from disclosure. It is intended only for the stated 
addressee(s) and access to it by any other person(s) is unauthorised. Any use, 
dissemination or disclosure not in accordance with its purpose, either in whole 
or in part, is prohibited without our prior formal approval. Any opinion 
expressed in this email may not necessarily reflect the opinion of Natixis, its 
affiliates. It may also be subject to change without prior notice. If you are 
not an addressee, you must not disclose, copy, circulate or in any other way 
use or rely on the information contained in this email. If you have received it 
in error, please inform us immediately and delete all copies. The Internet can 
not guarantee the integrity of this email therefore Natixis shall not be liable 
for the email if altered, changed or falsified and anyone who communicates with 
us by e-mail is taken to accept these risks.

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


Re: [rules-users] Agenda Groups basic question

2009-11-02 Thread Rongala, Kanthi
Hi,

As suggested, I made the following changes, to get the desired output. I have 
some questions regarding the approach to agenda-groups (in drools 5 context)

1. I had to enable auto-focus once per each agenda-group. I thought 
agenda-groups were stacked internally by drools engine, and auto-focus might be 
acting as a directional mechanism (help determine which rule under which agenda 
is to be triggered). Clearly, I am mistaken and it seems that auto-focus is the 
way to go.

I would like to know about other ways to set focus on agenda-groups. I have 
seem code snippets on google bearing session.setFocus("[agenda-group-name]"). I 
am currently using statefulsession and cann't figure out this 'setFocus()' 
method

2. I was 'compelled' to comment out lock-on-active directive. I understand that 
lock-on-active is an variant of no-loop causing each fact to be passed to the 
rule only once in a active agenda (correct me if I am mistaken). With 
lock-on-active set, I was expecting the messages to be print once atleast, but 
the current behavior beats me.

Code is given below:

package com.mscibarra.examples.drools.controllers;

import com.mscibarra.examples.drools.domainentities.*;

rule "Detect and Remove Duplicate Shelves"
agenda-group "Phase1"
//lock-on-active
dialect "mvel"
auto-focus
when
$universe : LibraryUniverse()
$shelf : Shelf() from $universe.shelves
$shelf2 : Shelf(this != $shelf) from $universe.shelves
then
System.out.println("Duplicate Shelves found::"+$shelf);
// without the modify(), drools is not alerted about changes
/*
modify($universe) {
shelves.remove($shelf);
};
*/
end

rule "Singleton Shelf Detector"
agenda-group "Phase2"
//lock-on-active
dialect "mvel"
auto-focus
when
$universe : LibraryUniverse(shelves.size > 1)
then
System.out.println("Multiple Shelves found::"+$universe.shelves.size);
end



With Regards,
Swaroop

-
---------------------

Message: 3
Date: Mon, 2 Nov 2009 10:51:32 -0500
From: Edson Tirelli 
Subject: Re: [rules-users] Agenda Groups basic question
To: Rules Users List 
Message-ID:

Content-Type: text/plain; charset="windows-1252"

   You need to set the focus for an agenda group to execute.

   []s
   Edson

2009/11/2 Rongala, Kanthi 

>  Hi,
>
>
>
> I am new to Drools and trying my hands out at Drools 5. I cann?t figure out
> how to use agenda- groups. I have a small drl file with two agenda groups
> and one rule per agenda-group. This doesn?t seem to work. However if I
> happen to comment out the agenda-group attribute, the results are as
> expected.
>
>
>
> Please let me know what I am missing.
>
>
>
> *package* com.mscibarra.examples.drools.controllers;
>
>
>
> *import* com.mscibarra.examples.drools.domainentities.*;
>
>
>
>
>
> *rule* "Detect and Remove Duplicate Shelves"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
>   $universe : LibraryUniverse()
>
>   $shelf : Shelf() *from* $universe.shelves
>
>   $shelf2 : Shelf(*this* != $shelf) *from*$universe.shelves
>
> *then*
>
>   System.out.println("Duplicate Shelves found::"+$shelf);
>
>   // without the modify(), drools is not alerted about changes
>
>   // $universe.shelves.remove($shelf);
>
>   /*
>
>   *modify*($universe) {
>
> shelves.remove($shelf);
>
>   };
>
>   */
>
>
>
> *end*
>
>
>
> *rule* "Singleton Shelf Detector"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
>   $universe : LibraryUniverse(shelves.size > 1)
>
> *then*
>
>   System.out.println("Multiple Shelves found::"+$universe.shelves.size);
>
>
> *End*
>
>
>
>
>
>
>
> With Regards,
>
> Kanthi Swaroop Rongala
>
> * *
>
>
>
> --
> NOTICE: If received in error, please destroy and notify sender. Sender does
> not intend to waive confidentiality or privilege. Use of this email is
> prohibited when received in error.
>
> ___________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-- next part 

Re: [rules-users] Agenda Groups basic question

2009-11-03 Thread Edson Tirelli
   session.getAgenda().getAgendaGroup("Phase1").setFocus();

   auto-focus automatically sets the focus when the rule is activated, but
that might not be what you want...

   Edson

2009/11/3 Rongala, Kanthi 

> Hi,
>
> As suggested, I made the following changes, to get the desired output. I
> have some questions regarding the approach to agenda-groups (in drools 5
> context)
>
> 1. I had to enable auto-focus once per each agenda-group. I thought
> agenda-groups were stacked internally by drools engine, and auto-focus might
> be acting as a directional mechanism (help determine which rule under which
> agenda is to be triggered). Clearly, I am mistaken and it seems that
> auto-focus is the way to go.
>
> I would like to know about other ways to set focus on agenda-groups. I have
> seem code snippets on google bearing
> session.setFocus("[agenda-group-name]"). I am currently using
> statefulsession and cann't figure out this 'setFocus()' method
>
> 2. I was 'compelled' to comment out lock-on-active directive. I understand
> that lock-on-active is an variant of no-loop causing each fact to be passed
> to the rule only once in a active agenda (correct me if I am mistaken). With
> lock-on-active set, I was expecting the messages to be print once atleast,
> but the current behavior beats me.
>
> Code is given below:
>
> package com.mscibarra.examples.drools.controllers;
>
> import com.mscibarra.examples.drools.domainentities.*;
>
> rule "Detect and Remove Duplicate Shelves"
> agenda-group "Phase1"
> //lock-on-active
> dialect "mvel"
> auto-focus
> when
>$universe : LibraryUniverse()
>$shelf : Shelf() from $universe.shelves
>$shelf2 : Shelf(this != $shelf) from $universe.shelves
> then
>System.out.println("Duplicate Shelves found::"+$shelf);
>// without the modify(), drools is not alerted about changes
> /*
> modify($universe) {
>shelves.remove($shelf);
>};
>*/
> end
>
> rule "Singleton Shelf Detector"
> agenda-group "Phase2"
> //lock-on-active
> dialect "mvel"
> auto-focus
> when
>$universe : LibraryUniverse(shelves.size > 1)
> then
>System.out.println("Multiple Shelves
> found::"+$universe.shelves.size);
> end
>
>
>
> With Regards,
> Swaroop
>
>
> -
>
> -
>
> Message: 3
> Date: Mon, 2 Nov 2009 10:51:32 -0500
> From: Edson Tirelli 
> Subject: Re: [rules-users] Agenda Groups basic question
> To: Rules Users List 
> Message-ID:
>
> Content-Type: text/plain; charset="windows-1252"
>
>   You need to set the focus for an agenda group to execute.
>
>   []s
>   Edson
>
> 2009/11/2 Rongala, Kanthi 
>
> >  Hi,
> >
> >
> >
> > I am new to Drools and trying my hands out at Drools 5. I cann?t figure
> out
> > how to use agenda- groups. I have a small drl file with two agenda groups
> > and one rule per agenda-group. This doesn?t seem to work. However if I
> > happen to comment out the agenda-group attribute, the results are as
> > expected.
> >
> >
> >
> > Please let me know what I am missing.
> >
> >
> >
> > *package* com.mscibarra.examples.drools.controllers;
> >
> >
> >
> > *import* com.mscibarra.examples.drools.domainentities.*;
> >
> >
> >
> >
> >
> > *rule* "Detect and Remove Duplicate Shelves"
> >
> > *agenda-group* "Phase1"
> >
> > *lock-on-active*
> >
> > *dialect* "mvel"
> >
> > *when*
> >
> >   $universe : LibraryUniverse()
> >
> >   $shelf : Shelf() *from* $universe.shelves
> >
> >   $shelf2 : Shelf(*this* != $shelf) *from*$universe.shelves
> >
> > *then*
> >
> >   System.out.println("Duplicate Shelves found::"+$shelf);
> >
> >   // without the modify(), drools is not alerted about changes
> >
> >   // $universe.shelves.remove($shelf);
> >
> >   /*
> >
> >   *modify*($universe) {
> >
> > shelves.remove($shelf);
> >
> >   };
> >
> >   */
> >
> >
> >
> > *end*
> >
> >
> >
> > *rule* "Singleton Shelf Detector"
> >
> >

Re: [rules-users] Agenda Groups and Salience

2011-03-18 Thread Michael Anstis
Do you inform the engine that values have changed in your RHS:-

then
modify( incomingClaim ) {
   setMedicare(true);
}
...
end

On 18 March 2011 14:16, Dean Whisnant  wrote:

> Hello,
>
> Are there any conflicts in 5.1 between using salience and agenda groups?
>
> I have three sets of rules 1) base software, 2) Trading Partner Specific,
> 3)  Customer Specific.
>
> These three sets are split into different Guvnor packages and all of #1
> have an agenda group of "base", all of #2 have an agenda group of
> "tradingpartner" and all of #3 have no agenda group assigned.
>
> We load all the rules to the knowledge session, letting it know to fire
> them in that order.
>
> In my #1 set I have a few hundred rules.  About 10 of those rules it
> matters what individual order they fire in so I was setting up salience for
> them as well.
>
> Rule #1 has a salience of 21000 and it's job is to see if this is the first
> line item of a claim and if so to instantiate a new object, hasCOB.
>
> Rule #2 has a salience of 20900 and checks to see if the incoming claim is
> medicare and if so, sets a Boolean, hasMedicare, to true and then does some
> output so I know if it set it
>
> Rule #3 has a salience of 20900 and checks to see if the incoming claim is
> other insurance and if so, sets a Boolean, hasOther, to true and then does
> some output so i know if it set it
>
> Rule #4 has a salience of 20800 and looks to see if there is a hasCOB
> object with hasMedicare = to true and then does output so I know if it
> worked
>
> Rule #5 has a salience of 20800 and looks to see if there is a hasCOB
> object with hasOther = to true and then does output so I know if it worked
>
> So I run a sample file through that hasCOB and should set hasOther to true.
>
> Rule #1 fires and creates hasCOB
> Rule #3 fires and sets hasOther to true and gives me output
> Rule #5 doesn't fire???
>
> Whether or not salience is the best method to accomplish this, shouldn't
> this work?  DO you see a better way to accomplish this?  Rules 4 and 5 are
> dummy rules here for testing, but what comes next is calculations based upon
> the existence of hasOther and/or hasMedicare.
>
> I'm at a loss here and any thoughts/help would be welcomed...
>
> Thank you!
>
> Dean
> ___
> 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] Agenda Groups and Salience

2011-03-22 Thread Dean Whisnant
I've done it both with setting the value and forcing salience to evaluate in a 
certain order and using the update a value with and without salience.

It's odd because when I was doing this on a standalone machine in Eclipse it 
all seemed to work fine, but now that I've moved rules into Guvnor I'm having 
issues with it.  Could there be something I did in calling agenda groups that 
could have removed the working of salience?

Also, I was using no-loop to make sure I didn't run the same rule over and 
over.  It only effects things if the rule has fired for one specific instance, 
correct?

Thank you!

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: Friday, March 18, 2011 10:43 AM
To: Rules Users List
Subject: Re: [rules-users] Agenda Groups and Salience

Do you inform the engine that values have changed in your RHS:-

then
modify( incomingClaim ) {
   setMedicare(true);
}
...
end
On 18 March 2011 14:16, Dean Whisnant mailto:d...@basys.com>> 
wrote:
Hello,

Are there any conflicts in 5.1 between using salience and agenda groups?

I have three sets of rules 1) base software, 2) Trading Partner Specific, 3)  
Customer Specific.

These three sets are split into different Guvnor packages and all of #1 have an 
agenda group of "base", all of #2 have an agenda group of "tradingpartner" and 
all of #3 have no agenda group assigned.

We load all the rules to the knowledge session, letting it know to fire them in 
that order.

In my #1 set I have a few hundred rules.  About 10 of those rules it matters 
what individual order they fire in so I was setting up salience for them as 
well.

Rule #1 has a salience of 21000 and it's job is to see if this is the first 
line item of a claim and if so to instantiate a new object, hasCOB.

Rule #2 has a salience of 20900 and checks to see if the incoming claim is 
medicare and if so, sets a Boolean, hasMedicare, to true and then does some 
output so I know if it set it

Rule #3 has a salience of 20900 and checks to see if the incoming claim is 
other insurance and if so, sets a Boolean, hasOther, to true and then does some 
output so i know if it set it

Rule #4 has a salience of 20800 and looks to see if there is a hasCOB object 
with hasMedicare = to true and then does output so I know if it worked

Rule #5 has a salience of 20800 and looks to see if there is a hasCOB object 
with hasOther = to true and then does output so I know if it worked

So I run a sample file through that hasCOB and should set hasOther to true.

Rule #1 fires and creates hasCOB
Rule #3 fires and sets hasOther to true and gives me output
Rule #5 doesn't fire???

Whether or not salience is the best method to accomplish this, shouldn't this 
work?  DO you see a better way to accomplish this?  Rules 4 and 5 are dummy 
rules here for testing, but what comes next is calculations based upon the 
existence of hasOther and/or hasMedicare.

I'm at a loss here and any thoughts/help would be welcomed...

Thank you!

Dean
___
rules-users mailing list
rules-users@lists.jboss.org<mailto: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] Agenda Groups in Stateless Knowledge Session

2013-08-05 Thread Wolfgang Laun
Why don't  you just try it?
-W

On 05/08/2013, alfaoasis  wrote:
> Is it possible to use agenda groups with stateless knowledge session? if
> not
> whats the alternative?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Agenda-Groups-in-Stateless-Knowledge-Session-tp4025332.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Agenda Groups in Stateless Knowledge Session

2013-08-05 Thread alfaoasis
I have tried it. But I am getting the results of other agenda groups as well
which is present in the drl file. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Agenda-Groups-in-Stateless-Knowledge-Session-tp4025332p4025338.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


Re: [rules-users] Agenda Groups in Stateless Knowledge Session

2013-08-05 Thread alfaoasis
I have tried it. But I am getting the results of other agenda groups as well
which is present in the drl file. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Agenda-Groups-in-Stateless-Knowledge-Session-tp4025332p4025339.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


Re: [rules-users] Agenda Groups in Stateless Knowledge Session

2013-08-05 Thread Wolfgang Laun
On 05/08/2013, alfaoasis  wrote:
> I have tried it. But I am getting the results of other agenda groups as
> well
> which is present in the drl file.

This is rather unlikely. You should post code to reproduce this behaviour.

StatelessRuleSession does not have an API to set the agenda group, but
it can be done via RHS code, as described in the "Expert" manual,
section "The Right Hand Side (then)". But rules from an agenda group
that is not given the focus should never fire.

-W


>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Agenda-Groups-in-Stateless-Knowledge-Session-tp4025332p4025339.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Agenda Groups in Stateless Knowledge Session

2013-08-05 Thread alfaoasis
Thanks for your reply. Will explain what I am trying to do. I have a separate
drools rule invocation file for stateless and stateful knowledge sessions
respectively. But I have a single drl file for the rules to be fired
accordingly. When I execute my stateless session file, I am getting the
incorrect output of the stateful+correct output for my stateless. Only if I
set lock-on-active to true, I am getting the desired result. But its not
always possible to use lock-on-active...



--
View this message in context: 
http://drools.46999.n3.nabble.com/Agenda-Groups-in-Stateless-Knowledge-Session-tp4025332p4025349.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