Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

2012-08-10 Thread Wolfgang Laun
For a simplified scenario, it is easily possible to determine which rules
fire and which don't. This scenario assumes that you have
 - a set of rules
 - some static facts (which may be modified in the process or not)
 - one transactional fact
and the simple sequence
  kSession.insert( transFact );
  kSession.fireAllRules();
repeated for each fact.

Set up an agenda event listener and register which rules fired - all
the others did not.

Analysing why some fact does not trigger a rule R is much more complex
than rule R itself. Consider: rule R constrains n properties, and each
of these values can be out of the hot range. Lets say we are
investigating boxes with height, width, depth, colour, material, and
weight. When your rule looks for h10, w20, d5, colour == RED,
material == WOOD, weight  100 then you have 6 individual
possibilities for this rule to fire.

If you really need to have a detailed analysis you will have to
redesign your rule base with individual rules checking individual
properties, one rule each for width, height, depth, colour, material
and weight. Each of these rules would add a property (WIDTH_OK,
HEIGHT_OK,... WEIGHT_OK) to the investigated box. Then, at the end of
the firings you look at the collected properties and can determine
what is there and what isn't. If it is the full set, you have a
matching box; otherwise the missing properties tell you what
prohibited a full match. (Again, this assumes that you are
investigating one transactional fact at a time.)

Of course it will get even more complicated if you need to investigate
combinations of facts, but I think it can be done, but it'll need some
extensive work.

-W









On 09/08/2012, Rana ven12...@yahoo.com wrote:
 Hi Davide, your second guess is right. Sorry I should have said failed
 condition.

 I wanted to know which rule got fired and which one did not (because the
 condition failed in when clause).

 I wanted to know those, because we have requirement which asks for what are
 the rules which have passed and failed copnditions, so that we can make
 some
 decisions.

 Also, I wanted to know that in a rule

 rule name
 when
 //condition
 then
//consequence
 end

 when the condition is failed will the rule goes to consequence or not.  (I
 am fairely new to Drools. sorry).

 Thanks.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019077.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] DRL to Decision Table

2012-08-10 Thread Michael Anstis
There is none with which I am aware of; however there might be something in
the community.

The concept has been loosely spoken about within the Drools team however
nothing more concrete.

Wait to see if there are replies from anybody else before drawing your
conclusion.

With kind regards,

Mike

On 10 August 2012 08:03, Mahadevappa, Shobha shobha.mahadeva...@nttdata.com
 wrote:

 Hi,
 Please let me know if there is any tool to convert .drl file to a decision
 table.
 Any pointers rgding this very much appreciated.



 Regards,
 Shobha M

 __
 Disclaimer:This email and any attachments are sent in strictest confidence
 for the sole use of the addressee and may contain legally privileged,
 confidential, and proprietary data.  If you are not the intended recipient,
 please advise the sender by replying promptly to this email and then delete
 and destroy this email and any attachments without any further use, copying
 or forwarding

 ___
 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] Decision table help

2012-08-10 Thread Michael Anstis
In DRL terms this is quite simple:-

when
   $instance1 : ObjA( $mailID : mailId )
   ObjA( this != $instance1, mailId != $mailId )
then
   ...

This translates to a XLS decision table like this:-

| CONDITION | CONDITION   | CONDITION|
+---+-+--+
| $i : ObjA | ObjA   |
+---+-+--+
| $mid : mailId | this != $param  | mailId != $param |
+---+-+--+
| 12345 | $i  | $mid |

There are no doubt other approaches.

With kind regards,

Mike

On 9 August 2012 11:07, Mahadevappa, Shobha
shobha.mahadeva...@nttdata.comwrote:

  Hi,

 I have scenario where I need to compare attributes of two different
 instances of an object in the decision table.

 ** **

 The scenario is - say I have 5 instances of an object ObjA.

 ObjA has an attribute mail_id.

 I need to compare the maild_id attributes of the ObjA instances to figure
 out if they do not match (Ex: instance1.maild1  instance2 maild)

 Can you please let me know how this can be achieved using the decision
 table.

 ** **

 ** **

 Regards,

 *Shobha M *| Senior Program Manager,* *AAD | NTT DATA Global Delivery
 Services Limited| *w.* +91-80-26659482 (Ext 3679) |* v. *8814.3679 | *m.*
 +91.9972522743 | shobha.mahadeva...@nttdata.com

 ** **

 __
 Disclaimer:This email and any attachments are sent in strictest confidence
 for the sole use of the addressee and may contain legally privileged,
 confidential, and proprietary data. If you are not the intended recipient,
 please advise the sender by replying promptly to this email and then delete
 and destroy this email and any attachments without any further use, copying
 or forwarding

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


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


