Re: [rules-users] Conflict detection problem

2011-03-11 Thread Swindells, Thomas
An approach that may work is to decouple the suggested results from the model 
with support for multiple values.
To do this you could define an fact type of Affirmation(String name, Object 
subject, Object value).
Where the names are a list of well known values.

You rules would then look like the following:
rule Is Major
when
$a : Applicant (age = 18)
then
insert(new Affirmation(IsMajor, $a, true));
 end

 rule Is Minor
when
$a : Applicant (age  21)
then
insert(new Affirmation(IsMajor, $a, false));
end

you can then look for contradictions with a rule like the following

rule contradiction
when
$aff1 : Affirmation()
$aff2 : Affirmation(this != aff1, name == $aff1.name, subject 
== $aff1.subject, value != $aff1.value)
then
//is both true and false, 3 and 5 etc
end

Obviously there are various way this could be enhanced or done - the 
affirmations could include the rule name to allow you to pinpoint which ones 
are producing contradictory results etc. You would also have some lower 
salience rules to actually populate your real facts with the actual results if 
a contradiction didn't occur.


Thomas


 -Original Message-
 From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
 boun...@lists.jboss.org] On Behalf Of AlisterC
 Sent: 11 March 2011 09:27
 To: rules-users@lists.jboss.org
 Subject: [rules-users] Conflict detection problem

 Greetings,

 I am working on a collaborative platform project which will contain
 datas,
 informations and knowledges
 such as buisness rules. Consequently, a rule engine is a requisite and
 I am
 testing the Drools suite.

 Because a lot of different people will be able to define rules, some
 combinations might be contradictory.
 So the rule user need to know which rules are in conflict, and
 eventually
 choose the ones to disabled to fix the problem.

 Here is my use case : I fill in a java class some information about a
 people, his hame and his age, and I want to check if he is an adult.
 Two different users have written a rule to check this. The first,
 living in
 place where a 18 years old people is an adult wrote this rule :
 ___
 rule Is Major
   when
   $a : Applicant (age = 18)
   then
   $a.setMajor( true );

 end
 ___

 The second one, write this one :
 ___
 rule Is Minor
   when
   $a : Applicant (age  21)
   then
   $a.setMajor( false );

 end
 ___

 I've tried to solve this knowledge base with a 19 years old people, but
 no
 conflict was detected.
 In fact the rules are executed sequentially and the result depends of
 the
 order the rules are called.

 My use case is very simple, but I think I am not considering it
 correctly.
 Or maybe it is impossible with forward chaining ?

 Does anyone can help me to solve this problem, by telling what is wrong
 or
 giving me some internet ressource link ?

 Thanks a lot in advance.

 --
 View this message in context: http://drools-java-rules-
 engine.46999.n3.nabble.com/Conflict-detection-problem-
 tp2664121p2664121.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


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

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


Re: [rules-users] Conflict detection problem

2011-03-11 Thread AlisterC
Thanks a lot, Thomas. I am going to test this decoupled approach.

Alister

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Conflict-detection-problem-tp2664121p2664253.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] Conflict detection problem

2011-03-11 Thread Wolfgang Laun
Some other techniques:

(1) Authors must avoid magic numbers. Define constants such as
MAX_MINOR_AGE in Java. Compiled rules could be inspected to detect literals.

(2) getters can be written to compare the old value against the argument.
(This may mean that simple types have to be avoided in fact classes to have
null as an indication.)

(3) You could use Property Change Listener, which could also be used to
inform the engine about fact changes.

(4) Listening for Working Memory Events in combination with Activation
Events could be used in combination with Java reflection to detect duplicate
updates.

-W







On 11 March 2011 11:35, AlisterC alister.cr...@dps-fr.com wrote:

 Thanks a lot, Thomas. I am going to test this decoupled approach.

 Alister

 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Conflict-detection-problem-tp2664121p2664253.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] Conflict detection problem

2011-03-11 Thread AlisterC
Thank you Wolfgang. I am a beginner with Drools, so it might take me some
time to experimente these ways. But I'll give my feedback in the next days.

Alister

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Conflict-detection-problem-tp2664121p2665008.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] Conflict detection problem

2011-03-11 Thread Esteban Aliverti
You can also take a look at drools-verifier:
http://community.jboss.org/wiki/DroolsVerifier

Best Regards,



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


On Fri, Mar 11, 2011 at 11:52 AM, AlisterC alister.cr...@dps-fr.com wrote:

 Thank you Wolfgang. I am a beginner with Drools, so it might take me some
 time to experimente these ways. But I'll give my feedback in the next days.

 Alister

 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/Conflict-detection-problem-tp2664121p2665008.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