Re: [rules-users] First Order Logic - METHODS in Drools

2011-04-20 Thread Arjun Dhar
ok thanks, i think i confused my notion of eval() with also its ability to
return int on calculations in some other framework.

The reason why i started this thread was to ensure in the process of Rule
engineering, I could write optimal rules in mathematical notion and not have
to worry about technical differences in how a Predicate is translated while
translation to drools. (ideally)

thanks everyone.


-
Software documentation is like sex: If its good its really really good, if not 
then its still better than nothing!
--
View this message in context: 
http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2841531p2842153.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] First Order Logic - METHODS in Drools

2011-04-20 Thread Arjun Dhar
I believe eval() solves that purpose functionally but is not optimal; not
sure how evals() tie in with Rete-OO
Specially since the return type of eval() is not known, I can seriously
doubt it being optimal as using Objects directly in conditions.

-
Software documentation is like sex: If its good its really really good, if not 
then its still better than nothing!
--
View this message in context: 
http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2841531p2842085.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] First Order Logic - METHODS in Drools

2011-04-19 Thread Arjun Dhar
According to First order Logic, (from a rule perspective), one can represent
their statements using:
PREDICATES, METHODS, CONNECTORS (including existential quantifiers)

..while PREDICATES can be synonymous with Object and Object expressions; the
only way of using methods  has been via "eval" (AFAIK, as per my outdated
knowledge); and this is discouraged for the fact that evals perhaps dont fit
in the RETE-OO scheme of things.
Please note: By methods I dont bean Bean getter/setters; but work horse
service layer methods.

..however, to be true to FOL, using methods directly should be supported.
Q1) If it is, can one show or state an example? 
Q2) If not, for METHODS that return a specific type of Object, cant they be
useful in RETE-OO evaluation?
Q3) I've used "from" for DAO's , conceptually does "from" address this
fully? In FOL (imo) PREDICATES & METHODS can be exchanged freely, not sure
if "from" gives that freedom.

thanks




--
View this message in context: 
http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2841531p2841531.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] Support for Probabilistic reasoning & FOL

2011-04-12 Thread Arjun Dhar
Hi,
 though it is clear Rule Engine (lke Drools) supports Declarative
programming and First order Logic or FOL (with existential quantifiers and
works)  am also looking for Probabilistic Reasoning.

Example: 
Fact: A U B => C; this fact exists with a probability of 0.9.
Principles namely being: Locality, Detachment, Truth functionality (i.e.
when predicates in facts are not mutually exclusive then probabilistic
calculations are not as simple as Boolean operations) etc. 

Has such theory been worked into Drools yet or are there any plans for the
future?
I'd assume the same concepts can be used on Fuzzy rules and fuzzy sets.

Am sure these are practical issues that at some point the Drools team would
have thought about. Whats the direction on this?

thanks


--
View this message in context: 
http://drools.46999.n3.nabble.com/Support-for-Probabilistic-reasoning-FOL-tp2810931p2810931.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] Drools 5.1.1 : Error reporting issue in PackageBuilder

2011-03-21 Thread Arjun Dhar
ok?! Should i file a JIRA?

--
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-5-1-1-Error-reporting-issue-in-PackageBuilder-tp2705166p2709887.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] Drools 5.1.1 : Error reporting issue in PackageBuilder

2011-03-19 Thread arjun dhar
Hi,
 I was trying out the new stable version of Drools and on faulty DRL files I 
was getting:

Exception in thread "main" java.lang.ArrayStoreException
    at java.lang.System.arraycopy(Native Method)
    at java.util.ArrayList.toArray(ArrayList.java:306)
    at org.drools.compiler.PackageBuilder.getErrors(PackageBuilder.java:1274)
    at 
org.drools.builder.impl.KnowledgeBuilderImpl.getErrors(KnowledgeBuilderImpl.java:70)
    at com.arjun.SetGame.main(SetGame.java:18)

The actual Error being:: (See Reference DRL at the end of this post)
[Unable to resolve ObjectType 'MockBoolean' : [Rule name='show_time']
, Incorrect number of arguments for interval timer 'int 5s 2m']

I'd assume it be better to have an Exception with the root cause, than a faulty 
Error trapping system, that is trapping a System generated Exception. Is this a 
bug in "PackageBuilder : Line 1274"?

Reference DRL:
package com.arjun

    rule show_time
        timer (int 5s 2m)
        when 
            MockBoolean(value == true)
        then
            System.out.println("Hey");
    end






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


[rules-users] Forrest Vs DocBook - your experience

2009-04-13 Thread Arjun Dhar
Hey,
 I think I saw Apache-Forrest being used in your docs earlier sometime. Now when
I look at the POM I see DOC Book plugin.

The Drools documentation is 'pretty' (thanks); just wanted to know if you guys
employ forrest. And Are you using the two together or your doing away with one
(and whats the reason).

Interested to hear your views/experience.

Thanks,
Arjun

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


[rules-users] Counting rules matches within a rule + optimizing evals

2009-04-11 Thread Arjun Dhar
Hi,
 I have many rules. These rules may or may not belong to the same set. However,
based on their name they can be grouped. Say all rules starting with
"Traffic_Rule", "Criminal_Rule" etc.

Q1. I want to check after assertion of a fact (A.) how many and (B.) which all
rules executed for "Traffic_Rule" and the result will fire another rule.
(So I want all this in the rules files only) - So in a way I want to collect the
consequences and based on the result of that consequence set fire more rules.

Q2. evals() are expensive. I dont think we can assign the output of an eval in
the condition to a variable; so how do I re-use an eval in a condition and then
in the consequence? (To avoid calling the function multiple times)

P.S: Can someone please do something about that spammer (Vacation Reply)

regards,
Arjun


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


[rules-users] Re: Rule Count and Consequence Sets

2009-04-07 Thread Arjun Dhar
Hey,
 any answers? Though my questions were logical and simple for guys who would 
know :)

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


[rules-users] Re: high cpu usage

2009-04-01 Thread Arjun Dhar
I dont see any mention of the rules themselves in this thread.

Check if you are using a lot of "evals" and also you may be using the same
object in all your rules; so the theoretical ReteOO performance goes for a toss
coz it does branch the tree based on object type.

If the above is what your rules look like; you know whats wrong. Re model the
object model and re mode the rules... "yeah just do everything, thanks that
helps man"!!! :)

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


[rules-users] Rule Count and Consequence Sets

2009-04-01 Thread Arjun Dhar
Hi,
 I have many rules. These rules may or may not belong to the same set. However,
based on their name they can be grouped. Say all rules starting with
"Traffic_Rule", "Criminal_Rule" etc.

Q1. I want to check after assertion of a fact (A.) how many and (B.) which all
rules executed for "Traffic_Rule" and the result will fire another rule.
(So I want all this in the rules files only) - So in a way I want to collect the
consequences and based on the result of that consequence set fire more rules.

