Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Wolfgang Laun
Hello Peter,

Perhaps I'm overly apprehensive, but I feel compelled to throw in a word of
warning concerning the idea of creating high salience rules for "special
cases" so as to avoid using a full set of constraints for clear separation
of the "symptom sets". Assuming (for the moment) that all symptoms are
booleans, let's say that we have to deal separately with the special cases
s1&&s2 as opposed to s1&&s2&&s3, s1, and s2. Clearly, you cannot have them
all at the same salience level. Given that this is realistic:

   - Will your "clinical content experts" be able to assign the correct set
   of salience values?
   - Who will validate this, and how?

Also, what if none of the "special" rules fires so that the "general case"
kicks in but there is a set of deviations from the norm, hitherto
unobserved?

Clearly, adding all the negatives is tedious work, but that's what code
generators are there for. Using decision tables with suitable defaults would
be one way of dealing with this. I'd even investigate the implementation of
a special decision table parser/compiler for this use case.

-W











2011/3/9 Peter Ashford 

> Ok, thanks.   I can see how asserting a control fact would work here – I
> only asked about a terminate option to be able to avoid having to check for
> the absence of the control fact in every rule, but that’s fine if that’s
> what I have to do.
>
>
>
> Thank s everyone for the help – it’s been excellent and very instructive
> :o)
>
>
>
> p.s.: No, I don’t use RuleFlow or jBPM.  We’re writing DRL’s by hand and
> it’s our expectation that we will have clinical content experts using Guvnor
> to author rules once we’ve got our new system up and running.  At this point
> I’m just trying to establish what best practice for our domain ought to be.
>
>
>
> Peter.
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Michael Anstis
> *Sent:* Thursday, 10 March 2011 10:45 a.m.
>
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> I don't suppose you (Peter) use RuleFlow or jBPM?
>
> If not then remember rules' patterns are matched as facts are inserted into
> WM. The resulting activations are ordered by controlling semantics such as
> salience, no-loop, lock-on-active etc. Therefore should higher salience
> rules activations (that will be executed first) alter the state of WM lower
> salience rules' activations could be removed (by the presence of the control
> fact or non-null "advice" depending on what approach you take) and hence not
> be candidate for execution.
>
> This is why, IMO, people talk about considering all rules executing in
> parallel rather than sequentially.
>
> If you're using jBPM then fail-fast is an option, but not something I know
> much about.
>
> Cheers,
>
> Mike
>
> 2011/3/9 Greg Barton 
>
> "Control facts" is a term for objects in working memory that are not
> directly derived from outside data, or used as output.  As their name
> implies, they're used to explicitly control flow of the rules.
>
> --- On *Wed, 3/9/11, Peter Ashford * wrote:
>
>
> From: Peter Ashford 
>
>
> Subject: Re: [rules-users] Misunderstanding salience?
>
> To: "Rules Users List" 
> Date: Wednesday, March 9, 2011, 2:54 PM
>
>
>
> Working with Zombies?  No... although some of our clients
>
>
>
> A wrinkle we have is that sometimes an exception case should terminate the
> decision.  Usually that’s an emergency case and it will be something like
> “this patient needs to be admitted to hospital immediately”.  In other
> cases, we want to provide some advice which a clinician may or may not
> choose to heed. It sounds to me that the insertLogical mechanism might well
> work for those latter cases (was this what you were referring to when you
> talked about ‘control facts’?)  In the other case – an emergency when you
> need to give one element of critical advice then quit – is there an option
> to terminate the rules immediately and return the current result?
>
>
>
> Peter
>
>
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Swindells, Thomas
> *Sent:* Wednesday, 9 March 2011 10:23 p.m.
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> I don’t think you even need it that complicated.
>
> Just have your constraints in the form
>
> Patient(advice == null, ...)
>
>
>
> This assumes you only give the patient one advice at a time – if not
> control facts would have to be the way to go.
>
>
>
> You also need to make sure you actually tell the rule engine you have
> modified the patient when you set their advice – you need to wrap the call
> with a modify(p) {...}.
>
>
>
> Hope you get your zombies under control soon,
>
>
>
> Thomas
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Michael Anstis
> *Sent:* 09 March 2011 07:58
> *To:* Rules

[rules-users] join gateway

2011-03-09 Thread Salina Fung/UFL - ICIL
Please give me some example to illustrate the difference between
'XOR', 'Discriminator', 'n of m'?

And my understanding of 'And' should be waiting for ALL incoming branches are 
completed
before move to the next node, is it correct?  So, if I have 2 incoming branches 
are
from 2 human task, and the out-going branch is to an END node, if only one human
task is finished, the process will not be ended, until the second one is 
completed by user.
Is it correct?


Thanks
Salina

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


Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Peter Ashford
Ok, thanks.   I can see how asserting a control fact would work here - I only 
asked about a terminate option to be able to avoid having to check for the 
absence of the control fact in every rule, but that's fine if that's what I 
have to do.

 

Thank s everyone for the help - it's been excellent and very instructive :o)

 

p.s.: No, I don't use RuleFlow or jBPM.  We're writing DRL's by hand and it's 
our expectation that we will have clinical content experts using Guvnor to 
author rules once we've got our new system up and running.  At this point I'm 
just trying to establish what best practice for our domain ought to be.

 

Peter.

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: Thursday, 10 March 2011 10:45 a.m.
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

I don't suppose you (Peter) use RuleFlow or jBPM?

If not then remember rules' patterns are matched as facts are inserted into WM. 
The resulting activations are ordered by controlling semantics such as 
salience, no-loop, lock-on-active etc. Therefore should higher salience rules 
activations (that will be executed first) alter the state of WM lower salience 
rules' activations could be removed (by the presence of the control fact or 
non-null "advice" depending on what approach you take) and hence not be 
candidate for execution.