Re: [rules-users] How to define keywords that represent objects(in facts) to be able to use in rules

2012-08-10 Thread Wolfgang Laun
On 10/08/2012, san_drools pathasant...@yahoo.co.in wrote:
 Hello Laune,
Yes, we can use parameters in DSL phrases. But the
 problem here is rule author doesn't know which object to refer.

Consider this DSL definition:
   [when][]ThereIsProgramHistoryData = ProgramHistory ()
   [when][]- where {VarName} is {AttributeName} and is {operator} {value}=
 {VarName}: {AttributeName}  {operator}  {value}

So you can write in DSLR
   ThereIsProgramHistoryData
- where  lpy  is levelPriorYear and is greater than 0

Note that the author can choose the name (lpy) with which the field
(levelPriorYear) can be referred to in subsequent conditions. You
can
add more DSL phrases, or raw DRL (using '' as the first character):

   ThereIsProgramHistoryData
   - where  lpy  is levelPriorYear and is greater than 0
 eval( lpy  1000 )

or you can even use DRL without the '' provided you add this *as the
last definition* to your DSL:
   [condition][] {anything} = {anything}

   ThereIsProgramHistoryData
   - where  lpy  is levelPriorYear and is greater than 0
   eval( lpy  1000 )


  And, can we translate a business rule with keywords
 into DRL?

This is what happens anyway.  To see the result, add this as the first
line to your DSL definitions:
   #/ result


  You can use $ContactNum from the DRL translation. It's not hidden.
 --
 means, can we write in translated DRL for further actions?

I think that's clear, by now?



  I think per my knowledge, we can write use keywords in business rule but
 not directly in technical rule(DRL).

Distinguish DSLR and DRL. DSLR is where you write rules with phrases you
define in an DSL definition, and this is translated into DRL. DRL is
translated into the (internal) representation of rules for building
the Knowledge Base.

If you write DRL, there's no translation before the one from DRL to
internal, so you cannot use anything that's not in the DRL syntax.


 And when i write businessrule using
 keywords, the total rule can be using keywords only as the actual objects
 will not be available to this rule. Am i right?

What you write doesn't make sense to me.

A keyword is translated into a chunk of text anywhere, a DSL
definition with when represents a conditional element or constraint
in the when part, and a DSL definition with then expands into a
statement in the then part.

Thus, a keyword can be used to represent any piece of text.

Make sure to read the documentation. Experiment, using #/ result and
see what you get.

-W


Could you lease make me to understad the things clearly in this context.






 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-define-keywords-that-represent-objects-in-facts-to-be-able-to-use-in-rules-tp4019065p4019081.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] Decision table help

2012-08-10 Thread Mahadevappa, Shobha
Thanks Mike. Will give it a try



Regards,
Shobha M

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 10 August 2012 PM 02:16
To: Rules Users List
Subject: Re: [rules-users] Decision table help

In DRL terms this is quite simple:-

when
   $instance1 : ObjA( $mailID : mailId )
   ObjA( this != $instance1, mailId != $mailId )
then
   ...

This translates to a XLS decision table like this:-

| CONDITION | CONDITION   | CONDITION|
+---+-+--+
| $i : ObjA | ObjA   |
+---+-+--+
| $mid : mailId | this != $param  | mailId != $param |
+---+-+--+
| 12345 | $i  | $mid |

There are no doubt other approaches.

With kind regards,

Mike
On 9 August 2012 11:07, Mahadevappa, Shobha 
shobha.mahadeva...@nttdata.commailto:shobha.mahadeva...@nttdata.com wrote:
Hi,
I have scenario where I need to compare attributes of two different instances 
of an object in the decision table.

The scenario is - say I have 5 instances of an object ObjA.
ObjA has an attribute mail_id.
I need to compare the maild_id attributes of the ObjA instances to figure out 
if they do not match (Ex: instance1.maild1  instance2 maild)
Can you please let me know how this can be achieved using the decision table.


Regards,
Shobha M | Senior Program Manager, AAD | NTT DATA Global Delivery Services 
Limited| w. +91-80-26659482tel:%2B91-80-26659482 (Ext 3679) | v. 8814.3679 | 
m. +91.9972522743tel:%2B91.9972522743 | 
shobha.mahadeva...@nttdata.commailto:shobha.mahadeva...@nttdata.com


