Re: [rules-users] CLOSED - JUnit Test, Mockito, AgendaEventListener Problem.

2013-09-23 Thread melchoir55
If this is fixed, could you please explain how you fixed it? Thank you.

-Reposting after joining mailing list.



--
View this message in context: 
http://drools.46999.n3.nabble.com/JUnit-Test-Mockito-AgendaEventListener-Problem-tp4025470p4026100.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] performance of ruleflowGroup

2013-09-23 Thread Mark Proctor
In 5.x ruleflow groups do not impact performance at all. All rules are 
evaluated at all times, when data is changed, regardless of the group they are 
in.

In 6.x only rules for the active ruleflowgroup are evaluated.

In 5.x if you are having performance issues, I'd recommend a root context 
pattern to short circuit the network evaluation. In 6.x that is not necessary.

Mark
On 23 Sep 2013, at 07:43, ashish6276  wrote:

> Hi
> 
>   I am exploring ruleflow. Can somebody help me in knowing how
> RuleFlOWGROUP  affects the performance of rules. Say i have 1 lakh rules.
> what will be difference in performance if i keep all rules without any group
> and if i group rules in diff small small ruleflowgroup and then create a
> processflow to execute the flow in such a way where selected ruleflowgroup
> will be used based on condition defined in process flow.
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/performance-of-ruleflowGroup-tp4026085.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] Indicating "used" rules

2013-09-23 Thread Wolfgang Laun
Usually a set of rules fires all rules when you call fireAllRules. So,
what's keeping you from collecting the solutions derived from the
fired rules and presenting them in some order to the user?

If the sequental addition or update of properties is interleaved with
calls to fireAllRules I'd attach a marker object "Refused" with each
rule resulting in a solution, and set its property to true when necessary.

-W

On 23/09/2013, Andrzej Grzelak  wrote:
> Hello again,
>
> Im making some kind of expert system. And now i got new problem:
>
> User is asked sequentially for propetieries of object, than I modify object
> propetieries, then i call update() and fireAllRules() to check for any
> answers.
> It is repeated for every object property till we fire rule with answer.
>
> Now problem comes : When user decline answer we need to find another one.
> But first answer will fire every time now. That's not what i need
>
> Making somewhere in app list of "false answers" and then striping out them
> on return wont work. My app flow is determined by drools rule fire - if one
> of "answer rules" fires i return that answer, normally i would ask another
> question.
>
> I would need to indicate drools somehow to delete/deactivate that rule.
>
>
> Thanks for any help.
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Indicating "used" rules

2013-09-23 Thread Davide Sottara
You might also try the new Belief System capabilities.. (JTMS and/or
Defeasible), see Mark's email/blog
about how to insert "negative" or "defeated" facts


On 09/23/2013 08:18 AM, Mauricio Salatino wrote:
> yeah you can do that, you can write rules about rules activations with
> the declarative agenda feature. 
> Check this out: 
>
> http://planet.jboss.org/post/declarative_agenda_and_control_rules
>
>
> On Mon, Sep 23, 2013 at 4:06 PM, Andrzej Grzelak  > wrote:
>
> Hello again,
>
> Im making some kind of expert system. And now i got new problem:
>
> User is asked sequentially for propetieries of object, than I
> modify object propetieries, then i call update() and
> fireAllRules() to check for any answers.
> It is repeated for every object property till we fire rule with
> answer.
>
> Now problem comes : When user decline answer we need to find
> another one.
> But first answer will fire every time now. That's not what i need
>
> Making somewhere in app list of "false answers" and then striping
> out them on return wont work. My app flow is determined by drools
> rule fire - if one of "answer rules" fires i return that answer,
> normally i would ask another question.
>
> I would need to indicate drools somehow to delete/deactivate that
> rule.
>
>
> Thanks for any help.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org 
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> -- 
>  - MyJourney @ http://salaboy.com 
>  - Co-Founder @ http://www.jugargentina.org
>  - 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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Indicating "used" rules

2013-09-23 Thread rjr201
Could you post an example rule and some code that uses it? It'll make it
easier to understand what you're trying to achieve.



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Indicating-used-rules-tp4026093p4026095.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] Indicating "used" rules

2013-09-23 Thread Mauricio Salatino
yeah you can do that, you can write rules about rules activations with the
declarative agenda feature.
Check this out:

http://planet.jboss.org/post/declarative_agenda_and_control_rules


On Mon, Sep 23, 2013 at 4:06 PM, Andrzej Grzelak wrote:

> Hello again,
>
> Im making some kind of expert system. And now i got new problem:
>
> User is asked sequentially for propetieries of object, than I modify
> object propetieries, then i call update() and fireAllRules() to check for
> any answers.
> It is repeated for every object property till we fire rule with answer.
>
> Now problem comes : When user decline answer we need to find another one.
> But first answer will fire every time now. That's not what i need
>
> Making somewhere in app list of "false answers" and then striping out them
> on return wont work. My app flow is determined by drools rule fire - if one
> of "answer rules" fires i return that answer, normally i would ask another
> question.
>
> I would need to indicate drools somehow to delete/deactivate that rule.
>
>
> Thanks for any help.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - MyJourney @ http://salaboy.com 
 - Co-Founder @ http://www.jugargentina.org
 - 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] Indicating "used" rules

2013-09-23 Thread Andrzej Grzelak
Hello again,

Im making some kind of expert system. And now i got new problem:

User is asked sequentially for propetieries of object, than I modify object
propetieries, then i call update() and fireAllRules() to check for any
answers.
It is repeated for every object property till we fire rule with answer.

Now problem comes : When user decline answer we need to find another one.
But first answer will fire every time now. That's not what i need

Making somewhere in app list of "false answers" and then striping out them
on return wont work. My app flow is determined by drools rule fire - if one
of "answer rules" fires i return that answer, normally i would ask another
question.

I would need to indicate drools somehow to delete/deactivate that rule.


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

[rules-users] replace session clock at runtime

2013-09-23 Thread Alexander Wolf
Drools 5.5 

Hey guys, 

Is it possible to replace the session clock of an existing stateful knowledge 
session (STREAM mode) while it is running or at least by pausing and restarting 
it?
I need to feed old events into the session to restore a certain session state 
before switching the sessions to "realtime" mode and continue with new incoming 
events...

A code snippet would make me very happy ;) 

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


Re: [rules-users] Declared Types and Globals in different files with incremental KnowledgeAgent

2013-09-23 Thread De Rooms Brecht

Op 20/09/2013 21:23, Davide Sottara schreef:

Brecht, thanks for reporting this, but I don't think these are bugs.

Thanks for the explanations. I tested it to be sure and it works as 
expected. The "drools.agent.useKBaseClassLoaderForCompiling" option 
indeed fixes the issue unless the agent detects several files at the 
same time in which case they are processed in alphabetical order (which 
is to be expected). In that case my preprocessing hack is still useful. 
The globals are just something different than what I expected globals to 
be.


Thank you very much for the support.
1) In order to set the value of a global from a rule's RHS, you have 
to do somehting like this


drools.getKnowledgeRuntime().setGlobal( "RULES_MATCHED", newValue );

The reason is that the rule's RHS sees a reference to the original 
global... a local variable with the
same name initialized appropriately. Something like RULES_MATCHED = 0 
will only change the local

reference, not modify the global.

2) The KnowledgeAgent supports declared types incrementally.. (Esteban 
and I spent a lot of time to make

that work), but you have to set a flag in the KA's configuration:

KnowledgeAgentConfiguration aconf = 
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();

aconf.setProperty( "drools.agent.useKBaseClassLoaderForCompiling", true );

The "incremental" mode (newInstance=false) only ensures that the 
existing KnowlegeBase is updated,
tue "useKBaseClassLoaderForCompiling" will ALSO make sure that, as the 
new resources are compiled
by a KnowledgeBuilder, this is initialized with the KB's classloader, 
which has the classes for the declared types.


3) I have proposed a fix for the issue you reported the other day... 
actually two in one.

- 3a ) Runtime exceptions will be catched,
- 3b ) you **WILL NOT** be able to use primitive types with globals 
anymore.. (which would result in a RTE anyway)


Hope this help
Best
Davide



On 09/20/2013 02:18 AM, De Rooms Brecht wrote:

Dear Drools Users,

I am building a network server for drools  since the existing 
drools-server did not meet my requirements.  Since I recently found a 
bug and find the people here very helpful I'll try to explain another 
issue I encountered in the hope that it improves drools 5.6 and 6.0.
I noticed that declared types and globals don't seem to be found when 
you access them from a rule that was written in a different file. For 
the declared types I hacked around this issue by preprocessing the 
files and placing every declared type at the top of each file that 
needs it. For globals this is of course not possible.


An example is shown below. File1 is loaded from the moment the agent 
starts up, then file2 is loaded.
There is a difference when the knowledgeAgent detects the two files 
at once or one by one. In this case the KnowledgeAgent detects one 
file and then a few minutes later the other file and compiles them 
completely separately.
The idea is to keep how many rules are matched of a certain type in a 
global.