Q2. evals() are expensive. I dont think we can assign the output of an eval in
the condition to a variable; so how do I re-use an eval in a condition and then
in the consequence? (To avoid calling the function multiple times)

regards,
Arjun

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


[rules-users] Re: wrapping drools api?

2008-09-24 Thread Arjun Dhar
Mark Proctor  codehaus.org> writes:

> 
> thomaskukofka  web.de wrote:
> > Hello,
> >
> > some people write about wrapping the Drools API with an own access API 
> > for integration in the application.
> > Sorry for the perhaps stupid question, but what is the reason for 
> > this? Does this only make sense if  I'm thinking about changing the 
> > rule engine one day?
> yes they do this for rule engine independance.
> > If I'm not intending to change the rule engine from Drools to another, 
> > so isn't it the same if the developpers has to use the native Drools 
> > API or an self-written access API?
> >
> > Regards
> > Tom
> > ___
> > rules-users mailing list
> > rules-users  lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> 
> ___
> rules-users mailing list

People also do it to shield against backward compatibility issues even with the 
same engine.

Taking nothing away from Drools, but over the past many version changes there 
have been issues migrating. Wrapping may not stop it but one can always put 
checks and balances there so the rest of the application and effective JUnit 
testing can be done layer by layer.

Regards,
Arjun
> 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] Re: Hire a programmer from JBoss Rules

2008-03-08 Thread Arjun Dhar
> 
> Don't forget the free Drools job board. Where the jobs are also listed 
> on the blog.
> http://jobs.athico.com/

Hi Mark,
 thats what I had forgotten :o) Thanks for the link!

Mark Proctor  codehaus.org> writes:




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


[rules-users] Hire a programmer from JBoss Rules

2008-03-07 Thread Arjun Dhar
Hey guys,
 I reference of mine  is interested in hiring a JBoss Rules resource for a new 
venture. To ensure the person is good I'm not throwing this to the general 
public; is it possible to contact you guys?

lemme know.

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


[rules-users] Re: Can I reuse eval output?

2007-12-12 Thread Arjun Dhar

> > evals by reusing their output?
> >   
> no
> > Another question is, is tehre something wrong in the above definition from 
a 
> > declarative programming point of view?
> >   
> its not idea - but sometimes over use of eval can't be helped - only you 
> know the answer to that, being your domain model expert.

Well, then the optimal way is to Pre-Evaluate it in the code and assert that 
variable as a Fact. But I dont think this is great from a declarative 
programming point of view.

Actually in decision table, a condition will be repeated "Row" number of times. 
So in the condition if an eval() is used; that eval is used "Row" number of 
times (though prasctically dependson other conditions, if at runtime how many 
times the eval will be used), but still it is inefficient.

I think it is important to maintain discipline when writing declarative 
staements, and should try and rely less on the code for efficient solutions.
I guess I have no choice in this case.

Thanks for you reply.

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


[rules-users] Can I reuse eval output?

2007-12-10 Thread Arjun Dhar
Hi,
 I've learned the use of eval() is not efficient, but it cannot be avoided in 
many cases.

However, using temporary variables I tried:

when
 $tmp: eval(...)
 ($tmp == false) or (eval(...))
Then
 ...
end


The above doers not compile; is there an alternative to reduce the number of 
evals by reusing their output?

Another question is, is tehre something wrong in the above definition from a 
declarative programming point of view?

Thanks,
Arjun

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


[rules-users] 'exists' asa field in an Object causes error

2007-11-29 Thread Arjun Dhar
Hi I have a BusinessObject with a field called "exists".

I think the rule engine interprets this in some special way.

Is there a way I can emphasize its a variable and not a syntax word?

Thanks,
Arjun

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


[rules-users] Indep stated Sub Conditions Vs AND

2007-11-21 Thread Arjun Dhar
Whats the difference between:

when
  
  
Then
 ...
End

Vs


when
   and 
Then
 ...
End


..Assumping I have no need to use variables between A & B, do I get a 
performance improvement using "AND" or does the Rete evaluate faster if the sub-
conditions are stated independently?


Thanks in advance


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


[rules-users] Re: Design guidelines regarding session pools

2007-11-21 Thread Arjun Dhar
Mikael Larsson  redpill.se> writes:

> 
> Hi!
> 
> Just the answer I was hoping for, thanks for the fast reply!

Hmmm, I just wished the answer was also "Well, if you have pooled them 
there is no harm" :o)

This is something that I've been concerned with from a long time. 
I do pool sessions and have not noticied anything funny so far, I guess to be 
safe I'll reconsider changing to pool the RuleBase rather than the stateless 
sessiosn itself.



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


[rules-users] Re: How and when are objects released in Stateless Session - Awsome, Thanks

2007-11-21 Thread Arjun Dhar
Mark Proctor  codehaus.org> writes:

> 
> 

Awsome! This was the exact level of detail I was looking for. Thank you soo 
much. I've been troubled abouth this for some time, and did not have time to 
dig through.

but really appreciate it, cant tell you how thankful I am.

Thanks,
Arjun



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


[rules-users] Re: How and when are objects released in Stateless Session

2007-11-17 Thread Arjun Dhar
> You cannot insert data over time into a stateless session, all data is 
> added at the same time. When the engine has finished processing it w ill 
> return and is finished, at this point as soon as the stateless session 
> is available for garbage collection the objects will be removed. There 
> is no life cycle other than the standard GC one.

> Shadows are created on non-final classes unless you tell the system not 
> to, if you are sure you don't need them you can turn them off. They can 
> be turned of for all object, or specific objectsor packages.

> no.

Am sorry I got confused with the statement "All data is added at the same time. 
When engine has finshed processing it will return finish" --> Isn't this 
applicable for a single "execute" only?

A fresh execute would imply a 'new usage' of the same session (Since it is 
stateless, else I could use new stateful sessions also each time I had to 
execute). And for this reason I cant understand why can't a stateless session 
be used indefinitely?! As each "execute" is stateless!

So what you are saying is as long a stateless session is not garbage collected, 
it will retain references too all objects asserted to it (even over multiple 
execute calls)?

i.e. session.execute() A reference to that object or its shadow will be 
maintained till GC of the session?!









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


[rules-users] How and when are objects released in Stateless Session

2007-11-15 Thread Arjun Dhar
Hi,
 can someone please explain; if a stateless session is used over a log period 
of time. How are the objects (rather the shadows to them) released?

I understand that as long as a class is not final, its shadow is created and 
used. This raises a concern about the life cycle of that object.

perhaps the cause of memory leaks in the past.

Wanted to nkow the life cycle in breif.

Thanks

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


[rules-users] Re: Fire Rules in DT based on a rule in DT

2007-11-15 Thread Arjun Dhar
Steven Williams  gmail.com> writes:

> 
> 
> I added agenda-group to decision tables in September 2006.cheersSteve

2006, or 2007? Because it was not there in JBoss Rules 4.0.0 (at least not 
documented). 

Either way, it means it exists now. So will look at the latest release 
documentation.

Thanks

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


[rules-users] Fire Rules in DT based on a rule in DT

2007-11-14 Thread Arjun Dhar
Hi,
 I have the following scenario.

SCENARIO (simplified for discussion from actual blown up scenario)
-
 1. A decision table (DT) with rules for "all types of employees" - Call 
it "Common DT"
 2. The DT mentioned in Point 1 has a condition that fetched data depending 
on "Type Of Employee"

 3. There are other decision tables that would like to use the the rules 
from "Common DT", but here are the challenges:
  
Challenges
--
1. Decision does not support Agenda Groups
2. Using a fact; to hold the evaluated result from a DT can pass it from a 
child to a parent; but it requires an "update()"; which can cause infinite 
recursion if i dont have a "Execute ONE Rule Only from Table" decision variable.

(Parent) DT - Condition 1, condition 2, Condition 3 (Actually result of Child 
DT)


(Child DT)
... The relation is maintained using decision variables.

This relation works perfenctly good (been working for 3 months now), but issue 
is it creates a Sort of a Tree (with each node a DT); in shich I cannot fire a 
common set of rules from Any Node.

As an alternative; I'm suggesting to the client to write replicated DT's for 
each type of employee instead of 1 generic DT.

Can anyone help?

I've been begging for agenda Groups in decision tables but I guess you guys are 
tied up. So at a design level can you suggest a work around?

Thanks,
Arjun

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


[rules-users] Re: Ruleflow groups in decision tables

2007-10-15 Thread Arjun Dhar
Mark Proctor  codehaus.org> writes:

> 
> 
> Knapp, Barry wrote:
> 
>   That generic attribute would sure be a nice place to put effective and
> expiration dates.
> Really looking forward to the patch :)


Ok, so whose writing the patch?

Can we have a spec of whats exactly needed?!
I've been wiating for agenda Groups in Decision tables for a long time.

I've created my own ways of forcing sequence in decision tables (using extended 
attributes in the condition itself); but theres room for elegance by using 
AGENDA Groups.

All other attribs can be coded in conditions also; so its importat to draw a 
line and say whatever falls on this side of the line is a legitimate attribute 
or else the user may use a condition as a substitute.

Personally I care about AGENDA Groups the max; lack of it retards decision 
tables considerably.

Thanks,
Arjun





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


[rules-users] Sequential Execution Flow

2007-10-15 Thread Arjun Dhar
Hi,
 something I must have missed is "Sequential Execution Flow". Is this simply 
putting a salience in order from top to down for rules or someting else

 how do I use this "Sequential Execution Flow" (If it is not what I think it 
is), how is it faster and consume lesser memory?

Thanks


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


[rules-users] Re: Infinite Recursion, with no-loop also -- HELP

2007-08-22 Thread Arjun Dhar
Arjun Dhar  yahoo.com> writes:

> 
> Hi,
>  This problem needs to be solved conceptually before technically.
> Assuming (I can't use Agenda Groups in decision tables).
> 
> SUMMARY
> ---
> Some rules evaluate some logic and pass it to a rule which aggregates the 
logic 
> to give the final outcome. Now that requires use of update. (or insert)

Details are there in previous post; but this is really important. WOuld 
appreciate some help on this!

Thanks,
Arjun

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


[rules-users] Rules with 'From' condition with another not using From causes problem

2007-08-22 Thread Arjun Dhar
Test case:

Write a Rule that uses a From clause and on another object does not use a from 
clause:
example:
#From row number: 28
rule "Rules_28"

when
cntct: Contact(initialized==true)
config: BooleanConfiguration(value==true) from 
meta.getConfiguration(cntct.getClient(), "Param1")
pref: Relation(contact==cntct, type=="old") or (eval
(false==true)  and not Relation(contact==cntct, origin=="old"))
then
 System.out.println("Fired 28");
end

If All 3 are true:
 1. Delete Condition 2 --> Rule fires
 2. Delete COnditon 3 (But keep 2) --> Rule fires
 3. Keep 2 & 3 (with 1) --> Rule does not fire

Whats strage is that conditon 1 does not use from and it works with condition 2 
without any problem, but when 2 & 3 are there together the rule does not work.

Please see if it is a bug
Am posting on JIRA

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


[rules-users] Infinite Recursion, with no-loop also

2007-08-21 Thread Arjun Dhar
Hi,
 This problem needs to be solved conceptually before technically.
Assuming (I can't use Agenda Groups in decision tables).

SUMMARY
---
Some rules evaluate some logic and pass it to a rule which aggregates the logic 
to give the final outcome. Now that requires use of update. (or insert)

Before I get into the details as I usually do; one quick Question:
Q) Are recursion a result of update() or can they be caused by insert()??? 
because i have an alternative hypothesis using insert() (described in my 
solution section)


DETAILS

So exact scenario in 'Rules' is below; and this causes infinite-recursion.
Note: I've solved it but I'm looking for something more sophisticated or clean.

My current solution is written below after the problem is described in rules.


rule "Main"

no-loop true
when
cntct: Contact(initialized==true)
eval(cntct.extendedProperty("Table1_Output",true) ==true)
then
...
end

# setExtendedProperty = hashMap
rule "Rule_1"

no-loop true
when
cntct: Contact(initialized==true)
cfg_tab1: BooleanConfiguration(value!=false, param=="x1")
then
cntct.setExtendedProperty("Table1_Output", false);
...
update(cntct);
end


rule "Rule_2"

no-loop true
when
cntct: Contact(initialized==true)
cfg_tab2: BooleanConfiguration(value!=false, param=="x2")
then
cntct.setExtendedProperty("Table2_Output", false);
...
update(cntct);
end


rule "Rule_3"

no-loop true
when
cntct: Contact(initialized==true)
cfg_tab3: BooleanConfiguration(value!=false, param=="x3")
then
cntct.setExtendedProperty("Table3_Output", false);
...
update(cntct);
end

---

My solution: take one of the rules:
rule "Rule_3"

no-loop true
when
cntct: Contact(initialized==true)
cfg_tab3: BooleanConfiguration(value!=false, param=="x3")
 ## Line below filters & restrcits the execution to once only per table ##
eval(cntct.extendedProperty("Table1_Output",true) ==true)
then
cntct.setExtendedProperty("Table3_Output", false);
...
update(cntct);
end

Criticism of my own solution: 
1. This solution, will only allow one rule to fire per table (For each rule 1, 
there is a table of rules like rule 1, similarly for rule 2 type rules there is 
a table if you just play with true and false values in those rules)?

Even with Agenda-Groups; again how do you do an update() once you know the 
rules of the agenda have all fired??? Can we program that in the rules itself?? 

2. Can i use insert instead of update(cntct) and insert another Object into 
working memoy and evaluate that as part of a condition to prevent recursion?

I feel adding conditions to control activations and sequence as a path of long 
term confusion, so can you please provide a more sophisticated approach or re-
evaluate my approaches to the least?

Thanks,
Arjun

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


[rules-users] Optimization Problem - fat expressions vs ceating additional objects

2007-08-15 Thread Arjun Dhar
I have a rule:

SOLUTION 1
===
when
cntct: Contact(initialized==true)
rel: Relation(contact==cntct, active:active == $1) 

then
…
end

For this to run, it requires the "Relation" object asserted into working memory;
so I'd have to forcefully assert (Relation object with active = false), even if
no relation exists.

An alternative solution is to write the rule like this:

SOLUTION 2
==
when
cntct: Contact(initialized==true)
rel: Relation(contact==cntct, active:active == $1
 or  (eval(false==false) and not relation())

then
…
end

#Note: The eval is for decision table since the same cell can be true or false,
and this part of condition should be active only when the cell = false.

Now, Soltuion 2 is a better way to represent the functionlaity and also saved
creation of addtional/redundant objects but introduces an eval() and a not.

>From a perfromance perspective, which solution is more optimized?
If it helps, imagine this used for millions of facts.

At a more granular level, does a Java New() cost more than an eval(false==false)
<-- trivial comparion, but uses the forbidden eval() and then a 'not'

please let me know your views!

Thanks,
Arjun



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


[rules-users] Re: mve bugs

2007-08-15 Thread Arjun Dhar

> Should we go to Jira to find what are the open issues?
> 
> I have been fighthing one issue where drools doesnt seem to be
> evaluating all the constraints. I have two columns with the same class
> on both and around 8-9 joined constraints. Constraints 5+ are never
> evaluated (at least my class fields are never called).
> 
> thanks,


Hey Yuri,
 I had a similar problem but your definition is very abstract. Try declaring the
final node classes as "final", if it works then it is a problem I
reported/suspected with shadow facts.

Please confirm, if final works for you. if it does then we can re-open the bug.
I thought I was the only one facing the problem so I coud not provide conclusive
evidence for a bug.

thanks,
Arjun


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


[rules-users] "From" clause and connection time outs - suggestion

2007-08-13 Thread Arjun Dhar
Hi,
 in a load intensive operation, if a pool of JDBC connections is exausted 
the 'from' breaks. Ok, it should! (Not expecting magic :o) ) ,.. but I'm 
concerned about the trace it generates.

The stack trace does not suggest the ground reality and is very abstract. Can 
you have an enhacement to wrap the actual exception or atleast say somewhere 
he "from" failed? 

org.mvel.MVEL.executeExpression(MVEL.java:219)
org.drools.base.dataproviders.MVELDataProvider.getResults
(MVELDataProvider.java:45)

... I could figure out from the following lines what was wrong, but someone 
else may not be able to figure it out. It's not that big a deal, but just a 
suggestion since I think in high load conditions this would be a common error.

Full trace below
===
java.lang.reflect.InvocationTargetException
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:54)
org.mvel.optimizers.impl.refl.VariableAccessor.getValue
(VariableAccessor.java:39)
org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:174)
org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
org.mvel.CompiledExpression.getValue(CompiledExpression.java:98)
org.mvel.MVEL.executeExpression(MVEL.java:219)
org.drools.base.dataproviders.MVELDataProvider.getResults
(MVELDataProvider.java:45)
org.drools.reteoo.FromNode.assertTuple(FromNode.java:61)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertObject(JoinNode.java:162)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:317)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
org.drools.reteoo.Rete.assertObject(Rete.java:168)
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:848)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:623)
org.drools.reteoo.ReteooStatelessSession.execute
(ReteooStatelessSession.java:135)
com.gryphonnetworks.brms.sessions.RulesEngineSessionJBossRules4.execute
(RulesEngineSessionJBossRules4.java:113)

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


[rules-users] Re: Decision Tables: How to fit RuleBaseConfiguration?

2007-08-09 Thread Arjun Dhar
Hi Mark,
 based on previous post I decided to write my own implementation of 
COnflictResolver and set that into RuleBaseConfiguration. All very well,
 but how do I hook it up to my rule base?? I cant find methods to connect the 
two. ..someone help, we're all gonna die ..kidding :o)

Appreciate your help as usual!


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


[rules-users] Re: Decision Tables: Probelm with sequence=true

2007-08-09 Thread Arjun Dhar
Mark Proctor  codehaus.org> writes:

> 
> 
> I just looked at the decision-table implementation. The sequential
> option there is different from rulebase sequential mode, my mistake
> sorry. sequential the option just sets a salience value on each row,
> based on row number. So I see no reason why this shouldn't work.
> Mark

Hi Mark,
 I sequenced the rolws in reverse order (lowermost row lowest priority); and it 
did not fire the rules twice. Sequence in decision table is definitely doing 
somethingf funny.

Ok, I'll try and write my own Conflict Resolution strategy so that I'm sure of 
a predictable result. I have some custom requirements:
 1. Based on a flag at runtime, execute only first activation
 2. Top row should win in decision table
 3. If a rule conflicts with a nother rule, which has more conditions satisfied 
then the engine should be intelligent enough to choose the more specific rule 
(Specifity)

I dont think Drools 4 supports my requirements, so will try and buuld a 
ConflictResolver.

Are there any particular notes that I need to keep in mind when designing my 
own strategy?

Thanks,
Arjun

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


[rules-users] Re: Decision Tables: Probelm with sequence=true

2007-08-08 Thread Arjun Dhar
they all have getInstance(), except 
> Composite, so it should be fine.

Hi Mark,
 I appreciate the tip regarding writing cutom ConflictResolvers, I needed that
as a develper who cant keep his nose out of the core code.

But right now as an end user I have a problem. I opened my mouth about rules of
same priority executing top to down. Unfortunately thats only garunteed with
"sequence = true"; but I have an update that causes these rules to fire again.

>From an end user perspective and an black-box tester, I feel this is a bug as
the behavior is inconsistant between, "sequence=true" and "sequence=false"

Logically if the function of sequence in decision tables is just to sequence the
execution then nothing in the rules should cause them to fire twice.

Please let me now if i should a file a JIRA for this?

thanks,
Arjun

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


[rules-users] Decision Tables: Probelm with sequence=true

2007-08-08 Thread Arjun Dhar
Hi,
 I usually use decision tables without sequence. But there was a request Not to 
use priority and if there was a conflict then the rule on top should get 
priority.

I thought, sequence = true was a good way of ensuring that. But in the rules I 
call update(); this forces all the rules to fire twice.

I think this is a bug; without sequence the update does not cause such problems.

Please advise,
Arjun

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


[rules-users] Latest Build for 4.0?