__
Disclaimer:This email and any attachments are sent in strictest confidence for 
the sole use of the addressee and may contain legally privileged, confidential, 
and proprietary data. If you are not the intended recipient, please advise the 
sender by replying promptly to this email and then delete and destroy this 
email and any attachments without any further use, copying or forwarding

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


__
Disclaimer:This email and any attachments are sent in strictest confidence for 
the sole use of the addressee and may contain legally privileged, confidential, 
and proprietary data.  If you are not the intended recipient, please advise the 
sender by replying promptly to this email and then delete and destroy this 
email and any attachments without any further use, copying or forwarding___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Audit Logs: Business Case? Any pearls of wisdom?

2012-08-10 Thread Vincent LEGENDRE
I agree with Wolfgang on it is common sense to have audit logs for a real 
application, and of course the way to do it with listeners. 

Most of time, for my experience, these logs (which rule has triggered, what are 
the changes made (insert, retract, update...) ...) are simply dumped in the 
main application log file, and follow the same life cycle (deleted after some 
fixed time). Except for some really critical application that needs a strong 
justification of their results (like something doing quotations, or computing 
salaries), I don't see the utility of keeping all audit for all transactions in 
a production evironnement. 
But for debug phase (and also users training phase), it is really useful. 

In your mail, I see two distincts questions : 
- Should you add in your system some audit functionnalities to log what happend 
somewhere : I would say yes 
- Should you keep all this stuff somewhere, and how to store and how to format 
these information : I would say that raw logging is enough for debugging, but 
not if you have other requirements (like giving access to this to non IT rules 
author, use the audit result in a automated alert system, do report on rules 
usage, being able to answer to claims for a long period of time ...). 


- Mail original -

De: Wolfgang Laun wolfgang.l...@gmail.com 
À: Rules Users List rules-users@lists.jboss.org 
Envoyé: Jeudi 9 Août 2012 20:31:29 
Objet: Re: [rules-users] Audit Logs: Business Case? Any pearls of wisdom? 

If you need to keep track of changes in your WM database, a property change 
listener is one solution. In addition with an AgendaEventListener listening to 
rules being fired you should be able to document what was done and by which 
rule. I'd say it is common sense to have this in a business application that 
uses rule to modify data. 

There are simpler scenarios such as validating or analyzing data where it 
might not be necessary (after testing). 

-W 


On 9 August 2012 20:14, BenjaminWolfe  benjamin.e.wo...@gmail.com  wrote: 


Hello all, 

My company is just venturing into Drools, and I'd like to help make the 
endeavor as successful as possible. We'll be incorporating the rules engine 
into a broad range of use cases (depending on how successful the first few 
are, of course), with a wide range of business users, most of them using the 
Guvnor interface. 

It seems to me we'll want some sort of audit log in the form of a 
transaction-level table, simply to answer the question (in any given case, 
for any reason) of /what happened?/. On the other hand, a transaction-level 
table -- for a whole set of rules -- for a *lot* of facts (built up over 
time) -- could get pretty big. And our tech folks might not want to 
allocate resources to store and maintain the table. So I have a couple of 
questions for the more experienced Drools users: 

1. How might you build a solid business case for such logging? Do you have 
any specific examples of the problems an audit log would solve, or the 
benefits it would create? 
2. How common is it to keep audit logs? Do almost all of your projects 
include them, almost none, or somewhere in between? 
3. Maybe I'm missing some nuance. Do you include audit logs of some rules 
fired, in some applications, but not others? Any other nuggets of wisdom? 

Thanks everyone, 
Benjamin 



-- 
View this message in context: 
http://drools.46999.n3.nabble.com/Audit-Logs-Business-Case-Any-pearls-of-wisdom-tp4019073.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 

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


Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

2012-08-10 Thread Zhong, Jason
A simple solution is to pass in a string list and for each rule that is fired, 
append the rule name to the list. Example

In your Java code declare:
class RuleLog {
List log = new ArrayList();
public void add(String logEntry) {
log.add(logEntry);
}   
...
}

Then insert an instance of RuleLog as a fact to the rules engine. The log 
entries generated can be retrieved after the rule session is completed.

In your rule:

rule foo
   when 

logger: RuleLog()
   Then
