[rules-users] Drools Flow client.getTasksAssignedAsPotentialOwner API returns duplicates - bug?

2011-03-11 Thread gs76pl
hi,

i've noticed that after creating two separate tasks (different names) for
the same user below query return 2x2=4 items from which two of them are
duplicates

minaClient.getTasksAssignedAsPotentialOwner("user","language",responseHandler)

List tasksOwned = responseHandler.getResults();

I've checked database and in fact there are only two rows in a Task table
but the above API calls multiple outer joins on different tables that cause
duplicates to be produced.

So, if this is an "intentional bug" and it is up to the calling method to
get rid of duplicates is there any other better/more efficient way of
working with tasks as it seems like the whole API is somehow flawed. I
suspect that with significant number of tasks the performance will be very
low



--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-client-getTasksAssignedAsPotentialOwner-API-returns-duplicates-bug-tp2666918p2666918.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  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


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] is is possible to insert facts into working memory from functions ?

2011-03-11 Thread groovenarula
Duh !!! Of course - I forgot the import statement. For some reason I thought
KnowledgeHelper would already be imported.

Thanks for your help once again W !

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/is-is-possible-to-insert-facts-into-working-memory-from-functions-tp2663433p2664731.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  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
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] Misunderstanding salience?

2011-03-11 Thread Leonardo Gomes
I didn't actually read through all of the thread, but it sounds to me that
you're looking for "drools.halt()", which is something that you can actually
call from the consequence part of your rules.

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 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 ca

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


[rules-users] Conflict detection problem

2011-03-11 Thread AlisterC
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


Re: [rules-users] OptionalDataException while running sample mortagage example

2011-03-11 Thread Aditya
HI All,

I am providing the changeset.xml which was not pasted properly earlier







and i using Drools 5.1 server and Guvnor 5.1
Let me know if any more information required.

Regards,
Aditya


--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/OptionalDataException-while-running-sample-mortagage-example-tp2661626p2664061.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