This is why, IMO, people talk about considering all rules executing in parallel 
rather than sequentially.

If you're using jBPM then fail-fast is an option, but not something I know much 
about.

Cheers,

Mike

2011/3/9 Greg Barton 

"Control facts" is a term for objects in working memory that are not directly 
derived from outside data, or used as output.  As their name implies, they're 
used to explicitly control flow of the rules.  

--- On Wed, 3/9/11, Peter Ashford  wrote:


From: Peter Ashford 


Subject: Re: [rules-users] Misunderstanding salience?

To: "Rules Users List" 
Date: Wednesday, March 9, 2011, 2:54 PM

 

Working with Zombies?  No... although some of our clients   

 

A wrinkle we have is that sometimes an exception case should terminate the 
decision.  Usually that's an emergency case and it will be something like "this 
patient needs to be admitted to hospital immediately".  In other cases, we want 
to provide some advice which a clinician may or may not choose to heed. It 
sounds to me that the insertLogical mechanism might well work for those latter 
cases (was this what you were referring to when you talked about 'control 
facts'?)  In the other case - an emergency when you need to give one element of 
critical advice then quit - is there an option to terminate the rules 
immediately and return the current result?

 

Peter

 

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas
Sent: Wednesday, 9 March 2011 10:23 p.m.
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

I don't think you even need it that complicated.

Just have your constraints in the form 

Patient(advice == null, ...)

 

This assumes you only give the patient one advice at a time - if not control 
facts would have to be the way to go.

 

You also need to make sure you actually tell the rule engine you have modified 
the patient when you set their advice - you need to wrap the call with a 
modify(p) {...}.

 

Hope you get your zombies under control soon,

 

Thomas

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 09 March 2011 07:58
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

You had me fooled Peter, I thought you worked in a zombie related field ;-)

Control Facts can also be used, which I think David eluded to with his use of 
"null advice", such that:-

rule "General brain eating advice"

   when

  p : Patient(eatsBrains == true)

 not Diagnosis( patient == $p )

   then

  p.setAdvice("Stop eating brains, or at least, try to cut down");  
 

  insertLogical( new Diagnosis( $p ) );  

end

 

rule "Zombie exception to brain eating advice" 

   salience -50

   when

  p : Patient(eatsBrains == true, isZombie == true)

 not Diagnosis( patient == $p )

   then

  p.setAdvice("Evidence suggests that the undead cannot contract 
Kuru or that the effects are irellevant given the " +

  "patient's current zombified state.\nSuggest 
euthenasing patient lest he/she eat your (or someone " +

  "else's) brains"); 

  insertLogical( new Diagnosis( $p ) );  

 

end

As David states, more specific rules should have higher salience than the more 
general that should have lower. Salience controls conflict resolution, w

Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Michael Anstis
I don't suppose you (Peter) use RuleFlow or jBPM?

If not then remember rules' patterns are matched as facts are inserted into
WM. The resulting activations are ordered by controlling semantics such as
salience, no-loop, lock-on-active etc. Therefore should higher salience
rules activations (that will be executed first) alter the state of WM lower
salience rules' activations could be removed (by the presence of the control
fact or non-null "advice" depending on what approach you take) and hence not
be candidate for execution.

This is why, IMO, people talk about considering all rules executing in
parallel rather than sequentially.

If you're using jBPM then fail-fast is an option, but not something I know
much about.

Cheers,

Mike

2011/3/9 Greg Barton 