// this will add the current rule name to the log when this rule is 
fired
logger.add(drools.getRule().getName())
...
end

Jason




-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Rana
Sent: Thursday, August 09, 2012 5:00 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

Hi Davide, your second guess is right. Sorry I should have said failed
condition.

I wanted to know which rule got fired and which one did not (because the
condition failed in when clause).

I wanted to know those, because we have requirement which asks for what are
the rules which have passed and failed copnditions, so that we can make some
decisions.

Also, I wanted to know that in a rule

rule name
when
//condition
then
   //consequence
end

when the condition is failed will the rule goes to consequence or not.  (I
am fairely new to Drools. sorry).

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019077.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] Anyway to get Failed Reason for Failed Rule?

2012-08-10 Thread FrankVhh
Hi there,

Just a minor remark.

If you prefer this way of working, do not add the log as a Fact. Add it as a
global. Otherwise, it would clutter the rete tree and slow down the
execution.

Unless you want to use the RuleLog to control the further execution, that
is.

Regards,
Frank


jasonxzhong wrote
 
 A simple solution is to pass in a string list and for each rule that is
 fired, append the rule name to the list. Example
 
 In your Java code declare:
 class RuleLog {
   List log = new ArrayList();
   public void add(String logEntry) {
   log.add(logEntry);
   }   
 ...
 }
 
 Then insert an instance of RuleLog as a fact to the rules engine. The log
 entries generated can be retrieved after the rule session is completed.
 
 In your rule:
 
 rule foo
when 
   
   logger: RuleLog()
Then
   // this will add the current rule name to the log when this rule is 
 fired
   logger.add(drools.getRule().getName())
   ...
 end
 
 Jason
 
 
 
 
 -Original Message-
 From: rules-users-bounces@.jboss [mailto:rules-users-bounces@.jboss] On
 Behalf Of Rana
 Sent: Thursday, August 09, 2012 5:00 PM
 To: rules-users@.jboss
 Subject: Re: [rules-users] Anyway to get Failed Reason for Failed Rule?
 
 Hi Davide, your second guess is right. Sorry I should have said failed
 condition.
 
 I wanted to know which rule got fired and which one did not (because the
 condition failed in when clause).
 
 I wanted to know those, because we have requirement which asks for what
 are
 the rules which have passed and failed copnditions, so that we can make
 some
 decisions.
 
 Also, I wanted to know that in a rule
 
 rule name
 when
 //condition
 then
//consequence
 end
 
 when the condition is failed will the rule goes to consequence or not.  (I
 am fairely new to Drools. sorry).
 
 Thanks.
 
 
 
 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019077.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/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019088.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] Eclipse, Groovy and Drools - java.lang.NoClassDefFoundError

2012-08-10 Thread jasonxzhong
Do you use Groovy class in your rules? I had similar though not exact class
loading issue with Groovy when building rules on Guvnor.  Groovy pulls in a
lot of Java runtime classes for things like dynamic typing etc. and I
suspect you may have to add the jars that contain the missing classes to the
runtime class path. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Eclipse-Groovy-and-Drools-java-lang-NoClassDefFoundError-tp3355184p4019089.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] Eclipse, Groovy and Drools - java.lang.NoClassDefFoundError

2012-08-10 Thread ANDREI DIEGO CARDOSO
Hi Jason,

Appreciate your help. I just got to the point I was missing. I didn't have the 
GEF installed in my Eclipse environment.

Just installed and it worked.

Thanks again.
 
De: jasonxzhong jason.zh...@ellucian.com
Para: rules-users@lists.jboss.org 
Enviadas: Sexta-feira, 10 de Agosto de 2012 10:26
Assunto: Re: [rules-users] Eclipse, Groovy and Drools - 
java.lang.NoClassDefFoundError
 
Do you use Groovy class in your rules? I had similar though not exact class
loading issue with Groovy when building rules on Guvnor.  Groovy pulls in a
lot of Java runtime classes for things like dynamic typing etc. and I
suspect you may have to add the jars that contain the missing classes to the
runtime class path. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Eclipse-Groovy-and-Drools-java-lang-NoClassDefFoundError-tp3355184p4019089.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


[rules-users] Best design pattern for: Set of events with countdown timers?

2012-08-10 Thread dunnlow
Hi,

I am receiving events from a group of about 15 different event producers -
each with different names (located in the message).  I want to make sure
that I get at least one event from each of those 15 producers within a
pre-determined period of time; the period can be different for each
producer.  