2007-08-05 Thread Arjun Dhar
Hi,
 on the user forum, a post was sent to update from
http://labs.jboss.com/drools/downloads. (JAR Last updated 24th Jul 07)

I also took an update from:
http://repository.jboss.com/maven2/org/drools/ (JAR Last updated 31st Jul 07)

...or should I just simply take the latest build from maven ???

A little confused about the latest and/or most stable.

Thanks,
Arjun



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


[rules-users] Re: Need Design Inputs

2007-08-04 Thread Arjun Dhar

> 
> I feel using Drools would increase the
> development time a lot.Also from a maintenance
> perspective it might consume lots of effort.
> 
> Can anyone advice me what to use? also please let
> me know the PRO's and Cons if any?
> 

I think your main concern is mentioned in the last lines not the 80% above it 
:o)

You need to evaluate the parametes of why you would want a rules engine. I think
there is plenty of advice in the documentation also.

But personally here are the challanges I faced:

For a production quality system. There is more to oconsider than just that part
of it. (the ones you mentioned above)

1. One of the problems I faced was that DROOLS is an API and apart from the BRMS
part there isnt any production quality Service available. Like an EJB or RMI.
which would also require you to create your rule loading and refreshing
mechanism (They are working on it, but I had to build it from scratch)

2. How would you like to represent your rules? Is the intention that even a
non-technical user can play with them, or you dont care about rule authoring?

A rule engine, really comes to fore here. You have to script your rules with
business objects. 

It's great fun but if you are short for time it can make your
sweat. 

It's cool stuff but in production its not about cool, but $$$ and time

They have 3 major ways of representation: DRL, DSL, Decision Tables and Rule
Flow. Writing rules, does have a learning curve and each type of methodology
also has its own curve.

I love the fact you can take an Excel sheet and write rules on them, this is a
BIG Hit with non-technical users, 
all thought they still get confused, when the
combinations on a table increase ...lol

3. You have to bring the QA on board on how to test it. It requires a different
mind set. In the documnetation you will learn about FITS but your QA should be
reading that also. 
I had (have) a problem there.

4. With jBoss rules 4 what I really appreciate is "From". 
Everything else is magic in the java world but in real life production, 
you more interested in how you talk to external data sources; DB, LDAP, 
CRM systems etc.

So you have to think of what ratio of your data do you pre-initialize before
sending to the engine and what part should be queries within the engine.
Another tip: I found in "From" (used for getting data from extrnal source)

5. What is the expected shelf life of the product? if its long and Business
Logic is a very complex piece that they would like tighter control of then a
rule engine is a good investment; 
if your a programmer looking for a quick solution or alternative 
its worth experimenting.

6. the use of a rule engine (specially this one), stream lines the use of
business logic. In a normal application, it depends on the programmer. but here
(well yeah a lot depends on your rules and objects), but its better organized 
to suit long run needs.

7. Experience: No one in your company really cares about whats going on in an
engine compared to the bigger pciture. So someone in your organization need to
know the engine itself, its not good enough being a black box. 

You'll be shaking when things go wrong in production if you dont have tight 
command over concepts :O)

8. Performance: In the rule engine world people will talk about Rete, Rete 2
etc. Well when you dig deep a lot depends on:
8.1. Amount of external Data
8.2. Single based querying or batch
8.3. The way rules are written

With RETE, the number of rules has a NEGATIVE EXPONENTIAL time per rule. So if
you were to compare a flat Java Logic program and Rules Engine with loads of
rules and logic, the engine should beat it. But why I find this funny, is coz
this is not real life. In real life, its all about your interaction with
external data. When you write a program on an engine and one that talks to a
database, reality hits you in the face. 

You go to you client with a report on an empty in-memory engine running rules;
he's not going to be very interested to be honest. 
It the end to end picture that counts.

Rules ar always written in mind, as if you are operating on one entitiy or
maximum a "collection" but in an ER rlation usually to one entity still. 
So BULK querying in the middle ofthe engine is not possible; 
you must BULK query during pre-initialization of your objects.

8.3. Fortunately JBosss Rules 4, gives you the ability to do Asynchronous
executions. With a lettle effort you can improve performance by bulk querying.
It has nothing to do with the engine.

where performance is hit, is the extrnal data source. If all your performance
needs are taken care by the database and you have no need to consider the above
points then maybe a database is good. BTW Oracle has an inbuilt RETE based rule
engine, tehre has to be a reason why they put that there :o)

I personally love it, but I have had to face challenges in trying to develop
some understanding on this.

The best thing about Drools is, the team is really fast to response and really
helpf

[rules-users] Re: Why does Drools' RuleBase.addPackage() Behave This Way?

2007-08-04 Thread Arjun Dhar
Hi Mark 2 different questions below:
 BTW how do you implement sequential loading mode? is it there in the
documentation? please let me know even I'd like to experiment.

Also, I keep multiple sessions in memory loaded, A request sends Fact against a
session name; and that the execute for that session is called.

based on the info at :
http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/ch07.html#d0e4515

you do plan to keep ma image/cache of a working memory (session), so looks like
I'm doing the right thing. Just wanted to confirm.

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


[rules-users] Re: nested accessors with Sets

2007-08-04 Thread Arjun Dhar
Thanks,
 you really spiced up the documentation :o) Thats really great. 




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


[rules-users] Re: nested accessors with Sets

2007-08-01 Thread Arjun Dhar
> Q1) So would either or both "not contains" or "not in" work? 
> Q2) Or is "not contains" only for List or Collection type? what about 
HashMaps 
> then?
> Q3) Stretching my actual use case to its limits; if I want to write 
conditions 
> over objects that were never asserted into the working memory (need to OR 
them 
> with existing) ones, how do I do that? 

Sorry for Question 1, slight typo in my RULE using "In", I was trying to say:

obj: Composer( MyComposedObject not in this )


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


[rules-users] Re: nested accessors with Sets

2007-08-01 Thread Arjun Dhar
  comcast.net> writes:

> 
> My rule now appears to be working after switching from the "excludes"  
operator to the newer "not contains".
> 
> This works:
> $ca:CandidateAssociation(nurseDetails.stateLicensures not contains 
patientDetails.state  ) 
> 
> This does not:
> $ca:CandidateAssociation(nurseDetails.stateLicensures excludes  
patientDetails.state  ) 
> 
> Mark


I was just about to post a question and I think this may be the answer to my 
problem as well. So let me confirm.

Question) I hvae a rule

When
 obj: MyComposedObject(active == false) 
Then
  //Action
End

.. the problem is, if the above object was never asserted; I still want it to 
execute. Luckily MyComposedObject is  composend inside another object, so can i 
use the technique above as>

When
 obj: Composer( this not contains MyComposedObject)
End

or even obj: Composer( this not in MyComposedObject)


... My Composer simply composes the object and does not contain it in a list. 

