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-bounces(a)lists.jboss.org [mailto:rules-users-
bounces(a)lists.jboss.org] On Behalf Of AlisterC
Sent: 11 March 2011 09:27
To: rules-users(a)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(a)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 postmaster(a)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
**************************************************************************************