I am planning to use a template rule to relate producer name to time period. 
Then, I'll insert a myTimoutObject for each producer (not quite sure yet
where/how I'll do that) which will count down from the provided time period
and trigger an alert condition if they reach zero (and reset whenever a
new event from that producer arrives into the ksession).  

Does anyone have experience with a better way to implement this count-down
pattern?

Thanks for any insight,
-J



--
View this message in context: 
http://drools.46999.n3.nabble.com/Best-design-pattern-for-Set-of-events-with-countdown-timers-tp4019091.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] Best design pattern for: Set of events with countdown timers?

2012-08-10 Thread Vincent LEGENDRE
did you check here : 
http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-td3907955.html
 

- Mail original -

De: dunnlow dunn...@yahoo.com 
À: rules-users@lists.jboss.org 
Envoyé: Vendredi 10 Août 2012 16:19:33 
Objet: [rules-users] Best design pattern for: Set of events with countdown 
timers? 

Hi, 

I am receiving events from a group of about 15 different event producers - 
each with different names (located in the message). I want to make sure 
that I get at least one event from each of those 15 producers within a 
pre-determined period of time; the period can be different for each 
producer. 

I am planning to use a template rule to relate producer name to time period. 
Then, I'll insert a myTimoutObject for each producer (not quite sure yet 
where/how I'll do that) which will count down from the provided time period 
and trigger an alert condition if they reach zero (and reset whenever a 
new event from that producer arrives into the ksession). 

Does anyone have experience with a better way to implement this count-down 
pattern? 

Thanks for any insight, 
-J 



-- 
View this message in context: 
http://drools.46999.n3.nabble.com/Best-design-pattern-for-Set-of-events-with-countdown-timers-tp4019091.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


[rules-users] Web decision tables (Guvnor)

2012-08-10 Thread Stephen Masters
Hi folks,

Given a decision table a bit like this (hopefully the monospaced font lays it 
out ok!):

Account Currency CanTrade
   1   EUR   Y
   1   USD   Y
   1   IDR   Y
   1 Otherwise   N
   2   EUR   Y
   2   USD   Y
   2 Otherwise   N

LHS conditions are generated a bit like this:
account == 1, currency == 'EUR'
account == 1, currency == 'USD'
account == 1, currency == 'IDR'
account == 1, currency not in ('EUR', 'USD', 'IDR')
account == 2, currency == 'EUR'
account == 2, currency == 'USD'
account == 2, currency not in ('EUR', 'USD', 'IDR')

… which has the effect that for account 2, currency IDR, the rule does not 
fire. For the business analysts building the rules, this does't make a lot of 
sense, as they're expecting it to mean:
account == 2, currency not in ('EUR', 'USD')

Unfortunately this means that if a currency is permitted for one account, then 
a row must be added for every other account, indicating that the currency is 
not permitted.

I'm trying to achieve a sensible default (fire the rule to reject the trade) 
unless the currency is explicitly permitted.

Is there a decent mechanism for achieving this in a decision table?

One alternative I can think of is to create a technical rule which logically 
inserts a rejection which exists as long as this rule hash't fired. But I would 
really prefer to avoid doing anything like that, as I reckon it would be 
something of a maintenance nightmare.

Any thoughts?

Cheers,

Steve

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


Re: [rules-users] Web decision tables (Guvnor)

2012-08-10 Thread Michael Anstis
Hi Stephen,

You've made my afternoon ;)

The operation of otherwise is rather dumb. It does not have any
understanding of what groups of rows it is meant to limit it's search of
values to construct the not in part.

As you have discovered, in your case, the Account column has no
significance at all (to the web-guided decision table) although it does to
the business analyst.

The immediate workaround would be to move each group to a different
decision table; i.e. Account=1 and Account=2. I appreciate your example is
probably a simplification of the real problem.

