Arjun Dhar | 1 Jun 2007 13:06
Picon
Favicon
Gravatar

[rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()

Hi,
 I'm noticing very strange behaviour on JBoss Rules 4. (Havnt confirmed on 3).

Setup:
-------
1. CreateClasses
Class ChildA1 --<Extends>--> A --<Extends>--> Base
Class ChildA2 --<Extends>--> A --<Extends>--> Base
(Base has some attribute which is obviously inherited by A1 & A2)

2. Make a collection of such objects (ChildA1, ChildA2 & A)
I make a JDK 1.5 style "List<Base>", and put A1 & A2 into that.
{I was experimenting in measuring performance differce between inherited/Child 
Node types Vs using attributes on A}

3. Later I take this list and assert into a StaelessSession.

The Bug(s): (   So I think :o)  ), n please dont say its a feature... kidding!
---------------------
Rule USE CASE - I:

rule "Test A with attrib 1"
	salience 150
	no-loop true
when 
     a1: A(attrib=="type 1")
then
 ...
 drools.getActivation().remove(); 
end
(Continue reading)

Arjun Dhar | 1 Jun 2007 13:23
Picon
Favicon
Gravatar

Re: [rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()

> This would not happen if I did not use "drools.getActivation().remove(); " 
but 
> I need to or else rules fire over the same object. But if i use it then a 
rule 
> gets deactivated without firing.

... Ok I think it's def a bug. I noticed that if i remove the number of 
repeats: W
hen I use "drools.getActivation().remove()" the number of activations is 
**roughly half** 

Well based on the '~statistics~', I'd say that an "getActivation().remove()" is 
removing 'two' activations instead of one.

Looking fwd to hear you theory and solution. Statistics are a wonderful thing, 
you can misiterpret them as you like.. lol. :o) Ok, please let me know what you 
find!

thanks,
Arjun

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Edson Tirelli | 1 Jun 2007 14:14
Favicon

Re: [rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()


    Wow, Arjun, for the pure sake of finding an eventual bug, your strategy may be acceptable, but for writing rules, using getActivation().remove() is completely invasive to the engine... I have no idea just looking at your example about the effects of doing that... I need to go through the code.

    So, may I suggest you open a JIRA with your example for us to investigate the bug? Also, I'm tempted to refactor the interface if possible to not expose the method remove() in the consequence...
    What removes does is to remove the activation from the agenda, but the activation already fired, so what's the point of removing it? It may be the case that this is also creating an inconsistent state in the engine, so we need to check if that's the case and not expose the method anymore...

    Also, maybe you can show us a more complete example of what you are trying to achieve, so we can advise you on how to do it without calling the activation remove() method.

    Thank you for reporting!

    Regards,
       Edson


2007/6/1, Arjun Dhar <dhar_ar <at> yahoo.com>:
> This would not happen if I did not use "drools.getActivation().remove(); "
but
> I need to or else rules fire over the same object. But if i use it then a
rule
> gets deactivated without firing.

... Ok I think it's def a bug. I noticed that if i remove the number of
repeats: W
hen I use "drools.getActivation().remove()" the number of activations is
**roughly half**

Well based on the '~statistics~', I'd say that an "getActivation().remove()" is
removing 'two' activations instead of one.

Looking fwd to hear you theory and solution. Statistics are a wonderful thing,
you can misiterpret them as you like.. lol. :o) Ok, please let me know what you
find!

thanks,
Arjun




_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Arjun Dhar | 2 Jun 2007 11:24
Picon
Favicon
Gravatar