> "Control facts" is a term for objects in working memory that are not
> directly derived from outside data, or used as output.  As their name
> implies, they're used to explicitly control flow of the rules.
>
> --- On *Wed, 3/9/11, Peter Ashford * wrote:
>
>
> From: Peter Ashford 
>
> Subject: Re: [rules-users] Misunderstanding salience?
> To: "Rules Users List" 
> Date: Wednesday, March 9, 2011, 2:54 PM
>
>
> Working with Zombies?  No... although some of our clients
>
>
>
> A wrinkle we have is that sometimes an exception case should terminate the
> decision.  Usually that’s an emergency case and it will be something like
> “this patient needs to be admitted to hospital immediately”.  In other
> cases, we want to provide some advice which a clinician may or may not
> choose to heed. It sounds to me that the insertLogical mechanism might well
> work for those latter cases (was this what you were referring to when you
> talked about ‘control facts’?)  In the other case – an emergency when you
> need to give one element of critical advice then quit – is there an option
> to terminate the rules immediately and return the current result?
>
>
>
> Peter
>
>
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Swindells, Thomas
> *Sent:* Wednesday, 9 March 2011 10:23 p.m.
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> I don’t think you even need it that complicated.
>
> Just have your constraints in the form
>
> Patient(advice == null, ...)
>
>
>
> This assumes you only give the patient one advice at a time – if not
> control facts would have to be the way to go.
>
>
>
> You also need to make sure you actually tell the rule engine you have
> modified the patient when you set their advice – you need to wrap the call
> with a modify(p) {...}.
>
>
>
> Hope you get your zombies under control soon,
>
>
>
> Thomas
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Michael Anstis
> *Sent:* 09 March 2011 07:58
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> You had me fooled Peter, I thought you worked in a zombie related field ;-)
>
> Control Facts can also be used, which I think David eluded to with his use
> of "null advice", such that:-
>
> *rule* "General brain eating advice"
>
>*when*
>
>   p : Patient(eatsBrains == *true*)
>
>  not Diagnosis( patient == $p )
>
>*then*
>
>   p.setAdvice("Stop eating brains, or at least, try to cut
> down");
>
>   insertLogical( new Diagnosis( $p ) );
>
> *end*
>
>
>
> *rule* "Zombie exception to brain eating advice"
>
>*salience* -50
>
>*when*
>
>   p : Patient(eatsBrains == *true*, isZombie == *true*)
>
>  not Diagnosis( patient == $p )
>
>*then*
>
>   p.setAdvice("Evidence suggests that the undead cannot
> contract Kuru or that the effects are irellevant given the " +
>
>   "patient's current zombified state.\nSuggest
> euthenasing patient lest he/she eat your (or someone " +
>
>   "else's) brains");
>
>   insertLogical( new Diagnosis( $p ) );
>
>
>
> *end*
>
> As David states, more specific rules should have higher salience than the
> more general that should have lower. Salience controls conflict resolution,
> which is the order in which activations on the agenda are evaluated, it does
> not control which rules are evaluated - which happens as facts are inserted
> into working memory and not when fireAllRules( ) invoked.
>
> With kind regards,
>
> Mike
>
> 2011/3/9 Peter Ashford 
> http://mc/compose?to=pet...@bestpractice.org.nz>
> >
>
> Thanks for the ideas, David.
>
>
>
> What I ultimately want to achieve is to have the individual rules
> independent of each other to the maximal degree to which that is possible.
> That’s why I didn’ t want to have isZombie==false in the general rule – I
> wanted the general case to be unaware of the exceptions.  The field in which
> I’m working is clinical decision support 

Re: [rules-users] maven-drools-plugin, anyone?

2011-03-09 Thread Mauricio Salatino
I will take a look on that right now..
I was planning to do the same for some of my example projects.
I will come back with some feedback!
Greetings.

On Wed, Mar 9, 2011 at 6:29 PM, Ansgar Konermann <
ansgar.konerm...@googlemail.com> wrote:

> Hi,
>
> I prepared a tiny drools compiler plugin for Maven 3. It currently
> contains the smallest feature-set which is potentially useful for my
> colleagues at work, so up to now it's no more than a starting point for
> my team. Nevertheless, I invite you to take a look at it, comment on it
> and suggest features _you_ would like to see in the plugin in one of its
> future releases.
>
> There's some inital documentation here:
> http://passion.forco.de/content/maven-drools-plugin
>
> Looking forward to your comments.
>
> Best regards
>
> Ansgar
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

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


[rules-users] maven-drools-plugin, anyone?

2011-03-09 Thread Ansgar Konermann
Hi,

I prepared a tiny drools compiler plugin for Maven 3. It currently 
contains the smallest feature-set which is potentially useful for my 
colleagues at work, so up to now it's no more than a starting point for 
my team. Nevertheless, I invite you to take a look at it, comment on it 
and suggest features _you_ would like to see in the plugin in one of its 
future releases.

There's some inital documentation here: 
http://passion.forco.de/content/maven-drools-plugin

Looking forward to your comments.

Best regards

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


Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Greg Barton
"Control facts" is a term for objects in working memory that are not directly 
derived from outside data, or used as output.  As their name implies, they're 
used to explicitly control flow of the rules.  

--- On Wed, 3/9/11, Peter Ashford  wrote:

From: Peter Ashford 
Subject: Re: [rules-users] Misunderstanding salience?
To: "Rules Users List" 
Date: Wednesday, March 9, 2011, 2:54 PM

Working with Zombies?  No... although some of our clients    A wrinkle we 
have is that sometimes an exception case should terminate the decision.  
Usually that’s an emergency case and it will be something like “this patient 
needs to be admitted to hospital immediately”.  In other cases, we want to 
provide some advice which a clinician may or may not choose to heed. It sounds 
to me that the insertLogical mechanism might well work for those latter cases 
(was this what you were referring to when you talked about ‘control facts’?)  
In the other case – an emergency when you need to give one element of critical 
advice then quit – is there an option to terminate the rules immediately and 
return the current result?  Peter    From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas
Sent: Wednesday, 9 March 2011 10:23 p.m.
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?  I don’t think you even 
need it that complicated.Just have your constraints in the form Patient(advice 
== null, ...) This assumes you only give the patient one advice at a time – if 
not control facts would have to be the way to go. You also need to make sure 
you actually tell the rule engine you have modified the patient when you set 
their advice – you need to wrap the call with a modify(p) {...}. Hope you get 
your zombies under control soon, Thomas From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 09 March 2011 07:58
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience? You had me fooled Peter, 
I thought you worked in a zombie related field ;-)

Control Facts can also be used, which I think David eluded to with his use of 
"null advice", such that:-rule "General brain eating advice"   
when  p : Patient(eatsBrains == true) not 
Diagnosis( patient == $p )   then  p.setAdvice("Stop eating 
brains, or at least, try to cut down");                 insertLogical( new 
Diagnosis( $p ) );  end rule "Zombie exception to brain eating advice"    
salience -50   when  p : Patient(eatsBrains == true, isZombie 
== true) not Diagnosis( patient == $p )   
then  p.setAdvice("Evidence suggests that the undead cannot 
contract Kuru or that the effects are irellevant given the " 
+      "patient's current zombified state.\nSuggest
 euthenasing patient lest he/she eat your (or someone " 
+      "else's) brains");               
insertLogical( new Diagnosis( $p ) );   end

As David states, more specific rules should have higher salience than the more 
general that should have lower. Salience controls conflict resolution, which is 
the order in which activations on the agenda are evaluated, it does not control 
which rules are evaluated - which happens as facts are inserted into working 
memory and not when fireAllRules( ) invoked.

With kind regards,

Mike2011/3/9 Peter Ashford Thanks for the ideas, 
David. What I ultimately want to achieve is to have the individual rules 
independent of each other to the maximal degree to which that is possible.  
That’s why I didn’ t want to have isZombie==false in the general rule – I 
wanted the general case to be unaware of the exceptions.  The field in which 
I’m working is clinical decision support where there might be a number of 
exceptions and corner cases.  I’d like to be able to express the core logic 
without reference to the corner cases and then deal with the exceptions 
separately.   I think your idea of using salience but only adding advice if it 
hasn’t already been given fits the bill – that way the general case can be 
simple and not have to explicitly exclude all the exception cases.   Thanks 
very much for the feedback – it’s really valuable to get an idea about what 
options are available and what’s
 considered best practice. Cheers! Peter.  From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of David Faulkner
Sent: Wednesday, 9 March 2011 4:51 p.m.
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience? Peter, The EXACT way to 
accomplish the functionality that you are looking for is “activation-group”; if 
two rules are in the same activation group, only one of them will fire. Note 
that the rule with HIGHER salience will fire first; to accomplish what you are 
looking for you’d have to give the except

Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Peter Ashford
Working with Zombies?  No... although some of our clients   

 

A wrinkle we have is that sometimes an exception case should terminate the 
decision.  Usually that's an emergency case and it will be something like "this 
patient needs to be admitted to hospital immediately".  In other cases, we want 
to provide some advice which a clinician may or may not choose to heed. It 
sounds to me that the insertLogical mechanism might well work for those latter 
cases (was this what you were referring to when you talked about 'control 
facts'?)  In the other case - an emergency when you need to give one element of 
critical advice then quit - is there an option to terminate the rules 
immediately and return the current result?

 

Peter

 

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Swindells, Thomas
Sent: Wednesday, 9 March 2011 10:23 p.m.
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

I don't think you even need it that complicated.

Just have your constraints in the form 

Patient(advice == null, ...)

 

This assumes you only give the patient one advice at a time - if not control 
facts would have to be the way to go.

 

You also need to make sure you actually tell the rule engine you have modified 
the patient when you set their advice - you need to wrap the call with a 
modify(p) {...}.

 

Hope you get your zombies under control soon,

 

Thomas

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 09 March 2011 07:58
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

You had me fooled Peter, I thought you worked in a zombie related field ;-)

Control Facts can also be used, which I think David eluded to with his use of 
"null advice", such that:-

rule "General brain eating advice"

   when

  p : Patient(eatsBrains == true)

 not Diagnosis( patient == $p )

   then

  p.setAdvice("Stop eating brains, or at least, try to cut down");  
 

  insertLogical( new Diagnosis( $p ) );  

end

 

rule "Zombie exception to brain eating advice" 

   salience -50

   when

  p : Patient(eatsBrains == true, isZombie == true)

 not Diagnosis( patient == $p )

   then

  p.setAdvice("Evidence suggests that the undead cannot contract 
Kuru or that the effects are irellevant given the " +

  "patient's current zombified state.\nSuggest 
euthenasing patient lest he/she eat your (or someone " +

  "else's) brains"); 

  insertLogical( new Diagnosis( $p ) );  

 

end

As David states, more specific rules should have higher salience than the more 
general that should have lower. Salience controls conflict resolution, which is 
the order in which activations on the agenda are evaluated, it does not control 
which rules are evaluated - which happens as facts are inserted into working 
memory and not when fireAllRules( ) invoked.

With kind regards,

Mike

2011/3/9 Peter Ashford 

Thanks for the ideas, David.

 

What I ultimately want to achieve is to have the individual rules independent 
of each other to the maximal degree to which that is possible.  That's why I 
didn' t want to have isZombie==false in the general rule - I wanted the general 
case to be unaware of the exceptions.  The field in which I'm working is 
clinical decision support where there might be a number of exceptions and 
corner cases.  I'd like to be able to express the core logic without reference 
to the corner cases and then deal with the exceptions separately.  

 

I think your idea of using salience but only adding advice if it hasn't already 
been given fits the bill - that way the general case can be simple and not have 
to explicitly exclude all the exception cases.  

 

Thanks very much for the feedback - it's really valuable to get an idea about 
what options are available and what's considered best practice.

 

Cheers!

 

Peter.

 

 

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of David Faulkner
Sent: Wednesday, 9 March 2011 4:51 p.m.


To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

 

Peter,

 

The EXACT way to accomplish the functionality that you are looking for is 
"activation-group"; if two rules are in the same activation group, only one of 
them will fire. Note that the rule with HIGHER salience will fire first; to 
accomplish what you are looking for you'd have to give the exception rule a 
higher salience.

 

I would also note that although there are specific instances where 
activation-group has a strong need, many in the community find that the most 
power and flexibility from the rule engine comes from "letting go" of trying to 
exactly order your rule exe

Re: [rules-users] Need Help writing then part in DSLR

2011-03-09 Thread Saleem Lakhani
Thanks. It is working. 

 

saleem

 

From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Wednesday, March 09, 2011 1:57 PM
To: Rules Users List
Subject: Re: [rules-users] Need Help writing then part in DSLR

 

Omit the '-' from the DSL and the DSLR:
   [then]The standard error level is ...
-W

2011/3/9 Saleem Lakhani 

Hi,

 

This is what used to work in Drools 3: Sample from DSL:

 

[then]A validation error has occurred=ValErrTO valErrTO = new
ValErrTO(); java.util.HashMap variableMap = new java.util.HashMap();

[then]- The standard error level is "{standard_error_level}"=int
stdErrLevel={standard_error_level}; valErrTO.setErrorCode(stdErrLevel);

 

With Drools 5.2.1 it gives me the following error:

No modify was found to add the modifier to: - The standard error level
is "400"

 

How do I write the above 2 statements again in Drools 5.2.1, NOTE: I
need to write this in DSL.

 

Sample DSLR:

 

rule "Your First Rule"

  

  when

There is a Coverage with

  then 

#actions

A validation error has occurred

  - The standard error level is "400"

end

 

 

Thanks,

saleem

 


___
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] Need Help writing then part in DSLR

2011-03-09 Thread Wolfgang Laun
Omit the '-' from the DSL and the DSLR:
   [then]The standard error level is ...
-W

2011/3/9 Saleem Lakhani 

>  Hi,
>
>
>
> This is what used to work in Drools 3: Sample from DSL:
>
>
>
> [then]A validation error has occurred=ValErrTO valErrTO = new ValErrTO();
> java.util.HashMap variableMap = new java.util.HashMap();
>
> [then]- The standard error level is 
> "{standard_error_level}"=*int*stdErrLevel={standard_error_level}; 
> valErrTO.setErrorCode(stdErrLevel);
>
>
>
> With Drools 5.2.1 it gives me the following error:
>
> No modify was found to add the modifier to: - The standard error level is
> "400"
>
>
>
> How do I write the above 2 statements again in Drools 5.2.1, NOTE: I need
> to write this in DSL.
>
>
>
> Sample DSLR:
>
>
>
> *rule* "Your First Rule"
>
>
>
>   *when*
>
> There *is* a Coverage *with*
>
>   *then*
>
> #actions
>
> A validation error has occurred
>
>   - The standard error level *is* "400"
>
> *end*
>
>
>
>
>
> Thanks,
>
> saleem
>
>
>
> ___
> 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] Need Help writing then part in DSLR

2011-03-09 Thread Saleem Lakhani
Hi,

 

This is what used to work in Drools 3: Sample from DSL:

 

[then]A validation error has occurred=ValErrTO valErrTO = new
ValErrTO(); java.util.HashMap variableMap = new java.util.HashMap();

[then]- The standard error level is "{standard_error_level}"=int
stdErrLevel={standard_error_level}; valErrTO.setErrorCode(stdErrLevel);

 

With Drools 5.2.1 it gives me the following error:

No modify was found to add the modifier to: - The standard error level
is "400"

 

How do I write the above 2 statements again in Drools 5.2.1, NOTE: I
need to write this in DSL.

 

Sample DSLR:

 

rule "Your First Rule"

  

  when

There is a Coverage with

  then 

#actions

A validation error has occurred

  - The standard error level is "400"

end

 

 

Thanks,

saleem

 

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


Re: [rules-users] New Questions about drools

2011-03-09 Thread Esteban Aliverti
Hi,

*1) When rules are entered through the UI are they immediately added to the
rule base?*
I assume by UI you mean Guvnor. In Guvnor, each rule is defined inside a
package. When you create a new rule you must define the package where it
belongs. Guvnor doesn't create any kbase, you can see a package (in Guvnor)
like a DRL file split in different parts: the imports, the globals, each
rule, etc. So Guvnor is only in charge of maintain different versions of
that DRLs.