A better solution would be to furnish the otherwise value with the
information it would need to determine it's search range. e.g. define
otherwise with a key column of Account. This is however an enhancement
:(

Feel free to raise a JIRA (for GUVNOR)... no promises as to when I'll get a
chance to do anything about it though :(

More complex requirements exist, for example given:-

Account Qualifier Currency   CanTrade
   1  A EUR Y
   1  A USD Y
   1  B IDR Y
   1  A   Otherwise N
   2  A EUR Y
   2  B USD Y
   2  B   Otherwise N

Account=1, Qualifier=A, Otherwise = not in (EUR, USD)
Account=1, Qualifier=B, There is no otherwise
Account=2, Qualifier=A, There is no otherwise
Account=2, Qualifier=B, Otherwise = not in (USD) etc

So Otherwise will need a set of key\group columns.

With kind regards,

Mike

On 10 August 2012 15:50, Stephen Masters stephen.mast...@me.com wrote:

 Hi folks,

 Given a decision table a bit like this (hopefully the monospaced font lays
 it out ok!):

 Account Currency CanTrade
1   EUR   Y
1   USD   Y
1   IDR   Y
1 Otherwise   N
2   EUR   Y
2   USD   Y
2 Otherwise   N

 LHS conditions are generated a bit like this:
 account == 1, currency == 'EUR'
 account == 1, currency == 'USD'
 account == 1, currency == 'IDR'
 account == 1, currency not in ('EUR', 'USD', 'IDR')
 account == 2, currency == 'EUR'
 account == 2, currency == 'USD'
 account == 2, currency not in ('EUR', 'USD', 'IDR')

 … which has the effect that for account 2, currency IDR, the rule does not
 fire. For the business analysts building the rules, this does't make a lot
 of sense, as they're expecting it to mean:
 account == 2, currency not in ('EUR', 'USD')

 Unfortunately this means that if a currency is permitted for one account,
 then a row must be added for every other account, indicating that the
 currency is not permitted.

 I'm trying to achieve a sensible default (fire the rule to reject the
 trade) unless the currency is explicitly permitted.

 Is there a decent mechanism for achieving this in a decision table?

 One alternative I can think of is to create a technical rule which
 logically inserts a rejection which exists as long as this rule hash't
 fired. But I would really prefer to avoid doing anything like that, as I
 reckon it would be something of a maintenance nightmare.

 Any thoughts?

 Cheers,

 Steve


 ___
 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] Web decision tables (Guvnor)

2012-08-10 Thread Vincent LEGENDRE
Hi

I was wondering why you need the otherwise here.
May be it is only because you have simplified your sample, but the table you 
sent is like a truth-table telling what currency can be converted for a 
particular account.
So, as you have a 2 state answer, you can simply add rules to specify the 
true answer, by modifying the answer flag that is set to false initially. In 
other words, you cannot convert the currency unless a rule have triggered to 
set the flag to true. Or if you use a fact to store the answer, if the fact is 
there you can convert, if not (because no rule had triggered) you can't convert.

This way, your table becomes quite simple, but I don't know if my assumption is 
generalizable to your whole application.

- Original Message -

From: Michael Anstis michael.ans...@gmail.com
To: Rules Users List rules-users@lists.jboss.org
Sent: Friday, August 10, 2012 5:07:54 PM
Subject: Re: [rules-users] Web decision tables (Guvnor)

Hi Stephen,

You've made my afternoon ;)

The operation of otherwise is rather dumb. It does not have any understanding 
of what groups of rows it is meant to limit it's search of values to construct 
the not in part.

As you have discovered, in your case, the Account column has no significance at 
all (to the web-guided decision table) although it does to the business analyst.

The immediate workaround would be to move each group to a different decision 
table; i.e. Account=1 and Account=2. I appreciate your example is probably a 
simplification of the real problem.