Re: [rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()

>     So, may I suggest you open a JIRA with your example for us to investigate 
the bug? Also, I'm tempted to refactor the interface if possible to not expose 
the method remove() in the consequence...    What removes does is to remove the 
activation from the agenda, but the activation already fired, so what's the 
point of removing it? It may be the case that this is also creating an 
inconsistent state in the engine, so we need to check if that's the case and 
not expose the method anymore...
>     Also, maybe you can show us a more complete example of what you are 
trying to achieve, so we can advise you on how to do it without calling the 
activation remove() method.    Thank you for reporting!    Regards,       Edson

Hi Edson,
 For a large number of rules comming from decison tables, when arranging them 
sometimes it is helpful to modularize tables; with the result of one rule-table 
driving another rule table. The preferred method is Decision table. Also this 
allows a person to lazy load rules over a set of base rules (part of the reason 
is business process and stability around an established concept. The format 
makes sense accoring to the business model also) <-- Background, so now i'll 
get to the point!

So there is a need of one set of rules (outcome) to influence another (using 
tables). Scenario is like this:

Table 1:
-----------
Rule 1.1
Rule 1.2.
Rule 1.3.

Table 2:
----------
Rule 1.2.1 (If fires will influence 1.2)
Rule 1.2.2 (If fires will influence 1.2)

>From this point on, you could suggest anything you see is not fit <----

... Thre preferred way to influence the connection = Change an attribute of the 
same object (Since the specific rule in the top table cannot fire till its 
conditions are not fullfilled); so when the attribute is set then only the 
rules in the above table will become active for that object.

So when the "Business Object" is modified in Table 2, and hence modify() is 
called.

You are right, the activation fires and is removed but due to modify() it 
causes a re-firing and puts some already fired activation back in the Agenda.

Initally it hung, I realized the reason and put "no-loop". That stopped the 
recursion but I noticed certain activationse firing multiple times (Ideally I'd 
like the activation to fire and get out but here it would add it back again)
which is not acceptable.

I used "drools.getActivation().remove()" and it stopped the repeats, but then 
it was removing subsequent activations as well. I know why now. What I want to 
do is prevent this rule from firing again but inturn remove is removing the 
next activation. So the question is how to prevent the activation for that 
object not to fire again????

My problem ends here (I understand it better now, not sure it should go into 
JIRA yet. Would like your comments one more time)

About your comment about removing it. Due to the declrative nature of rules 
there are lot of conceptual barriers. So conceptual workarounds are restricted 
by the technology so we need every advantage. But then again, if you show me a 
better path to a solution I'd be more than happy.

Thanks Edson, Appreciate it!

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Geoffrey De Smet | 2 Jun 2007 11:27
Picon
Gravatar

Re: [rules-dev] Jboss snapshot repo

Sorry, the correct url is http://snapshots.jboss.org/maven2/
my bad.

I saw it in the jboss richfaces pom, so I figured it's the standaard 
jboss snapshot repo.
Idunno who's in charge of the repo's at JBoss?

AFAIK, if JBoss follows the maven guidelines it's recommended to have 2 
repo's:
1) a releases repo, which:
-- gets release artifacts deployed to it from jboss projects ("mvn 
release/deploy") upon release
-- has a number of groupId's which are synced up to central 
(repo1.maven.org). For example org.drools would be nice as then users 
will find it when they search repo1 or mvnrepository.com)
-- optionally is a proxy (see the app servers proximity or archiva) to 
central, though I'd recommend against this, as you might as well get 
them directly from central
2) a snapshot repo, which is uses if the version number ends in 
-SNAPSHOT, during development and for nightly builds.

Note that the maven guidelines figured out it's a bad idea to separate 
normal repo's from pluginRepo's (or even not keep them in sync in your 
pom.xml), but it's highly recommended to split up snapshot from non 
snapshot repo's.

With kind regards,
Geoffrey De Smet

Michael Neale wrote:
> HI Geoffrey - not sure what that does? at the time I was checking that 
> repo was not available.
> 
> Michael.
> 
> On 5/28/07, *Geoffrey De Smet* < ge0ffrey.spam <at> gmail.com 
> <mailto:ge0ffrey.spam <at> gmail.com>> wrote:
> 
>     I took a quick look at seam and richfaces, and it looks like it
>     might be
>     interesting to add this to the <repositorie> entry in the parent pom:
> 
>          <repository>
>            <id>jboss-snapshots</id>
>            <url> http://snapshots.jboss.com/maven2/</url>
>          </repository>
> 
> 
>     --
>     With kind regards,
>     Geoffrey De Smet
> 
>     _______________________________________________
>     rules-dev mailing list
>     rules-dev <at> lists.jboss.org <mailto:rules-dev <at> lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-dev
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rules-dev mailing list
> rules-dev <at> lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Edson Tirelli | 2 Jun 2007 17:43
Favicon