*2) Does the edit UI require code to define new entities and associated
metadata? *
If you need to use Domain specific entities in your rules (and I'm sure you
will), you have 2 different ways to define them:
1.- Declare the entities in Guvnor. This will use the "declare" keyword to
define a New Data Type.
2.- Upload to guvnor's package a .jar file containing your model.

*3) What would our interface look like if we called it as a service for only
rule evaluation? *
I didn't get this question. If you want to use your rules, you will need to
create an application that creates a knowledge base from one or more
resources (the packages hosted in Guvnor) and then creates a knowledge
session from it. You can then expose that session as a service.
Or you can use drools server which does exactly what I told you.

*4) What is the rule scoping mechanism. That is, how do I say "evaluate this
set of information against *
*ruleset Q"? *
One way to have different "rulesets" is to define different knowledge bases
containing different rules. If you are using Guvnor to store your rules, you
could have for example 3 packages A, B and C. Then, when you create a
knowledge base, you could select only the packages with the rules that you
need.
The evaluation takes place when you insert facts (objects) into a knowledge
session.

*5) I'm concerned about the "then" clause. It looks like it is always code.
If our "then" always consists of *
*assignments to some set of variables or parameters, what does the person
writing rules see?*
mmmh... He will see the assignments? :P


Best Regards,



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