A better solution would be to furnish the otherwise value with the 
information it would need to determine it's search range. e.g. define 
otherwise with a key column of Account. This is however an enhancement :(

Feel free to raise a JIRA (for GUVNOR)... no promises as to when I'll get a 
chance to do anything about it though :(

More complex requirements exist, for example given:-


Account Qualifier Currency CanTrade
1 A EUR Y
1 A USD Y
1 B IDR Y
1 A Otherwise N
2 A EUR Y
2 B USD Y
2 B Otherwise N
Account=1, Qualifier=A, Otherwise = not in (EUR, USD)
Account=1, Qualifier=B, There is no otherwise
Account=2, Qualifier=A, There is no otherwise
Account=2, Qualifier=B, Otherwise = not in (USD) etc

So Otherwise will need a set of key\group columns.

With kind regards,

Mike

On 10 August 2012 15:50, Stephen Masters  stephen.mast...@me.com  wrote: 




Hi folks,


Given a decision table a bit like this (hopefully the monospaced font lays it 
out ok!):


Account Currency CanTrade
1 EUR Y
1 USD Y
1 IDR Y
1 Otherwise N
2 EUR Y
2 USD Y
2 Otherwise N


LHS conditions are generated a bit like this:
account == 1, currency == 'EUR'
account == 1, currency == 'USD'
account == 1, currency == 'IDR'
account == 1, currency not in ('EUR', 'USD', 'IDR')
account == 2, currency == 'EUR'
account == 2, currency == 'USD'
account == 2, currency not in ('EUR', 'USD', 'IDR')


… which has the effect that for account 2, currency IDR, the rule does not 
fire. For the business analysts building the rules, this does't make a lot of 
sense, as they're expecting it to mean:
account == 2, currency not in ('EUR', 'USD')


Unfortunately this means that if a currency is permitted for one account, then 
a row must be added for every other account, indicating that the currency is 
not permitted.


I'm trying to achieve a sensible default (fire the rule to reject the trade) 
unless the currency is explicitly permitted.


Is there a decent mechanism for achieving this in a decision table?


One alternative I can think of is to create a technical rule which logically 
inserts a rejection which exists as long as this rule hash't fired. But I would 
really prefer to avoid doing anything like that, as I reckon it would be 
something of a maintenance nightmare.


Any thoughts?


Cheers,


Steve


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





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

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


Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

2012-08-10 Thread Rana
ok this is what I have done.

I have create a ResourceChangeScannerConfiguration and applying the
changeSet to load the files dynamically.
then I have created a KnowledgeAgent and then knowledgebase from Agent.

Then in another class I have created knowledgeSession adding EventListeners
and logging in each overriden method inside it.

Now to fire rules

session.fireUntilHalt(AgendaFilter arg); //what will be AgendaFilter here?

I am guessing it is the Agenda-Group from my rule file. But how to get it?

Also I have dynamically loaded all the rule files, now how am I suppose to
get session on the specific rule file that I want to fire on?

Please let me know.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019096.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] Web decision tables (Guvnor)

2012-08-10 Thread Wolfgang Laun
If any of the positive rules for a Trade (account==N,
currency==XYZ) were to modify or retract the fact a single
low-salience technical rule triggering on the modified or remaining
fact would be sufficient to implement an otherwise for everything.
Which account and which currency is available from the fact itself.

If modifying or retracting is out, consider inserting a Done fact
referring to the Trade, and the low-salience rule is almost as simple.
-W

On 10/08/2012, Stephen Masters stephen.mast...@me.com wrote:
 Hi folks,

 Given a decision table a bit like this (hopefully the monospaced font lays
 it out ok!):

 Account Currency CanTrade
1   EUR   Y
1   USD   Y
1   IDR   Y
1 Otherwise   N
2   EUR   Y
2   USD   Y
2 Otherwise   N

 LHS conditions are generated a bit like this:
   account == 1, currency == 'EUR'
   account == 1, currency == 'USD'
 account == 1, currency == 'IDR'
   account == 1, currency not in ('EUR', 'USD', 'IDR')
   account == 2, currency == 'EUR'
   account == 2, currency == 'USD'
   account == 2, currency not in ('EUR', 'USD', 'IDR')

 … which has the effect that for account 2, currency IDR, the rule does not
 fire. For the business analysts building the rules, this does't make a lot
 of sense, as they're expecting it to mean:
   account == 2, currency not in ('EUR', 'USD')

 Unfortunately this means that if a currency is permitted for one account,
 then a row must be added for every other account, indicating that the
 currency is not permitted.

 I'm trying to achieve a sensible default (fire the rule to reject the trade)
 unless the currency is explicitly permitted.

 Is there a decent mechanism for achieving this in a decision table?

 One alternative I can think of is to create a technical rule which logically
 inserts a rejection which exists as long as this rule hash't fired. But I
 would really prefer to avoid doing anything like that, as I reckon it would
 be something of a maintenance nightmare.

 Any thoughts?

 Cheers,

 Steve



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


Re: [rules-users] Web decision tables (Guvnor)

2012-08-10 Thread Stephen Masters
Thanks for the feedback chaps.

Wolfgang / Vincent - The real application is evaluating what products (FX 
swaps, options, forwards, etc) a particular account is permitted to trade with 
different banks. The example provided was rather simplified, just to 
demonstrate the workings of a decision table and what I was hoping to do with 
it. The way the system is designed, there should always be a rule within that 
table, firing and inserting a new fact into working memory. The system collates 
responses from a variety of rules in order to provide detailed responses on why 
a particular transaction is permitted or not.

My thinking for now is that I'll break it into separate tables, which as per 
Mike's response will at least get the 'otherwise' working in a more readable 
manner. An added benefit is that this particular decision table had hit a few 
hundred rows, and it's looking like a table-per-account approach will be more 
manageable. Somewhat like Wolfgang's idea, I think I may handle the potential 
of these rules not firing through a separate technical rule which looks to see 
whether a rule response fact has been inserted by one of these rules. It's not 
too tricky to do, but I had hoped there might be a neater way to do it within 
the decision tables. Where possible I like to keep my rules nicely encapsulated 
so that future developers won't be caught out by 'hidden' technical rules, 
which are tightly coupled to rules which are managed by the business within 
Guvnor.

Mike - I'll have a think on wording a Jira enhancement request. I think it 
would be useful, so if it's in Jira, then at least it might get built at some 
point in the future in the unlikely case that you find yourself with some time 
to kill. ;)