Q1) So would either or both "not contains" or "not in" work? 
Q2) Or is "not contains" only for List or Collection type? what about HashMaps 
then?
Q3) Stretching my actual use case to its limits; if I want to write conditions 
over objects that were never asserted into the working memory (need to OR them 
with existing) ones, how do I do that? I understand technically it does not 
make sense to want conditions over objects one never asserted; ... but please 
think a moment. A person asserts Objects and due to some external factor some 
objects do not get asserted. Since he is aware of it, can he trap that 
conidtion in the rule itself?
Example: Assertions --> (Object Type) A1, A2, A4

RULES: I never got Object type A3 so Do Notify Admin <-- How to write such a 
rule?

I hope I'm able to express my use case.


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


[rules-users] Multiple independent Assertions

2007-08-01 Thread Arjun Dhar
Hi,
 In "stateless" Session:

If List of A1,B1,C1 are executed - execute(List)
and at the same time in a paralell thread A2,B2,C2 are executed - execute(List)

In "Theory" (Conceptually), I want to confirm if A1 will interfere with the 
rule using A2? Just want to ensure what is appropriate or expecteed behavior.

...assuming both threads hit the same session for that "delta t" period of time.

thanks,
arjun

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


[rules-users] Re: class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Arjun Dhar
Thanks, I logged it in JIRA: http://jira.jboss.com/jira/browse/JBRULES-1047

Your suggestions were helpful

Thanks again!

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


[rules-users] Re: class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Arjun Dhar
FYI
 Let $1 = true
 and the object Contact is declared 'final'

thanks,
Arjun



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


[rules-users] class Cast Exception when using OR (||) - Bug?

2007-07-30 Thread Arjun Dhar
When I define a rule:

When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct, 
   active:active==$1, 
   relationName=="Old")
Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
end

..The bove works.

BUT, when I do the following:

When
 cntct:Contact (initialized==true)
 exr:Relation( contact==cntct, 
   active:active==$1, 
   relationName=="Old")
 || Relation( contact==cntct, 
   active:active==$1, 
   relationName==null)
Then
 contact.getStatus().setStatus(true);
 contact.getStatus().addToReasonTrace(drools.getRule().getName());
end
... The script compiles anda stateless Session is created successfully, but at 
runtime/execution it fails with the exception:
java.lang.ClassCastException: com.arjun.brms.businessObjects.Contact
org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75)
org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertObject(JoinNode.java:162)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:317)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
org.drools.reteoo.Rete.assertObject(Rete.java:168)
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:848)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:623)

Class diagram:

Contact<-- bi-directional association -->List

Please advise! is this a bug?

thanks,
Arjun

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


[rules-users] Bug: Shadow facts

2007-07-30 Thread Arjun Dhar
Hi,
 I have an Object 'Configuration'

public class BooleanConfiguration {
  String paramName;
  Boolean value;
  Client client;
}

I asserted this object and the rule was not executing as I expected.

I put a break point in the object, and found that it set it correctly but 
whenenver the rule engine called the get method the vaue of the object was null.

I traced this the place where it creates shadows in Rete.java.
I had observed a similar behaviour in version 3.1 or 3.6 (if there was a 3.6). 
it was more prolific then. I have over 50 objects, only this one is giving a 
problem.

I made the class 'final' (This prevents a shadow from being created), and voila 
my rule worked as expected.
Note: None of the otehr objects needed a final, but had comeplex associations.
But this particular object does not run, unless declared final.

The fact that i have to use 'final' for it to work, seals it for me as a bug.

thanks,
Arjun

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


[rules-users] Does the Rete Graph recognize associations independently?

2007-07-29 Thread Arjun Dhar
Hi,
 one doubt I've had while writing DRL scripts and also with others is:

A {
 B b
 C c
 D d
};

If The rules are to be Written over A, B, C
Then should one assert B, C & D also? ---> Answer yes!

Ok, now that we've asserted them, in the Rule if one uses:
A.b; does the Rete graph recognize it as a node of A or B?
I suspect it is 'A'

Hence...
I take a safe approach and write rules on B,C independently but then ensure 
those objects are reverse associated with A. This increases the risk of objects 
not being released for GC (depends on JVM) if not nullified (and breaking the 
circular associations).

So whats the best approach in designing objects for the Engine?

Thanks,
Arjun

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


[rules-users] EJB's/Distributes Objects in Working Memory?

2007-07-25 Thread Arjun Dhar
Hi,

Q1. we all use POJOS in the Working Memory. Theoretically is it even possoble 
to experiment with distributed objects in the working memory running in a JVM? 
At the end its an object, but well... :)

Q2. Another question, with DSL, Decsion Tables, Rule Flows. Where does the 
JBoss Rules dev team commitment lie most? I need to ask this coz everyone has 
their preference but where support is; one should go! (example: Decsion tables 
still does not Support agenda groups and 'from', I've had to develop work 
arounds); so where does the commitment lie?

thanks,
Arjun

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


[rules-users] Re: Load working memory with "old/existsing" facts

2007-07-25 Thread Arjun Dhar
  bergstein-soraic.de> writes:

> 
> 
> I've a use case that is similar to the TroubleTicketExample that is part of 
the drools examples.  
> In this examples new tickets are inserted via workingMemory.assertObject
(ticket). However, tickets are usually managed and stored in a ticketing system 
(Remedy, Peregrine, etc). When I stop the drools engine, I assume that the 
state of the working memory is lost. When I start the engine again, I'd like to 
load the working memory with the tickets that are stored in the ticketing 
system, but I don't want to fire all rules, since I'd to avoid that rules are 
executed again (e.g., rule "Escalate" -> send a e-mail), which have been 
already executed before the drools engine has
>   been stopped. Existing tickets in the ticketing system are important facts 
for the rules!
>   and therefore the need to be loaded into the morking memory.
> 
>  
> Is there a way to build up the working memory with initial facts? 
> Can I persist the state of the working memory and load it later again? 
> 
>  
> Many thanks in advance, 
>   Tom 
> 

Hey my two bits,

Assuming I dont know much about StatefulSessions holding objects I wanted to 
check with you, is this safe? I'm not sure over a period of time if your 
objects would be released with a StatefulSession/WorkingMemory, would recommend 
you 'soak test' (test over a period of time with consistent load)

But here is the possibility:
Well the interface WorkinfgMemory -- extends --> Eventmanager which extends 
Serializable.

You could try serializing the object, or query your WorkingMemory for its state 
and save it to a database. Am assuming you are using StatefulSession so you 
will have access to WorkingMemory.

Conceptually I just think its worng to use a Rule Engine to persist state over 
a such a long period of time. Any expert opinion?

regards,
Arjun

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


[rules-users] Re: JBoss Drools 4.0 Released

2007-07-25 Thread Arjun Dhar
CONGRATULATIONS :o) And BIG Thanks guys! Brilliant Job.