Re: [rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()


   Arjun,

   Did you tried to use agenda-groups and/or rule-flow to control the sequence of execution (assuming of course you are using 4.0MR2 or later)?

   Basically the idea of these features is to implement phased rules firing, or as the name says, "rule flows"... so, for instance, if you are using agenda-groups, you can have all your rules for each table in a different agenda-group: "table 1", "table 2", etc... when the condition to move focus from one agenda-group to other is met ( for instance, table1->table2), you change the focus to the table2 agenda-group and then, even doing modify in objects that would usually trigger rules from table 1, the agenda group prevents that from happening. So you have your phased execution.
   Rule-flow kind of does the same thing, but is more flexible and powerful (a bit more complex too), allowing conditional transitions and a graphical design of you rule groups.

   Unfortunately there are not many docs out there, but you can get some info from the wiki and the blog... also, keep asking your questions in the list and maybe give us a hand on documenting the features you eventually use so others can benefit too.

   Think that using agenda.remove(), besides being conceptually inappropriate, will only cause you headaches. I'm sure there are ways of expressing your rules without incurring in such "technical rules-engine specific hacks".

   Hope it helps,
        Edson

2007/6/2, Arjun Dhar <dhar_ar <at> yahoo.com>:
>     So, may I suggest you open a JIRA with your example for us to investigate
the bug? Also, I'm tempted to refactor the interface if possible to not expose
the method remove() in the consequence...    What removes does is to remove the
activation from the agenda, but the activation already fired, so what's the
point of removing it? It may be the case that this is also creating an
inconsistent state in the engine, so we need to check if that's the case and
not expose the method anymore...
>     Also, maybe you can show us a more complete example of what you are
trying to achieve, so we can advise you on how to do it without calling the
activation remove() method.    Thank you for reporting!    Regards,       Edson

Hi Edson,
For a large number of rules comming from decison tables, when arranging them
sometimes it is helpful to modularize tables; with the result of one rule-table
driving another rule table. The preferred method is Decision table. Also this
allows a person to lazy load rules over a set of base rules (part of the reason
is business process and stability around an established concept. The format
makes sense accoring to the business model also) <-- Background, so now i'll
get to the point!

So there is a need of one set of rules (outcome) to influence another (using
tables). Scenario is like this:

Table 1:
-----------
Rule 1.1
Rule 1.2.
Rule 1.3.


Table 2:
----------
Rule 1.2.1 (If fires will influence 1.2)
Rule 1.2.2 (If fires will influence 1.2)

>From this point on, you could suggest anything you see is not fit <----

... Thre preferred way to influence the connection = Change an attribute of the
same object (Since the specific rule in the top table cannot fire till its
conditions are not fullfilled); so when the attribute is set then only the
rules in the above table will become active for that object.

So when the "Business Object" is modified in Table 2, and hence modify() is
called.

You are right, the activation fires and is removed but due to modify() it
causes a re-firing and puts some already fired activation back in the Agenda.

Initally it hung, I realized the reason and put "no-loop". That stopped the
recursion but I noticed certain activationse firing multiple times (Ideally I'd
like the activation to fire and get out but here it would add it back again)
which is not acceptable.

I used "drools.getActivation().remove()" and it stopped the repeats, but then
it was removing subsequent activations as well. I know why now. What I want to
do is prevent this rule from firing again but inturn remove is removing the
next activation. So the question is how to prevent the activation for that
object not to fire again????

My problem ends here (I understand it better now, not sure it should go into
JIRA yet. Would like your comments one more time)

About your comment about removing it. Due to the declrative nature of rules
there are lot of conceptual barriers. So conceptual workarounds are restricted
by the technology so we need every advantage. But then again, if you show me a
better path to a solution I'd be more than happy.

Thanks Edson, Appreciate it!

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Arjun Dhar | 4 Jun 2007 03:29
Picon
Favicon
Gravatar

Re: [rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()

Edson Tirelli <tirelli <at> post.com> writes:

>    Arjun,   Did you tried to use agenda-groups 

Thanks Edson,

Comment #1) Decision Tables do not support "Agenda-Group" for some strange 
reason I cant figure out. Please see: DefaultRuleSheetListener
(But It is defined in ActionType, .... strange!)

Question 1) Can someone there modify it to include this as a patch? Am sure it 
wont be much effort. I could do it (should I modify the base or provide an 
extension??), but not sure if it would feed back ASAP into your code base :o) 