2011/3/9 Carlos Santiago Moreno 

> Hi There! I have been reading some more about Drools, Guvnor, and JBPM5,
> and I have a few new doubts, that I couldn't get solved from the
> documentation I read. And here they are:
>
> 1) When rules are entered through the UI are they immediately added to the
> rule base?
>
> 2) Does the edit UI require code to define new entities and associated
> metadata?
>
> 3) What would our interface look like if we called it as a service for only
> rule evaluation?
>
> 4) What is the rule scoping mechanism. That is, how do I say "evaluate this
> set of information against
> ruleset Q"?
>
> 5) I'm concerned about the "then" clause. It looks like it is always code.
> If our "then" always consists of
> assignments to some set of variables or parameters, what does the person
> writing rules see?
>
> 6) Can I define a new workflow and connect it into some dispatcher for
> invokation without writing any code and without stopping or upgrading the
> app?
>
> Thanks for your help.
>
> Carlos S. Moreno
>
> ___
> 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] not sure if this is a bug of drools or my bad usage...

2011-03-09 Thread Wolfgang Laun
On 9 March 2011 04:59, Simon Chen  wrote:

> Hi Wolfgang,
>
> First, your rules work...
>
> But for the second rule, I replaced the first Reachable() in the when
> clause to Link(), and the result is still correct. Only if I remove
> "no-loop true", the issue I had appeared.
>

My statement about avoiding a mix of given and derived facts was
definitely exaggerating matters. But the representation of Link vs.
Reachable merits some consideration.


>
> So, I understand how "no-loop true" in this case helps to make the
> result correct. But, do you see any scenarios where "no-loop" can
> cause incorrect results? For example, not enough number of recursions?
>

No-loop is almost never satisfactory.

It's necessary to avoid duplications of Reachable. You can't add a "not" CE
to
block this, but it's possible to configure against the insertion of equal
facts.
For this, equals() and hashCode() must be implemented properly, and the
AssertBehaviorOption.EQUALITY must be set.

I have found this to work quite well:

public class Reachable {
  private String src;
  private String tgt;
  //...
public boolean equals(Object obj) {
if (this == obj) return true;
if( ! (obj instanceof Reachable)) return false;
Reachable other = (Reachable) obj;
return other.src.equals( src ) &&  other.tgt.equals( tgt );
  }
}

public class Link extends Reachable {
  public Link( String src, String tgt ){
super(src, tgt);
  }
}

Notice that this subclassing avoids the creation of Reachable for each Link.
And I still think that computing the closure should be done by using
Reachable only. Note the absence of no-loop!

rule deriveReachReach
when
Reachable( $src: src, $mid: tgt )
Reachable( src == $mid, $tgt: tgt != $src )
then
insertLogical( new Reachable( $src, $tgt ));
end


  kbConfig.setOption( AssertBehaviorOption.EQUALITY );   // identical and
equal not inserted
  kBase = KnowledgeBaseFactory.newKnowledgeBase( kbConfig );

Cheers
-W







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


[rules-users] New Questions about drools

2011-03-09 Thread Carlos Santiago Moreno
Hi There! I have been reading some more about Drools, Guvnor, and JBPM5, and
I have a few new doubts, that I couldn't get solved from the documentation I
read. And here they are:

1) When rules are entered through the UI are they immediately added to the
rule base?

2) Does the edit UI require code to define new entities and associated
metadata?

3) What would our interface look like if we called it as a service for only
rule evaluation?

4) What is the rule scoping mechanism. That is, how do I say "evaluate this
set of information against
ruleset Q"?

5) I'm concerned about the "then" clause. It looks like it is always code.
If our "then" always consists of
assignments to some set of variables or parameters, what does the person
writing rules see?

6) Can I define a new workflow and connect it into some dispatcher for
invokation without writing any code and without stopping or upgrading the
app?

Thanks for your help.

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


Re: [rules-users] Is it possible to Iteriate over a list of string values ?

2011-03-09 Thread groovenarula
I was hoping to be able to give the Business Analysts an overall process to
use Drools by avoiding as much java code as possible. If there was some way
to do this, I could have just had them create different templates they would
need (based on the format of the spreadsheets they currently use) and
minimize interactions between the B.A.s and the developers. 

I'll just keep digging for a bit 

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2655825.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Unable to find implementation for BusinessRuleProvider

2011-03-09 Thread John Peterson
Hi,

I've been experimenting with the Guided Rule Editor plug-in in Eclipse.
I've built a Drools Project using the default Hello World sample
application.  I've created a new "Guided Rule" in my project called
"GuidedRule.brl" and get the associated "drools.package" with it.  The
rule is simple:

WHEN
THEN
  System.out.println("Rule has fired");

I build the knowledge base as follows:

private static KnowledgeBase readKnowledgeBase() throws
Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(ResourceFactory.newClassPathResource("SampleGuided.drl"),
ResourceType.BRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not
parse knowledge.");
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase();

kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}

The only line changed is adding the resource of type BRL.

When I try to run, I get the following error:

java.lang.RuntimeException: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:544)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:41)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:386)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:470)
... 3 more
Caused by: org.drools.CheckedDroolsException: Unable to find
implementation for BusinessRuleProvider
at
org.drools.compiler.BusinessRuleProviderFactory.throwNoImplementationFou
nd(BusinessRuleProviderFactory.java:66)
at
org.drools.compiler.BusinessRuleProviderFactory.loadProvider(BusinessRul
eProviderFactory.java:42)
at
org.drools.compiler.BusinessRuleProviderFactory.getProvider(BusinessRule
ProviderFactory.java:25)
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:366)
... 4 more