Hope we can contribute better to your release. If nothing else atelast the 
documentation.

Actually, have discovered a lot of things and notes and am wondering how to 
share it back.

Example, writing multi table decision tables, rule sequencing without using 
Agenda Groups in Decision Tables etc.

How can we contribute back, is this the best place to post? Not sayin its all 
quality, but you filter it out ;o) 

congrats again,
Arjun

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


[rules-users] Re: ConcurrentModificationException in Drools...

2007-07-23 Thread Arjun Dhar

> Just info, I ran a test on about a million requests (loop) and 50 threads. 
> approx 6 business Obectts and 15 rules. I did get any concurrent modfication 
> issues on JBoss Rules 4. Can you please post the rule scripts/DRL used
> 
> regards,
> Arjun
> 

Sorry Typo. I was saying is I "did not" get any concurrent exception. I'm using 
a stateless session in JBoss rules 4. 

I tried this on SynchronizedWorkingMemory in 3 also and did not get any problem.

regads,
Arjun




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


[rules-users] Re: Decision Table - Object equality example

2007-07-23 Thread Arjun Dhar
dpark  exchangesolutions.com> writes:

> 
> 
> I'm in the process of upgrading our decision table rules from 2.1 to 3.0.
> However I've run into a bit of a snag that I hope someone can help me with.
> 
> We have a generalized consolidation rule that: 
> * takes 2 parameters of the same Object Type
> * makes sure that they don't point to the same reference
> * makes sure a field is the same
> * and finally retracts one of the objects from working memory (and updates
> some statistics on the survivor object)
> 
> It just seems a little fuzzy to me how I would write that in a DRL and a
> Decision Table.
> (I'm finding the decision table documentation and supplied example a little
> on the light side)
> 
> Any sympathetic helpers out there?

Well this is how I get it done:

Object Model:
A {
 B b;
 valueSet;
}

B {
 A a;
 price;
}

Rule in Decision Table:
condition 1-- instanceOfA:A
  valueSet==$1 or whatever you want
  

condition 2-- instanceOfB:B
  a == instanceOfA
  price == $1
  

The above reverse association in the object model will ensure that the rule is 
executed for that object only. If you have multiple condiotions on "A" itself, 
then use "this" e.g. 'secondInstanceOfA == this' :o)

regards,
Arjun

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


[rules-users] Re: Decision Table does not support Agenda Groups

2007-07-23 Thread Arjun Dhar

> I need to do two things:
> 1. Support sequencing of rule groups
> 2. allow two modes: a. Execute all rules, b. Break on first rule

..ok, let me go one level further, ...even if the decision table does not 
support it; I want to dynamically invoke it. This is what I really want.

I.e. If the switch says execute first activation only then that happens else 
all activations fire. So that way I can use the same rules in multiple 
scenarios. I'm looking at the KnowledgeHelper interface!

Any thoughts would be appreciated.

thanks,
Arjun


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


[rules-users] Re: ConcurrentModificationException in Drools...

2007-07-23 Thread Arjun Dhar
Edson Tirelli  post.com> writes:

> 
> 
>    Can you please provide details or better yet a self contained example that 
shows the problem.   []s   Edson
> 2007/7/23, McShiv <
> rajesh_sachin10  yahoo.co.in>:
> Hi, I am getting the following error when I try to run the rules in
> bulk(EG: 5 or 6 rules together). But when I start running the 
rulesindividually, all the rules are working fine.0060 SystemErr R 
org.drools.spi.ConsequenceException:java.util.ConcurrentModificationException

Just info, I ran a test on about a million requests (loop) and 50 threads. 
approx 6 business Obectts and 15 rules. I did get any concurrent modfication 
issues on JBoss Rules 4. Can you please post the rule scripts/DRL used

regards,
Arjun




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


[rules-users] Decision Table does not support Agenda Groups

2007-07-23 Thread Arjun Dhar
Hi,
 I reported this earlier also, I cant understand why do we not provide AGENDA-
Group support for Decision tables, while we do provide Activation?

See DefaultRuleSheetListener.

I need to do two things:
1. Support sequencing of rule groups
2. allow two modes: a. Execute all rules, b. Break on first rule

1 --> Solution: Agenda groups :o( <-- NOT SUPPORTED in decision table
2 --> Solution: Activation Group: :o)

.. is there any reason for not supporting Agenda Groups in D.Tables 

regards,
Arjun

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


[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-23 Thread Arjun Dhar
Michael Neale  gmail.com> writes:

> 
> 
> Hi Arjun - I wouldn't recommend re-using session unless there is some 
expensive state you wish to reuse. Pooling them will use up far more resources 
then freeing them. You should only pool expensive to obtain resources.


Hi Michael,
 thanks a lot for your help.

I wish to share something that might be news:
Well I tried two models:
1. Create a new stateless session, everytime you recieve a request
2. Share the same session among multiple threads.
(Million Loops, Zero ramp up time - JMeter settings)

.. As I increased the number of threads the performance output for 1 dipped 
around. But for 2 there was a minor exponential increase in performance.

Ofcourse, this depends on the rules and the way the business obejcts are also 
written. But this was m personal experience.

Functionally there was no difference and also no memory leaks in the latest 
build.

I'm pretty happy.
Thanks,
Arjun

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


[rules-users] The method modify(MyBusinessObject) is undefined for the type Rule_xxx

2007-07-20 Thread Arjun Dhar
Hi,
 I took the latest Snapshots from the trunk, to check if the memory leak 
problem was fixed, but in compiling the rules i got:

The method modify(MyBusinessObject) is undefined for the type Rule_xxx

Have you removed "modify()"? so By default modify will be invoked without 
having to explicitly call it?

Thanks,
Arjun

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


[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Arjun Dhar
> Stateless sessions should not hold onto any references. Stateful do,
> and dispose() must be called when its finished - otherwise the rulebase
> holds a reference forever. If the rulebase is holding onto stateless
> sessions, then that is a bug.
> Mark
> 

Thanks a lot Mark,
 taking the latest binary passed the load testing one a single thread atleast. 
Though I need to confirm due to removal of "modify()" none of the functionality 
has got altered. It chokes a little in the middle but is not going out of 
memory so I guess the leak is really fixed.

One last question on this:
On the Build 4MR2, I disposed the session and created a new one from the cached 
RuleBase and it took the load (on the code that had the memory leak)

So what approach is conceptually better; Keep the same statless session for 
ever or for each execution request use a new one?? I talking pure 
performance/memory?!?!

I remember you saying creating sessions is cheap; so if I have a million 
requests and for each one I create a new session is it still cheap? or a single 
stateless session servicing the requests is better?
Typical Application: telephone exchange; where numbers are bombarding the 
engine. For each incomming request I'd assume a single session would be the 
most optimal solution as long as the rules are common. Right?!

I'm wondering if I should also maintain an image, object = {RuleBase + Globals} 
so I can create a session. but I think this would have a huge performance cost 
to create new sessions per request. Right?

Thanks for the Fix, its  life saver!


Thanks,
Arjun



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


[rules-users] Re: BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Arjun Dhar
> QUESTION:: Is the session maintaining references to those objects ever after 
> executing them? Why are the objects not being released? 
> 
> Specially I'd imagine for a STATELESS session (which is what I've set as 
> default).
> 
> Using JMeter this system crashes every time under load, even with a single 
> Thread. Clearly objects are not being released.
> 
> The error I get may help you: (Along with out of memory). This exception only 
> comes under Load conditions.
> Admin:ERROR: [com.myserver.brms.demos.certify.web.servlet.CertifyWebRequests]
> [service] :org.drools.spi.ConsequenceException: java.lang.NullPointerException
> 
>   at org.drools.common.DefaultAgenda.fireActivation
> (DefaultAgenda.java:501)
> 
>   at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:461)
> 
>   at org.drools.common.AbstractWorkingMemory.fireAllRules
> (AbstractWorkingMemory.java:373)
> 
>   at org.drools.reteoo.ReteooStatelessSession.execute
> (ReteooStatelessSession.java:72)
> 
>   at com.myserver.brms.sessions.RulesEngineSessionJBossRules4.execute
> (RulesEngineSessionJBossRules4.java:113)
> at 
> 
com.myserver.brms.services.execute.recore.batch.ExecuteSessionBatch.executeBatch
> (ExecuteSessionBatch.java:160)
> 
> Please help me! This is the only downtime issue I face and unfortunatley its 
> the most critical point of failure.