Comment #2) Another request. Many a time for the same business rules, one may 
want to turn activation-group on or off; using a global config. Is there some 
way of controlling them without touching the rules? This would be a great 
feature if not already present as it would allow people to re-use their rules 
without having to touch them.
Question 2) Does this already exist? Example: For a Rulebase turn on activation-
group feature or turn it off.

Comment #3) I had a feeling you'd mention 'rule flows' :o) but unfortunatley 
because it was just released and requires more study its a risk for 
implementation and requires a higer learning curve for business and also the 
way business would like to express rules, so currently not practical for me.
Decision tables currently has a great market appeal. I'm sure I can phase it 
off once Rule flows gains maturity and will contribute back by researching on 
it in the mean time.

Thanks & regards,
Arjun

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Michael Neale | 4 Jun 2007 07:06
Picon
Gravatar

[rules-dev] hold off on checking in to org.drools.brms.client.modeldriven.brxml for a few days PLEASE !

I am working on reworking some of the model, GUI etc to cope with the awesome new expressiveness that Edson went and put in. It may take me a couple of goes/days so please hold off working on anything that touches on the RuleModel, the widgets that edit it or the DRLPersistence stuff.

Thanks,

Michael.

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Mark Proctor | 5 Jun 2007 05:51

[rules-dev] change "assert" to "insert"+ other changes

I've had no further feedback on this, so I'm going to make this change as part of the next milestone release (this week) - these changes are considerable.

assert will change to insert
-avoid the constant keyword collision with "assert", most languages are seem to support this now
-will change in both the drl and working memory api

modify to become update
-instead of workingMemory.modify(FactHandle, Object) it will be workingMemory.update(FactHandle, Object), will change modify to update in drl.
-this method is now only used for ShadowFact objects, it's  a method to let the engine know that an external object has been updated and to update it's internal cache. and reprocess.
-avoid keyword collision in MVEL which has nice "modify" sugar now

insertObject, retractObject and updateObject to beome insert, retract and update
-the Object part seems superflous, might as well remove it, especially as we start to support none Object fact types
-drl and working memory api will now use the same method names.

added new WorkingMemory modifyRetract and modifyAssert methods
-allows for non shadow fact objects.
-When not using shadow facts (although will ofcourse work with shadow facts) you cannot call 'update', or what use to be called 'modify', because we need to know the "old" value of fields so we can retract the from the workign memory. The only safe way is to first retract the object and then assert it. However with the existing api this adds extra work and results in new fact handle. modifyRetract and modifyAssert can now be used together to "simulate" a modify on a none shadow fact object in two parts. First call modifyRetract, then change your field values, then call modifyAssert.
-MVEL has sugar to do: modify ( person ) { age += 1, location = "london" }, what actually happens here is it first calls modifyRetract then applies the setters and then calles modifyAssert.

Mark

Greg Barton wrote:
I think it's a good idea, so ya, change to "insert" GreG --- Mark Proctor <mproctor <at> codehaus.org> wrote:
We have been getting querries with regards to jdk assert collision and jboss rules assert, for this reason we are thinking of changing it to insert for 4.0. Further to that its causing language integrations issues for us as we expand pluggeable dialects. For this reason we are thinking of chaning assert to insert, this would be an api change and a language level change. I'd thought I'd throw this out to the community before we do it. This of course breaks backwards compatability. Mark _______________________________________________ rules-dev mailing list rules-dev <at> lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev
____________________________________________________________________________________Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. http://new.toolbar.yahoo.com/toolbar/features/norton/index.php _______________________________________________ rules-dev mailing list rules-dev <at> lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Andrew Kinard | 6 Jun 2007 02:08
Picon
Favicon

[rules-dev] Who is in charge of Rules Management System development?

Hello all,

I'm new to this list, but I've been using JBoss Rules (Drools) for  
about 2 years.  I'm interested in alpha/beta testing the JBoss  
Business Rules Management System in whatever form it currently has.   
Who is in charge of development for this portion of the JBoss Rules  
project?  Can I get a copy of the current development release?

Regards,
Andrew Kinard
Cisco Systems, Inc.

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev


Gmane