*   FILE1: global_rules_matches.drl
--
package ellipsoidfacts

// declare
global Integer RULES_MATCHED;

// initialize global
rule "initRULESMATCHED"
  salience 999
  when

  then
  RULES_MATCHED = 0;
end*

*   FILE2: testrule.drl
--
package ellipsoidfacts

   rule "Gesture_lefthook"
when

// ... any  precedent rules ...

then
System.out.println("matched gesture:  lefthook"+ RULES_MATCHED);
end*

In this particular case, my rule is not matched. I load these rules 
using a changeset xml, my knowledgeagent is set to incremental (but 
either doesnt work).
The same happens when I declare types in FILE1 and use them in FILE2. 
When I write the type declaration in both files it works perfectly.
Being the same package I assumed that these two scenarios should 
work. Am I doing something wrong or is the agent not supposed to work 
like this and should a package be in one file?


Kind Regards,
De Rooms Brecht


___
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



--
Brecht De Rooms
=
Phd Student
Vrije Universiteit Brussel
Research Group CISA(WISE) - DINF F.10.707
Department of Computer Science
Pleinlaan 2   - 1050 Brussels - Belgium
Tel. +32-2-629 1103
E-mail: bdero...@vub.ac.be
Website  http://wise.vub.ac.be/brecht-de-rooms
=

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

Re: [rules-users] Exception in thread "main" java.lang.ClassCastException: org.drools.io.impl.FileSystemResource cannot be cast to org.drools.io.InternalResource

2013-09-23 Thread AlesD
Please check if:

a) both classes are loaded by same classloader
  - Are you using Drools in web-container or in OSGi?
b) you do not have multiple classes with same name on your classpath
  - Do you have multiple drools JARs (possibly with different versions) on
classpath?

Ales



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Exception-in-thread-main-java-lang-ClassCastException-org-drools-io-impl-FileSystemResoue-tp4026030p4026088.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] How To Implement Rule Flow

2013-09-23 Thread Michael Anstis
You could use RuleFlow, sure. But you don't have to.

Consider the following:-

*1) Intermediate facts
*
when
$p : Person( age < 18 )
then
insertLogical( new Juvenile( $p ) );
end

when
$p : Person( age >= 18 )
then
insertLogical( new Adult( $p ) );
end

when
Juvenile()
then
//Whatever
end

when
Adult()
then
//Whatever
end

Both Juvenile and Adult could be declared types.

*2) Multiple patterns
*
when
$p : Person( age < 18 )
WhateverCheckYouNeedForJuveniles( )
then
//Whatever
end

when
$p : Person( age >= 18 )
WhateverCheckYouNeedForAdults( )
then
//Whatever
end



On 23 September 2013 07:24, ashish6276  wrote:

> You can do this.
>
> There is a property called ruleflowGroup. Associate this propert with all 3
> of your rule. So now your Rule 1 has ruleflowgroup 1, Rule 2 has ruleFlow
> group2 and rule3 has ruleflowgroup3.
>
> Now create a rule flow.
> create rule task 1. go to property tab. associate the ruleflowgroup1 with
> this task so your rule 1 is associated here.
> Then create a diverge node. diverge based on condition if age is greater
> than or less than 18.
> so you have 2 flow from here. create 2 more rule task. associate ruleflow
> group 2 and rule flowgroup3 with these. now add sequence flow based on your
> converge. then have a converge node. join flow coming from both way here.
> create end node.
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-To-Implement-Rule-Flow-tp4025932p4026084.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] Guvnor 5.5 Final: Can I restrict LOGIN Attempts by user

2013-09-23 Thread Zahid Ahmed
Hi,

I have a requirement to restrict login attempts to Guvnor to prevent 
BruteForceAttacks. For authentication I am using JAAS authentication with 
Guvnor.


Is there any option in Guvnor/Seam/JAAS to configure such requirement ?

E.g., A user can try a maximum of 3 unsuccessful attempts for login. If user 
fails in all 3 login attempts then the user has to wait for 5 minutes.


My Environment :

1.   JBOSS EAP 6.1.0

2.   Drools-Guvnor 5.5.0-Final;

Thanks and Best Regards,
¬
Zahid Ahmed
Senior Software Engineer | Emirates Group IT
P.O. Box 686 | Dubai, United Arab Emirates
T +971 4 203 3912| M +971   55 124 9171



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