Many thanks all,

Steve


On 10 Aug 2012, at 17:00, Wolfgang Laun wrote:

 If any of the positive rules for a Trade (account==N,
 currency==XYZ) were to modify or retract the fact a single
 low-salience technical rule triggering on the modified or remaining
 fact would be sufficient to implement an otherwise for everything.
 Which account and which currency is available from the fact itself.
 
 If modifying or retracting is out, consider inserting a Done fact
 referring to the Trade, and the low-salience rule is almost as simple.
 -W
 
 On 10/08/2012, Stephen Masters stephen.mast...@me.com wrote:
 Hi folks,
 
 Given a decision table a bit like this (hopefully the monospaced font lays
 it out ok!):
 
 Account Currency CanTrade
   1   EUR   Y
   1   USD   Y
   1   IDR   Y
   1 Otherwise   N
   2   EUR   Y
   2   USD   Y
   2 Otherwise   N
 
 LHS conditions are generated a bit like this:
  account == 1, currency == 'EUR'
  account == 1, currency == 'USD'
account == 1, currency == 'IDR'
  account == 1, currency not in ('EUR', 'USD', 'IDR')
  account == 2, currency == 'EUR'
  account == 2, currency == 'USD'
  account == 2, currency not in ('EUR', 'USD', 'IDR')
 
 … which has the effect that for account 2, currency IDR, the rule does not
 fire. For the business analysts building the rules, this does't make a lot
 of sense, as they're expecting it to mean:
  account == 2, currency not in ('EUR', 'USD')
 
 Unfortunately this means that if a currency is permitted for one account,
 then a row must be added for every other account, indicating that the
 currency is not permitted.
 
 I'm trying to achieve a sensible default (fire the rule to reject the trade)
 unless the currency is explicitly permitted.
 
 Is there a decent mechanism for achieving this in a decision table?
 
 One alternative I can think of is to create a technical rule which logically
 inserts a rejection which exists as long as this rule hash't fired. But I
 would really prefer to avoid doing anything like that, as I reckon it would
 be something of a maintenance nightmare.
 
 Any thoughts?
 
 Cheers,
 
 Steve
 
 
 
 ___
 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] guvnor 5.4 final turning off authentication

2012-08-10 Thread Michael Anstis
Guvnor 5.4 uses Seam 3 whereas Guvnor 5.3 used Seam 2.

At the same time the org.drools.guvnor.server.security.NilAuthenticator was
removed.

AFAIK you should be able to copy
org.drools.guvnor.server.security.DemoAuthenticator and have it
authenticate regardless of user credentials.

http://docs.jboss.org/seam/3/security/latest/reference/en-US/html/security-authentication.html#d0e212might
be of assistance.

With kind regards,

Mike

On 7 August 2012 15:20, mpgong michael.p.g...@lmco.com wrote:

 Hello,

 I'm trying to upgrade from 5.3 to 5.4 and i guess i must have configured
 5.3
 to not authenticate when accessing the resources in guvnor like the
 binaries, etc using the REST api because when i try to access them under
 5.4
 i'm getting the 401 response.

 I read that security is configured in the beans.xml i believe but not sure
 how to do it properly.  I basically want to have no authentication.  In 5.3
 i believe this was achieved changing the components.xml and adding this
 security:identity
 authenticate-method=#{nilAuthenticator.authenticate}/.

 How do i this under 5.4?

 Thanks.



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/guvnor-5-4-final-turning-off-authentication-tp4019042.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