I've tried variations to add the drools.package as a PKG type, I've had
the rules (and package) in both "com.sample" and /src/main/rules, but I
can't seem to resolve the problem.  "drools.package" has been updated to
include the package name (package com.sample;) and I import the message
class as well (even though it isn't being used currently).

I suspect the issue is simple, but I haven't been able to figure it out.
Any help would be appreciated.


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


Re: [rules-users] Is it possible to Iteriate over a list of string values ?

2011-03-09 Thread Wolfgang Laun
On 9 March 2011 13:07, groovenarula  wrote:

>
>XXX  YYY   "one,two,three"
>
> where XXX, YYY will be in 2 individual cells that will hold the values for
> one fact, and the "one,two,three" will be in a third cell will from which I
> need to create separate instances for each value of fact #2.
>
> I'm trying to see if there's a way to use the current spreadsheet without
> changing it drastically. That will make the solution a lot more acceptable.
>
>
Looks like reading the cells and generating Java code to insert the facts
is the cheapest solution. I see no point in constructing rules just to get
some facts into WM.



> W - Can you please elaborate on your last statement :
>
> It's doable from a spreadsheet, using the "forall" substitution.
>
> If I'm not mistake that's what I would use if it's a decision table - Would
> I be able to use 'forall' even if I'm using a template to insert the facts
> ?
>

Yes, I was referring to decision tables. No, that "forall" is done by the DT
parser/expander.

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


Re: [rules-users] Is it possible to Iteriate over a list of string values ?

2011-03-09 Thread groovenarula
All,

Thanks for the quick responses. 

Mantis, I did try using from [ "one","two","three" ] syntax, but it did not
work. It gave me a parser error. 

Basically I need to create a spreadsheet reader that inserts values into WM
before reasoning over them. The spreadsheet that the users are currently
using for their own internal use look something like this :

XXX  YYY   "one,two,three"

where XXX, YYY will be in 2 individual cells that will hold the values for
one fact, and the "one,two,three" will be in a third cell will from which I
need to create separate instances for each value of fact #2.

I'm trying to see if there's a way to use the current spreadsheet without
changing it drastically. That will make the solution a lot more acceptable. 

W - Can you please elaborate on your last statement :

It's doable from a spreadsheet, using the "forall" substitution.

If I'm not mistake that's what I would use if it's a decision table - Would
I be able to use 'forall' even if I'm using a template to insert the facts ?

I'll try the different solution and see what fits the best. But if you can
please elaborate on this, it will help.

Thanks
G


--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654934.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Is it possible to Iteriate over a list of string values ?

2011-03-09 Thread Wolfgang Laun
This is all very well, but why does it have to be so complicated?

rule createFacts
when
then
   for( String s: new String[]{ "one", "two", "three" } ){
  insert( new Fact( s ) );
   }
end

This rule executes once. Presumably you'll use a very high salience. The
condition might contain CEs to make this happen depending on whatever.

It's doable from a spreadsheet, using the "forall" substitution.

-W


On 9 March 2011 09:41, FrankVhh  wrote:

> Hi all,
>
> The way I understand your question, you want to evaluate some string value
> to a list of Strings, and insert an "alarm" in the form of a new object to
> notify that these values are present.
>
> This is possible. Insert a String into working memory, then call the
> following rule:
>
> #Testing rule
> rule "test"
>when
>$vals: String(this in ("help","support","assist"))
>not Fact(value == $vals )
>then
>insert ( new Fact ( $vals ) );
>System.out.println("This WORKS!");
> end
>
> The rule checks for a String in working memory, and evaluates its contents
> (
> this in ( list ) ) . If a Fact with the corresponding value hasn"t been
> inserted yet, it will be inserted at runtime.
>
> Regards,
> Frank
>
>
> groovenarula wrote:
> >
> > Hello all,
> >
> > In one of my use cases, I need to insert a variable collections of facts
> > into working memory in order to be able to test for those values later :
> >
> > So I was wondering if there's a way to do something like this
> >
> > when
> > $vals : String() from [ "A 12345", "B 45678", "C 8695" ]
> > then
> >  insert ( new Fact ( $vals ) );
> >
> > With the intention that the rule will fire 3 times and insert the 3 new
> > facts with the values " A 12345" and "B 45678" and "C 8695".
> >
> > Is this possible using rules or do I have to resort to using functions.
> > The problem I'm trying to overcome is to see if there's a way to get the
> > "A 12345", "B 45678", "C 8695"  from a single cell of a spreadsheet.
> >
> > Thanks in advance,
> > G
> >
>
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654347.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Swindells, Thomas
I don't think you even need it that complicated.
Just have your constraints in the form
Patient(advice == null, ...)

This assumes you only give the patient one advice at a time - if not control 
facts would have to be the way to go.

You also need to make sure you actually tell the rule engine you have modified 
the patient when you set their advice - you need to wrap the call with a 
modify(p) {...}.

Hope you get your zombies under control soon,

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 09 March 2011 07:58
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

You had me fooled Peter, I thought you worked in a zombie related field ;-)

Control Facts can also be used, which I think David eluded to with his use of 
"null advice", such that:-
rule "General brain eating advice"
   when
  p : Patient(eatsBrains == true)
 not Diagnosis( patient == $p )
   then
  p.setAdvice("Stop eating brains, or at least, try to cut down");
  insertLogical( new Diagnosis( $p ) );
end

rule "Zombie exception to brain eating advice"
   salience -50
   when
  p : Patient(eatsBrains == true, isZombie == true)
 not Diagnosis( patient == $p )
   then
  p.setAdvice("Evidence suggests that the undead cannot contract 
Kuru or that the effects are irellevant given the " +
  "patient's current zombified state.\nSuggest 
euthenasing patient lest he/she eat your (or someone " +
  "else's) brains");
  insertLogical( new Diagnosis( $p ) );

end

As David states, more specific rules should have higher salience than the more 
general that should have lower. Salience controls conflict resolution, which is 
the order in which activations on the agenda are evaluated, it does not control 
which rules are evaluated - which happens as facts are inserted into working 
memory and not when fireAllRules( ) invoked.

With kind regards,

Mike
2011/3/9 Peter Ashford 
mailto:pet...@bestpractice.org.nz>>
Thanks for the ideas, David.

What I ultimately want to achieve is to have the individual rules independent 
of each other to the maximal degree to which that is possible.  That's why I 
didn' t want to have isZombie==false in the general rule - I wanted the general 
case to be unaware of the exceptions.  The field in which I'm working is 
clinical decision support where there might be a number of exceptions and 
corner cases.  I'd like to be able to express the core logic without reference 
to the corner cases and then deal with the exceptions separately.

I think your idea of using salience but only adding advice if it hasn't already 
been given fits the bill - that way the general case can be simple and not have 
to explicitly exclude all the exception cases.

Thanks very much for the feedback - it's really valuable to get an idea about 
what options are available and what's considered best practice.

Cheers!

Peter.


From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org]
 On Behalf Of David Faulkner
Sent: Wednesday, 9 March 2011 4:51 p.m.

To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

Peter,

The EXACT way to accomplish the functionality that you are looking for is 
"activation-group"; if two rules are in the same activation group, only one of 
them will fire. Note that the rule with HIGHER salience will fire first; to 
accomplish what you are looking for you'd have to give the exception rule a 
higher salience.

I would also note that although there are specific instances where 
activation-group has a strong need, many in the community find that the most 
power and flexibility from the rule engine comes from "letting go" of trying to 
exactly order your rule execution, and instead letting the rule engine decide 
what would happen here. One way to accomplish this in your case would be to 
simply add (isZombie == false) to your constraint on the general rule.  Another 
way that involves salience but NOT agenda groups is to set a high salience on 
your exception rule, but only add advice if advice is null. The possibilities 
are endless.

With kind regards,
David Faulkner
david.faulk...@amentra.com

From: 
rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org]
 On Behalf Of Peter Ashford
Sent: Wednesday, March 09, 2011 7:24 AM
To: Rules Users List
Subject: Re: [rules-users] Misunderstanding salience?

Actually, I think I've figured this one out : in the Zombie case, it's firing 
both rules and it's just that with the negative salience,  the zombie exception 
rule 