Ok, I think I figured it out. But please confirm.

The Rule Engine Session DOES NOT release objects. (But hten why have a 
Stateless session?) if the duration of use of the session is not going to be 
long?

The solution: Pool the RuleBase and on a request createa freesh session from it 
each time a request comes in!

Let me know if the cocept is sound or what I'm thinking is now correct.

Thanks,
Arjun




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


[rules-users] BRMS Server - memory Issue while execution - Critical

2007-07-20 Thread Arjun Dhar
Hi,
 I've been building a BRMS server over the Drools 4MR2 API.

The Server has a Boot process to allow to make it become a Rule server(s). 
reads and XML configuration in which a user can specify the location of the 
DRL, XLS, CVS, etc. During the Boot proocess it verifies thew authenticity of 
each resource it loads. To sommarize:

 


..

 

 


..
 
..well its more, but I guess this paints the picture.


It creates a Pool of Sessions. Now I know creating a Session is inexpensive, 
but the process of creating them and authentication of resources etc. (Required 
for prodcution quality system)

Once the server is up, requests are serviced. the request knows which session 
it wants and facts are asserted per request. The request can be Synchronous or 
Async and single or batch.

For testing I'm using: (JMeter test Case)
Session mode: STATELESS
Synchronous
Mode: Batch of 5 facts (composing of other objects (about 5) which are asserted 
into the Session as well) at at a time
Loop: 10,000 <-- Does not matter how fast or slow I trow this at the engine

After the request is processed and results logged; Result and what rules led to 
that result. I even nullify the top level Business obejcts. (a desperate 
attempt to free memory)

After about 10,000 loops the System goes out of memory. 
Sorry to bore you so far, but it was important you have the right context :o)

QUESTION:: Is the session maintaining references to those objects ever after 
executing them? Why are the objects not being released? 

Specially I'd imagine for a STATELESS session (which is what I've set as 
default).

Using JMeter this system crashes every time under load, even with a single 
Thread. Clearly objects are not being released.

The error I get may help you: (Along with out of memory). This exception only 
comes under Load conditions.
Admin:ERROR: [com.myserver.brms.demos.certify.web.servlet.CertifyWebRequests]
[service] :org.drools.spi.ConsequenceException: java.lang.NullPointerException

at org.drools.common.DefaultAgenda.fireActivation
(DefaultAgenda.java:501)

at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:461)

at org.drools.common.AbstractWorkingMemory.fireAllRules
(AbstractWorkingMemory.java:373)

at org.drools.reteoo.ReteooStatelessSession.execute
(ReteooStatelessSession.java:72)

at com.myserver.brms.sessions.RulesEngineSessionJBossRules4.execute
(RulesEngineSessionJBossRules4.java:113)
at 
com.myserver.brms.services.execute.recore.batch.ExecuteSessionBatch.executeBatch
(ExecuteSessionBatch.java:160)

Please help me! This is the only downtime issue I face and unfortunatley its 
the most critical point of failure.

All thats left is to build an RMI service with a console dameon shell to give 
it the final touches. Once this is done i'd like to share the deisng with you 
guys if you like it.

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


[rules-users] JBoss Rules as a Daemon Service

2007-05-29 Thread Arjun Dhar
Hi,
I uploaded the JBoss Rules 4 WAR; I saw the repository options but no admin 
console to run a service. Maybe I'm missing something?!?!

Q) Being under the cover of the JBoss server am sure there must be some 
fascility to run this as a daemon service 'out of the box'! Right?? <-- 
Important

(posted this 3 days ago but it got lost somwhere; prob deleted the approval 
mail; FYI not being impatient :o) but its important so would like to know)

Thanks!


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


[rules-users] Re: JBRMS

2007-05-29 Thread Arjun Dhar
Michael Neale  gmail.com> writes:

> 
> 
> Yes, as discussed, you need to add import statements for the types you want 
the BRMS to be aware of - if you like, create a feature request jira for auto 
importing. I deliberately didn't do it cause I thought it would cause more 
confusion, but perhaps I was wrong. 
> Also, the video on the blog: http://markproctor.blogspot.com I made shows 
this.Michael.
>  -
> The 
> other question is: How could us contribute (If any interest on this, of 
course) 
> , with the module? In particular we are looking for internationalization 
stuff. 
> It is very important for us, and I think might be interesting for others 
> users.
> 
>  
> Thanks
> 

Speaking of internationalization, I have a more specific question. I'd assume 
that using one Working memory for rules for one country would be advisable.

Now, my business object model would be different also hence the Question:
Q1) Can we have a base model that is shared across rules firing in multiple 
WM's and certain extended objects only loaded for certain WMemories??? 

I'm sorry I have not invested too much time studying the Drools 4 Class 
Loaders hierarchy so if you could just tell me the answer, I'd appreciate it. 
Will reasearch it later in detal.

Q2) For that it would also imply when loading (DRL --> Package --> Rule Base --
> W.M); Rule bases to Working memory we also have to worry about the object 
model. So, in the diagram for JBoss Rules 4 
(http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesRepository) we only see a 
deployment strategy for the RuleBase and not its corresponsding "Object 
Model"; so that gives me a feeling that all object models are shared. Is this 
true?



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