Re: [rules-users] Is it possible to Iteriate over a list of string values ?

2011-03-09 Thread FrankVhh
Hi all,

The way I understand your question, you want to evaluate some string value
to a list of Strings, and insert an "alarm" in the form of a new object to
notify that these values are present.

This is possible. Insert a String into working memory, then call the
following rule: 

#Testing rule
rule "test"
when
$vals: String(this in ("help","support","assist"))
not Fact(value == $vals )
then
insert ( new Fact ( $vals ) );
System.out.println("This WORKS!");
end

The rule checks for a String in working memory, and evaluates its contents (
this in ( list ) ) . If a Fact with the corresponding value hasn"t been
inserted yet, it will be inserted at runtime.

Regards,
Frank


groovenarula wrote:
> 
> Hello all,
> 
> In one of my use cases, I need to insert a variable collections of facts
> into working memory in order to be able to test for those values later :
> 
> So I was wondering if there's a way to do something like this 
> 
> when
> $vals : String() from [ "A 12345", "B 45678", "C 8695" ]
> then
>  insert ( new Fact ( $vals ) );
> 
> With the intention that the rule will fire 3 times and insert the 3 new
> facts with the values " A 12345" and "B 45678" and "C 8695".
> 
> Is this possible using rules or do I have to resort to using functions.
> The problem I'm trying to overcome is to see if there's a way to get the 
> "A 12345", "B 45678", "C 8695"  from a single cell of a spreadsheet.
> 
> Thanks in advance,
> G
> 


--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654347.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Misunderstanding salience?

2011-03-09 Thread Michael Anstis
You had me fooled Peter, I thought you worked in a zombie related field ;-)

Control Facts can also be used, which I think David eluded to with his use
of "null advice", such that:-

*rule* "General brain eating advice"

   *when*

  p : Patient(eatsBrains == *true*)

 not Diagnosis( patient == $p )

   *then*

  p.setAdvice("Stop eating brains, or at least, try to cut
down");


  insertLogical( new Diagnosis( $p ) );

*end*



*rule* "Zombie exception to brain eating advice"

   *salience* -50

   *when*

  p : Patient(eatsBrains == *true*, isZombie == *true*)

 not Diagnosis( patient == $p )

   *then*

  p.setAdvice("Evidence suggests that the undead cannot contract
Kuru or that the effects are irellevant given the " +

  "patient's current zombified state.\nSuggest
euthenasing patient lest he/she eat your (or someone " +

  "else's) brains");

  insertLogical( new Diagnosis( $p ) );

*
*
*end*

As David states, more specific rules should have higher salience than the
more general that should have lower. Salience controls conflict resolution,
which is the order in which activations on the agenda are evaluated, it does
not control which rules are evaluated - which happens as facts are inserted
into working memory and not when fireAllRules( ) invoked.

With kind regards,

Mike

2011/3/9 Peter Ashford 

> Thanks for the ideas, David.
>
>
>
> What I ultimately want to achieve is to have the individual rules
> independent of each other to the maximal degree to which that is possible.
> That’s why I didn’ t want to have isZombie==false in the general rule – I
> wanted the general case to be unaware of the exceptions.  The field in which
> I’m working is clinical decision support where there might be a number of
> exceptions and corner cases.  I’d like to be able to express the core logic
> without reference to the corner cases and then deal with the exceptions
> separately.
>
>
>
> I think your idea of using salience but only adding advice if it hasn’t
> already been given fits the bill – that way the general case can be simple
> and not have to explicitly exclude all the exception cases.
>
>
>
> Thanks very much for the feedback – it’s really valuable to get an idea
> about what options are available and what’s considered best practice.
>
>
>
> Cheers!
>
>
>
> Peter.
>
>
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *David Faulkner
> *Sent:* Wednesday, 9 March 2011 4:51 p.m.
>
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> Peter,
>
>
>
> The EXACT way to accomplish the functionality that you are looking for is
> “activation-group”; if two rules are in the same activation group, only one
> of them will fire. Note that the rule with HIGHER salience will fire first;
> to accomplish what you are looking for you’d have to give the exception rule
> a higher salience.
>
>
>
> I would also note that although there are specific instances where
> activation-group has a strong need, many in the community find that the most
> power and flexibility from the rule engine comes from “letting go” of trying
> to exactly order your rule execution, and instead letting the rule engine
> decide what would happen here. One way to accomplish this in your case would
> be to simply add (isZombie == false) to your constraint on the general rule.
>  Another way that involves salience but NOT agenda groups is to set a high
> salience on your exception rule, but only add advice if advice is null. The
> possibilities are endless.
>
>
>
> With kind regards,
>
> David Faulkner
>
> david.faulk...@amentra.com
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Peter Ashford
> *Sent:* Wednesday, March 09, 2011 7:24 AM
> *To:* Rules Users List
> *Subject:* Re: [rules-users] Misunderstanding salience?
>
>
>
> Actually, I think I’ve figured this one out : in the Zombie case, it’s
> firing both rules and it’s just that with the negative salience,  the zombie
> exception rule is the last rule fired, therefore, the last thing written
> into advice.
>
>
>
> So... what would be the correct way to do what I’m trying to do here?  The
> idea is that the Zombie exception rule should fire in preference to the
> general rule and that none of the general processing should occur at all
> (imaging that these rules had side-effects for the rest of the system
> they’re attached to, we don’t want all the general rule side effects to
> apply and then all the exception case side effects)
>
>
>
> Thanks in advance!
>
>
>
> Peter.
>
>
>
> *From:* rules-users-boun...@lists.jboss.org [mailto:
> rules-users-boun...@lists.jboss.org] *On Behalf Of *Peter Ashford
> *Sent:* Wednesday, 9 March 2011 1:31 p.m.
> *To:* ru