RE: [drools-user] Comment on drools performance.

2005-11-03 Thread Michael Neale
Well said Dave.

There are all sorts of ways you can "measure" performance, but it is still
hard to compare. For instance, the "Miss Manners" (in drools example) is an
traditional test to stress rules engines. The way this is implemented in
drools is blindingly fast, relative to other engines (it is an optimised
implementation):
More on drools miss manners results:
http://jira.codehaus.org/browse/DROOLS-235
Miss manners:
http://blogs.ittoolbox.com/eai/leadership/archives/002349.asp

Further to this, it is easy to come up with a test to show a particular
angle. For instance, I made a simple rule set, and tried it out with 50
different facts, on my laptop drools can process upwards of 375 000 rules
per second when calculating the agenda (while listening to iTunes). What
does this number mean? I don't know, but if someone was to write about it in
the press I am sure things would get out of hand ! I am sure everyone would
rather we get on with the job, working with drools, rather then lots of
discussions about this and that (having said that, to answer Felipe's query,
we do want to make sure people feel confident). Drools marketing budget:
zero dollars (well, Mark will give you a cup of tea if you visit him in the
UK).

There are some typical things that can cause people to get unstuck, like a
combination explosion if there are multiple arguments (if this is combined
with a large number of facts, you run up against the laws of physics), or
just a huge amount of recursion happening.

There is also scaling with the number of rules (not just number of facts),
which is quite favourable:
see graph of scaling with number of rules (strangely came from an article
about Microsofts BRE in BizTalk):
http://geekswithblogs.net/images/geekswithblogs_net/cyoung/507/o_brecomp02b.
gif

Finally, Mark Proctor is currently beavering away to get a tech preview out
of the "full" RETE engine (and more) - this will effectively replace the
current drools-core. Further to this, the plan is to support alternative
algorithms which in some cases can prove optimal. Keep in mind that the
drools 2.0 core was built for stability and simplicity, which is has
achieved. Bob Mc did an amazing job getting all that going, which is a great
foundation to build on.

As for the meantime, many people are already using drools, in large and
small projects. RETE is only one part of the equation, many "new" rule
engines claim to not even want to support RETE - it is to complex an issue
to come down to a number or a single fact to latch on to.
Simon Harris on drools: (he has contributed a lot since this post):
http://www.redhillconsulting.com.au/blogs/simon/archives/000208.html

Share your stories !

if you want to help out and are handy with a profiler, find some hot spots:
http://drools.org/Hot+Spots

At the end of the day drools is completely open, so get involved, have a
poke around and see what you can do !


Michael. 
(about to take off for 2 weeks of sitting around on a beach, and by the
pool).

-Original Message-
From: Hamu, Dave [mailto:[EMAIL PROTECTED] 
Sent: Friday, 4 November 2005 9:41 AM
To: user@drools.codehaus.org; Felipe Piccolini
Subject: RE: [drools-user] Comment on drools performance.

All-

Yeah, there are a bunch of misinformed people who have made disparaging
remarks about Drools on various blogs.  Either they really haven't attempted
to work with drools, or they simply read something negative that someone
else wrote and accepted it as fact.  In many cases, they are writing because
they have an agenda to promote some other commercial or open-source product.


It is conspicuous that these bloggers rarely have anything by way of
contrast or comparison to say that demonstrates that their favorite solution
is fundamentally superior.  In the rare case, that there are comments that
assert that a particular product may be superior to DROOLS, it is rare that
they have done a good job of researching the differences.  

Perhaps the one area that Drools does not compare favorably against
commercial products is the lack of a GUI front end and in the lack of an
integrated tool to easily manage rules repositories (although that will
probably be forthcoming now that DROOLS is part of JBOSS).  That said, I
would urge people to look at the commercial products and realize that there
are certain hoops that you need to jump through to utilize the rule
repositories and operate within the UI -- trust someone who has worked with
a variety of these products, it's no picnic working with the commercial
products, and you typically have a 1/4 M$ entry fee (generally much higher
than that) for even a pilot project.

That's not to say that certain rules engines might not be a better fit for
some projects than others, but I think that the analysis that is needed to
compare the advantages and disadvantages of one engine over another is much,
much more than what these bloggers have shown.

- Dave



-Original Message-
From: Felipe Piccolini [mailto

RE: [drools-user] Comment on drools performance.

2005-11-03 Thread Michael Neale
Also I believe (from memory) that in Jrules it works the same under the
covers (but "from memory" as it is not freely available). 
Front ends built on top of the rule engines can generally automate change
notifications at RuleBase build/compile time (so you get the best of both
worlds).
 

-Original Message-
From: Mark Proctor [mailto:[EMAIL PROTECTED] 
Sent: Friday, 4 November 2005 9:23 AM
To: user@drools.codehaus.org
Subject: Re: [drools-user] Comment on drools performance.

Read the comment he made, we do support that via JavaBeans property change
listener - but using modifyObject is actually more powerfull as you can
"batch" your chages thus removing the number of propergation cycles on the
same object.

Mark
Felipe Piccolini wrote:
> Guys,
>
>  In this link a guy comment on Drools's performance and some people in  
> my company are worried about the impact this can produce on the  
> application (beacuse of course I introduced Drools on it). I know  
> this is not a real problem, and we are using rule engine in a smart  
> way so working memory and rules are no over loaded, but the top  
> managers need more facts than just my opinion, and Im asking all of  
> you guys about experiences and real comments about this link and  
> about your application performance and scalability using Drools.
>
>  
> http://bizrules.eclipsedevelopersjournal.com/some_thoughts_about_drool
> s.htm
>  
>  Thaks a lot.
>
>   
>
> --
> Felipe Piccolini
> [EMAIL PROTECTED]
>
>
>
>   



RE: [drools-user] RE: [spam]::Re: [drools-user] Is order of "rule" elements in "rule-set" the load-order?

2005-11-19 Thread Michael Neale
No the ordering works over the whole ruleset with nothing to do with xor
grouping.

The rules inside an xor group would follow the ordering of rule firing of
the whole rule set, the xor group having no effect on this (the xor group
simply only allows one of the rules to fire).

 

-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 20 November 2005 9:50 AM
To: user@drools.codehaus.org
Subject: [drools-user] RE: [spam]::Re: [drools-user] Is order of "rule"
elements in "rule-set" the load-order?

> -Original Message-
> From: Geoffrey Wiseman [mailto:[EMAIL PROTECTED]
> 
> On 11/19/05, Karr, David <[EMAIL PROTECTED]> wrote:
> > I'm trying to figure out how I can make only one rule in a set of 
> > rules fire, and have it check the rules in a certain order.
> >
> > I see that using the "xor-group" attribute deals with the
> "only one" 
> > part, but I'm not sure how to specify the order it checks
> the rules in
> > an xor-group. Is that what "salience" is for? In a particular 
> > xor-group, will the rule with the highest salience be checked first?
> 
> Salience is a factor, yes; that's the easiest way to control the 
> firing of rules. There's a page on the Drools site about Conflict 
> Resolution that should help clarify somewhat.

Yes, I saw that section.  I wasn't certain from that exactly what the
semantics would be in the context of xor-groups.  Would the saliency
ordering in a particular xor-group be completely independent of the saliency
ordering in a different xor-group, even for identical saliency values across
xor-groups?

I want to use salience within xor-groups because I want each rule in an
xor-group to have a condition which checks to see whether a particular code
value "isPresent()" in a list, but each particular code value has a
"priority", so I'll set the salience for that rule to the priority for the
code value.



RE: [drools-user] RE: [spam]::RE: [drools-user] RE: [spam]::Re: [drools-user] Is order of "rule" elements in "rule-set" the load-order?

2005-11-19 Thread Michael Neale
No if salience (priority) is not set, then it is not necessarily as simple
as top to bottom in the XML (as I am sure you read in the doco on it). 

If you care about the order in the xor group, you need to set salience
accordingly. 

If you have very special needs for ordering, you can write and plug in your
own conflict resolver of course.

-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 20 November 2005 11:53 AM
To: user@drools.codehaus.org
Subject: [drools-user] RE: [spam]::RE: [drools-user] RE: [spam]::Re:
[drools-user] Is order of "rule" elements in "rule-set" the load-order?

So are you saying that rules definitely fire (checking conditions) in the
order they are in in the XML, ignoring for the moment any conflict
resolution settings (like salience)?  If that's the case, then that might
give me what I need, if I order the rules in order of priority in each
xor-group.

> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> 
> No the ordering works over the whole ruleset with nothing to do with 
> xor grouping.
> 
> The rules inside an xor group would follow the ordering of rule firing 
> of the whole rule set, the xor group having no effect on this (the xor 
> group simply only allows one of the rules to fire).
> 
> -Original Message-
> From: Karr, David [mailto:[EMAIL PROTECTED]
> 
> > -Original Message-
> > From: Geoffrey Wiseman [mailto:[EMAIL PROTECTED]
> > 
> > On 11/19/05, Karr, David <[EMAIL PROTECTED]> wrote:
> > > I'm trying to figure out how I can make only one rule in a set of 
> > > rules fire, and have it check the rules in a certain order.
> > >
> > > I see that using the "xor-group" attribute deals with the
> > "only one"
> > > part, but I'm not sure how to specify the order it checks
> > the rules in
> > > an xor-group. Is that what "salience" is for? In a particular 
> > > xor-group, will the rule with the highest salience be
> checked first?
> > 
> > Salience is a factor, yes; that's the easiest way to control the 
> > firing of rules. There's a page on the Drools site about Conflict 
> > Resolution that should help clarify somewhat.
> 
> Yes, I saw that section.  I wasn't certain from that exactly what the 
> semantics would be in the context of xor-groups.
> Would the saliency ordering in a particular xor-group be completely 
> independent of the saliency ordering in a different xor-group, even 
> for identical saliency values across xor-groups?
> 
> I want to use salience within xor-groups because I want each rule in 
> an xor-group to have a condition which checks to see whether a 
> particular code value "isPresent()" in a list, but each particular 
> code value has a "priority", so I'll set the salience for that rule to 
> the priority for the code value.



RE: [drools-user] Is order of "rule" elements in "rule-set" the load-order?

2005-11-19 Thread Michael Neale
Salience "2" will fire first, as salience is priority (numerically). XOR
means that once rule with salience 2 fires, then the other rule will not as
it is in the same XOR group.

Salience and XOR have no direct interaction, you only need salience if order
of firing is important (order of firing *consequences* of course - it is
hard to predict when conditions will be evaluated). 

Make sense? (ie what you described is to be expected). 

-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 20 November 2005 3:22 PM
To: user@drools.codehaus.org
Subject: Re: [drools-user] Is order of "rule" elements in "rule-set" the
load-order?

I just tried to set this up in a prototype, and I must be misunderstanding
something about xor-group, because it didn't work the way I expected.

I defined two rules, both of which would match the input based on their
parameters and conditions.  I set the first one to salience "1" and the
second to "2".  I set them both to have the same xor-group value.  In my
consequence, I just added a print statement, so I would know which one it
matched.

What I saw is that it matched both rules, and it matched the one with
salience "2" first.

What do I have to do to have it match only a single rule (or none) in an
xor-group?

> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 19, 2005 5:59 PM
> To: user@drools.codehaus.org
> Subject: [spam]::RE: [drools-user] RE: [spam]::RE: 
> [drools-user] RE: [spam]::Re: [drools-user] Is order of "rule" 
> elements in "rule-set" the load-order?
> 
> 
> No if salience (priority) is not set, then it is not necessarily as 
> simple as top to bottom in the XML (as I am sure you read in the doco 
> on it).
> 
> If you care about the order in the xor group, you need to set salience 
> accordingly.
> 
> If you have very special needs for ordering, you can write and plug in 
> your own conflict resolver of course.
> 
> -Original Message-
> From: Karr, David [mailto:[EMAIL PROTECTED]
> Sent: Sunday, 20 November 2005 11:53 AM
> To: user@drools.codehaus.org
> Subject: [drools-user] RE: [spam]::RE: [drools-user] RE: 
> [spam]::Re: [drools-user] Is order of "rule" elements in "rule-set" 
> the load-order?
> 
> So are you saying that rules definitely fire (checking
> conditions) in the order they are in in the XML, ignoring for the 
> moment any conflict resolution settings (like salience)?
> If that's the case, then that might give me what I need, if I order 
> the rules in order of priority in each xor-group.
> 
> > -Original Message-
> > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > 
> > No the ordering works over the whole ruleset with nothing to do with 
> > xor grouping.
> > 
> > The rules inside an xor group would follow the ordering of
> rule firing
> > of the whole rule set, the xor group having no effect on
> this (the xor
> > group simply only allows one of the rules to fire).
> > 
> > -Original Message-
> > From: Karr, David [mailto:[EMAIL PROTECTED]
> > 
> > > -Original Message-
> > > From: Geoffrey Wiseman [mailto:[EMAIL PROTECTED]
> > > 
> > > On 11/19/05, Karr, David <[EMAIL PROTECTED]> wrote:
> > > > I'm trying to figure out how I can make only one rule
> in a set of
> > > > rules fire, and have it check the rules in a certain order.
> > > >
> > > > I see that using the "xor-group" attribute deals with the
> > > "only one"
> > > > part, but I'm not sure how to specify the order it checks
> > > the rules in
> > > > an xor-group. Is that what "salience" is for? In a particular 
> > > > xor-group, will the rule with the highest salience be
> > checked first?
> > > 
> > > Salience is a factor, yes; that's the easiest way to control the 
> > > firing of rules. There's a page on the Drools site about Conflict 
> > > Resolution that should help clarify somewhat.
> > 
> > Yes, I saw that section.  I wasn't certain from that
> exactly what the
> > semantics would be in the context of xor-groups.
> > Would the saliency ordering in a particular xor-group be completely 
> > independent of the saliency ordering in a different xor-group, even 
> > for identical saliency values across xor-groups?
> > 
> > I want to use salience within xor-groups because I want each rule in 
> > an xor-group to have a condition which checks to see whether a 
> > particular code value "isPresent()" in a list, but each particular 
> > code value has a "priority", so I'll set the salience for
> that rule to
> > the priority for the code value.
> 
> 



RE: [drools-user] RE: [spam]::RE: [drools-user] Is order of "rule" elements in "rule-set" the load-order?

2005-11-20 Thread Michael Neale
I have been out of the loop for the past few weeks, but I believe a bug was
found in the xor group feature, which has been fixed and should be out with
"2.5".  Perhaps this is showing the bug... (can't remember the jira off the
top of my head).  

-Original Message-
From: Karr, David [mailto:[EMAIL PROTECTED] 
Sent: Monday, 21 November 2005 3:07 AM
To: user@drools.codehaus.org
Subject: [drools-user] RE: [spam]::RE: [drools-user] Is order of "rule"
elements in "rule-set" the load-order?

I think I understand salience, but I still don't understand xor-groups.
>From what I thought I understood, what I described doesn't match your
description, particularly related to your statement "then the other rule
will not as it is in the same XOR group".  In my test case, it executed the
consequence for both rules in the same xor-group.  How does that jive with
your statement?

Perhaps my misunderstanding about this has to do with what "fire" means.
I thought this referred to the checking of the parameters and conditions on
a rule.  Your statements seem to imply that's not the case.

> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> 
> Salience "2" will fire first, as salience is priority (numerically). 
> XOR means that once rule with salience 2 fires, then the other rule 
> will not as it is in the same XOR group.
> 
> Salience and XOR have no direct interaction, you only need salience if 
> order of firing is important (order of firing
> *consequences* of course - it is hard to predict when conditions will 
> be evaluated).
> 
> Make sense? (ie what you described is to be expected). 
> 
> -Original Message-
> From: Karr, David [mailto:[EMAIL PROTECTED]
> 
> I just tried to set this up in a prototype, and I must be 
> misunderstanding something about xor-group, because it didn't work the 
> way I expected.
> 
> I defined two rules, both of which would match the input based on 
> their parameters and conditions.  I set the first one to salience "1" 
> and the second to "2".  I set them both to have the same xor-group 
> value.  In my consequence, I just added a print statement, so I would 
> know which one it matched.
> 
> What I saw is that it matched both rules, and it matched the one with 
> salience "2" first.
> 
> What do I have to do to have it match only a single rule (or
> none) in an xor-group?
> 
> > -Original Message-
> > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, November 19, 2005 5:59 PM
> > To: user@drools.codehaus.org
> > Subject: [spam]::RE: [drools-user] RE: [spam]::RE:
> > [drools-user] RE: [spam]::Re: [drools-user] Is order of "rule" 
> > elements in "rule-set" the load-order?
> > 
> > 
> > No if salience (priority) is not set, then it is not necessarily as 
> > simple as top to bottom in the XML (as I am sure you read
> in the doco
> > on it).
> > 
> > If you care about the order in the xor group, you need to
> set salience
> > accordingly.
> > 
> > If you have very special needs for ordering, you can write
> and plug in
> > your own conflict resolver of course.
> > 
> > -Original Message-
> > From: Karr, David [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, 20 November 2005 11:53 AM
> > To: user@drools.codehaus.org
> > Subject: [drools-user] RE: [spam]::RE: [drools-user] RE:
> > [spam]::Re: [drools-user] Is order of "rule" elements in "rule-set" 
> > the load-order?
> > 
> > So are you saying that rules definitely fire (checking
> > conditions) in the order they are in in the XML, ignoring for the 
> > moment any conflict resolution settings (like salience)?
> > If that's the case, then that might give me what I need, if I order 
> > the rules in order of priority in each xor-group.
> > 
> > > -Original Message-
> > > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > > 
> > > No the ordering works over the whole ruleset with nothing
> to do with
> > > xor grouping.
> > > 
> > > The rules inside an xor group would follow the ordering of
> > rule firing
> > > of the whole rule set, the xor group having no effect on
> > this (the xor
> > > group simply only allows one of the rules to fire).
> > > 
> > > -Original Message-
> > > From: Karr, David [mailto:[EMAIL PROTECTED]
> > > 
> > > > -Original Message-
> > > > From: Geoffrey Wiseman [mailto:[EMAIL PROTECTED]
> > > >

RE: [drools-user] Consequence firing

2005-11-22 Thread Michael Neale
I thought about asking that yesterday. But thought, no, surely not !

That's OK, mistakes happen !

Good luck.

-Original Message-
From: Segal, Jeffrey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 23 November 2005 12:57 AM
To: user@drools.codehaus.org
Subject: RE: [drools-user] Consequence firing

Just figured it out, and it was indeed right under my nose and a bit
embarrassing.  I was simply not calling workingMemory.fireAllRules() after
asserting my objects, but I was thrown off by the fact that the
isAllowed() methods in my conditions were still being called.  Based on
that, I assumed rule validation was an asynchronous process that began as
soon as objects are asserted into WorkingMemory.

Sorry about that folks...I appreciate the help though!

Jeff

-Original Message-
From: Mark Proctor [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 22, 2005 9:44 AM
To: user@drools.codehaus.org
Subject: Re: [drools-user] Consequence firing

Look in the online Semantic Module documentation and read the hello world
example - its not indepth, but should give you the information you need.

Mark
Leotis buchanan wrote:
> How do you register your consequence factory in a conf file , and 
> where will your drools app look for this conf file.
>
> On 11/21/05, Dave B <[EMAIL PROTECTED]> wrote:
>   
>> Have you:
>> - registered your consequence factory in a conf file?
>> - checked that your consequence factory is called?
>> - checked that your consequence factory returns a valid consequence?
>>
>> I vaguely recall having a similar problem a couple of months ago, and

>> indeed remember that the solution was right under my nose -- but I 
>> can't recall the details right now. Will scan my code later today and

>> let you know if that rings any bells.
>>
>> In any case, the debugger is your friend here, should be pretty easy 
>> to track down.
>>
>> Regards,
>> David
>>
>>
>>
>> On 11/22/05, Segal, Jeffrey <[EMAIL PROTECTED]> wrote:
>> 
>>> I've been working on drools DSL for my particular project and have 
>>> overcome all of the classpath, naming convention issues, etc. that 
>>> can come up when using a DSL. The problem I am having is in getting 
>>> my consequences to fire. Here is a sample of how my rules look:
>>>
>>> 
>>>
>>>  >> anAttribute="some value"/> >> anotherAttribute="some other value">   
>>> 
>>>
>>>  >> anAttribute="a value">   
>>>
>>> 
>>>
>>>
>>> When I assert objects, my conditions are firing as expected and 
>>> without exception. However, I'm not seeing any conditions fire, even

>>> when all of the conditions are true. I.e., isAllowed() is returning 
>>> true for conditions "aCondition" and "anotherCondition", but the
>>> invoke() method of "myConsequence" is not being called. Even when I 
>>> set my isAllowed() methods to always return true, my invoke()
methods are never reached.
>>> Xerces has no problem validating my XML against my schema, so I'm at

>>> a loss as to what would be causing this.
>>>
>>> Maybe the solution is right under my nose...any ideas?
>>>
>>> Thanks,
>>> Jeff
>>>
>>>   
>
>   



RE: [drools-user] Drools performance and scalability

2005-11-29 Thread Michael Neale
Who was it from? (the archived mail).

I am not sure if 1 million users per month would really require 1 million
facts in a single working memory. Can you elaborate on what you want to do a
bit more (if you are allowed to !).


Michael. 

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jorge DeFlon
Sent: Wednesday, 30 November 2005 9:31 AM
To: user@drools.codehaus.org
Subject: [drools-user] Drools performance and scalability 

Hi,

I really like Drools, but I have to evaluate it use in masive distributed
application (1,000,000 users per month with a few hundred of rules.)

I reviewed the list's archive and found that someone is using it with
millions of items.

May you share your experiences with that project and details of your
plataform,please?


Regards




Re: [drools-user] Is Fix available for this DROOLS-446 "Performance degradation due to PrimitiveLongMap".

2005-12-07 Thread Michael Neale
Yes fix has been put in 2.5 CVS HEAD.

As you may or may not have heard, I have joined JBoss full time and am
working on Drools. I will be managing the release of 2.5 as soon as
possible, but I am still transitioning to this new role, getting
equipment/office setup etc, so I am not fully up and running as yet.

I think the codebase is fairly good for 2.5, but I would like to
resolve some issues people are having around JNDI and serialisation
(the new SMF work can make rulebase loading times much much much
faster now, so I would like to include those improvements).

For most people, the issue DROOLS-446 would have basically no impact
anyway. It took a while for it to be noticed as well !

Thanks for you patience while I get up to speed with everything.


Michael

On 12/7/05, christy praveen <[EMAIL PROTECTED]> wrote:
> Could you pls let me know when is the release of 2.5
> planned ..
>
> --- "Smith, Philip" <[EMAIL PROTECTED]> wrote:
>
> >
> > http://jira.codehaus.org/browse/DROOLS-462
> >
> > It is unlikely to be concurrency since I am very
> > careful to execute all
> > WM operations on a single thread.
> >
> > Philip Smith
> > [EMAIL PROTECTED]
> > (650) 628-7941 (x87941)
> >
> >
> > -Original Message-
> > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 06, 2005 11:41 AM
> > To: user@drools.codehaus.org
> > Subject: Re: [drools-user] Is Fix available for this
> > DROOLS-446
> > "Performance degradation due to PrimitiveLongMap".
> >
> > Whats the jira for this? Are you sure its not a from
> > concurrency?
> > externally reading values from the map while its
> > doing additions - the
> > map is not synchronized.
> >
> > Mark
> > Smith, Philip wrote:
> > > I filed another bug on the PrimitiveLongMap for a
> > NullPointerException.
> > > Has anybody looked at that one?
> > >
> > >
> > > Philip Smith
> > > [EMAIL PROTECTED]
> > > (650) 628-7941 (x87941)
> > >
> > > -Original Message-
> > > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, December 06, 2005 8:07 AM
> > > To: user@drools.codehaus.org
> > > Subject: Re: [drools-user] Is Fix available for
> > this DROOLS-446
> > > "Performance degradation due to PrimitiveLongMap".
> > >
> > > I believe that Michael has a fix and its in CVS.
> > Drools 2.5 in CVS is
> > > good to go, I think we are just waiting for the
> > new .Net c# SMF to be
> > > committed, which Michael is taking care of.
> > >
> > > Mark
> > > christy praveen wrote:
> > >
> > >> Hello ,
> > >>
> > >> I saw the Drools problem DROOLS-446 "Performance
> > >> degradation due to PrimitiveLongMap".
> > >>
> > >> Could you let me know whether the correction is
> > >> available for this. This is a blocking point for
> > us as
> > >> of now.
> > >>
> > >> It will be helpful if we can get this as soon as
> > >> possible.
> > >>
> > >> Regards,
> > >> Praveena
> > >>
> > >>
> > >>
> > >> __
> > >> Yahoo! DSL - Something to write home about.
> > >> Just $16.99/mo. or less.
> > >> dsl.yahoo.com
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> >
> >
>
>
>
>
> __
> Yahoo! DSL – Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
>


Re: [drools-user] Drools with a Database?

2005-12-07 Thread Michael Neale
One simple way that people have done this before is simply to store
the DRL "source" as text in a database (depending on your database,
you will have to choose an appropriate data type). The RuleBase can
then be loaded and cached from this DRL.



On 12/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Has Anyone tried to read rules from a database.  I noticed the Rule Class and 
> how one could implement a rule, but it looks moderately confusing since 
> drools supports multiple languages.
>
>
> Scott
>
>
> 
> Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading 
> spam and email virus protection.
>
>


[drools-user] Re: [drools-dev] Michael Neale joins JBoss full time to work on Drools

2005-12-07 Thread Michael Neale
Thanks for the welcome Mark.

Allow me to provide some more info about myself:

I live in Brisbane, Australia (hence the strange times I am online),
am married and have a 2.5 year old daughter.
If you are in Australia and want to catchup, feel free to drop me a
line. I occasionally travel to Sydney and Melbourne (Sydney is my home
town). I am very keen to visit sites (the information gathered from
"real world" visits is fantastic).

I am excited to be working with Drools, and JBoss, there are very
exciting times ahead, things have only just started.

I am pleased to see heaps of people helping out others on this mailing
list, its the sign of a healthy project ! so keep it up. I am very
interested in getting more and more people to contribute, of late
there have been many more people chipping in which is great, I would
love to encourage that. It is amazing to see what people do with
drools, and "real world" feedback and contributions are absolultely
invaluable.

Hopefully we can drive the adoption or rule technology to make smarter
and smarter software, which can adapt to changes rapidly. I am sure
everyone is getting a little weary of endless ways to build the same
"CRUD" database application ! Its nearly 2006 and time to make smarter
apps, focusing on complex rules and complex and valuable apps - but I
digress. (if any of you are from commercial rule management vendors,
we would love to hear from you, history shows us that Open Source and
commercial products can live together in the market !).

See you around !

Michael

Here is a picture of me, taking a picture of myself, in scrubs:
http://www.users.on.net/~michaelneale/michael.jpg


On 12/7/05, Mark Proctor <[EMAIL PROTECTED]> wrote:
> I have some great news. Michael Neale, responsible for the Excel
> integration, has joined JBoss full time to work on Drools. His initial
> areas of focus will be on Rule Management and Repository as well as to
> continue with better tool integration with products like Excel. This is
> great news for Drools and its community and ensures we will have an even
> stronger product in the future.
>
> Mark Proctor
> Drools Project Lead
>


Re: [drools-user] help

2005-12-12 Thread Michael Neale
Hi Tarek - do you want to build drools from source, or just use it in binary
form?

On 12/7/05, Tarek Rahal <[EMAIL PROTECTED]> wrote:
>
> Hello guys.
>
> Excuse my question, I am a newbie, trying to get some tutorial on how to
> use the drools. I have installed the jar files, maven, cvs. However, I
> am still unable to function with them. How to use them.
>
> The tutorial on drools.org was not helpful for me, it might be helpful
> for an expert I guess.
> Anyway I would appreciate your help, in giving me any tutorial url, or
> any help possible.
>
> Thank you
>
> Tarek
>
> -Original Message-
> From: christy praveen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 07, 2005 8:26 AM
> To: user@drools.codehaus.org
> Subject: RE: [drools-user] Is Fix available for this DROOLS-446
> "Performance degradation due to PrimitiveLongMap".
>
> Could you pls let me know when is the release of 2.5
> planned ..
>
> --- "Smith, Philip" <[EMAIL PROTECTED]> wrote:
>
> >
> > http://jira.codehaus.org/browse/DROOLS-462
> >
> > It is unlikely to be concurrency since I am very
> > careful to execute all
> > WM operations on a single thread.
> >
> > Philip Smith
> > [EMAIL PROTECTED]
> > (650) 628-7941 (x87941)
> >
> >
> > -Original Message-
> > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 06, 2005 11:41 AM
> > To: user@drools.codehaus.org
> > Subject: Re: [drools-user] Is Fix available for this
> > DROOLS-446
> > "Performance degradation due to PrimitiveLongMap".
> >
> > Whats the jira for this? Are you sure its not a from
> > concurrency?
> > externally reading values from the map while its
> > doing additions - the
> > map is not synchronized.
> >
> > Mark
> > Smith, Philip wrote:
> > > I filed another bug on the PrimitiveLongMap for a
> > NullPointerException.
> > > Has anybody looked at that one?
> > >
> > >
> > > Philip Smith
> > > [EMAIL PROTECTED]
> > > (650) 628-7941 (x87941)
> > >
> > > -Original Message-
> > > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, December 06, 2005 8:07 AM
> > > To: user@drools.codehaus.org
> > > Subject: Re: [drools-user] Is Fix available for
> > this DROOLS-446
> > > "Performance degradation due to PrimitiveLongMap".
> > >
> > > I believe that Michael has a fix and its in CVS.
> > Drools 2.5 in CVS is
> > > good to go, I think we are just waiting for the
> > new .Net c# SMF to be
> > > committed, which Michael is taking care of.
> > >
> > > Mark
> > > christy praveen wrote:
> > >
> > >> Hello ,
> > >>
> > >> I saw the Drools problem DROOLS-446 "Performance
> > >> degradation due to PrimitiveLongMap".
> > >>
> > >> Could you let me know whether the correction is
> > >> available for this. This is a blocking point for
> > us as
> > >> of now.
> > >>
> > >> It will be helpful if we can get this as soon as
> > >> possible.
> > >>
> > >> Regards,
> > >> Praveena
> > >>
> > >>
> > >>
> > >> __
> > >> Yahoo! DSL - Something to write home about.
> > >> Just $16.99/mo. or less.
> > >> dsl.yahoo.com
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> >
> >
>
>
>
>
> __
> Yahoo! DSL - Something to write home about.
> Just $16.99/mo. or less.
> dsl.yahoo.com
>
>
>
>


Re: [drools-user] Using annotations without Spring with DROOLS V 2.1

2005-12-14 Thread Michael Neale
In the archives there is a discussion about this where Peter Lin brough up
some good reasons why annotations will be problematic for 3.0 and beyond.

In terms of Spring support, if anyone wants to support or maintain Spring
support, they are welcome too. Spring is pretty much a part of the furniture
now for JEE development, so some spring integration would be great, but not
necessarily POJO rules.



On 12/15/05, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
> fyi annotated rules will be dropped from the 3.0 release lines.
>
> Mark
> Tushar T wrote:
> > Hi,
> > I am in a process of using Drools (version 2.1) for development of an
> > application. I want to make use of JDK 5.0 annotations for defining
> > rules but I dont want to load them in Spring's Application Contest. I
> > have seen the Java Annotation Semantics and documentation for the
> > same, but I was not able to create rule base for plain annotated rule
> > POJOs.
> >
> > The work around I could find is to use drools-annotation-2.0.jar which
> > supports annotations like @DroolsRule.
> >
> > Can somebody please comment, if it possible to use Drools 2.1
> > annotation semantics, without loading the rules in application context?
> > If yes, then how to do it?
> >
> > Thanks in advance.
> > Tushar
> >
>
>


Re: [drools-user] help

2005-12-15 Thread Michael Neale
you won't need maven or any of the build tools then.

Make sure the drools-all.jar, and all of the dependencies are on your
classpath. You can then execute any of the examples from the
org.drools.examples packages (they all have "main" methods to run).

On 12/15/05, Tarek Rahal <[EMAIL PROTECTED]> wrote:
>
> Thank you for replying Michael,
>
> I am trying to simply use it in binary form.
>
> Thanks.
>
> -----Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 13, 2005 3:13 AM
> To: user@drools.codehaus.org
> Subject: Re: [drools-user] help
>
> Hi Tarek - do you want to build drools from source, or just use it in
> binary
> form?
>
> On 12/7/05, Tarek Rahal <[EMAIL PROTECTED]> wrote:
> >
> > Hello guys.
> >
> > Excuse my question, I am a newbie, trying to get some tutorial on how
> to
> > use the drools. I have installed the jar files, maven, cvs. However, I
> > am still unable to function with them. How to use them.
> >
> > The tutorial on drools.org was not helpful for me, it might be helpful
> > for an expert I guess.
> > Anyway I would appreciate your help, in giving me any tutorial url, or
> > any help possible.
> >
> > Thank you
> >
> > Tarek
> >
> > -Original Message-
> > From: christy praveen [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, December 07, 2005 8:26 AM
> > To: user@drools.codehaus.org
> > Subject: RE: [drools-user] Is Fix available for this DROOLS-446
> > "Performance degradation due to PrimitiveLongMap".
> >
> > Could you pls let me know when is the release of 2.5
> > planned ..
> >
> > --- "Smith, Philip" <[EMAIL PROTECTED]> wrote:
> >
> > >
> > > http://jira.codehaus.org/browse/DROOLS-462
> > >
> > > It is unlikely to be concurrency since I am very
> > > careful to execute all
> > > WM operations on a single thread.
> > >
> > > Philip Smith
> > > [EMAIL PROTECTED]
> > > (650) 628-7941 (x87941)
> > >
> > >
> > > -Original Message-
> > > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, December 06, 2005 11:41 AM
> > > To: user@drools.codehaus.org
> > > Subject: Re: [drools-user] Is Fix available for this
> > > DROOLS-446
> > > "Performance degradation due to PrimitiveLongMap".
> > >
> > > Whats the jira for this? Are you sure its not a from
> > > concurrency?
> > > externally reading values from the map while its
> > > doing additions - the
> > > map is not synchronized.
> > >
> > > Mark
> > > Smith, Philip wrote:
> > > > I filed another bug on the PrimitiveLongMap for a
> > > NullPointerException.
> > > > Has anybody looked at that one?
> > > >
> > > >
> > > > Philip Smith
> > > > [EMAIL PROTECTED]
> > > > (650) 628-7941 (x87941)
> > > >
> > > > -Original Message-
> > > > From: Mark Proctor [mailto:[EMAIL PROTECTED]
> > > > Sent: Tuesday, December 06, 2005 8:07 AM
> > > > To: user@drools.codehaus.org
> > > > Subject: Re: [drools-user] Is Fix available for
> > > this DROOLS-446
> > > > "Performance degradation due to PrimitiveLongMap".
> > > >
> > > > I believe that Michael has a fix and its in CVS.
> > > Drools 2.5 in CVS is
> > > > good to go, I think we are just waiting for the
> > > new .Net c# SMF to be
> > > > committed, which Michael is taking care of.
> > > >
> > > > Mark
> > > > christy praveen wrote:
> > > >
> > > >> Hello ,
> > > >>
> > > >> I saw the Drools problem DROOLS-446 "Performance
> > > >> degradation due to PrimitiveLongMap".
> > > >>
> > > >> Could you let me know whether the correction is
> > > >> available for this. This is a blocking point for
> > > us as
> > > >> of now.
> > > >>
> > > >> It will be helpful if we can get this as soon as
> > > >> possible.
> > > >>
> > > >> Regards,
> > > >> Praveena
> > > >>
> > > >>
> > > >>
> > > >> __
> > > >> Yahoo! DSL - Something to write home about.
> > > >> Just $16.99/mo. or less.
> > > >> dsl.yahoo.com
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> >
> > __
> > Yahoo! DSL - Something to write home about.
> > Just $16.99/mo. or less.
> > dsl.yahoo.com
> >
> >
> >
> >
>
>


Re: [drools-user] Advice on organising drl files

2005-12-22 Thread Michael Neale
Yes you need some sort of flushable cache to be able to change the RuleBase
at runtime. But you don't want to be reloading the rulebase each time. Just
call .newWorkingMemory() each time you need a fresh WM to use (sometimes
people keep WMs hanging around - not for performance but because the rule
engine is stateful in their case).

As for DRLs, Geoffrey said it well.

You can use XML entities to break apart your DRL files if needed. A rulebase
can be made up of multiple rulesets, but as you observed, most scenarious
are one DRL to one ruleset, to one rulebase (but this is not necessarily the
case).

You certainly want to have seperate rulebases for different parts of your
system if they are using rules in totally different ways.

On 12/22/05, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> Thanks Geoffrey, that's just what I was looking for. Just been doing
> some further reading and it seems that the way I have currently
> organised it seems to be correct. The only thing I may do additional
> is getting the RuleBases bound into JNDI so that I can potentially
> update them at runtime.
>
> Thanks again for the response.
>
> On 12/22/05, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
> > On 12/21/05, Paul Smith <[EMAIL PROTECTED]> wrote:
> > >
> > > Is there logically a concept that you have a drl file
> > >
> > that is just logic for a particular context of the application in one
> > > drl file and separate logic in another drl file.
> >
> >
> > I'm not sure if I'm reading this the way you intended.  If you have two
> sets
> > of rules that are logically disjoint, that you expect to run at
> different
> > points of the application, then, yes, I'd make these entirely distinct
> > rulesets and load them in entirely distinct rulebases, so that they
> could be
> > invoked separately.  You could do this with rule filters, IIRC, but I
> > wouldn't be inclined to; if you can make these kinds of partitions, it
> > limits the size of the rete graph, simplifying the processing.
> >
> > The second level of division I'd see is this: are there rules that are
> > re-usable from one RuleBase to another in segments smaller than the
> > rulebase?  That is, does one rulebase consist of rules ABCD and the next
> > CDEF?  If so, then it's helpful to have C and D declared in different
> files
> > han AB and EF, because they are more easily reused.
> >
> > Finally, any level below that seems largely organizational; there are
> some
> > implication level concerns around things like functions and imports at a
> > ruleset level, but at this level it's more about those concerns and the
> > sheer aesthetics than anything else.
> >
> > Does that answer your question?
> >
> > 2. I am presuming that RuleBase instance/s should be loaded up at
> > > application initialisation and then a new WorkingMemory created when
> > > the rules are to be fired. Not sure if this is the case or not as the
> > > code examples are not clear on this. I'm just looking at it from a
> > > performance optimisation perspective.
> >
> >
> > This has some caching value, yes -- working memories are likely to be
> > distinct on a per-use basis, but rule bases can be shared.  Due to the
> > performance overhead involved in creating a rulebase from .drl, caching
> can
> > be considered useful, although as in other uses of caching, this is a
> > tradeoff against memory consumption and updatability that you should
> > consider.
> >
> >   - Geoffrey
> >
> > --
> > Geoffrey Wiseman
> >
> >
>


Re: [drools-user] Advice on organising drl files

2005-12-22 Thread Michael Neale
Another point to think about is if you are planning on allowing rules to
change in a running system. With DRL files, you will be updating them as one
item, so you version control it as one items, test it, approve it etc... So
you may break down the rules such that rules that change at different times
are seperate.



On 12/23/05, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> Yes that's what I figured. I think it boils down to having the
> application operate in particular context and organising those rules
> for that context. ie) I might want rules around my supplier
> information but those rules would be different for say validating the
> suppliers details when you were setting them up as opposed to
> validating whether a particular supplier could fullfill your
> requirements in a given time frame. Same data to be validated but the
> context of how you use/validate it is different.
>
> On 12/23/05, Michael Neale <[EMAIL PROTECTED]> wrote:
> > Yes you need some sort of flushable cache to be able to change the
> RuleBase
> > at runtime. But you don't want to be reloading the rulebase each time.
> Just
> > call .newWorkingMemory() each time you need a fresh WM to use (sometimes
> > people keep WMs hanging around - not for performance but because the
> rule
> > engine is stateful in their case).
> >
> > As for DRLs, Geoffrey said it well.
> >
> > You can use XML entities to break apart your DRL files if needed. A
> rulebase
> > can be made up of multiple rulesets, but as you observed, most
> scenarious
> > are one DRL to one ruleset, to one rulebase (but this is not necessarily
> the
> > case).
> >
> > You certainly want to have seperate rulebases for different parts of
> your
> > system if they are using rules in totally different ways.
> >
> > On 12/22/05, Paul Smith <[EMAIL PROTECTED]> wrote:
> > >
> > > Thanks Geoffrey, that's just what I was looking for. Just been doing
> > > some further reading and it seems that the way I have currently
> > > organised it seems to be correct. The only thing I may do additional
> > > is getting the RuleBases bound into JNDI so that I can potentially
> > > update them at runtime.
> > >
> > > Thanks again for the response.
> > >
> > > On 12/22/05, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
> > > > On 12/21/05, Paul Smith <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Is there logically a concept that you have a drl file
> > > > >
> > > > that is just logic for a particular context of the application in
> one
> > > > > drl file and separate logic in another drl file.
> > > >
> > > >
> > > > I'm not sure if I'm reading this the way you intended.  If you have
> two
> > > sets
> > > > of rules that are logically disjoint, that you expect to run at
> > > different
> > > > points of the application, then, yes, I'd make these entirely
> distinct
> > > > rulesets and load them in entirely distinct rulebases, so that they
> > > could be
> > > > invoked separately.  You could do this with rule filters, IIRC, but
> I
> > > > wouldn't be inclined to; if you can make these kinds of partitions,
> it
> > > > limits the size of the rete graph, simplifying the processing.
> > > >
> > > > The second level of division I'd see is this: are there rules that
> are
> > > > re-usable from one RuleBase to another in segments smaller than the
> > > > rulebase?  That is, does one rulebase consist of rules ABCD and the
> next
> > > > CDEF?  If so, then it's helpful to have C and D declared in
> different
> > > files
> > > > han AB and EF, because they are more easily reused.
> > > >
> > > > Finally, any level below that seems largely organizational; there
> are
> > > some
> > > > implication level concerns around things like functions and imports
> at a
> > > > ruleset level, but at this level it's more about those concerns and
> the
> > > > sheer aesthetics than anything else.
> > > >
> > > > Does that answer your question?
> > > >
> > > > 2. I am presuming that RuleBase instance/s should be loaded up at
> > > > > application initialisation and then a new WorkingMemory created
> when
> > > > > the rules are to be fired. Not sure if this is the case or not as
> the
> > > > > code examples are not clear on this. I'm just looking at it from a
> > > > > performance optimisation perspective.
> > > >
> > > >
> > > > This has some caching value, yes -- working memories are likely to
> be
> > > > distinct on a per-use basis, but rule bases can be shared.  Due to
> the
> > > > performance overhead involved in creating a rulebase from .drl,
> caching
> > > can
> > > > be considered useful, although as in other uses of caching, this is
> a
> > > > tradeoff against memory consumption and updatability that you should
> > > > consider.
> > > >
> > > >   - Geoffrey
> > > >
> > > > --
> > > > Geoffrey Wiseman
> > > >
> > > >
> > >
> >
> >
>


[drools-user] Merry Christmas to all

2005-12-22 Thread Michael Neale
And a happy new year.

Next year will be a big one !

Thanks for all your support and contributions.


Michael.


Re: [drools-user] setting application-data with spring drools

2005-12-24 Thread Michael Neale
On the other side, spring would be a fine way of wiring up an application to
the drools engine. This really has nothing to do with the POJO rule module
though.

You can use spring to inject a RuleBase into you spring managed beans, or
even a working memory, depending on your needs. No specific support is
required in Drools to do this of course.

On 12/25/05, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
> Here is the quick answer, its xmas eve here :)
>
> Drools can be used in Spring and we want to encourage as much spring
> integration a possible. What is not practical is the current pojo side.
> The reason being is that pojo's only support standard monolithic
>  - this is the same as a jess testnode and
> a jrules evaluate node. These are constraints that are not specific a
> particularly fact; what we refer to as a column in the tuple, where the
> tuple is really just a Fact[]. If we want to take Drools to the next
> level we are going to have to move beyond this. It would be possible to
> layer the existing spring pojo implementation on drools 3.0 but you
> would basically be labotomising all the power of drools, someone is by
> all means welcome to do this and we will add it to an unsupported
> contributors area - but it is simply something that I don't want to have
> to maintain and support in the main build.
>
> So what do I mean by this?
>
> AlphaNodes are constraints on fields for a specific fact. In rule
> engines its encourages to build up your rules and constraints one fact
> at a time - this maximises the amount of possible sharing. JoinNodes
> must alwayss have a Column and its AlphaNodes feeding in to the right
> side.
>
> This is a Column with two constraints
> Person( name == "mark", partyLocation:location == "London" )
>
> We can only place Not, Exist and OR at the head of Column constraints -
> this also includes Accumualate and Forall which will be added in 3.1.
> The reason for this is we need a right input to make these work; with
> testnodes there is no right input it simply takes the results of a join.
>
> Pupil( x:name, age == 15 )
> Not ( Results( name == x, average < 50 ) )
>
> Here we have two columns the first does a binding and the latter checks
> none-existence using the binding to correctly constrain the cross
> products.
>
> If this was a pojo we couldn't get the compact way of assigning bindings
> and head conditional operators would not be possible.
>
> So the approach now is to have the compiler compile down the drls to
> real classes with src jars - so at least people can see and debug the
> produced java classes.
>
> Hope that makes sense.
>
> Mark
>
> Hamu, Dave wrote:
> > Mark & Drools Community:
> >
> > I am interested in the question of using rules engines (Drools, in
> > particular, with frameworks such as the Spring Framework), which
> > Leonardo discussed in his e-mail (below).  Can someone elaborate more
> > fully on the reason that Drools or other rules engines cannot be used
> > within the Spring framework.  I understand that a key feature of Spring
> > is that it is a pojo framework and that it uses the "Hollywood
> > Principle".  I have not had any hands-on experience with Spring, but
> > there are many aspects of the framework that I have gleaned from my
> > readings that make Spring very attractive to me.
> >
> > I have long been critical of Struts, because it is needlessly complex
> > and unfortunately so heavily reliant on EJB's.  In contrast, I favor the
> > concepts advocated by Rod Johnson which are exploited in Spring.  I
> > realize that that this is a bit tangential from the Drools community's
> > focus, however, there is an inherent elegance in pairing a rules engine
> > with an application framework.
> >
> > So, I would like to encourage some discussion on the following topics:
> >
> > 1) Practical approaches for using Drools with Application Frameworks
> > 2) Problems with using Drools with Application Frameworks
> > 3) Using Drools along with Workflow and/or BPM  (some ideas about where
> > Drools is going as part of the JBOSS stack would be beneficial)
> >
> > I am working with a very novel application framework concept that is an
> > original product within the team that I work with at Avnet.  The
> > framework is a command-controller/front-controller framework based on
> > concepts published on sun.java.com.  This framework has some interesting
> > features:
> >
> > 1) It is readily extended to invoke a rules engine on demand (we have
> > not exploited this yet, but we have some prototype code for this)
> > 2) It is easy to implement workflow within the framework (and we have
> > exploited this to a limited extent)
> >
> > The chief problem with our in-house designed framework is that it is not
> > an open-source product and not supported by vast number of developers
> > (just our team).  On the one hand, it would be interesting to see our
> > framework adopted by a community of developers (although this may not be
> > practical), or altern

Re: [drools-user] setting application-data with spring drools

2005-12-27 Thread Michael Neale
We want to release a rule repository API with the Drools 3.0 version.

This is something that could be contributed towards that if you are happy to
!

The idea is to have a foundation API, which provides all repository
functionality, including versioning, searching, checkin/out etc, which can
be used to deploy rules into running systems. A web based user interface is
one front end to this API, as will be any plug ins - or custom applications
for people with special needs for their environment. It sounds like you are
a lot of the way there.

I was initially trying the Java Content Repository API, but decided it will
be easier to use hibernate directly - out of the box we can include HSQLDB
(so people can get up and running without a seperate database server) but of
course MySQL, Oracle and SQL Server, DB etc can be supported thanks to
hibernate.

Please do share it !


Michael
JBoss Inc.


On 12/28/05, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> Yes, I'd certainly be interested in taking a look too. I'm keen to do
> some proof of concept work in the near future using drools in our EAM
> system. To have the added flexibility to modify to rules without a
> redeploy would be a big advantage. Not sure how you would source
> control the rule bases if they are all stored in a database but I
> certainly like the idea.
>
> On 12/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > I'd definately be interested in looking at your code.
> >
> > Scott
> >
> > -Original Message-
> > From: Sujit Pal <[EMAIL PROTECTED]>
> > To: user@drools.codehaus.org
> > Sent: Tue, 27 Dec 2005 09:16:40 -0800
> > Subject: Re: [drools-user] setting application-data with spring drools
> >
> >
> > Hi,
> >
> > I've just finished building a small proof-of-concept that uses a
> database to store rules and provides a simplified interface to the Drools
> engine to the client. The client calls named rulesets using the interface
> and the rules are loaded from the database.
> >
> > There is also a web interface to maintain the rules. The rulesets are
> stored atomically, ie as normalized data instead of as a .drl file (CLOB
> data). The web interface is built using Spring MVC. The database object
> abstraction is built using Hibernate. The body of the conditions and
> consequences are scriptable using Python or extendable using small Java
> classes. I did the Petstore example using both approaches to illustrate the
> usage.
> >
> > If there is interest in this sort of thing, please let me know. I would
> be happy to write up this stuff with the code, perhaps in the user stories
> section of the drools site.
> >
> > Thanks
> > Sujit
> >
> > Hamu, Dave wrote:
> > > Mark & Drools Community:
> > > > I am interested in the question of using rules engines (Drools, in
> > > particular, with frameworks such as the Spring Framework), which
> > > Leonardo discussed in his e-mail (below). Can someone elaborate more
> > > fully on the reason that Drools or other rules engines cannot be used
> > > within the Spring framework. I understand that a key feature of Spring
> > > is that it is a pojo framework and that it uses the "Hollywood
> > > Principle". I have not had any hands-on experience with Spring, but
> > > there are many aspects of the framework that I have gleaned from my
> > > readings that make Spring very attractive to me.
> > > > I have long been critical of Struts, because it is needlessly
> complex
> > > and unfortunately so heavily reliant on EJB's. In contrast, I favor
> the
> > > concepts advocated by Rod Johnson which are exploited in Spring. I
> > > realize that that this is a bit tangential from the Drools community's
> > > focus, however, there is an inherent elegance in pairing a rules
> engine
> > > with an application framework. > > So, I would like to encourage some
> discussion on the following topics:
> > > > 1) Practical approaches for using Drools with Application Frameworks
> > > 2) Problems with using Drools with Application Frameworks
> > > 3) Using Drools along with Workflow and/or BPM (some ideas about where
> > > Drools is going as part of the JBOSS stack would be beneficial)
> > > > I am working with a very novel application framework concept that is
> an
> > > original product within the team that I work with at Avnet. The
> > > framework is a command-controller/front-controller framework based on
> > > concepts published on sun.java.com. This framework has some
> interesting
> > > features:
> > > > 1) It is readily extended to invoke a rules engine on demand (we
> have
> > > not exploited this yet, but we have some prototype code for this)
> > > 2) It is easy to implement workflow within the framework (and we have
> > > exploited this to a limited extent)
> > > > The chief problem with our in-house designed framework is that it is
> not
> > > an open-source product and not supported by vast number of developers
> > > (just our team). On the one hand, it would be interesting to see our
> > > framework adopted by a 

Re: [drools-user] setting application-data with spring drools

2005-12-28 Thread Michael Neale
Thanks Sujit. All we need are some screen shots in action and we can put it
up as an article !

Looks good. I can see you have implemented to the SPI, which is fine as it
gives you maximum dynamic ness, and is a valid approach, especially for
python which is always interpreted.

If people are interested, we can put it on the drools site as a possibly
utility when working with Drools 2 rulebases and python.




On 12/29/05, Sujit Pal <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Thanks for the interest. The code is temporarily available for download
> here (I need the space for some future plans, future == couple weeks
> :-)). If you think its worthwhile, maybe it can find a permanent home on
> the Drools site. And if you do decide to use this as a base for a future
> Drools API, please feel free.
>
> http://home.comcast.net/~sujit.pal/pluto.tar.gz
>
> There is a dbi-doc.txt in wiki format which explains the design, along
> with 2 .png files detailing the class diagram and schema design.
>
> You can build the database using the file generated using ant schema.
> There are 2 .sql files for the schema, one for postgresql and the other
> for mysql.
>
> You can run the junit tests for the API using:
>  ant clean compile compile-test test
>
> The web application is designed with resin, but it should work for other
> application servers too. You may need to tweak the deploy target to tell
> it the correct location of your application server.
>
> Comments to some of the posts:
> Michael Neale> We want to store rules atomically, and add in things like
> versioning, access control and so on. Of course, it needs to be generic.
> We need a rule repository API, and then tools that use it (ie the web
> interface can be a component that people can use, or they can use the
> API directly to store rules).
> sujit> The project provides an API, although it is not as comprehensive
> as you expected in your email. For example, version control and access
> control is not covered, although it should be fairly easy to add in.
> However, there are facilities to list all rulesets in the database, load
> a ruleset by name, save/update a ruleset and clone rulesets. The web
> interface uses the same API.
>
> Paul Smith> To have the added flexibility to modify to rules without a
> redeploy would be a big advantage. Not sure how you would source
> control the rule bases if they are all stored in a database but I
> certainly like the idea.
> sujit> Yes, not having to redeploy was one of the considerations.
> Although, looking back on it, I ended up re-inventing some wheels
> already done by the Drools team. Perhaps a better way to do this would
> be to marry the two, ie use the database to store the data, then
> generate a .drl file on demand and run it through the provided Drools API.
>
> I am also looking for feedback on what you think I've done wrong, or
> stuff you think I could have done better.
>
> Thanks
> -sujit
>
> Michael Neale wrote:
> > We want to release a rule repository API with the Drools 3.0 version.
> >
> > This is something that could be contributed towards that if you are
> happy to
> > !
> >
> > The idea is to have a foundation API, which provides all repository
> > functionality, including versioning, searching, checkin/out etc, which
> can
> > be used to deploy rules into running systems. A web based user interface
> is
> > one front end to this API, as will be any plug ins - or custom
> applications
> > for people with special needs for their environment. It sounds like you
> are
> > a lot of the way there.
> >
> > I was initially trying the Java Content Repository API, but decided it
> will
> > be easier to use hibernate directly - out of the box we can include
> HSQLDB
> > (so people can get up and running without a seperate database server)
> but of
> > course MySQL, Oracle and SQL Server, DB etc can be supported thanks to
> > hibernate.
> >
> > Please do share it !
> >
> >
> > Michael
> > JBoss Inc.
> >
> >
> > On 12/28/05, Paul Smith <[EMAIL PROTECTED]> wrote:
> >
> >>Yes, I'd certainly be interested in taking a look too. I'm keen to do
> >>some proof of concept work in the near future using drools in our EAM
> >>system. To have the added flexibility to modify to rules without a
> >>redeploy would be a big advantage. Not sure how you would source
> >>control the rule bases if they are all stored in a database but I
> >>certainly like the idea.
> >>
> >>On 12/28/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >>
> >>>I'd 

Re: [drools-user] Re: JSR94 statefule rule session

2005-12-29 Thread Michael Neale
Not off the top of my head (I may be missing something obvious).

Do you mean modified as in the state of the object is modified, or modified
in terms of drools.modifyObject?

PropertyChangeListeners are always are always an option to capture state
changes.

On 12/30/05, Jonathan Lundquist <[EMAIL PROTECTED]> wrote:
>
> If there isn't a way to do with with the JSR94 api  stateful session, is
> there a way with the standard drools interface  (rule base, working memory,
> etc) to fireAllRules and get just the facts  that have changed as a
> result?  I've mostly only worked with  Drools through the JSR94 api so far
> and not with the direct Drools  objects/interfacts.
>
>   Thanks again!
>   Jonathan
>
> -
> Is there a way, when using the JSR94 api for  Drools and using a
> StatefulRuleSession to find only those facts that  have changed upon
> execution of the executeRules method?  I  understand, as with all rules
> engines, that executing all the rules in  the fact base can assert new
> facts, retract existing ones, and update  existing ones.  So the real
> question is, can you get just the  facts that currently exist in the working
> memory that were changed or  added by the last executeRules() method call?
>
>   Here is the basic sequence:
>   (1) load a base set of lots of facts into the fact base
>   (2) assert a few more facts
>   (3) executeRules & find which facts changes (& still exist)
>   (4) assert a few more facts
>   (5) executeRules & find which facts changes (& still exist)
>
>   I thought that a way to do this might be to use the StatefulRuleSession
> 's getObjects() method that takes a parameter.  
> However,
> I looked at the drools jsr94 code base (the  online cvs repository) and
> didn't see any implementation of the  ObjectFilter class.  Is this the case
> -- Object filter is not  implemented and not currently supported by drools'
> jsr94  implementation?  If it is implemented, could someone tell me how  to
> use it, what its uses are, etc?
>
> Is there another approach  that will let me get just those objects from
> the StatefulRuleSession  that have changed upon calling executeRules?
>
>   Thanks!
>
>
>
>
>


Re: [drools-user] Re: JSR94 statefule rule session

2005-12-29 Thread Michael Neale
you would not call drools.modifyObject if you just were storing the result
of some calculation in a consquence, that really has nothing to do with
other rules firing. as modifyObject causes all the rules to be checked
against again etc...
But you would use modifyObject if you were changing the state such that a
whole stack of other rules may now apply.

Mark may be able to correct me, but in drools 3.0 calling modifyObject may
not be necessary, and it will be easier to track what facts have changed.

I don't think it currently tracks what objects were modified by
modifyObject, but it would be pretty easy to via many means (adding in event
listeners is one way - you can easily trap all the events of objects being
modified and build up a map of them if you like).
You can register a listener with the working memory, and it will tell you
each time an object is modified.



On 12/30/05, Jonathan Lundquist <[EMAIL PROTECTED]> wrote:
>
> What would be the difference between modifying the  state of the object
> and using drools.modifyObject?  I know they're  two different steps, but
> if you change the state of the object,  wouldn't you always want to call
> modifyObject right after that?   Or are there times you would do one without
> the other?  I'd be  interested to know if this is the case.
>
> Michael Neale <[EMAIL PROTECTED]> wrote:  Not off the top of my head
> (I may be missing something obvious).
>
> Do you mean modified as in the state of the object is modified, or
> modified
> in terms of drools.modifyObject?
>
> PropertyChangeListeners are always are always an option to capture state
> changes.
>
> On 12/30/05, Jonathan Lundquist  wrote:
> >
> > If there isn't a way to do with with the JSR94 api  stateful session, is
> > there a way with the standard drools interface  (rule base, working
> memory,
> > etc) to fireAllRules and get just the facts  that have changed as a
> > result?  I've mostly only worked with  Drools through the JSR94 api so
> far
> > and not with the direct Drools  objects/interfacts.
> >
> >   Thanks again!
> >   Jonathan
> >
> > -
> > Is there a way, when using the JSR94 api for  Drools and using a
> > StatefulRuleSession to find only those facts that  have changed upon
> > execution of the executeRules method?  I  understand, as with all rules
> > engines, that executing all the rules in  the fact base can assert new
> > facts, retract existing ones, and update  existing ones.  So the real
> > question is, can you get just the  facts that currently exist in the
> working
> > memory that were changed or  added by the last executeRules() method
> call?
> >
> >   Here is the basic sequence:
> >   (1) load a base set of lots of facts into the fact base
> >   (2) assert a few more facts
> >   (3) executeRules & find which facts changes (& still exist)
> >   (4) assert a few more facts
> >   (5) executeRules & find which facts changes (& still exist)
> >
> >   I thought that a way to do this might be to use the
> StatefulRuleSession
> > 's getObjects() method that takes a parameter.  However,
> > I looked at the drools jsr94 code base (the  online cvs repository) and
> > didn't see any implementation of the  ObjectFilter class.  Is this the
> case
> > -- Object filter is not  implemented and not currently supported by
> drools'
> > jsr94  implementation?  If it is implemented, could someone tell me
> how  to
> > use it, what its uses are, etc?
> >
> > Is there another approach  that will let me get just those objects from
> > the StatefulRuleSession  that have changed upon calling executeRules?
> >
> >   Thanks!
> >
> >
> >
> >
> >
>
>
>
>


[drools-user] Drools 2.5 BETA 1 is out

2005-12-29 Thread Michael Neale
Thanks to everyone for all the contributions. We have had a lot of really
good improvements and patches submitted.

2.5 has a major redesign of the Semantic Module Framework, and it now
generates bin/src bundles behind the scenes for deployment (and possibly
debugging). This can also allow for fast startup times which is handy for
people in a non server environment. The rules classes are now loaded quite
differently. There are some API changes that you may or may not notice.

The whole shebang can be gotten from:

http://dist.codehaus.org/drools/distributions/drools-2.5-beta-1-bin-withdeps.zip

Note that there are quite a few changes in dependencies. It now uses the
Eclipse JDT compiler by default for java (hence the larger download size).

Please give it a go and log all issues as usual. The SMF improvements in
particular are a key foundation for Drools 3.0.



Regards,

Michael.

PS the individual module jars are in the usual place:
http://dist.codehaus.org/drools/jars/ - note that you can't mix and match
modules from 2.5 with 2.1 in general.


Re: [drools-user] Exclusion of rules

2005-12-29 Thread Michael Neale
use xor-group attribute. When a rule fires that has a xor-group name set,
then non of the other rules with the same group will fire.

I *think* this is a 2.1 feature (been a while !).



On 12/30/05, Sinha, Amitesh <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>
>
> I hope holiday season is bringing a lot of happiness for all of us.
>
>
>
> I am wondering if there is a way to implement the following. If Rule1 is
> satisfied, Rule 2 should not be evaluated.
>
>
>
> e.g., In the example below if the "GreaterThan10" rule is satisfied,
> "GreaterThan5" rule should not be applied.  The reason being I want to
> return the consequence from the first rule satisfying the condition.
>
>
>
> 
> xmlns="http://drools.org/rules";
>
> xmlns:java="http://drools.org/semantics/java";
>
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
>
> xs:schemaLocation="http://drools.org/rules rules.xsd
>
>
> http://drools.org/semantics/java java.xsd">
>
>
>
>
>
> java.lang.String
>
>
>
> 
>
> 
>
> String
>
> 
>
> Integer.parseInt(number) > 10
> 
>
>  System.out.println("Greater than 10 rule
> satisfied"); 
>
> 
>
>
>
>
>
> 
>
> 
>
> String
>
> 
>
> Integer.parseInt(number) > 5
> 
>
>  System.out.println("Greater than 5 rule
> satisfied"); 
>
> 
>
>
>
> 
>
>
>
> Thanks in advance.
>
>
>
> Amitesh Sinha
>
>
>
> Technical Architect
>
> Telecom Business Unit
>
> Patni Computer Systems
>
> [EMAIL PROTECTED]
>
>
>
>
>


Re: [drools-user] Execution of Rules

2006-01-05 Thread Michael Neale
Unless I am mistaken, using Native you have to "roll your own" condition
sharing, as the engine has no way of knowing intrinsically how to share.
>From looking at the code it looks like if you implement hashCode and equals
correctly, it may be able to share (but I am not sure).

The DRL condition sharing works when conditions are in the same order, and
"look the same" (its kind of cheating !).

Also not that for 2.5, you have to use the ReteDumper class, NOT the plain
Dumper class (just FYI - it uses Dumper behind the scenes, but as there is
proxying, you can't use it directly in 2.5).


Michael.

On 1/6/06, Usha <[EMAIL PROTECTED]> wrote:
>
> Use Case:
> -
> Test whether an object that has attributes A, B and C passes through a set
> of
> rules.
> Rule 1: pass if Condition1: attribute A = "A1" & Condition2: attribute B =
> "Y"
> Rule 2: pass if Condition1: attribute A = "A1" & Condition3: attribute C =
> "C1"
> Rule 3: pass if Condition4: A = "A3".
>
> An object that has the attributes A="A4", B="Y" and C="C1" is asserted
> into
> the working memory.
>
> Scenario 1: Rules are built using a DRL file with the rules hardcoded into
> the
> DRL file. When the above object is asserted, Rule1/Condition1 is tested,
> and
> since it doesn't evaluate to true, Rule 2 is not executed. Rule 3 is
> tested
> however, and I can see from the Dumper output that the rules are organized
> into a tree structure based on the results of each condition.
>
> Scenario 2: The rules are built using the Native method manually building
> the
> rule set using the Condition and Consequence objects. Rule 2 is tested,
> even
> if Rule 1 Condition1 does not pass. I do get the correct results from the
> Rules engine, but from an execution point of view, it doesn't seem to be
> organized/optimized as expected.
>
> Using the native rule definition method, how do I define the conditions
> such
> that they are organized as in Scenario 1? So, in the above example, if
> Condition1 in Rule 1 does not pass, Rule 2 should not be even tested, but
> Rule
> 3 should be tested.
>
> Any help would be greatly appreciated.
>
>
>


Re: [drools-user] Execution of Rules

2006-01-06 Thread Michael Neale
sorry, I have to do a beta-2 release. Ignore my comment about 2.

As far as I know, condition share all you want !

On 1/7/06, Usha <[EMAIL PROTECTED]> wrote:
>
> Thanks Micheal. That worked.
>
> I didn't get the "Condition Sharing" terminology from the documentation.
> It is
> entirely possible that I didn't read the docs propertly ;) but do you
> people
> have some other documentation that is not available online? Can you pass
> it on?
>
> - Is there a performance implication if there is a lot of condition
> sharing in
> a rule set?
> - Are there any specific guidelines to follow while setting up rules as
> you
> said condition sharing kind of depends on the order in which conditions
> are
> specified?
>
> On a slightly different note...
> - I have downloaded 2.5 Beta 1 and cannot find the ReteDumper class. I can
> access the Dumper directly.
>
>
>


Re: [drools-user] Problem using Drools 2.5 HelloWorld Example

2006-01-08 Thread Michael Neale
Yep I get that too. Am looking into it. The SMF stuff is quite new, so there
are still things like this to iron out, but its good to know its not just my
environment.


Michael.

On 1/9/06, Kapil Gupta <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have just downloaded the Drools 2.5 Beta and trying to run the
> HelloWorldExample program. I receive the following error on running
> the program. All the required jars are in the classpath
>
> drools/org/HelloWorld_1136780794223/java/Hello_World_0.java(23)
> The method helloWorld(String) is undefined for the type Hello_World_0
> drools/org/HelloWorld_1136780794223/java/Hello_World_0.java(13)
> drools.org.HelloWorld_1136780793364 cannot be resolved to a type
> drools/org/HelloWorld_1136780794223/java/Hello_World_0.java(23)
> The method helloWorld(String) is undefined for the type Hello_World_0
> drools/org/HelloWorld_1136780794223/java/Goodbye_Cruel_World_0.java(13)
> drools.org.HelloWorld_1136780793364 cannot be resolved to a type
> drools/org/HelloWorld_1136780794223/java/Goodbye_Cruel_World_0.java(23)
> The method goodbyeWorld(String) is undefined for the type
> Goodbye_Cruel_World_0
> The method goodbyeWorld(String) is undefined for the type
> Goodbye_Cruel_World_0
> FIRE RULES(Hello)
> --
> Exception in thread "main" java.lang.NoClassDefFoundError:
> drools/org/HelloWorld_1136780794223/java/Hello_World_0
> at
> drools.org.HelloWorld_1136780794223.java.Hello_
> World_0Invoker$Condition_0Invoker.invoke(Hello_World_0Invoker.java:22)
> at org.drools.semantics.java.JavaCondition.isAllowed(
> JavaCondition.java:172)
> at org.drools.reteoo.ConditionNode.assertTuple(ConditionNode.java
> :154)
> at org.drools.reteoo.TupleSource.propagateAssertTuple(
> TupleSource.java:118)
> at org.drools.reteoo.ParameterNode.assertObject(ParameterNode.java
> :126)
> at org.drools.reteoo.ObjectTypeNode.assertObject(
> ObjectTypeNode.java:173)
> at org.drools.reteoo.Rete.assertObject(Rete.java:111)
> at org.drools.reteoo.RuleBaseImpl.assertObject(RuleBaseImpl.java
> :193)
> at org.drools.reteoo.WorkingMemoryImpl.assertObject
> (WorkingMemoryImpl.java:373)at
> org.drools.reteoo.WorkingMemoryImpl.assertObject
> (WorkingMemoryImpl.java:348) at
> org.drools.example.HelloWorldExample.main(HelloWorldExample.java:47)
>
> The same program runs well with Drools 2.1. Please help me out.
> Thanks & Regards,
> Kapil
>
>
>


Re: [drools-user] excel worksheet conditions ignored

2006-01-13 Thread Michael Neale
if there is no text in the cell, the condition will not be included.

On 1/13/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
>
> Hi everybody !
>
> I am using drools 2.1 with excel worksheet. Sometimes, some conditions
> columns are completely ignored by the engine, and thus my actions are
> executed without testing the conditions . If I generate a DRL file from
> the
> worksheet, I see that my conditions are not included in the generated
> file.
> I can't find the reason for my condition column to be ignored.
> Does anyone has a clue ?
>
> Regards,
>
> Pascal Chanteux.
>
>


Re: [drools-user] Re: excel worksheet conditions ignored

2006-01-13 Thread Michael Neale
sometimes the excel format can cause havok with the apache POI parser
(depends on exact versions of excel).



On 1/14/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
>
> The problem seems to be a cell format/formula problem. I need to use the
> 'general' format because my cell has a formulas. In this case my condition
> is ignored. When I hard code the result of the formula in the cell, it's
> ok.
>
> Is it forbidden to have excel formulas in the cells belonging to the
> condition column ?
>
>
> On 1/13/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
> >
> > Hi everybody !
> >
> > I am using drools 2.1 with excel worksheet. Sometimes, some conditions
> > columns are completely ignored by the engine, and thus my actions are
> > executed without testing the conditions . If I generate a DRL file from
> the
> > worksheet, I see that my conditions are not included in the generated
> file.
> > I can't find the reason for my condition column to be ignored.
> > Does anyone has a clue ?
> >
> > Regards,
> >
> > Pascal Chanteux.
> >
>
>


Re: [drools-user] excel worksheet caching

2006-01-13 Thread Michael Neale
no there is no caching. What version of excel are you using?

I have added CSV support as it is less prone to strange variances in the
file format which xls is. Unfortunately Excel 97 format is very much  a
closed format, so it can be a little hard to account for all versions
saveing in strange states.

Hopefully Microsoft will open up the new OfficeXML format enough, and that
coupled with ODF (OpenDocument) will provide a better general purpose format
(but it will take time to be widely available).

On 1/14/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> Is there any form of caching during the parsing/loading of an excel
> worksheet ?
> I have an excel worksheet for my drools test. The result of my test case
> is
> correct. Everything is OK.
> When I change something in the content of my cell, I have this exception :
>
> *org.drools.decisiontable.parser.DecisionTableParseException: An error
> occurred processing the decision table.
> at org.drools.decisiontable.DecisionTableLoader.loadDRLFromStream(
> DecisionTableLoader.java:124)
> at org.drools.decisiontable.DecisionTableLoader.getReader(
> DecisionTableLoader.java:108)
> at org.drools.decisiontable.DecisionTableLoader.loadFromInputStream(
> DecisionTableLoader.java:102)
> ...Caused by: org.apache.poi.hssf.record.RecordFormatException: Unable
> to construct record instance, the following exception occured: null
> at org.apache.poi.hssf.record.RecordFactory.createRecord(
> RecordFactory.java
> :237)
> at
> org.apache.poi.hssf.eventusermodel.HSSFEventFactory.genericProcessEvents
> (HSSFEventFactory.java:183)
> at org.apache.poi.hssf.eventusermodel.HSSFEventFactory.processEvents(
> HSSFEventFactory.java:101)
> at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(
> ExcelParser.java:263)
> at org.drools.decisiontable.SpreadsheetDRLConverter.getRuleSheetListener(
> SpreadsheetDRLConverter.java:123)
> at org.drools.decisiontable.SpreadsheetDRLConverter.convertToDRL(
> SpreadsheetDRLConverter.java:72)
> at org.drools.decisiontable.DecisionTableLoader.loadDRLFromStream(
> DecisionTableLoader.java:118)
> ... 20 more*
>
> I found a workarround for this, simply by changing the name of the ruleset
> in the worksheet. In this case everything works fine again.
>
> Is this normal or I am missing something ?
>
> Thanks,
>
> Pascal
>
>


Re: [drools-user] Re: excel worksheet conditions ignored

2006-01-16 Thread Michael Neale
Would be worth a look if you can ! I don't know off the top of my head how
Formula record works. Presumably at the moment they are not included, hence
your problem.

On 1/16/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I've explored the drools excel parser (
> org.drools.decisiontable.parser.xls.ExcelParser), but I don't see any
> references to the FormulaRecord (*
> org.apache.poi.hssf.record.FormulaRecord*
> ) . I suppose I need to add some lines of code in the parser if I wanna to
> use formula in my Drools decision table ?
> Thanks,
> Pascal.
>
>
> On 1/14/06, Michael Neale <[EMAIL PROTECTED]> wrote:
> >
> > sometimes the excel format can cause havok with the apache POI parser
> > (depends on exact versions of excel).
> >
> >
> >
> > On 1/14/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
> > >
> > > The problem seems to be a cell format/formula problem. I need to use
> the
> > > 'general' format because my cell has a formulas. In this case my
> > condition
> > > is ignored. When I hard code the result of the formula in the cell,
> it's
> > > ok.
> > >
> > > Is it forbidden to have excel formulas in the cells belonging to the
> > > condition column ?
> > >
> > >
> > > On 1/13/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi everybody !
> > > >
> > > > I am using drools 2.1 with excel worksheet. Sometimes, some
> conditions
> > > > columns are completely ignored by the engine, and thus my actions
> are
> > > > executed without testing the conditions . If I generate a DRL file
> > from
> > > the
> > > > worksheet, I see that my conditions are not included in the
> generated
> > > file.
> > > > I can't find the reason for my condition column to be ignored.
> > > > Does anyone has a clue ?
> > > >
> > > > Regards,
> > > >
> > > > Pascal Chanteux.
> > > >
> > >
> > >
> >
> >
>
>


Re: [drools-user] excel worksheet caching

2006-01-16 Thread Michael Neale
Thats great. Well we should update to poi 3 when it is final (or close
enough). Probably will resolve other issues as well.

On 1/16/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
>
> FYI, with POI v3.0alpha, everything concerning hssf seems to be OK.
>
>
> On 1/16/06, Pascal Chanteux <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I am using excel 2000. I've got a lot of problems while parsing the
> excelfiles. An exception of type '
> >
> > Caused by:
> > *java.lang.ArrayIndexOutOfBoundsException*
> >
> > at java.lang.System.arraycopy(
> > *Native Method*)
> >
> > at org.apache.poi.hssf.record.UnknownRecord.(
> > *UnknownRecord.java:62*) ' occurs often when I modify a well formatted
> > excel file.
> >
> > I am looking for a way to avoid these exception. Can I use a newer
> version
> > of the apache POI ?
> >
> > Thanks,
> >
> > Pascal
> >
> >  On 1/14/06, Michael Neale <[EMAIL PROTECTED]> wrote:
> > >
> > > no there is no caching. What version of excel are you using?
> > >
> > > I have added CSV support as it is less prone to strange variances in
> the
> > >
> > > file format which xls is. Unfortunately Excel 97 format is very
> much  a
> > > closed format, so it can be a little hard to account for all versions
> > > saveing in strange states.
> > >
> > > Hopefully Microsoft will open up the new OfficeXML format enough, and
> > > that
> > > coupled with ODF (OpenDocument) will provide a better general purpose
> > > format
> > > (but it will take time to be widely available).
> > >
> > > On 1/14/06, Pascal Chanteux <[EMAIL PROTECTED] > wrote:
> > > >
> > > > Hi ,
> > > >
> > > > Is there any form of caching during the parsing/loading of an excel
> > > > worksheet ?
> > > > I have an excel worksheet for my drools test. The result of my test
> > > case
> > > > is
> > > > correct. Everything is OK.
> > > > When I change something in the content of my cell, I have this
> > > exception :
> > > >
> > > > *org.drools.decisiontable.parser.DecisionTableParseException: An
> error
> > > > occurred processing the decision table.
> > > > at org.drools.decisiontable.DecisionTableLoader.loadDRLFromStream(
> > > > DecisionTableLoader.java:124)
> > > > at org.drools.decisiontable.DecisionTableLoader.getReader(
> > > > DecisionTableLoader.java:108)
> > > > at org.drools.decisiontable.DecisionTableLoader.loadFromInputStream(
> > > > DecisionTableLoader.java:102)
> > > > ...Caused by: org.apache.poi.hssf.record.RecordFormatException:
> > > Unable
> > > > to construct record instance, the following exception occured: null
> > > > at org.apache.poi.hssf.record.RecordFactory.createRecord(
> > > > RecordFactory.java
> > > > :237)
> > > > at
> > > >
> > >
> org.apache.poi.hssf.eventusermodel.HSSFEventFactory.genericProcessEvents
> > > > (HSSFEventFactory.java :183)
> > > > at org.apache.poi.hssf.eventusermodel.HSSFEventFactory.processEvents
> (
> > > > HSSFEventFactory.java:101)
> > > > at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(
> > > > ExcelParser.java:263)
> > > > at
> > > org.drools.decisiontable.SpreadsheetDRLConverter.getRuleSheetListener(
> > > > SpreadsheetDRLConverter.java:123)
> > > > at org.drools.decisiontable.SpreadsheetDRLConverter.convertToDRL(
> > > > SpreadsheetDRLConverter.java :72)
> > > > at org.drools.decisiontable.DecisionTableLoader.loadDRLFromStream(
> > > > DecisionTableLoader.java:118)
> > > > ... 20 more*
> > > >
> > > > I found a workarround for this, simply by changing the name of the
> > > ruleset
> > > > in the worksheet. In this case everything works fine again.
> > > >
> > > > Is this normal or I am missing something ?
> > > >
> > > > Thanks,
> > > >
> > > > Pascal
> > > >
> > > >
> > >
> > >
> >
>
>


Re: [drools-user] Necessity of negative conditions?

2006-01-16 Thread Michael Neale
Drools 3 will have Not built in. Not sure if that helps !

On 1/17/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I was wondering what your opinions are on the necessity of negative
> conditions in production rules? The reason I am interested is that I am
> currently developing a Java embedding of a rule-based programming
> language myself, with similar expressive power as the current Drools
> language (i.e.: forward chaining rules without negative conditions). I
> am pleased to see a system as Drools became this popular and widely used
> and accepted without support for negative conditions. It strengthens my
> feeling that a language could do without (and without the complexities
> of implementing it efficiently...).
>
> So, the main question for the discussion I am hoping to get started here
> (probably you've had it before somewhere, in which case a summary of the
> outcomes would be much appreciated): are negative conditions necessary?
> Are they missed in practice a lot?
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>


Re: [drools-user] XOR group

2006-01-17 Thread Michael Neale
This is something that can be tackled by doing lazy condition evaluation
(backward), which may be included in the future as an option.

In most cases, I don't think the impact on performance would really be
anything much. Of course there are some cases where it would - one "hack"
which has been suggested before - is to put a lazy check inside the
consequence itself. So the "condition" is not a condition node, but just a
check before the consequence does what it wants. This "hack" is then
invisible to the engine, but may work in some special cases.

On 1/17/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> As far as I know you cannot really do this, because Drools is a
> Rete-based system, which is an eager evaluation algorithm. This means
> the complete conflict set gets cumputed, followed by the selection of
> one to fire (match - select - act). I guess the XOR group will then
> delete the other rules from the agenda as well. That's my guess of
> course, since I don't know much about the internal details of Drools.
> And yes, you are right, this could get really inefficient in some cases,
> but, in general, this remains limited. If it really starts to become a
> performance issue, you should consider using a system based on a lazy
> evaluation algorithm...
>
> Yours,
> Pé
>
>
> Sinha, Amitesh wrote:
> > If the XOR group is used, all conditions are evaluated and only one
> > consequence is executed. E.g.,
> > If I have N rules, all N conditions are evaluated before one consequence
> > is triggered. If the value of N is very high, this is going to degrade
> > the performance drastically.
> >
> > 
> >
> > 
> > -
> > -
> > -
> > 
> > 
> > -
> > -
> > -
> > 
> > .
> > .
> > .
> >
> > 
> > -
> > -
> > -
> > 
> > 
> >
> >
> > Is there a way we can use so that when one condition is satisfied, none
> > of the other conditions are evaluated?
> >
> >
> > Thanks in advance,
> >
> > Amitesh
> >
> > http://www.patni.com
> > World-Wide Partnerships. World-Class Solutions.
> > _
> >
> > This e-mail message may contain proprietary, confidential or legally
> > privileged information for the sole use of the person or entity to
> > whom this message was originally addressed. Any review, e-transmission
> > dissemination or other use of or taking of any action in reliance upon
> > this information by persons or entities other than the intended
> > recipient is prohibited. If you have received this e-mail in error
> > kindly delete  this e-mail from your records. If it appears that this
> > mail has been forwarded to you without proper authority, please notify
> > us immediately at [EMAIL PROTECTED] and delete this mail.
> > _
> >
>
>
>


Re: [drools-user] best practice for ruleset constants?

2006-01-17 Thread Michael Neale
You can actually put constants in functions, and use them in rules as you
would normally.



public static final int SOME_VALUE_HERE = 42;
public static final String ANOTHER_CONST = "Slartibartfast";



But I am not sure if thats exactly what you want. If these are parameters
that you want users to tweak on the fly, probably best to put them in a
properties file, or a database with a web front end to change them. The rule
engine can then access them as application data, as you said. In Drools 2
there isn't really another way to make it neater (short of creating your own
XML language, which might be more work then you are prepared to do).



On 1/17/06, Adrian Bigland <[EMAIL PROTECTED]> wrote:
>
>
> Hi all,
>
> I need several constants in a ruleset - they represent confidence factors
> (weights) for different inputs.
>
> These weights are decided by the business and need to be changed in the
> same way as the business rule logic, so I'd like to represent the values
> in
> the ruleset definition file.
>
> I also need to use the JSR-94 API.
>
> My question is - what is the most elegant way to set up these constants in
> a rule file.
>
> I can think of a few possible approaches, but I haven't figured out a way
> to do it yet:
>
> - application data - but I have yet to find out how to set the values in
> the rulefile.
> - use rules to assert values - I'm currently trying to figure out how to
> control when these fire.
>
> Am I trying to do something in a very non-rule engine way here? Or has
> anyone had some experience of doing this that they would like to share?
>
> Thanks,
>
> Adrian Bigland.
>
>
>
>
>
> **
>
> This e-mail and any attachment is intended for the named addressee(s)
> only, or person authorised to receive it on their behalf. The content should
> be treated as confidential and the recipient may not disclose this message
> or any attachment to anyone else without authorisation. Unauthorised use,
> copying or disclosure may be unlawful. If this transmission is received in
> error please notify the sender immediately and delete this message from your
> e-mail system. Any view expressed by the sender of this message or any
> attachment may be personal and may not represent the view held by First
> Choice Holidays PLC and its subsidiaries. All electronic transmissions to
> and from First Choice are recorded, may be monitored and are scanned for
> viruses and content. E-mails containing viruses will be deleted without
> notification. Whilst we maintain virus checks on inbound e-mails we accept
> no liability for viruses or other material introduced with this message.
>
> All companies form part of the First Choice Holidays PLC group of
> companies.
>
> First Choice Holidays PLC Company Registration No: 48967 (England)
>
> Registered Office: First Choice House, London Road, Crawley, WestSussex
> RH10 9GX
>
> **
>
>
>
>


Re: [drools-user] [Drools][5.2.1] JDKs support in rules expression

2006-01-18 Thread Michael Neale
2.1 only supports JDK 1.4 version of java.

2.5 (which is in beta) I believe supports 1.5 thanks to the built in eclipse
JDT compiler.

On 1/18/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Hello.
>
>
>
> I've already successfully checked that Drools supports JDK 1.5 at runtime
> for the java code that calls it.
>
> But it seems the code snippets in rules expression are rejected if some
> JDK
> 1.5 features, like the new for loops, are used.
>
>
>
> Could somebody confirm that ?
>
> Or is there a way to make Drools compile JDK 1.5 rules ?
>
>
>
> Thanks.
>
>
>
> --
>
> Ephemeris Lappis
>
>
>
>
>


Re: [drools-user] [Drools][5.2.1] Loop control and best practice

2006-01-18 Thread Michael Neale
Yes no-loop is pretty basic, its idea is to stop RuleA causing it to fire
itself recursively. Of course, RuleA could cause RuleB to fire, which in
turn causes RuleA to fire (no-loop is not designed to stop that).

To make sure things only fire once for the given facts, which I gather is
what you want, as you say you need to have your own memory in your model of
what has fired.
Alternatively (perhaps, ideally) you do something like the "fish shop"
example does regarding free samples:
In your rule "customer-has-orders" where you add a free Gift CD, you can add
a check to see if they already have a "gift CD" in the basket, and only add
one if they don't. This ensures that the rule is always logically correct no
matter when it fires.

This has the added advantage that another rule may come along which adds a
gift CD, which means that the rule I described would still be correct
(otherwise they may end up with multiple Gift CDs, which would not be
stopped by controlling the loop behaviour).

Does that make sense?

On 1/18/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Hello.
>
> I've tried to build a first simple case with potential loops.
>
> The rules script is attached (I hope the list supports attachments ?)…
> I don't send the full project, but I can do it if needed.
>
> The test system is about customers, their placed orders, and the rules are
> to select gifts that may be offered to customers depending on several
> conditions. Gifts are selected and placed into a virtual 'basket' that
> handles the decision process.
>
> Something like :
>
> - if a customer is 40 years old or more, we offer glasses.
> - If a customer has already placed order for more than 2500 €, we may give
> a CD.
> - If the basket contains 2 gifts or more, we also give a bag to put them.
>
>


Re: [drools-user] [Drools][5.2.1] Loop control and best practice

2006-01-18 Thread Michael Neale
Ideally you should not need to rely on no-loop behaviour, instead making
your rules logically correct no matter what order they fire in etc... its a
bit of a different way of thinking really.

On 1/19/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Thanks for your response.
> Things seem clear for the "no-loop" and for the hand-made loop control for
> other cases too.
>
> --
> Ephemeris Lappis
>
> -Message d'origine-
> De : Michael Neale [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 18 janvier 2006 23:54
> À : user@drools.codehaus.org
> Objet : Re: [drools-user] [Drools][5.2.1] Loop control and best practice
>
> Yes no-loop is pretty basic, its idea is to stop RuleA causing it to fire
> itself recursively. Of course, RuleA could cause RuleB to fire, which in
> turn causes RuleA to fire (no-loop is not designed to stop that).
>
> To make sure things only fire once for the given facts, which I gather is
> what you want, as you say you need to have your own memory in your model
> of
> what has fired.
> Alternatively (perhaps, ideally) you do something like the "fish shop"
> example does regarding free samples:
> In your rule "customer-has-orders" where you add a free Gift CD, you can
> add
> a check to see if they already have a "gift CD" in the basket, and only
> add
> one if they don't. This ensures that the rule is always logically correct
> no
> matter when it fires.
>
> This has the added advantage that another rule may come along which adds a
> gift CD, which means that the rule I described would still be correct
> (otherwise they may end up with multiple Gift CDs, which would not be
> stopped by controlling the loop behaviour).
>
> Does that make sense?
>
> On 1/18/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
> >
> > Hello.
> >
> > I've tried to build a first simple case with potential loops.
> >
> > The rules script is attached (I hope the list supports attachments ?)…
> > I don't send the full project, but I can do it if needed.
> >
> > The test system is about customers, their placed orders, and the rules
> are
> > to select gifts that may be offered to customers depending on several
> > conditions. Gifts are selected and placed into a virtual 'basket' that
> > handles the decision process.
> >
> > Something like :
> >
> > - if a customer is 40 years old or more, we offer glasses.
> > - If a customer has already placed order for more than 2500 €, we may
> give
> > a CD.
> > - If the basket contains 2 gifts or more, we also give a bag to put
> them.
> >
> >
>
>


Re: [drools-user] [Drools][5.2.1] JDKs support in rules expression

2006-01-19 Thread Michael Neale
hehehehe... good question.

Well, in 2.1 it used Janino. Which is a simple in memory compiler. So the
first time you go to execute a rule that has embedded code, it would compile
and cache it on the fly. Kind of lazy compilation.

In 2.5, its a bit different. It actually takes the "java" (actually it can
be other semantic languages as well, such as groovy, there is even a .net
version now) and generates a little piece of code (all in memory), includes
your functions (if any), then it sends this code to "JCI" which is a generic
java compiler interface (which supports more then just java).

JCI then invokes the appropriate runtime compiler (by default in 2.5 is is
eclipse jdt, which is definately not javac !), and ends up building a binary
"ddj" (which is really a jar) of all the rules, which is then loaded into
the ruleset. This all happens behind the scenes, but you can get the "jar"
out (both source and binary) to have a look. So in effect the rules run off
the compiled version (meaning fast startup times as no lazy compilation).

To make it dynamic, package names used by the rulesets are unique, so when a
new version is loaded, its actually a different "package" name behind the
scenes. Also, a custom classloader is used, not the system classloader (so
it shouldn't be effected by the runtime environment).

It is important to note that this all happens in memory, unless you want to
persist the binary/source forms of the rules for deployment purposes. So no
conflict with J2EE restrictions about files, system settings etc.

For groovy all of the above applies. For Jython, there is no compiling, its
totally script based dynamic.

Phew - does that answer your question ?



On 1/20/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Hello.
>
> I'm not absolutely sure I have understood well how it works.
>
> Does Drools translate DRL files in java source files, and then compile
> them
> using a javac compiler ? Or is there another kind of dynamic interpreter
> that just shares the java language syntax, in case of this semantic is
> used
> ?
>
> What are the technical impacts, for instance in use cases inside J2EE
> plaforms (EJB specifications come with many programming restrictions), or
> when a simple JRE is available (embedded systems for example) ?
>
> Thanks.
>
> --
> Ephemeris Lappis
>
>
> -Message d'origine-
> De: Mark Proctor [mailto:[EMAIL PROTECTED]
> Envoyé: vendredi 20 janvier 2006 04:20
> À: user@drools.codehaus.org
> Objet: Re: [drools-user] [Drools][5.2.1] JDKs support in rules expression
>
> Drools 2.1 uses Janino, which is jdk1.4.
> Drools 2.5 can use either Eclipse JDT (default) or janino. Eclipse JDT
> works fine with JDK1.5
>
>
> Mar
> Ephemeris Lappis wrote:
> > Hello.
> >
> >
> >
> > I've already successfully checked that Drools supports JDK 1.5 at
> runtime
> > for the java code that calls it.
> >
> > But it seems the code snippets in rules expression are rejected if some
> JDK
> > 1.5 features, like the new for loops, are used.
> >
> >
> >
> > Could somebody confirm that ?
> >
> > Or is there a way to make Drools compile JDK 1.5 rules ?
> >
> >
> >
> > Thanks.
> >
> >
> >
> > --
> >
> > Ephemeris Lappis
> >
> >
> >
> >
> >
>
>


Re: [drools-user] [Drools][5.2.1] JDKs support in rules expression

2006-01-19 Thread Michael Neale
Yes Eclipse JDT is in the distro (it in theory can also work with janino).

Mostly we have been able to track down app server issues, but obviously its
not possible to catch them all, as there are too many to try.
There is nothing particularly magical about classloading. To the app servers
point of view, rules are just new classes. The issues are generally around
conflicting classes in different classloaders, or replaceing classes etc.





On 1/20/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Hello.
>
> Comments and more questions below in the text...
>
> Thanks !
>
> --
> Ephemeris Lappis
>
> > -----Message d'origine-
> > De: Michael Neale [mailto:[EMAIL PROTECTED]
> > Envoyé: vendredi 20 janvier 2006 08:02
> > À: user@drools.codehaus.org
> > Objet: Re: [drools-user] [Drools][5.2.1] JDKs support in rules
> expression
> >
> > hehehehe... good question.
> >
> > Well, in 2.1 it used Janino. Which is a simple in memory compiler. So
> the
> > first time you go to execute a rule that has embedded code, it would
> > compile
> > and cache it on the fly. Kind of lazy compilation.
>
> Right, this is the version I'm using...
>
> >
> > In 2.5, its a bit different. It actually takes the "java" (actually it
> can
> > be other semantic languages as well, such as groovy, there is even a
> .net
> > version now) and generates a little piece of code (all in memory),
> > includes
> > your functions (if any), then it sends this code to "JCI" which is a
> > generic
> > java compiler interface (which supports more then just java).
> >
> > JCI then invokes the appropriate runtime compiler (by default in 2.5 is
> is
> > eclipse jdt, which is definately not javac !), and ends up building a
> > binary
> > "ddj" (which is really a jar) of all the rules, which is then loaded
> into
> > the ruleset. This all happens behind the scenes, but you can get the
> "jar"
> > out (both source and binary) to have a look. So in effect the rules run
> > off
> > the compiled version (meaning fast startup times as no lazy
> compilation).
>
> Does it mean that the JDT will come packaged along with Drools ?
>
> >
> > To make it dynamic, package names used by the rulesets are unique, so
> when
> > a
> > new version is loaded, its actually a different "package" name behind
> the
> > scenes. Also, a custom classloader is used, not the system classloader
> (so
> > it shouldn't be effected by the runtime environment).
> >
> > It is important to note that this all happens in memory, unless you want
> > to
> > persist the binary/source forms of the rules for deployment purposes. So
> > no
> > conflict with J2EE restrictions about files, system settings etc.
>
> Except for class loaders uses !
> But should it be a true problem, depending on the application server ?
>
> >
> > For groovy all of the above applies. For Jython, there is no compiling,
> > its
> > totally script based dynamic.
> >
> > Phew - does that answer your question ?
>
> For sure !
>
> >
> >
> >
> > On 1/20/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
> > >
> > > Hello.
> > >
> > > I'm not absolutely sure I have understood well how it works.
> > >
> > > Does Drools translate DRL files in java source files, and then compile
> > > them
> > > using a javac compiler ? Or is there another kind of dynamic
> interpreter
> > > that just shares the java language syntax, in case of this semantic is
> > > used
> > > ?
> > >
> > > What are the technical impacts, for instance in use cases inside J2EE
> > > plaforms (EJB specifications come with many programming restrictions),
> > or
> > > when a simple JRE is available (embedded systems for example) ?
> > >
> > > Thanks.
> > >
> > > --
> > > Ephemeris Lappis
> > >
> > >
> > > -Message d'origine-
> > > De: Mark Proctor [mailto:[EMAIL PROTECTED]
> > > Envoyé: vendredi 20 janvier 2006 04:20
> > > À: user@drools.codehaus.org
> > > Objet: Re: [drools-user] [Drools][5.2.1] JDKs support in rules
> > expression
> > >
> > > Drools 2.1 uses Janino, which is jdk1.4.
> > > Drools 2.5 can use either Eclipse JDT (default) or janino. Eclipse JDT
> > > works fine with JDK1.5
> > >
> > >
> > > Mar
> > > Ephemeris Lappis wrote:
> > > > Hello.
> > > >
> > > >
> > > >
> > > > I've already successfully checked that Drools supports JDK 1.5 at
> > > runtime
> > > > for the java code that calls it.
> > > >
> > > > But it seems the code snippets in rules expression are rejected if
> > some
> > > JDK
> > > > 1.5 features, like the new for loops, are used.
> > > >
> > > >
> > > >
> > > > Could somebody confirm that ?
> > > >
> > > > Or is there a way to make Drools compile JDK 1.5 rules ?
> > > >
> > > >
> > > >
> > > > Thanks.
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Ephemeris Lappis
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
>
>


Re: [drools-user] Null fact assertion and retraction

2006-01-21 Thread Michael Neale
Cheers prem !

Actually, as an initial thing to try, I would suggest keeping calling
.newWorkingMemory each time you want a clean WM - rather then clearing it.

WMs are lightweight objects and very quick to create. I think in your case,
as you are clearing the WM, it may actually be quicker to create it fresh
and discard the old one.

Give that a try, it may solve your problems (unless I have mis-interpreted
your requirements). Generally the reason to keep working memories is if you
want to keep the state in them (and keep adding facts over time), but in
your case, you are clearing it, so my suggestion is to get a fresh one (and
you don't really need a pool then - so less contention for the app server).


Michael.

On 1/22/06, prem <[EMAIL PROTECTED]> wrote:
>
>
> Hi drools team,
>
> First of all, drools is a great product and saved us lots of time, effort
> and
> money. Thanks.
>
> We have a web application in which drools is a key component. I have
> created a
> pool of WorkingMemories, since given any time, there could be multiple
> users
> requesting for the rules service. Whenever rules need to be run, a
> WorkingMemory
> is pulled out of the pool used and returned back to the pool. After
> allocating
> the WorkingMemory, before using it, old facts are cleared. It is done by
> the
> following method:
>
> public static void clearWorkingMemory(WorkingMemory wMem) {
> List factHandleList;
>
> factHahdleList=wMem.getFactHandles();
> for(FactHandle fh : factHandleList) {
> wMem.retractObject(fh);
> }
> }
>
>
> Now, when I assert a null fact the above method throws a
> NoSuchFactObjectException.
>
>
>
> Besides, some of my conditions actually check for the fact to be null and
> act
> appropriately. This is because a fact being null has a meaning by itself.
> These
> conditions are not even evaluated when the fact is asserted as null.
> Without
> understanding this behaviour, I got around it by creating FactWrapper
> bean.
>
> After pondering little while I realized that when a null fact is asserted
> into
> the working memory, there is no information to ascertain which fact is
> being
> asserted. [when a fact is non-null, by reflection the class and the
> properties
> can be ascertained. This can be compared against parameter declaration].
> Which
> actually means that asserting a null fact can have no effect on the rule
> execution. If that is the case, I feel that it will be better to prevent
> asserting null facts. This will save time for so many. Do I have a point
> here
> or am I missing something??
>
>
>
> Regarding the NoSuchFactObjectException, I dug into the code and found
> that
> org.drools.reteoo.WorkingMemoryImpl.retractObject calls
> WorkingMemoryImpl.getObject(). getObject() when it gets a null from the
> PrimitiveLongMap assumes that the object is not found and throws the
> exception.
> This should have been looking for objects.containsKey() and if this
> returns
> false, then throw NoSuchFactObjectException. I checked PrimitiveLongMap
> and
> found that even containsKey does [return get(key)!=null]. This can be
> fixed by
> adding a getInternal() private method like this:
>
> 
> Existing code: org.drools.util.PrimitiveLongMap.java
> public Object get(long key)
> {
> if ( key > this.maxKey || key < 0 )
> {
> return null;
> }
>
> Object value = findPage( key ).get( key );
>
> // NULL means the key exists, so return a real null
> if ( value == NULL )
> {
> value = null;
> }
> return value;
> }
>
> public boolean containsKey(long key)
> {
> if ( key < 0 ) return false;
>
> return get( key ) != null;
> }
>
> Can be changed to:
>
> public Object get(long key)
> {
> Object value = getInternal(key);
>
> // NULL means the key exists, so return a real null
> if ( value == NULL )
> {
> value = null;
> }
> return value;
> }
>
> private Object getInternal(long key)
> {
> if ( key > this.maxKey || key < 0 )
> {
> return null;
> }
>
> return findPage( key ).get( key );
> }
>
> public boolean containsKey(long key)
> {
> if ( key < 0 ) return false;
>
> return getInternal( key ) != null;
> }
> 
>
>
> 
> Existing code: org.drools.reteoo.WorkingMemoryImpl.java
> public Object getObject(FactHandle handle) throws
> NoSuchFactObjectException
> {
> Object object = this.objects.get( ((FactHandleImpl) handle).getId(
> ) );
>
> if ( object == null )
> {
> throw new NoSuchFactObjectException( handle );
> }
>
> return object;
> }
>
> can be changed to:
> public Object getObject(FactHandle handle) throws
> NoSuchFactObjectException
> {
> long key = ((FactHandleImpl) handle).getId( );

Re: [drools-user] Spring Inejection of RulesBase

2006-01-21 Thread Michael Neale
no reason why not.

spring can manage the rulebase creation and cache just find, and inject it
as needed (you can even get it to inject a .newWorkingMemory into managed
beans if you needed to, I guess).

On 1/22/06, Ronald R. DiFrango <[EMAIL PROTECTED]> wrote:
>
> Mark,
>
> I assume though you will keep this so that you can still use Spring to
> inject a RulesBase
>
> Ron
>
>
> On 1/21/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
> >
> > Drools 2.5 is the last release, if you want this in it has to be
> > committed asap - the spring stuff will not be migrated to the 3.0series.
> >
> > Mark
> > Armin Ehrenfels wrote:
> > > Ron,
> > >
> > > I created a JIRA issue a few minutes ago. You should have received a
> > > notification from the list. At least, I have.
> > > Anyway, look at this:
> > >
> > > http://jira.codehaus.org/browse/DROOLS-476
> > >
> > > good luck.
> > >
> > > Armin
> > >
> > >
> > > Ronald R. DiFrango wrote:
> > >
> > >> Armin,
> > >>
> > >> No attachements here.
> > >>
> > >> Ron
> > >>
> > >> On 1/20/06, Armin Ehrenfels <[EMAIL PROTECTED]> wrote:
> > >>
> > >>
> > >>> Done (hopefully correctly  ;-) )
> > >>>
> > >>> Barry Kaplan wrote:
> > >>>
> > >>>
> > > I sent the code to the folks around Marc Procter. They told me the
> > > changes will be part of future releases, but obviously not
> 2.5-beta.
> > > Also, I can't find it in the CVS repository. If you are
> interested,
> > > let me know.
> > >
> >  I've been out of the loop for some time, so probably I dropped the
> >  ball on this submission. Is the code you emailed to me some time
> ago?
> >  If so, could you create a jira issue and attach the code there.
> That
> >  way I will be sure to get it integrated once I have completed
> moving
> >  into to my new pad and have my machine setup.
> > 
> >  -barry
> > 
> > 
> > >>>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> >
>
>


Re: [drools-user] Performance problems on Transitivity Inferencing + Suggestion for future Release

2006-01-22 Thread Michael Neale
Hi Andreas.

The Combination monster strikes again !

Add this as your first condition:
 System.identityHashCode(Y) >
System.identityHashCode (X)

This will ensure that only "useful" combinations are added. When I add that,
9 tuples took about 14milliseconds, and 20 took about 1 second (!) - your
mileage may vary. Before that I was getting worse times then you (my machine
in more humble, it would seem?). Perhaps you can confirm that this is what
you need?

We/I have been planning for some time to build in a feature to remove
"unhelpful" combinations, by making use of the System identity of the fact
objects, and this certainly re-inforces that. Note that the above is just a
bit of "sugar" such that the rule will only be activated for unique
combinations of tuple instances (by using identity hashcode, it is
arbitrary, but unique).

In general, for *most* people having (fact1, fact2) and (fact2, fact1)
combinations is not terribly helpful, so I would like it on by default in
Drools 3 (no change to drools 2) (any one care to disagree?). So instead of
Combinations, we end up with Permutations (or is it the other way around? I
should have payed more attention in school rather then perving at the girl
in front).

Of course, I could be horribly wrong, and get blasted by people asking why
they are not getting all possible Combinations any more ! (perhaps I didn't
waste my time looking at the girl in front after all).

So in summary, try the above condition, and let me know if you get better
(and still correct) results. In Drools 3 we will aim to include this
condition implicitly via a few different means, but I think the same result
can be achieved (in fact there will be lots of other performance advantes,
of which this is just one).


For a bit more of an explanation by someone much much smarter and more
eloquent then me, read Simon Harris blog:
http://www.redhillconsulting.com.au/blogs/simon/archives/000213.html





Regards,

Michael
JBoss Business Rules

On 1/22/06, Andreas Andreakis <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I agree that generic-general purpose RuleEngines can not hold this
> computation.
>
> The problem is that you have dublication of Facts, which kill
> memory-space.
> For instance, if you execute the Example with 4 Triples under Drools you
> get:
>
> <0>  <1>
> <1>  <2>
> <2>  <3>
> <3>  <4>
> <0>  <2>
> <2>  <4>
> <1>  <3>
> <0>  <3>
> <1>  <4>
> <0>  <4>
> *<0>  <3>*
> *<1>  <4>*
> *<0>  <4>
> <0>  <4>
> <0>  <4>
> <0>  <4>*
>
> The marked Triples are dublicates. With a growing number of Triples the
> dublicates grow exponentialy.
> Each of the Triple is represented by a TripleObject (see Triple Class in
> first email). Theoreticly, Drools does a correct Job. In Practice, this
> behaviour is not always desired.
>
>


Re: [drools-user] Performance problems on Transitivity Inferencing + Suggestion for future Release

2006-01-23 Thread Michael Neale
well not really. If someone has a rule where they declare they want 2
objects of type A,
Then most of the time, they just want the "interesting" permutations from
matching objects in working memory. A hashcode is just an arbitrary way of
providing an order (refer to
http://www.redhillconsulting.com.au/blogs/simon/archives/000213.html
<http://www.redhillconsulting.com.au/blogs/simon/archives/000213.html>for an
example in SQL using an id field, which is really just as arbitrary in the
database world).

I think it does need to be an option for people to use, the question is to
make it default or not. It just seems that whenever someone writes rules
that take multiple same type parameters, they get into trouble when they
didn't really need all those extra combinations to start with.

The fact that the hash code changes with each run (possibly) doesn't matter
in this case, unless you magically expect certain objects to appear bound to
parameters based on their order, which doesn't even make any sense anyway.
In this case he was saying that he didn't need the extra combinations, and
identity is a efficient way to achieve this.

Michael.



On 1/23/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> Michael Neale wrote:
> > Hi Andreas.
> >
> > The Combination monster strikes again !
> >
> A monster indeed ;-)
>
> > Add this as your first condition:
> >  System.identityHashCode(Y) >
> > System.identityHashCode (X)
> >
> > This will ensure that only "useful" combinations are added. When I add
> that,
> > 9 tuples took about 14milliseconds, and 20 took about 1 second (!) -
> your
> > mileage may vary. Before that I was getting worse times then you (my
> machine
> > in more humble, it would seem?). Perhaps you can confirm that this is
> what
> > you need?
>
> Personally, I doubt it. Its a difficult question to answar what are the
> useful combinations. In constraint programming this translates in the
> question of what to propagate. There is a lot of knowledge that can be
> derived from a given knowledge base, but infering it all is in general
> not a very good idea. Indeed, *every* rule that fires in this particular
> test introduces redundant information. The extra constraints you are
> posing on the information infered by simple transitivity here is based
> on their identity hash-codes? How can that be a measure of usefulness?
> Besides, every run of your program will give different (indeterministic)
> results...
>
> But hey, that's just my idea...
>
> Chears,
> Pé
>
>


Re: [drools-user] Performance problems on Transitivity Inferencing + Suggestion for future Release

2006-01-23 Thread Michael Neale
OK I understand now - identity will only solve a little bit of the problem.

Yeah its a good idea to implement them anyway (read Joshua Blochs Effective
Java book for reasons - I think those chapters are online and free..)

If the rules were to work on string objects, then you get equals and
hashcode for free, but like you say it is work to "map" your objects to the
objects for the rule (which is work) so perhaps implementing your own
hashCode and equals is a good thing. Lots of rule engines work on
deftemplate like structures, which is kind of the same idea - you have to
map your domain objects to the rules model.

You hit the nail on the head when you said it is like OR mapping - for more
complex structures it is quite difficult. Part of the popularity of Drools
is the fact that you can just shove in your POJOs and work off them in the
rules (but it makes it hard to implement !).

The declarative approach could work - having a rule with higher salience to
remove the dupes - and it makes it explicit, but I am not sure what that
means performance wise. Basically you have a "disallow_dupes" rule which
does the check, and retracts the object if it is a duplicate - my gut feel
says the set approach is more efficient in drools 2.

Mark might be able to comment on the Drools 3 ways of addressing this, as
there will be more options. It sounds (from what Bob alluded to) that there
could be some flavours of drools tilted towards reasoning, which this sort
of behaviour is enabled by default.


Michael.

On 1/24/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> Andreas Andreakis wrote:
>
> > I agree, that it is not a beautiful solution.
> >
> > But the problem is, that you can´t tell if two Objects are equal if
> > you dont define equals() , hashcode() on your own. How will your
> > dublication-preventing Rule look like ?
>
> I would simply implement the equal and hashcode methods :-)
> It is general good practice to do so and it is quite easy: an equals
> method is almost trivial, and for the hashcode you can use e.g.
> http://www.javapractices.com/Topic28.cjp if you want...
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>
>


Re: [drools-user] NoSuchFieldError: tokenTypeToASTClassMap while loading rulebase

2006-01-24 Thread Michael Neale
hmmm.. often its a missing ";" in a condition, or something wierd in a
condition node.

Send your rules xml

On 1/25/06, Markus <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm running drools 2.1 on a servlet which is deployed to a Apache
> Tomcat 5.0.28 which works fine.
>
> I just tried to deploy the same webapp into an Oracle Application
> Server OAS 10.1.2.0.0 and got the following error while loading the
> rulebase:
>
> I'm using java 1.4.2_04.
>
> Code:
> ruleBase = RuleBaseLoader.loadFromInputStream(
> XPS.class.getResourceAsStream("rules.java.drl"
> ));
>
> Exception:
> java.lang.NoSuchFieldError: tokenTypeToASTClassMap   at
> org.drools.semantics.java.parser.JavaRecognizer.buildTokenTypeASTClassMap(
> JavaRecognizer.java:4809)
> at
> org.drools.semantics.java.parser.JavaRecognizer.(JavaRecognizer.java
> :55)
>   at
> org.drools.semantics.java.parser.JavaRecognizer.(JavaRecognizer.java
> :60)
>   at
> org.drools.semantics.java.JavaExprAnalyzer.analyze(JavaExprAnalyzer.java
> :100)
>   at
> org.drools.semantics.java.JavaCondition.(JavaCondition.java:108)
> at
> org.drools.semantics.java.JavaConditionFactory.newCondition(
> JavaConditionFactory.java:69)
>   at
> org.drools.io.ConditionHandler.end(ConditionHandler.java:66)   at
> org.drools.io.RuleSetReader.endElement(RuleSetReader.java:617)   at
> oracle.xml.parser.v2.XMLMultiHandler.endElement(XMLMultiHandler.java:184)
> at
> oracle.xml.parser.schema.XSDValidator.endElement(XSDValidator.java:737)
> at
> oracle.xml.parser.v2.NonValidatingParser.parseElement(
> NonValidatingParser.java:1254)
>   at
> oracle.xml.parser.v2.NonValidatingParser.parseRootElement(
> NonValidatingParser.java:311)
>   at
> oracle.xml.parser.v2.NonValidatingParser.parseDocument(
> NonValidatingParser.java:278)
>   at
> oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:184)   at
> oracle.xml.jaxp.JXSAXParser.parse(JXSAXParser.java:288)   at
> org.drools.io.RuleSetReader.read(RuleSetReader.java:443)   at
> org.drools.io.RuleSetReader.read(RuleSetReader.java:337)   at
> org.drools.io.RuleBaseLoader.loadFromInputStream(RuleBaseLoader.java:234)
> at
> org.drools.io.RuleBaseLoader.loadFromInputStream(RuleBaseLoader.java:193)
> at
> org.drools.io.RuleBaseLoader.loadFromInputStream(RuleBaseLoader.java:177)
>
>
> What went wrong?
>
> Markus
>


Re: [drools-user] NoSuchFieldError: tokenTypeToASTClassMap while loading rulebase

2006-01-25 Thread Michael Neale
Sorry missed that.

I know from past experience that Weblogic 8.1, for instance, had a version
of Antlr that conflicted with the version in Hibernate 3. Antlr is used by
the Java semantic module in drools, so perhaps it is a similar envionmental
issue?

Thats the only thing that leaps out at me, and the error is happening in the
antlr generated code.


On 1/25/06, Markus <[EMAIL PROTECTED]> wrote:
>
> 2006/1/24, Michael Neale <[EMAIL PROTECTED]>:
> > hmmm.. often its a missing ";" in a condition, or something wierd in a
> > condition node.
>
> As I wrote in my first posting everything works fine on Tomcat, even
> with the same rule-file.
> The problem only occurs when using drools on OAS.
>
> > Send your rules xml
>
> 
>
>xmlns="http://drools.org/rules";
>   xmlns:java="http://drools.org/semantics/java";
>   xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
>   xs:schemaLocation="http://drools.org/rules rules.xsd
>  http://drools.org/semantics/java java.xsd">
>
>   java.lang.Object
>   java.lang.String
>   on.portal.xps.OnFacts
>   on.portal.xps.OnMessageRepository
>
>identifier="resultMessages">java.util.List
>
>
>   
> 
>   String
> 
> browser==OnFacts.FACT_BROWSER_FIREFOX_PRE104
> 
> 
>   resultMessages.add(OnMessageRepository.MSG_BROWSER_FIREFOX_PRE104);
> 
>   
>
>   
> 
>   String
> 
> browser==OnFacts.FACT_BROWSER_OPERA
> 
>   resultMessages.add(OnMessageRepository.MSG_BROWSER_OPERA);
> 
>   
>
>   
> 
>   String
> 
> browser==OnFacts.FACT_BROWSER_IE5
> 
>   resultMessages.add(OnMessageRepository.MSG_BROWSER_IE5);
> 
>   
>
>   
> 
>   String
> 
> browser==OnFacts.FACT_BROWSER_UNKNOWN
> 
>   resultMessages.add(OnMessageRepository.MSG_BROWSER_UNKNOWN);
> 
>   
>
> 
>


Re: [drools-user] Loading and managing rules dynamically from a database

2006-01-25 Thread Michael Neale
I have updated the article to include a download. Enjoy.



On 1/26/06, Sujit Pal <[EMAIL PROTECTED]> wrote:
>
> Its probably not uploaded yet to the drools site, but you can get it
> from here:
> http://home.comcast.net/~sujit.pal/pluto.tar.gz
>
> On Wed, 2006-01-25 at 08:56, Afshartous, Nick wrote:
> > Hi,
> >
> > Am looking for the code download for the article
> >
> >   Loading and managing rules dynamically from a database
> >
> > Thanks.
> >
> > --
> >   Nick
>
>


Re: [drools-user] Problem with import (java sementics)

2006-01-26 Thread Michael Neale
I think you are missing semi colons at the end of the java:import lines (as
it is just normal java from a compilers point of view).

On 1/26/06, Nicolas Andrieux <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
>
>
>
> I'm trying to write function, using , but i've got a
> problem when i want to use some class.
>
> I'm doing something like this :
>
>
>
>
>
>
>
> [...]
>
> 
>
> etechnicien.dao.cpDaoReference.DaoReferenceFactory
>
> 
>
> 
>
> etechnicien.dao.cpDaoReference.DaoReference
>
> 
>
> 
>
> etechnicien.dao.cpDaoReference.DaoReferenceImp
>
> 
>
>
>
>
>
>
>
> public static boolean checkReference(int id_ref,String
> Champ){
>
> DaoReferenceFactory oDaoReference = DaoReferenceFactory.getReference();
>
>
>
>
> [...]
>
> }
>
> 
>
>
>
>
>
>
>
> [...]
>
>
>
>
>
>
>
>
>
>
>
>
>
> When i try to instantiate a RuleBase with :
>
>
>
>
> base = RuleBaseLoader.loadFromInputStream(new java.io.ByteArrayInputStream
> (myRules.getBytes()));
>
>
>
>
>
>
>
> I've got a, exception : error constructing import
>
>
>
>
>
>
>
> thanks in advance for your help
>
>


Re: [drools-user] Scheduling/Timetabling with drools

2006-01-26 Thread Michael Neale
No I don't think you need to follow miss manners. Miss manners is designed
to stress rule engines for performance profiling reasons, so probably not
ideal to emulate !

I am not quite across what you are doing, but I can take a wild stab... (I
hope no one gets hurt)...

Well in the first rule when you match a Task to a Slot and then modify,
instead assert a new object which is a tuple of the Task and Slot
combination. Then have a 2nd rule which checks that combination - if its
bad, it retracts that combination. If its OK, then it does the assignment
(if it wasn't done before), and then retracts those Tasks/Slots so they are
not considered again. Can something like that work? Or did I just take out
someone eye (I can hear the screaming).

Michael.


On 1/27/06, Robert Jaemmrich <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> is it possible (or wise ;-) to use drools in a scheduling application?
>
> I want to place Tasks into Timeslots. Placement is dependant on certain
> constraints (hard or maybe soft) and ressources. Each slot can contain
> one task.
>
> E.g. I have some tasks {t1,t2,t3} to place on slots {s1,s2,s3,s4}.
>
> Constraints are defining which slots a task may be placed into
> (c1{t1;s1..s4}, c2{t2;s1,s4}) or define a task sequence
> (task1.slotNumber < task2.slotNumber).
>
> My naive "newbie approach" is to define two rules like this:
>
>   
> 
>   Task
> 
> 
>   Slot
> 
> 
> slot.getTask() == null
> 
> 
> task.getSlot() == null
> 
> 
> System.out.println("Placing "+task.getName()+" on
> "+slot.getName());
> task.setSlot(slot);
> slot.setTask(task);
> drools.modifyObject(slot);
> drools.modifyObject(task);
> 
>   
>
>   
> 
>   Task
> 
> 
>   Constraint
> 
> 
> task.getSlot() != null
> 
> 
> !constraint.isOK(task)
> 
> 
> System.out.println("Resetting ... ");
> Slot slot = task.getSlot();
> task.setSlot(null);
> drools.modifyObject(task);
> slot.setTask(null);
> drools.modifyObject(slot);
> 
>   
>
> It assigns tuples of "Slot" and "Task" first and checks if they are ok
> (constraint.isOK) second. This leads to an infinite loop flipping
> between the two rules.
>
> Do I have to use a more "Miss Manners"ish approach of implementing some
> sort of backtracking mechanism by myself? I think I have to use some
> kind of depth search to avoid wasting huge quantities of workingMemory ..?
>
> Any help would be appreaciated! ;-)
>
>
> TIA,
>
> Robert
>


Re: [drools-user] Stragegies for stacking Exceptions

2006-01-29 Thread Michael Neale
yep validation like that definately should be done with an object and a
collection.

Like you say, have a ValidationList class, and .addValidationFail() method
that accumulates it. Exceptions generally are best avoided unless there is
something seriously wrong. This is analagous to web frameworks where they
have .addError() methods (like in struts for an unpleasant example).

On 1/30/06, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I maybe missing something fairly basic here but what I'm trying to do
> is have some of my rules throw an exception when the condition is true
> but I want to be able to stack those exceptions and return them all to
> be iterated through. Currently I only get one exception back which
> will basically be whichever rule is fired first. The only way I can
> think of doing this is instead of throwing the exception, add it to a
> list in the application data, then when I return from the rules
> engine, get that list from the application data and throw it back to
> the client. The example scenario is as follows:
>
> I want to be able to validate say an address but have each validation
> failure point as an exception and the list of exception messages then
> displayed to the client. eg) The user didn't set the postcode and the
> street number. The two validation exceptions are "Must enter a
> postcode" and "Must enter a street address". Each validation rule
> throws a ValidationException with a key and a message.
>
> Is this the way to do it or not?
>
> Regards
>
> Paul
>


Re: [drools-user] Stragegies for stacking Exceptions

2006-01-30 Thread Michael Neale
Good point. We will have to mention it in the manual for Drools 3.

As a general rule, I would say don't throw any exceptions unless you want to
rudely interrupt execution - that pretty much applies to any framework. In
my naive youth, I use to use exceptions as means of communicating UI
validation failures for instance, but they are not designed for that (you
can all point and laugh at me now), and it killed performance.

It would be possible for us to trap exceptions that occur in rule code, but
I don't think that would be expected - once an exception occurs, it is
reasonable to expect the rule engine to cease operation as a rule engine,
and return control to the caller as soon as possible (other people can
correct me if they have other ideas).



On 1/31/06, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
>
> On 1/30/06, Michael Neale <[EMAIL PROTECTED]> wrote:
> >
> > yep validation like that definately should be done with an object and a
> > collection.
> >
> > Like you say, have a ValidationList class, and .addValidationFail()
> method
> > that accumulates it. Exceptions generally are best avoided unless there
> is
> > something seriously wrong. This is analagous to web frameworks where
> they
> > have .addError() methods (like in struts for an unpleasant example).
>
>
> Wouldn't hurt to have some documentation covering Drools and exceptions so
> that people understand more clearly what happens when a rule throws an
> exception, when that would be a good idea and when it wouldn't.
>
>
> --
> Geoffrey Wiseman
>
>


Re: [drools-user] AssertObject Performance

2006-01-31 Thread Michael Neale
lazy loading going on? Are they hibernate proxies?

On 1/31/06, Felipe Piccolini <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I have a problem asserting some complex objects. Im asserting
> persistent objects with hibernate. This objects are very complex
> and in some cases assering one of them takes 3 secs!!... Im
> working with 500 rules aprox and this objects are parameters for
> just 50 or 100 of them.
>
> What could be the problem?...
>
> --
> Felipe Piccolini
> [EMAIL PROTECTED]
>
>


Re: [drools-user] Drools: Sharing a value between the rule's "condition" and "consequence" ?

2006-02-01 Thread Michael Neale
Using statics and setting them in a condition would probably not be a great
idea.

Also, its generally frowned on to set a value of anything in a consequence
(of course, calling a method to do a calculation to use in a predicate is
fine) at the moment.

Perhaps a better more "rule" way of doing this is to have the calculation as
a rule on its own - it can then assert the result of the calculation as its
own fact into the working memory. Finally, the rules that depend on the
result of this calculation will not be considered until the calculation is
done (this is assuming you want the calculation result to be constant for
the firing of the rules of course).

Drools 3 also has a "binding" where you can bind a field on a fact and use
it in the consequence etc.. (more info on this one day soon !). That would
solve this problem partly (however, if you are trying to avoid repeating the
calculation for the same fact in each rule, thats different).



On 2/1/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> I have few experiences with Drools, but I don't think that "application
> data" and static variables are the same.
>
> Application data, if I'm not mistaken, are placed in the working memory by
> the application client code. Thus, they are not a private state variable
> of
> the rule context, but a public exchange entity that rules can use out of
> their declared parameters. As the name says, they are the "application"
> responsibility, not the rule context one ! The working memory can be
> easily
> instantiated by the client code according to concurrent call, it seems
> easy
> to control threading issues...
>
> The static variable declared in a DRL function block doesn't seem to be
> public, since there is no evident (for me) way to get it from outside the
> rule context. What I don't know, is how Drools generates Java classes from
> the DRL files, and how resulting objects are created and/or shared by
> concurrent callers...
>
> Once again, some clarification about the better way to keep memory between
> rules, without any necessary external declarations, such as "application
> data", is welcome...
>
> --
> Ephemeris Lappis
>
>
> > -Message d'origine-
> > De: news [mailto:[EMAIL PROTECTED] De la part de Peter Van Weert
> > Envoyé: mardi 31 janvier 2006 18:38
> > À: user@drools.codehaus.org
> > Objet: Re: [drools-user] Drools: Sharing a value between the rule's
> > "condition" and "consequence" ?
> >
> > I agree, this is a brittle and counter-intuitive technique. Also,
> > looking at the original problem statement:
> >
> > > Please note I know about "application data", but i'd rather not use
> > > it, because my sqrt is just a temporary value...
> >
> > Does storing the value in a static variable solves this? I don't know
> > the exact semantics of Drools, but my guess is that application data is
> > essentially the same as a static variable?
> >
> > Carriing over computed results from conditions/guards to the
> > consequences/body/actions is a problem other rule engines also
> > encounter, and I don't think it can be solved nicely (i.e. without
> > resorting to global state) without a (small) language extension...
> >
> > Yours,
> > Peter
> >
> >
> > Smith, Philip wrote:
> > > Rule firing is single threaded so that shouldn't be a problem.
> However,
> > > the same static variable could be written to by the evaluation of many
> > > conditions and as such it could be overwritten before the consequence
> is
> > > actually fired. Your rules could be written such this could not happen
> > > but this remains a brittle technique.
> > >
> > > Philip Smith
> > > [EMAIL PROTECTED]
> > > (650) 628-7941 (x87941)
> > >
> > > -Original Message-
> > > From: sol myr [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 31, 2006 8:48 AM
> > > To: user@drools.codehaus.org
> > > Subject: Re: [drools-user] Drools: Sharing a value between the rule's
> > > "condition" and "consequence" ?
> > >
> > > Thanks very much for this reply :)
> > >   However, I was wondering: will it work in a multi-threaded
> environment
> > > ?
> > >   I have a Servlet, where each HTTP request is handled by a separate
> > > thread, as usual.
> > >   All those threads use the rule engine, simultaniously... if it's a
> > > static variable, won't they override each other's data ?
> > >
> > >Thanks again
> > >Sol
> > >
> > >
> > >
> > > Ricardo Rojas Aguirre <[EMAIL PROTECTED]> wrote:
> > >   Hi, I solved the same problem with a local variable defined in the
> > > function
> > > tag...
> > >
> > > To solve your proble try somthing like this...
> > >
> > >
> > > public static double sqrtResult;
> > >
> > >
> > >
> > >
> > >
> > > < parameter identifier="num" >
> > > < class > Integer < / class >
> > > < / parameter >
> > >
> > > < java:condition >
> > > (sqrtResult=Math.sqrt(num.intValue())) > 1000
> > > < / java:condition >
> > >
> > > < java:consequence >
> > > System.out.println( sqrtResult 

Re: Re[2]: [drools-user] AssertObject Performance

2006-02-01 Thread Michael Neale
I haven't come across it as yet. I wouldn't expect that the performance
issues would be related specifically to using it in drools. Even if the rule
engine is getting properties over and over for conditions, only once needs
to trigger the lazy load, so you would notice a hit the first time, and it
just happens to be in assertObject etc that makes it look like its the rule
engine slowing down.

If its hibernate 3 and up, its pretty agressive in being lazy (how can you
be "agressive" and "lazy" at the same time ;) so often you need to turn it
off in the mappings, or change the query to have fetch instructions - might
be worth a try when tuning.


Michael.

On 2/2/06, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
>
> This seems to have impacted our performance at least somewhat, so if there
> is good knowledge on the best way to optimize use of Drools on lazy-loaded
> domain objects via Hibernate, please, fire them off to the list so that I
> can pass them on.
>
> On 2/1/06, Felipe Piccolini <[EMAIL PROTECTED]> wrote:
> >
> > Michael,
> >
> > Yes, lazy loading, and yes... proxies as usual with hibernate.
> >
> > But I think I solved the problem, because there was some rules with
> > tuples (the same subject you are discussing all this time), two facts
> > of the same type  asserted with no condition asking the different
> > instance.
> >
> > Thanks anyway :)
> >
> > Tuesday, January 31, 2006, 6:59:45 PM, you wrote:
> >
> > > lazy loading going on? Are they hibernate proxies?
> >
> > > On 1/31/06, Felipe Piccolini <[EMAIL PROTECTED] > wrote:
> > > Hi all,
> >
> > > I have a problem asserting some complex objects. Im asserting
> > > persistent objects with hibernate. This objects are very complex
> > > and in some cases assering one of them takes 3 secs!!... Im
> > > working with 500 rules aprox and this objects are parameters for
> > > just 50 or 100 of them.
> >
> > > What could be the problem?...
> >
> > > --
> > > Felipe Piccolini
> > > [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> >
> > --
> > Felipe Piccolini
> > [EMAIL PROTECTED]
> >
> >
>
>
> --
> Geoffrey Wiseman
>
>


Re: Re[2]: [drools-user] AssertObject Performance

2006-02-01 Thread Michael Neale
The combination monster. Hopefully with Drools 3, performance for this sort
of thing will be much improved, but nevertheless, its always good to filter
out the unwanted conditions (that you know are unwanted). Generally I
believe it helps to have these conditions first in the rule condition list.

On 2/2/06, Felipe Piccolini <[EMAIL PROTECTED]> wrote:
>
> Michael,
>
> Yes, lazy loading, and yes... proxies as usual with hibernate.
>
> But I think I solved the problem, because there was some rules with
> tuples (the same subject you are discussing all this time), two facts
> of the same type  asserted with no condition asking the different
> instance.
>
> Thanks anyway :)
>
> Tuesday, January 31, 2006, 6:59:45 PM, you wrote:
>
> > lazy loading going on? Are they hibernate proxies?
>
> > On 1/31/06, Felipe Piccolini <[EMAIL PROTECTED] > wrote:
> > Hi all,
>
> > I have a problem asserting some complex objects. Im asserting
> > persistent objects with hibernate. This objects are very complex
> > and in some cases assering one of them takes 3 secs!!... Im
> > working with 500 rules aprox and this objects are parameters for
> > just 50 or 100 of them.
>
> > What could be the problem?...
>
> > --
> > Felipe Piccolini
> > [EMAIL PROTECTED]
>
>
>
>
>
>
>
> --
> Felipe Piccolini
> [EMAIL PROTECTED]
>
>


Re: [drools-user] Backward chaining

2006-02-02 Thread Michael Neale
no not as yet. Once again, its likely in future !

On 2/2/06, sol myr <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>   Does Drools support backward chaining ?
>   I know it's been asked before... but the relevant archive entries appear
> to be old, and they did mention (around 2004) that it might be supported in
> the future...
>
>   If backward chaining is *not* supported, how about simulating it with
> forward chaining - Has anyone tried it in "real world" projects ?
>   And are there good resources/articles on such simulation ? (the basic
> idea is obvious... but I'm looking for insights, optimization tips, etc).
>
>   BTW sincere thanks to everyone who answered my previous questions. Thank
> you so much for the help and the insight :)
>
>   Thanks very much.
>
>
>
> -
> Bring words and photos together (easily) with
> PhotoMail  - it's free and works with Yahoo! Mail.
>


Re: Re[2]: [drools-user] Did you see this?.... a new book

2006-02-02 Thread Michael Neale
Cool ! Well its always good to see value added stuff being done around an
open source product !

For Drools 3, we are hoping to have a "manual" out, which will be like the
hibernate manual. Of course, books can go much much further then this. If
people wanted to contribute their articles/use cases, we can certainly
include them (I expect the manual would be available HTML, PDF and printed
form, like the hibernate guide). Of course it will be online from the
website (anyone who has used hibernate, I am sure finds the manual an
invaluable reference, and thats what we want to do).


Michael.



On 2/3/06, Mark Claassen <[EMAIL PROTECTED]> wrote:
>
> Ah yes, in the product details.  I guess now I know where to look for that
> info.
> Now I feel a bit stupid for sending out that email to the author.  :(
>
> Mark
>
> -Original Message-
> From: Felipe Piccolini [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 02, 2006 3:08 PM
> To: Mark Claassen
> Cc: user@drools.codehaus.org
> Subject: Re[2]: [drools-user] Did you see this? a new book
>
> Mark,
>
> Amazon says release is May 15, 2006
>
> Thursday, February 2, 2006, 5:03:41 PM, you wrote:
>
> > I saw it (on Amazon) yesterday.  I wonder how good it is and when it
> > will be released.
> > 
> > I noticed that the author put his email address on Amazon.  I don't
> > know if I was supposed to or not, but I sent him a quick email.  If I
> > get a response I will let you know.
>
> > Mark
>
>
>
> > -Original Message-
> > From: Felipe Piccolini [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, February 02, 2006 2:49 PM
> > To: user@drools.codehaus.org
> > Subject: [drools-user] Did you see this? a new book
>
>
> > Look at this:
>
> >
>
> http://www.amazon.com/gp/product/1590595955/qid=1138909685/sr=2-1/ref=pd_bbs
> > _b_2_1/104-9718783-6610352?s=books&v=glance&n=283155
>
>
>
> > --
> > Felipe Piccolini
> > [EMAIL PROTECTED]
>
>
> --
> Felipe Piccolini
> [EMAIL PROTECTED]
>
>


Re: [drools-user] [Drools] Authoring and debugging tools

2006-02-06 Thread Michael Neale
Not easily at present. You can use Events to track what is happening on the
engine, and there is some support for looking at the Agenda in the plug in.

But the focus on the tools for all those features is for Drools 3.

Also, when you build a rulebase, the "snippets" are actually parsed and
compiled at that point (not just before executing) so there is that layer of
protection.

On 2/7/06, Ephemeris Lappis <[EMAIL PROTECTED]> wrote:
>
> Hello.
>
>
>
> I've been looking at the Drool's site, and (Google too !) but I didn't
> find
> anything about such tools.
>
>
>
> The DRL files syntax is quite simple for some development expert : the XML
> structure of the rule system is not complex at all, and the Java sections
> (or other semantic language) are rather simple too. But two points are
> critical for our customer and for us too.
>
>
>
> First, the overall form and syntax of the file should be checked as soon
> as
> possible. A part of the text is XML based and could be easily verified
> with
> a schema aware tool. But the condition and action sections, written in
> Java,
> make the rule file composite and need a multi-language editor that should
> at
> the same time offer contextual help and/or completion, and check the code
> correctness, similarly to what tools like Eclipse do.
>
>
>
> Is there any tool of this kind ?
>
>
>
> The second question is about rule systems debugging. A full work process
> can
> and must be defined to manage rule files, there versions, there
> qualification and regression tests, etc. This must be done according to
> the
> needs and tools of the enterprise.
>
>
>
> But how can we debug rules ? How can we trace the inference path and
> interrupt it to check drools or business objects state ? Is there a tool
> for
> this ?
>
>
>
> Thanks in advance.
>
>
>
> --
>
> Ephemeris Lappis
>
>
>
>
>


Re: [drools-user] 'otherwise' rule in decision table

2006-02-07 Thread Michael Neale
I am pretty sure it is, within the bounds of what is already there.

You kind of suggested one way yourself. On each rule row, have an extra
action (which you can hide if you like) that changes a value to stop the
"default" from firing.

>From the sounds of it, you are imagining a switch statement, which means you
are looking at top to bottom operation. If you only want one rule to fire,
and then the rules to stop processing, you can achieve all this by simply
having a rule with no conditions applying (not sure if that is what you
want).



On 2/7/06, Ronald van Kuijk <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Is it possible to have a 'last resort/otherwise/...' rule fire when no
> other
> rules have fired? Kind of like in java switch statements? I know I could
> use
> an action which updates a variable if any rule fires and then explicitly
> check in the last rule if this variable has a specific value. One can kan
> imagine that I'd like to have it implicitly done maybe with a specific
> rule
> name or even a rule-otherwise tag or something like that.
>
> TIA,
>
> Ronald van Kuijk
>
> p.s. If this functionality is available, I think I can keep a commercial
> vendor (yes I know, JBoss/Drools also has a commercial part ;-) )
>
>


Re: [drools-user] 'otherwise' rule in decision table

2006-02-07 Thread Michael Neale
Will consider it for Drools 3 - some kind of an "else" criteria.

On 2/7/06, Ronald van Kuijk <[EMAIL PROTECTED]> wrote:
>
> 2006/2/7, Michael Neale <[EMAIL PROTECTED]>:
> >
> > I am pretty sure it is, within the bounds of what is already there.
> >
> > You kind of suggested one way yourself. On each rule row, have an extra
> > action (which you can hide if you like) that changes a value to stop the
> > "default" from firing.
>
>
> Aren't I great ;-)
>
>
> From the sounds of it, you are imagining a switch statement, which means
> you
> > are looking at top to bottom operation. If you only want one rule to
> fire,
> > and then the rules to stop processing, you can achieve all this by
> simply
> > having a rule with no conditions applying (not sure if that is what you
> > want).
>
>
> Yes, top to bottom, but the last rule should only fire if none of the
> previous ones fired
>
> Initially I'll go for the first option, but to me it sounds like a nice
> enhancement
>
> Tia...
>
>


Re: [drools-user] Newbie: Is there a way to dynamically change the salience of a rule ?

2006-02-07 Thread Michael Neale
Not really from within a drl file, no.

The rule object has a salience property, so it can be set programmatically,
but its not part of the rule language.

On 2/8/06, sol myr <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>   Newbie question: is there a way to dynamically change the salience of a
> rule (namely, rule might be loaded from a standard "drl" file with some
> initial salience, but on some conditions I'd like to change it during
> runtime) ?
>
>   BTW I'm perfectly aware it's probably not brilliant design, not to
> mention maintenance...
>   I'm just curious  :)
>
>   Thanks very much
>
>
>
> -
> Relax. Yahoo! Mail virus scanning helps detect nasty viruses!
>


Re: [drools-user] 'otherwise' rule in decision table

2006-02-07 Thread Michael Neale
yes, something like that.

Lowest salience would be at the bottom of your rule rows, if you are using
it in top to bottom fashion.

On 2/7/06, Ronald van Kuijk <[EMAIL PROTECTED]> wrote:
>
> you mean an all wildcard rule (all columns empty) and then give it a a
> salience lower then the lowest of the above I could give it a try.
>
> Ronald
>
> 2006/2/7, Peter Van Weert <[EMAIL PROTECTED]>:
> >
> > Can't you use a rule with a very low salience for this in some way? I
> > haven't thought it through though (isn't this a nice sentence: thought
> > through though ;-) ), but maybe this can help you find the solution you
> > are seeking...
> >
> > Ronald van Kuijk wrote:
> >
> > >Hi,
> > >
> > >Is it possible to have a 'last resort/otherwise/...' rule fire when no
> > other
> > >rules have fired? Kind of like in java switch statements? I know I
> could
> > use
> > >an action which updates a variable if any rule fires and then
> explicitly
> > >check in the last rule if this variable has a specific value. One can
> kan
> > >imagine that I'd like to have it implicitly done maybe with a specific
> > rule
> > >name or even a rule-otherwise tag or something like that.
> > >
> > >TIA,
> > >
> > >Ronald van Kuijk
> > >
> > >p.s. If this functionality is available, I think I can keep a
> commercial
> > >vendor (yes I know, JBoss/Drools also has a commercial part ;-) )
> > >
> > >
> > >
> >
> >
> >
>
>


Re: [drools-user] staic checking on rules

2006-02-07 Thread Michael Neale
as in compiling? Yes.

On 2/8/06, Afshartous, Nick <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I was wondering if there's any static checking performed on the on rules
>
> before run-time ?
> Thanks.
> --
>   Nick
>
>
>


Re: [drools-user] Newbie build issue: Drools 2.1: Maven 1.1-beta-2

2006-02-07 Thread Michael Neale
hmmm... looks like a bug in maven 1.1, not sure if it is fixed yet:

http://www.nabble.com/Maven-1.1-and-cutom-properties-in-POM-t81808.html

On 2/8/06, Sankar Viswanathan <[EMAIL PROTECTED]> wrote:
>
> I am trying to evaluate Drools for a project.
>
> I have the following configuration:
>
> Windows XP SP1 / Java version 1.4.2_10 / Maven 1.1-beta-2 / Drools 2.1(source)
>
> While building with the command 'maven', I get an exception:
>
> org.apache.maven.MavenException: Unknown error reading project
> ...
>
> which eventually points to a line in project.xml:
>
> org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised
> tag: 'id'
> (position: START_TAG seen ...\r\n... @188:17)
>
> I am completely new to Maven and any help would be appreciated.
>
> Thanks,
> Sankar
>


Re: [drools-user] Newbie build issue: Drools 2.1: Maven 1.1-beta-2

2006-02-07 Thread Michael Neale
I never seem to have much luck with Maven 1 versions myself (I think I am
cursed), I often have to mess around with versions.


Maven 2 is the go for Drools 3, and so far it has been a great experience.
The difference is night and day (and this is coming from a non-maven fan !).
And maven 2 generates build.xml that actually work, so take hope !

Michael.

On 2/8/06, Matthew Shaw <[EMAIL PROTECTED]> wrote:
>
>
> Try using maven 1.0.2 first. I have had no probs.
>
> -Original Message-
> From: Sankar Viswanathan [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 8 February 2006 7:39 AM
> To: user@drools.codehaus.org
> Subject: [drools-user] Newbie build issue: Drools 2.1: Maven 1.1-beta-2
>
>
> I am trying to evaluate Drools for a project.
>
> I have the following configuration:
>
> Windows XP SP1 / Java version 1.4.2_10 / Maven 1.1-beta-2 / Drools 2.1(source)
>
> While building with the command 'maven', I get an exception:
>
> org.apache.maven.MavenException: Unknown error reading project
> ...
>
> which eventually points to a line in project.xml:
>
> org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised
> tag: 'id'
> (position: START_TAG seen ...\r\n... @188:17)
>
> I am completely new to Maven and any help would be appreciated.
>
> Thanks,
> Sankar
>
> This correspondence is for the named persons only.
> It may contain confidential or privileged information or both.
> No confidentiality or privilege is waived or lost by any mis transmission.
> If you receive this correspondence in error please delete it from your
> system immediately and notify the sender.
> You must not disclose, copy or relay on any part of this correspondence,
> if you are not the intended recipient.
> Any opinions expressed in this message are those of the individual sender
> except where the sender expressly,
> and with the authority, states them to be the opinions of the Department
> of Emergency Services, Queensland.
>


Re: [drools-user] Newbie build issue: Drools 2.1: Maven 1.1-beta-2

2006-02-08 Thread Michael Neale
I have logged an issue regarding this missing jar from ibiblio - its shown
up in the http directory listing, so it should be there. But it looks liek
the file has been removed. Hopefully should be sorted soon.

On 2/8/06, Sankar Viswanathan <[EMAIL PROTECTED]> wrote:
>
> > Try using maven 1.0.2 first. I have had no probs.
>
> I switched to Maven 1.0.2 and this resolved the issue.
>
> However, Maven couldn't find (auto update) jython-20020827-no-oro.jar.
> I downloaded it manually and put it in
> $HOME/.maven/repository/jython/jars.
> Though this fixed the issue, I wanted to know whether this is the right
> thing to do.
>
> Thanks.
> Sankar
>


Re: [drools-user] how to know which rule was fired?

2006-02-08 Thread Michael Neale
The interface to implement is org.drools.event.WorkingMemoryEventListener.

It has various call back methods that all get passed the appropriate event.
>From those events, you can extract the info you need. The method names
should be fairly informative in the listener interface.


On 2/9/06, Matthew Pawluk <[EMAIL PROTECTED]> wrote:
>
> Use the WorkingMemory addEventListener method
>
> snippet:
>
> Rulebase rb = RuleBaseLoader.loadFromInputStream(rulesetStream);
> WorkingMemory wm = rb.newWorkingMemory( );
> wm.addEventListener(new DebugWorkingMemoryEventListener());
>
>
> Geoffrey Wiseman wrote:
> > I don't know of a detailed example on the site for this; there may be
> one.
> > I've used it before, but I don't have a working example at hand that I
> can
> > easily supply, and a quick scan of Google doesn't show anything obvious.
> >
> > I do agree that this is probably what you want to look into though.
> > Activation fired events will tell you when a rule has been executed, and
> > applying an listener to working memory is fairly painless.
> >
> > On 2/8/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
> >
> >> I'm sorry, but I can't help you there. I have hardly any practical
> >> experience with Drools myself. Maybe someone else can help?
> >>
> >> Felipe Piccolini wrote:
> >>
> >> Peter,
> >>
> >>   Where can I get more info, doc or some examples for listeners and
> >>   event handlers. I would like to see some code example for a simple
> >>   rule execution, with fact assertions, application data and invoking
> >>   the fireAllRules method.
> >>
> >>   Thanks.
> >>
> >> Wednesday, February 8, 2006, 5:39:25 PM, you wrote:
> >>
> >>Maybe http://www.drools.org/Event+Model?nocache could be of use to
> you
> >> (in particular the ActivationFiredEvent-event)?
> >>
> >> Joel G. Rivera-González wrote:
> >>
> >>  i have a over a meg of rules and we need to know whitch rule was
> fired...
> >>
> >> i know i can send a string with the rule name on the
> >> consequence, but i would like to know if drools provide something
> >> for this...
> >> if not...i think it would be a great addition to drools to know the
> rule that was fired...
> >>
> >> thanks...
> >>
> >> -Joel
> >>
> >> Joel G. Rivera-González Wovenware, Inc [EMAIL PROTECTED]
> >> "The first 90% of a project takes 90% of the time, the last 10%
> >> takes the other 90% of the time" - Murphy's Law
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Felipe Piccolini
> >> [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Geoffrey Wiseman
> >
> >
>
> --
> Matthew Pawluk
> NeuLion Inc.
> 1600 Old Country Road
> Suite 102
> Plainview, NY 11803
> 516.249.6565
> [EMAIL PROTECTED]
>
>
>


Re: [drools-user] Feature Request: Using is for class-field

2006-02-08 Thread Michael Neale
In Drools 3 this is much clearer.

You would do a statement like: IF GenericComparable(primary == true)

Much neater, and you don't even have to declar the parameter of that type
(it is implicit in that case), and yes, it will understand "is" is actually
a getter (lots of people forget).

I think classifelds at the moment only work, with Strings, but I can't be
sure having not used them myself.


Michael.

On 2/9/06, Jason Vinson <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm trying to use the class-field property in a java semantics module
> and I'm having an issue with boolean properties.  I am trying to
> access a property named isPrimary which returns a boolean like so:
>
>  
>   value="true">GenericComparable
>  
>
> I get an exception from this stating that
>
> org.drools.smf.FactoryException: Field 'primary' does not exist for
> Class 'GenericComparable'.
>
> I know this does exist, and after looking at the drools code, I see
> the following:
>
>  // make sure field getter exists
>  clazz.getMethod( "get" + fieldName.toUpperCase( ).charAt
> ( 0 ) + fieldName.substring( 1 ),
>   (Class[]) null );
>
> which obviously doesn't work because my accessor starts with "is".
> Is there any plan to support something like this in the future (it's
> been in the JavaBean spec for a while, in section 8.3.2)?
>
> By the way, I tried to change my getter just to see if it works, but
> it still fails on the following in ClassFieldObjectType.matches(),
> because it returns a Boolean (true) and compares that to a String
> ("true").
>
>   result = this.getterMethod.invoke( object, ( Object[] )null ).equals
> ( this.getFieldValue( ) )
>
> Can we use boolean types in class-field?
>
> Thanks for a great api,
> Jason
>


Re: [drools-user] How do I control firing of rules ?

2006-02-08 Thread Michael Neale
so you are asserting into working memories orders, and items as "exploded"
apart from each other? (if you get my drift).


Michael.

On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm fairly new to drools, and was curious if there is a way to reduce the
> firing of rules.
>
> Whenever a fact is modified, drools fires all rules who's parameter ( is
> the same class type of the fact.
>
> e. g.
>
> 
> 
> com.blah.shipping.ruleengine.Order
> 
> 
> com.blah.shipping.ruleengine.Item
> 
>  :
>  :
>  :
> 
>
> Whenever we modify any fact of type object Item or type Order, this above
> rule will fire.
>
>
> Can we somehow specify a parameter based a sub-field of an object.
> Something like
>
> 
> 
> com.blah.shipping.ruleengine.Order
> 
> 
> order.orderItem
> 
>  :
>  :
>  :
> 
>
> Where order.orderItem is of type Item. In this scenario, the rule will
> only fire when an order fact or order.orderItem is modifed.
>
> Right now, to emulate the behaviour I am looking for, I am doing a check
> in a rule condition:
>
>
> 
> 
> com.blah.shipping.ruleengine.Order
> 
> 
> com.blah.shipping.ruleengine.Item
> 
>
> order.orderItem == item
>
>  :
>  :
>  :
> 
>
> Thanks,
> Alan Ho
>
>


Re: [drools-user] How do I control firing of rules ?

2006-02-08 Thread Michael Neale
how are you calling the rule engine - can you show a snippet of code?

On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
>
> I don't quite get your drift.
>
> If I modify N orders, each order with 1 item, I have to activate my rule
> N*N times. That's really costly.
>
> Regards,
> Alan
>
>
> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 3:39 PM
> To: user@drools.codehaus.org
> Subject: Re: [drools-user] How do I control firing of rules ?
>
> so you are asserting into working memories orders, and items as "exploded"
> apart from each other? (if you get my drift).
>
>
> Michael.
>
> On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I'm fairly new to drools, and was curious if there is a way to reduce
> > the firing of rules.
> >
> > Whenever a fact is modified, drools fires all rules who's parameter (
> > is the same class type of the fact.
> >
> > e. g.
> >
> > 
> > 
> > com.blah.shipping.ruleengine.Order
> > 
> > 
> > com.blah.shipping.ruleengine.Item
> > 
> >  :
> >  :
> >  :
> > 
> >
> > Whenever we modify any fact of type object Item or type Order, this
> > above rule will fire.
> >
> >
> > Can we somehow specify a parameter based a sub-field of an object.
> > Something like
> >
> > 
> > 
> > com.blah.shipping.ruleengine.Order
> > 
> > 
> > order.orderItem
> > 
> >  :
> >  :
> >  :
> > 
> >
> > Where order.orderItem is of type Item. In this scenario, the rule will
> > only fire when an order fact or order.orderItem is modifed.
> >
> > Right now, to emulate the behaviour I am looking for, I am doing a
> > check in a rule condition:
> >
> >
> > 
> > 
> > com.blah.shipping.ruleengine.Order
> > 
> > 
> > com.blah.shipping.ruleengine.Item
> > 
> >
> > order.orderItem == item
> >
> >  :
> >  :
> >  :
> > 
> >
> > Thanks,
> > Alan Ho
> >
> >
>


Re: 答复: [drools-user] how to know which rule was fired?

2006-02-09 Thread Michael Neale
Yes sometimes the "audit trail" of rule firing could be part of your model
itself (this is how I have always preferred it in the past).

On 2/9/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
>
>
> further more,the execute result of every rule  is concerned by the
> business analyst
> To jrules, this problem is headled by adding a result class to the bom,
> set the result object every time firing the rule,and record the execute
> result of the rule
> u can persist the result in audit log or db for using by the analyst tools
>
> -邮件原件-
> 发件人: Jaime Saiz Santos [mailto:[EMAIL PROTECTED]
> 发送时间: 2006年2月9日 17:00
> 收件人: user@drools.codehaus.org
> 主题: RE: [drools-user] how to know which rule was fired?
>
> Of course, you can also create your own event listener.
> Something like this:
>
> public class YourClass extends DefaultWorkingMemoryEventListener {
>   public void yourMethodForFiringRules()
>   {
> // Load the rules file and set the event listener
> FileReader rulesFile = new FileReader("yourRulesFile.drl");
> RuleBase ruleBase = RuleBaseLoader.loadFromReader(rulesFile);
> WorkingMemory workingMemory = ruleBase.newWorkingMemory();
> workingMemory.addEventListener(this);
>
> // Assert objects
> workingMemory.assertObject(new YourObject());
> ...
>
> // Fire rules
> workingMemory.fireAllRules();
>   }
>
>   public void activationFired(ActivationFiredEvent firedEvent)
>   {
> // Get the name of the fired rule
> String firedRuleName = firedEvent.getRule().getName();
> // See API for more methods on ActivationFiredEvent
>   }
> }
>
> God bless,
> Jaime
>
> -Mensaje original-
> De: Matthew Pawluk [mailto:[EMAIL PROTECTED]
> Enviado el: miércoles, 08 de febrero de 2006 23:16
> Para: user@drools.codehaus.org
> Asunto: Re: [drools-user] how to know which rule was fired?
>
> Use the WorkingMemory addEventListener method
>
> snippet:
>
> Rulebase rb = RuleBaseLoader.loadFromInputStream(rulesetStream);
> WorkingMemory wm = rb.newWorkingMemory( ); wm.addEventListener(new
> DebugWorkingMemoryEventListener());
>
>
> Geoffrey Wiseman wrote:
> > I don't know of a detailed example on the site for this; there may be
> one.
> > I've used it before, but I don't have a working example at hand that I
> > can easily supply, and a quick scan of Google doesn't show anything
> obvious.
> >
> > I do agree that this is probably what you want to look into though.
> > Activation fired events will tell you when a rule has been executed,
> > and applying an listener to working memory is fairly painless.
> >
> > On 2/8/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
> >
> >> I'm sorry, but I can't help you there. I have hardly any practical
> >> experience with Drools myself. Maybe someone else can help?
> >>
> >> Felipe Piccolini wrote:
> >>
> >> Peter,
> >>
> >>   Where can I get more info, doc or some examples for listeners and
> >>   event handlers. I would like to see some code example for a simple
> >>   rule execution, with fact assertions, application data and invoking
> >>   the fireAllRules method.
> >>
> >>   Thanks.
> >>
> >> Wednesday, February 8, 2006, 5:39:25 PM, you wrote:
> >>
> >>Maybe http://www.drools.org/Event+Model?nocache could be of use to
> >> you (in particular the ActivationFiredEvent-event)?
> >>
> >> Joel G. Rivera-González wrote:
> >>
> >>  i have a over a meg of rules and we need to know whitch rule was
> fired...
> >>
> >> i know i can send a string with the rule name on the consequence, but
> >> i would like to know if drools provide something for this...
> >> if not...i think it would be a great addition to drools to know the
> rule that was fired...
> >>
> >> thanks...
> >>
> >> -Joel
> >>
> >> Joel G. Rivera-González Wovenware, Inc [EMAIL PROTECTED] "The
> >> first 90% of a project takes 90% of the time, the last 10% takes the
> >> other 90% of the time" - Murphy's Law
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >> Felipe Piccolini
> >> [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Geoffrey Wiseman
> >
> >
>
> --
> Matthew Pawluk
> NeuLion Inc.
> 1600 Old Country Road
> Suite 102
> Plainview, NY 11803
> 516.249.6565
> [EMAIL PROTECTED]
>
>
> __
> Este mensaje, y en su caso, cualquier fichero anexo al mismo,  puede
> contener informacion clasificada por su emisor como confidencial  en el
> marco de su Sistema de Gestion de Seguridad de la Informacion siendo para
> uso exclusivo del destinatario, quedando prohibida su divulgacion copia o
> distribucion a terceros sin la autorizacion expresa del remitente. Si Vd. ha
> recibido este mensaje  erroneamente, se ruega lo notifique al remitente y
> proceda a su borrado.
> Gracias por su colaboracion.
> __
> This message including any attachments may contain confidential
> information, according to our Information Security Management System,  and
> intended solely for a specific individual to whom they are addressed.
> Any un

Re: [drools-user] How do I control firing of rules ?

2006-02-09 Thread Michael Neale
Yes that is correct, the rules will be revaluated when you modify any of the
objects - that is desired behaviour. If in your case you don't want the
second rule to fire, then there needs to be explicit conditions as to why it
should not fire (such as the calculation does not need to be done again).

>From what I can see - will you have more then one order in working memory at
one time? (hence the need to join the item to the order?).

One other option is to not have seperate item objects in working memory,
just order objects, and extract the item as needed in the rules. This may or
may not benefit you, but some people do it that way.

In your case, I am guessing, but perhaps you only want the second rule to
fire if the calculation is really needed, so the question is how to you
express that a calculation is needed? One way is to add a condition that
checks for a calculation result in the object in the second rule. Then in
any other rules that require re calculation, they simply clear the
calculation result, which means the second rule will kick in when
appropraite.


Michael.

On 2/10/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
>
> Thanks for your helping me out.  In my real application, there is a 1 to *
> relationship between orders and items.
>
> My App looks like :
>
> Item truckShippedItem = new Item();
> Order order = new Order();
>
> order.getItems().add(truckShippedItem);
> truckShippedItem.setParentOrder(order);
>
> Rate bc = new Rate("additive_charge",10);
> truckShippedItem.getRates().put("additive_charge", bc);
>
> try {
> workingMemory.assertObject( truckShippedItem );
> workingMemory.assertObject( order );
> workingMemory.fireAllRules( );
> } catch (FactException fe)
> {
> System.out.println("FactErrorOccured" +
> fe.getMessage());
> } catch (Exception e)
> {
> System.out.println(e.getMessage());
> }
>
> My 2 rules looks like:
>
> 
>
> 
> com.amazon.shipping.ruleengine.Order
> 
>
>
> ((Rate)order.getOrderLevelRates().get("additive_charge")).getRateCost() <
> order.getMaxAdditiveCharge().getRateCost() 
>
> 
> System.out.println("Modifying additive Charge for order");
> order.getOrderLevelRates().put("additive_charge",
> order.getMaxadditiveCharge());
> drools.modifyObject(order);
> 
> 
>
> 
>
> 
> com.amazon.shipping.ruleengine.Order
> 
>
> 
> com.amazon.shipping.ruleengine.Item
> 
>
>   item.parentOrder == order
>
> item.containsCharge
> ("additive_charge")
> order.containsCharge
> ("additive_charge")
> 
> ((Rate)order.getOrderLevelRates().get("additive_charge")).getRateCost()
> != 0 
>
> 
> System.out.println("Calculating additive Charge
> Allocation");
> 
> 
>
> public class Order {
>
> List items = new LinkedList();
> Map shipments = new HashMap();
> Map orderLevelRates = new HashMap(); }
>
> public class Item {
>
> Map itemLevelRates = new HashMap();
> Map catalogProperties = new
> HashMap();
>
> Order parentOrder;
> String name;
> }
>
>
> The second rule is my biggest problem. It fires whenever any Object or and
> item is modified
>
> Thanks,
> Alan Ho
>
> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 08, 2006 4:20 PM
> To: user@drools.codehaus.org
> Subject: Re: [drools-user] How do I control firing of rules ?
>
> how are you calling the rule engine - can you show a snippet of code?
>
> On 2/9/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
> >
> > I don't quite get your drift.
> >
> > If I modify N orders, each order with 1 item, I have to activate my
> > rule N*N times. That's really costly.
> >
> > Regards,
> > Alan
> >
> >
> > -Original Message-
> > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 08, 2006 3:39 PM
> > To: user@drools.codehaus.org
> > Subject: Re: [drools-user] How do I control firing of rules ?
> >
> > s

Re: [drools-user] Firing rules when something DOESN'T exist

2006-02-12 Thread Michael Neale
yeah thats a really powerful feature, and is definately going to be part of
Drools 3.

It will work something like:

not Person(name == "michael")
which says, there is NO person called michael.

Of course, you can work around this now, either by baking some of the logic
into your model, or looking through working memory (which is possibly
slower).

Regards,

Michael.

On 2/11/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
>
> Hey,
>
>
>
> I've used rules engines in the past the support the notion of a NOT
> pattern/conditional element for firing rules when a particular item
> doesn't
> exist in working memory.  Does Drools support such a feature?  I can't
> find
> it in the docs.
>
>
>
> I want to apply the following logic:
>
>
>
> IF there is an event object available
>
> AND there is no existing event history object
>
> THEN.
>
>
>
> -Mitch
>
>
>


Re: 答复: [drools-user] Firing rules when something DOESN'T exist

2006-02-13 Thread Michael Neale
quite similar to IRL, that bit, yes.

We don't want to shove S-expressions down peoples throught.

If enough people are interested, I could write something up on the new DRL
languages and features (just as a sneak preview).

On 2/14/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
>
>
> Just like jrules' TRL
>
> -邮件原件-
> 发件人: Mark Proctor [mailto:[EMAIL PROTECTED]
> 发送时间: 2006年2月14日 2:26
> 收件人: user@drools.codehaus.org
> 主题: Re: [drools-user] Firing rules when something DOESN'T exist
>
> Yes that is also the case.
>
> Mark
> Stuart Schmukler wrote:
> > I hope we will have this work for all objects of a class also.  For
> example:
> >
> > not Person()
> > which says, there is NO person.
> >
> > Stuart
> >
> >
> >
> >  On 13 Feb 2006 12:25:47, [EMAIL PROTECTED]
> > ([EMAIL PROTECTED]) wrote:
> >
> >
> >
> >> From: Michael Neale <[EMAIL PROTECTED]>
> >> To: user@drools.codehaus.org
> >> MIME-Version: 1.0
> >> Subject: Re: [drools-user] Firing rules when something DOESN'T exist
> >>
> >>
> >>
> >> yeah thats a really powerful feature, and is definately going to be
> >> part of Drools 3.
> >>
> >> It will work something like:
> >>
> >> not Person(name == "michael")
> >> which says, there is NO person called michael.
> >>
> >> Of course, you can work around this now, either by baking some of the
> >> logic into your model, or looking through working memory (which is
> >> possibly slower).
> >>
> >> Regards,
> >>
> >> Michael.
> >>
> >> On 2/11/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hey,
> >>>
> >>>
> >>>
> >>> I've used rules engines in the past the support the notion of a NOT
> >>> pattern/conditional element for firing rules when a particular item
> >>> doesn't exist in working memory.  Does Drools support such a
> >>> feature?  I can't find it in the docs.
> >>>
> >>>
> >>>
> >>> I want to apply the following logic:
> >>>
> >>>
> >>>
> >>> IF there is an event object available
> >>>
> >>> AND there is no existing event history object
> >>>
> >>> THEN.
> >>>
> >>>
> >>>
> >>> -Mitch
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
>
>
>
>
> 
> The information in this email is confidential and may be legally
> privileged. If you have received this email in error or are
> not the intended recipient, please immediately notify the sender and
> delete this message from your computer. Any use, distribution,
> or copying of this email other than by the intended recipient is strictly
> prohibited. All messages sent to and from us may be
> monitored to ensure compliance with internal policies and to protect our
> business.
> Emails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, lost or destroyed,
> or contain viruses. Anyone who communicates with us by email is taken to
> accept these risks.
>
> 收发邮件者请注意:
> 本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
> 进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
>
> 
>


Re: [drools-user] Drools and modules ?

2006-02-19 Thread Michael Neale
When you say modules - I gather you mean "include" files where a ruleset is
built up from other source files?

In Drools 3, I think mark is making such that rules in the same "ruleset"
namespace/package will all be combined together when you load them all. So
yes, in short you can break them down as much or as little as you want.

Modules as in Agenda stuff, thats called AgendaGroup as mark said.

On 2/19/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
>
> Its in Drools 3.0, we call them Agenda Groups.
>
> Mark
> sol myr wrote:
> > Hi,
> >
> >   I know that some rule engines support modules (so that large
> rule-bases can be broken into several files,).
> >   Is this supported in Drools ?
> >
> >   If so, how (just a quick pointer will do, of course).
> >
> >   Thanks very much :)
> >
> >
> > fkzeljo <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I am using my own condition and java:consequence element. I get an
> > java.lang.NoSuchMethodError exception.
> > Caused by: java.lang.NoSuchMethodError:
> > org.codehaus.janino.Java$MethodInvocation. <
> >
> init>(Lorg/codehaus/janino/Location;Lorg/codehaus/janino/Java$Scope;Lorg/codehaus/janino/Java$Atom;Ljava/lang/String;[Lorg/codehaus/janino/Java$Rvalue;)V
> > at
> > org.drools.semantics.java.JavaScriptEvaluator.addDeclarations(
> JavaScriptEvaluator.java:313)
> > at org.drools.semantics.java.JavaScriptEvaluator. <
> > init>(JavaScriptEvaluator.java:138)
> >
> > I am using janino.jar from version janino-2.3.17 and
> drools-all-jdk5-2.1.jar
> >
> > By the way I am using jdk1.4.
> >
> > Could someone tell if I am using an incorrect .jar or if I am missing
> > something else.
> > --
> > View this message in context:
> http://www.nabble.com/Janino-jar-and-no-such-method-exception-when-using-java%3Aconcequences-t1132124.html#a2964273
> > Sent from the drools - user forum at Nabble.com.
> >
> >
> >
> >
> > -
> >  Yahoo! Mail
> >  Use Photomail to share photos without annoying attachments.
> >
>
>


Re: 答复: [drools-user] Is there a way to not fire already fired rules

2006-02-20 Thread Michael Neale
so you want to effecively remove a rule once it has fired? Or just a
rule/fact combination? (ie that rule can fire for different facts that
haven't caused it to fire before?)

Condition sharing partly achieves what you need, BTW, conditions are not
retested more then they need to be in some cases.

On 2/21/06, Lionel Port <[EMAIL PROTECTED]> wrote:
>
> Theres got to be a better way, where all the conditions for rules already
> executed are not retested. There could be quite a number of rules that
> have
> already had there consequence executed and I'd like to to only test the
> conditions if the consequence for the rule hasn't been run yet.
>
> Something similar to the way noloop attribute can work on a single rule.
>
> Lionel
>
> On 2/21/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
> >
> >
> > declare another variable named countRule1 with initi value 1,
> > modify the rule 1 with condition x>2 && countRule1 ==1 and consequence
> > countRule1++ ;modifyObject(countRule1);
> >
> > another way?
> >
> > -邮件原件-
> > 发件人: Lionel Port [mailto:[EMAIL PROTECTED]
> > 发送时间: 2006年2月21日 8:39
> > 收件人: user@drools.codehaus.org
> > 主题: [drools-user] Is there a way to not fire already fired rules
> >
> > Hi,
> > Is there a way in drools to not have rules that have already been fired
> > firing again when an object is modified?
> >
> >
> > For example if I have:
> > 1. rule 1 with condition x>2
> > 2. rule 2 with condition y>2 and consequence x = 10 3. rule 3 with
> > condition x>6
> >
> > If I give the facts x=3 and y=3,
> >
> > I would want
> > 1. rule 1 and rule 2 are true so rule1 and rule 2 consequences are
> fired.
> > 2. The consequence of rule 2 make rule 3 true, so rule 3 fires.
> >
> > At the moment I get rule 1 firing a second time.
> >
> >
> > Lionel
> >
> >
> >
> >
> 
> > The information in this email is confidential and may be legally
> > privileged. If you have received this email in error or are
> > not the intended recipient, please immediately notify the sender and
> > delete this message from your computer. Any use, distribution,
> > or copying of this email other than by the intended recipient is
> strictly
> > prohibited. All messages sent to and from us may be
> > monitored to ensure compliance with internal policies and to protect our
> > business.
> > Emails are not secure and cannot be guaranteed to be error free as they
> > can be intercepted, amended, lost or destroyed,
> > or contain viruses. Anyone who communicates with us by email is taken to
> > accept these risks.
> >
> > 收发邮件者请注意:
> > 本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
> > 进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
> >
> >
> 
> >
>


Re: 答复: [drools-user] Is there a way to not fire already fired rules

2006-02-21 Thread Michael Neale
I think that is an enhancement I have suggested before, we will look at it
for 3. It does require keeping a memory of all past activations, so by
default it would not be turned on (as it would use up memory which is wasted
for the majority of cases where it is not needed).

On 2/22/06, Lionel Port <[EMAIL PROTECTED]> wrote:
>
> Yes. I want it to not fire again for that rule/fact combination even if
> the
> fact is modified in the consequence of a subsequent rule.
>
> On 2/21/06, Michael Neale <[EMAIL PROTECTED]> wrote:
> >
> > so you want to effecively remove a rule once it has fired? Or just a
> > rule/fact combination? (ie that rule can fire for different facts that
> > haven't caused it to fire before?)
> >
> > Condition sharing partly achieves what you need, BTW, conditions are not
> > retested more then they need to be in some cases.
> >
> > On 2/21/06, Lionel Port <[EMAIL PROTECTED]> wrote:
> > >
> > > Theres got to be a better way, where all the conditions for rules
> > already
> > > executed are not retested. There could be quite a number of rules that
> > > have
> > > already had there consequence executed and I'd like to to only test
> the
> > > conditions if the consequence for the rule hasn't been run yet.
> > >
> > > Something similar to the way noloop attribute can work on a single
> rule.
> > >
> > > Lionel
> > >
> > > On 2/21/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > declare another variable named countRule1 with initi value 1,
> > > > modify the rule 1 with condition x>2 && countRule1 ==1 and
> consequence
> > > > countRule1++ ;modifyObject(countRule1);
> > > >
> > > > another way?
> > > >
> > > > -邮件原件-
> > > > 发件人: Lionel Port [mailto:[EMAIL PROTECTED]
> > > > 发送时间: 2006年2月21日 8:39
> > > > 收件人: user@drools.codehaus.org
> > > > 主题: [drools-user] Is there a way to not fire already fired rules
> > > >
> > > > Hi,
> > > > Is there a way in drools to not have rules that have already been
> > fired
> > > > firing again when an object is modified?
> > > >
> > > >
> > > > For example if I have:
> > > > 1. rule 1 with condition x>2
> > > > 2. rule 2 with condition y>2 and consequence x = 10 3. rule 3 with
> > > > condition x>6
> > > >
> > > > If I give the facts x=3 and y=3,
> > > >
> > > > I would want
> > > > 1. rule 1 and rule 2 are true so rule1 and rule 2 consequences are
> > > fired.
> > > > 2. The consequence of rule 2 make rule 3 true, so rule 3 fires.
> > > >
> > > > At the moment I get rule 1 firing a second time.
> > > >
> > > >
> > > > Lionel
> > > >
> > > >
> > > >
> > > >
> > >
> >
> 
> > > > The information in this email is confidential and may be legally
> > > > privileged. If you have received this email in error or are
> > > > not the intended recipient, please immediately notify the sender and
> > > > delete this message from your computer. Any use, distribution,
> > > > or copying of this email other than by the intended recipient is
> > > strictly
> > > > prohibited. All messages sent to and from us may be
> > > > monitored to ensure compliance with internal policies and to protect
> > our
> > > > business.
> > > > Emails are not secure and cannot be guaranteed to be error free as
> > they
> > > > can be intercepted, amended, lost or destroyed,
> > > > or contain viruses. Anyone who communicates with us by email is
> taken
> > to
> > > > accept these risks.
> > > >
> > > > 收发邮件者请注意:
> > > > 本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
> > > > 进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
> > > >
> > > >
> > >
> >
> 
> > > >
> > >
> >
>


Re: [drools-user] Dealing with a massive number of rulesets

2006-02-26 Thread Michael Neale
With Drools 2.1, no, if you serialize it will compiler the snippets each
time.

Yes, if you did a DSL where you implemented the condition logic yourself
(not as java snippets) then it would not "compile" each time.

Alternatively, with drools 2.5 (and of course 3.0 coming up) you can
pre-compiler rulebases/rules to binary form, and have them loaded up very
quickly (which would be ideal for you). So there are possibly solutions, but
not using 2.1 version (other then your own DSL).

On 2/23/06, Marcelo Tallis <[EMAIL PROTECTED]> wrote:
>
> We want to implement a web service. We have a massive number of rulesets
> stored in a DB (too many to have them all loaded in memory at once). The
> rulesets are very simple and involve only a couple of dozens rules each.
> We
> receive (let say) millions of requests a day from clients. Different
> requests may require different rulesets. For every request: we load the
> required ruleset, update some facts in working memory, fireAllRules, and
> respond within a user tolerable response time.
>
> Question:
>
> What kind of tricks can we use to minimize the time to set up the
> execution
> of a rule set? Having to parse the rule set, compile it, set up the
> working
> memory, etc. for every request seems too expensive.
>
> For example:
>
> - Can we store serialized rulesets in a DB? How?
>
> -  Can we avoid the compilation of the java snippets in the rules each
> time
> we load (or de-serialize) a ruleset? Is this compilation time significant?
>
> - Would a domain specific language (one for all rulesets) save us some
> significant compilation time?
>
> Thanks,
>
> Marcelo
>
>


Re: [drools-user] WorkingMemory implementation question

2006-02-26 Thread Michael Neale
No Drools works off the objects directly.

In future, they will be optional shadow support for shallow copying of your
facts to insulate from concurrent changes, but by default it works off the
naked un proxied/copied objects (which makes some things a challenge ! But
we believe it makes it worth it for users in the end).

Also, Drools isn't really interpreted other then when it is using Jython -
otherwise it is bytecode that is running, same as you would do by hand.

On 2/23/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> Maybe not a good thing to say on the Drools mailinglist, but maybe there
> are alternatives that require less work. Since Prolog is backward
> chaining with integrated search and Drools is forward chaining and has
> no search support, I think moving from the former to the latter might be
> a rather big change.
> Alternatives to consider are Prolog interpreters written in Java
> (JIProlog, tuProlog, etc): their performance might be less than Prolog,
> but don't forget Drools is also an interpreter; or maybe better use a
> compiler that compiles your existing Prolog source code to executable
> Java classes (JProlog, etc) or bytecode.
>
> Peter
>
>
>
> Marcelo Tallis wrote:
> > We were using prolog to implement the inference support for our
> > applications. Now we are looking at switching to drools because we
> cannot
> > bare the overhead of translating between java and prolog the
> representation
> > of every data element that we pass to prolog. For example, integer
> numbers
> > in java are represented differently than in prolog and their
> representation
> > needed to be translated back and forth across the java / prolog
> interface.
> >
> > Drools seems to handle java objects in its primitive representation
> (good!).
> > However, we don't know how objects are represented in WorkingMemory.
> >
> > Question:
> > -
> >
> > Is the WorkingMemory keeping its own parallel COPY of the asserted
> objects
> > or it is only keeping REFERENCES to the actual objects? If the WM is
> copying
> > (or creating its own representation) of the asserted objects then the
> drools
> > alternative might not be as attractive as we thought.
> >
> > Thanks,
> >
> > Marcelo
> >
> >
> >
>
>
>


Re: 答复: [drools-user] drools and Rete-oo

2006-02-26 Thread Michael Neale
They are pretty handy little flash "screens" actually ! It looks like it is
from the Jess In Action book, with some animation.

On 2/24/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
>
>
> here are three flash demostrate how the rete works,hope they will give u a
> hand to understand how the rete network  work better
>
> http://www.ers.com/Graphics/TheReteNetwork.html
> http://www.ers.com/Graphics/TheReteNetwork2.html
> http://www.ers.com/Graphics/TheReteNetwork3.html
>
> -邮件原件-
> 发件人: sol myr [mailto:[EMAIL PROTECTED]
> 发送时间: 2006年2月24日 14:54
> 收件人: user@drools.codehaus.org
> 主题: [drools-user] drools and Rete-oo
>
> Hi,
>
>   The Drools website refers to "Rete-oo", but I'm not sure I understand it
> correctly ... especailly the "Extract Node" (mentioned in the
> documentation).
>
>   Suppose I have a class "Stock" which encapsulates some data
>   (for simplicity, I use only Objects, eg "java.lang.Double" ):
>
>  class Stock{
> Double  price;
> Double  expectedProfit;
> Double  risk;
>  }
>
>   Now, suppose I want to do
>   "assertObject(someStock)"
>   But I was the stock to enter the Rete as a Tuple of length 3  (price,
> profit,  risk) , rather than Tuple of length 1  (just 1 Stock encapsulating
> everything).
>   I understand the 3-tuple approach might give better performance,
> especially if you're about to play around with just one of the attributes (
> e.g. run the same simulation over and over again, each time with just a
> different "risk", while everything else remains fixed).
>
>   Is that what the Extract Node does ?
>   If so, how do you cause it to work - what exactly should you put in the
> < parameter > part of the rule ?
>
>   Thanks very much.
>
>
> -
> Yahoo! Mail
> Use Photomail to share photos without annoying attachments.
>
>
>
> 
> The information in this email is confidential and may be legally
> privileged. If you have received this email in error or are
> not the intended recipient, please immediately notify the sender and
> delete this message from your computer. Any use, distribution,
> or copying of this email other than by the intended recipient is strictly
> prohibited. All messages sent to and from us may be
> monitored to ensure compliance with internal policies and to protect our
> business.
> Emails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, lost or destroyed,
> or contain viruses. Anyone who communicates with us by email is taken to
> accept these risks.
>
> 收发邮件者请注意:
> 本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
> 进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
>
> 
>


Re: [drools-user] Using OR (||) in java Semantics

2006-02-28 Thread Michael Neale
Condition sharing is maybe one, the other being that there is possibly a
little more work being done. But its probably marginal in Drools 2. If it
makes you rules much neater, its probably fine to use it unless you are
noticing a specific performance problem.

On 2/28/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
>
> Just out of curiosity: why is it a bad idea to use || in conditions?
>
> Paul Smith wrote:
>
> I've used it in a few conditions along with &&.Given these comments
> though I'll rework them into separate conditions.
>
> On 2/27/06, Mark Proctor <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote:
>
>  Anagha,
>
> Its not a good idea to use || in conditions - instead  write out two
> rules for the different outcomes. However I thought that || had been
> made  allowed in conditions, for those that insist on using  it - has
> anyone else been able to use || in conditions? If || has not been yet
> made available i'm afraid you will have to wait till 3.0.
>
> Mark
> Anagha wrote:
>
>  Hi All,
> I'm using drools-2.1 with java semantics.
> I want to combine multiple condtions in a single condition with OR.
> i.e. if * (hello.equals("Hi") || hello.equals("Hey")
> But it seems "java.xsd" does not allow such type of constructs in the
> "condition".
> Any ideas?
>
> Any help is welcome.
>
> --
> Thanks & Regards,
> Anagha
>
>
>
>


Re: [drools-user] Drools 2.5

2006-02-28 Thread Michael Neale
2.5: this week hopefully. There is an up to date build of JCI from apache
that we have built ourselves. The guy who is maintaining it (Torsten) has
been moving house (!) so not able to do a formal release himself.

As for 3: should have beta 1 out Real Soon Now !


Michael.

On 2/28/06, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> I was going to have a look at using drools 2.5 because I couldn't get
> xor groups to work correctly. I believe that it's been fixed in 2.5.
> Problem is that it seems that drools is now using interfaces from the
> jakarta commons jci project ie) ResourceReader interface. There don't
> appear to be any releasable versions of this as yet. Will a full
> release of drools 2.5 be dependant upon a release candidate of the jci
> files? If so do we have a potential date for a 2.5 release ie) not the
> beta version? Also what about a release date for drools 3?
>
> Regards
>
> Paul
>


Re: [drools-user] Human readable rules

2006-03-01 Thread Michael Neale
Drools 3 will address this, definately. Timeframe is very soon for beta 1.

On 3/1/06, Ho, Alan <[EMAIL PROTECTED]> wrote:
>
> I've been looking at the Semantic Module Framework, however I found the
> Domain specific languages to be as complicated if not more than the java
> stuff.
>
> Is there a way to express rules in a more "human-readable" format ?
> Something like Subject Verb Object (e.g. drools is good) would work really
> well for both conditions and consequences.
>
> Regards,
> Alan Ho
>


Re: [drools-user] Problems running unit test with drools 2.5 beta 2

2006-03-01 Thread Michael Neale
I think its missing JDT from the classpath for the project.

On 3/1/06, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> Guys,
>
> has anybody had any issues trying to run their drools unit tests from
> eclipse with drools 2.5 beta 2. Everything seems to work well with 2.1 but
> I
> get the following with 2.5 beta 2:
>
> java.lang.NoClassDefFoundError:
> org/eclipse/jdt/internal/compiler/env/INameEnvironment
> at org.apache.commons.jci.compilers.JavaCompilerFactory.createCompiler(
> JavaCompilerFactory.java:82)
> at org.drools.semantics.java.JavaSemanticFunctionsCompiler.getInstance(
> JavaSemanticFunctionsCompiler.java:27)
> at org.drools.semantics.java.JavaFunctions.getSemanticFunctionsCompiler(
> JavaFunctions.java:101)
> at org.drools.smf.RuleSetCompiler.compile(RuleSetCompiler.java:166)
> at org.drools.smf.RuleSetCompiler.(RuleSetCompiler.java:67)
> at org.drools.io.RuleSetLoader.addFromInputSource(RuleSetLoader.java:169)
> at org.drools.io.RuleSetLoader.addFromUrl(RuleSetLoader.java:68)
> at org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java:529)
> at org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java:494)
> at org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java:479)
>
>
> This seems to be because it's trying to pick up the Eclipse compiler
> instead
> of the janino one which is on the classpath because of the following:
>
> public class JavaSemanticFunctionsCompiler extends
> AbstractSemanticCompiler
> implements
> SemanticFunctionsCompiler
> {
> private static SemanticFunctionsCompiler INSTANCE;
>
> private final String semanticType;
>
> public static SemanticFunctionsCompiler getInstance()
> {
> if ( JavaSemanticFunctionsCompiler.INSTANCE == null )
> {
> JavaSemanticFunctionsCompiler.INSTANCE = new
> JavaSemanticFunctionsCompiler( "java",
>
> JavaCompilerFactory.getInstance().createCompiler(
> JavaCompilerFactory.ECLIPSE ) );
> }
> return JavaSemanticFunctionsCompiler.INSTANCE;
> }
>
> INSTANCE seems to be always null when running from JUnit. Everything works
> ok when I run the cactus tests against the deployed app running under
> JBoss
> 4.0.4
>
> Do I have to configure something else when running straight JUnit tests?
>
>


Re: [drools-user] drools 2.5 HelloWorldExample

2006-03-04 Thread Michael Neale
yeah, there have been some dependency changes for 2.5 around libraries.
Check out the release notes on the website for a quick list of deps that
worked for me for the basic java semantics.

On 3/4/06, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> You need to add the commons-jci-SNAPSHOT20051110.jar on to your classpath.
> Drools now uses the commons-jci interfaces for the compiler so that it can
> use janino, eclipse or groovy compilers. The ResourceReader interface is
> in
> this jar file.
>
> On 3/4/06, Rajkumar Thirumalainambi <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I downloaded drools 2.5 and am trying to run
> > HelloWorldExample.
> >
> > The following error comes. Please help me to run this
> > example.
> >
> > Exception in thread "main" java.lang.NoClassDefFoundError
> > org.apache.commons.jci.readers.ResourceReader
> >
> >
> > Thank you very much.
> >
> > Best Regards
> > Rajkumar
> >
>
>


Re: [drools-user] can your use fireAllRules(AgendaFilter) multiple times

2006-03-06 Thread Michael Neale
no when its finished, the agenda is clear.

I think what you really want is "Agenda Groups" where it is partioned based
on some logic - but this is an upcoming drools 3 feature.

in the meantime, you can also iterate through and "modify" all the objects
that are already in working memory, causing rules to be put on the agenda
again (possibly).

However, I think the correct way is what you suggested, as you are talking
about 2 different points in your applications workflow, hence 2 rulesets.
The facts just happen to be the same. In any case, the "cost" is not so much
in iterating and calling assertObject, but the work done to calculate what
rules should fire, which in any case needs to happen twice.

Someone may have another more efficient suggestion however.

On 3/7/06, Lionel Port <[EMAIL PROTECTED]> wrote:
>
> When you use the fireAllRules(AgendaFilter) method on the WorkingMemory
> does
> it clear the Agenda when its done or can you fire different rules in the
> working memory at different points in time without modifying the facts in
> between.
>
> The rules I have can be broken into two distinct rulesets that need to be
> executed at different points but the conditions largely operate on the
> same
> facts, so I was trying to save time by asserting all the facts once and
> then
> doing something like:
>
> memory.fireAllRules(agendaFilter1);
> // do something not related to drools
> memory.fireAllRules(agendaFilter2);
>
>
> It doesn't seem to be working though. Should I just put the rules in
> different rule bases and assert the facts before I use it.
>
>


Re: Re[2]: [drools-user] can your use fireAllRules(AgendaFilter) multiple times

2006-03-07 Thread Michael Neale
hmmm... well perhaps the rule needs to be broken down, so that in one
consequence if modifies fact1, and in a different consequnce it modifies
fact2.

I am not sure how it can work otherwise. I assume there is more in your
consequence then just the modifies?

On 3/8/06, Felipe Piccolini <[EMAIL PROTECTED]> wrote:
>
> Michael,
>
>   But, how can you modify 'all' the objects on the working memory?..
>   when a consequence finds a drools.modifyObject(Fact) inside the .drl
>   all the rulebase is checked again no matter the next line...
>
>   I want to do:
>
>   
>   drools.modifyObject(myFact1);
>   drools.modifyObject(myFact2);
>   
>
>   But the matter is the second line is never executed.
>
> Monday, March 6, 2006, 10:51:29 PM, you wrote:
>
> > no when its finished, the agenda is clear.
>
> > I think what you really want is "Agenda Groups" where it is partioned
> based
> > on some logic - but this is an upcoming drools 3 feature.
>
> > in the meantime, you can also iterate through and "modify" all the
> objects
> > that are already in working memory, causing rules to be put on the
> agenda
> > again (possibly).
>
> > However, I think the correct way is what you suggested, as you are
> talking
> > about 2 different points in your applications workflow, hence 2
> rulesets.
> > The facts just happen to be the same. In any case, the "cost" is not so
> much
> > in iterating and calling assertObject, but the work done to calculate
> what
> > rules should fire, which in any case needs to happen twice.
>
> > Someone may have another more efficient suggestion however.
>
> > On 3/7/06, Lionel Port <[EMAIL PROTECTED]> wrote:
> >>
> >> When you use the fireAllRules(AgendaFilter) method on the WorkingMemory
> >> does
> >> it clear the Agenda when its done or can you fire different rules in
> the
> >> working memory at different points in time without modifying the facts
> in
> >> between.
> >>
> >> The rules I have can be broken into two distinct rulesets that need to
> be
> >> executed at different points but the conditions largely operate on the
> >> same
> >> facts, so I was trying to save time by asserting all the facts once and
> >> then
> >> doing something like:
> >>
> >> memory.fireAllRules(agendaFilter1);
> >> // do something not related to drools
> >> memory.fireAllRules(agendaFilter2);
> >>
> >>
> >> It doesn't seem to be working though. Should I just put the rules in
> >> different rule bases and assert the facts before I use it.
> >>
> >>
>
>
> --
> Felipe Piccolini
> [EMAIL PROTECTED]
>
>


Re: [drools-user] Loading Rules Fail--Help!!!

2006-03-07 Thread Michael Neale
yeah it did change. In 2.5, the functions are compiled into their own class,
which is then referred to as static methods in the generated rule classes.
Hence the need to be static. I should have put that in the relase notes


IN drools 3, we will have a function construct, so you don't have to worry
about public static etc.. you just say what the function name is, what what
its return type is (if any).

On 3/8/06, Paul Smith <[EMAIL PROTECTED]> wrote:
>
> I noticed that function declarations seemed to change between drools 2.1and
> 2.5. I had some functions that were not declared as static that compiled
> ok
> with drools 2.1 but I noticed that compilation error happening when I
> switched to 2.5.
>
> On 3/8/06, Steven Williams <[EMAIL PROTECTED]> wrote:
> >
> > Hi Russell,
> >
> > From looking at the examples I think your fix should be just a matter of
> > changing your function definition from:
> >
> > public void printStock
> >
> > to
> >
> > public static void printStock
> >
> >
> > cheers
> > Steve
> >
> >
> > On 3/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > >
> > > Guys:
> > >
> > > I am working through a simple example for loading rules.  I am running
> > jdk
> > > 1.5, eclipse 3.1.1, and drools2.5 final.
> > >
> > > When I run the application it complains about the rules.  This is
> > the
> > > rule set
> > >
> > >
> > >  > >xmlns="http://drools.org/rules";
> > >xmlns:java="http://drools.org/semantics/java";
> > >xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
> > >  xs:schemaLocation="http://drools.org/rules rules.xsd
> > > http://drools.org/semantics/java java.xsd
> ">
> > >
> > > 
> > > java.lang.Object
> > > java.lang.String
> > > com.company.dept.product.domain.StockOffer
> > >
> > > 
> > >   
> > > public void printStock(
> > com.company.dept.product.domain.StockOfferstock){
> > >System.out.println("Name:" + stock.getStockName()
> > >   + " Price:" + stock.getStockPrice()
> > >   + " BUY:"   + stock.getRecommendPurchase());
> > > }
> > >   
> > >
> > >   
> > >   
> > >  
> > > StockOffer
> > >  
> > >  
> > >  stockOffer.getRecommendPurchase() == null
> > > 
> > >  stockOffer.getStockPrice() < 100
> > 
> > >  
> > >   stockOffer.setRecommendPurchase(StockOffer.YES);
> > >   printStock(stockOffer);
> > >  
> > >   
> > > 
> > >
> > >   I am getting this error:
> > > [start of error]
> > > org.drools.semantics.java.JavaSemanticCompileError: A problem occured
> > > compiling the embedded code:
> > >
> > >
> >
> drools/org/businessrulesample_1141764314250/java/Stock_Price_Low_Enough_0.java(30)
> > > Cannot make a static reference to the non-static method
> > > printStock(StockOffer) from the type Function_0_0
> > > [end of error]
> > >
> > > Any insight would be greatly appreciated.
> > >
> > > Russ
> > >
> > >
> > >
> >
> >
> > --
> > Steven Williams
> >
> > Supervising Consultant
> >
> > Object Consulting
> > Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
> > [EMAIL PROTECTED]
> > www.objectconsulting.com.au
> >
> > consulting | development | training | support
> > our experience makes the difference
> >
> >
>
>


Re: [drools-user] Structuring conditions, alpha and beta networks

2006-03-07 Thread Michael Neale
The former would be more efficient, just as in java code. Its comparing to
identies (integer comparison) versus a method call.

(assuming the results are the same).

On 3/8/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
>
> Hey,
>
> If I have a Java bean with two properties, p1 and p2 and want to have a
> rule
> that processes matching beans, which set of patterns is 'better' as far as
> Drools is concerned?
>
> Assuming,
>
> MyBean
> MyBean
>
> Then would
>
> b1.getP1() == b2.getP1()
> b1.getP2() == b2.getP2()
>
> OR
>
> b1.equals(b2)
>
> (assuming I've properly implemented equals())
>
> Be more appropriate?
>
> Are there any performance implications between the two?
>
> My experience with other Rete implementations is that the alpha network
> performs constant tests.  In Drools, I'm having a hard time visualizing
> the
> difference between what the alpha and beta portions of the network will be
> processing.
>
> It seems to me that the alpha portion of the network should be responsible
> for the parameter identification (is this true?), if so, does it also
> apply
> to conditions, and if so, to what extent?
>
> I have read most (if not all) of the Drools documentation and still
> struggle
> a bit understanding how this works.
>
> Any help or pointers to good documentation would be appreciated.
>
> Thanks.
> -Mitch
>
>
>


Re: [drools-user] Escape Character for

2006-03-08 Thread Michael Neale
whats worse is that some XML parsers let you get away with it to some
extent, but then suddently it blows up.

Best bet, find a good graphical XML editor/plug in, and use CDATA. XML is
not the nicest thing to edit by hand !

On 3/9/06, Bob McWhirter <[EMAIL PROTECTED]> wrote:
>
> Yah, really, this is just how XML works.  Nothing we can do to change
> it for readability.
>
> -Bob
>
>
> On Mar 8, 2006, at 1:55 PM, Smith, Philip wrote:
>
> > I generally wrap everything in ![CDATA[ ]].
> >
> > 
> >
> > Philip Smith
> > [EMAIL PROTECTED]
> > (650) 628-7941 (x87941)
> >
> >
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 08, 2006 10:51 AM
> > To: user@drools.codehaus.org
> > Subject: [drools-user] Escape Character for <
> >
> > Guys:
> >
> > Just a general question about the denotation for less than operator.
> >
> > The schema is such the one can not use the '<' char for reflecting the
> > operation.
> > One must use the escape character < so the rule is correctly formed
> > document.
> >
> > Are there in plans to change this for better readability?
> >
> > Russ
> >
> >
> >
> > 
> >   
> >  
> > StockOffer
> >  
> >  
> >  stockOffer.getRecommendPurchase() == null
> > 
> >  stockOffer.getStockPrice() < 100
> > 
> >  
> >   stockOffer.setRecommendPurchase(StockOffer.YES);
> >   printStock(stockOffer);
> >  
> >   
> >
>
>


Re: [drools-user] drools 2.5 run-time dependencies

2006-03-08 Thread Michael Neale
no strong dependencies, no.

On 3/9/06, Leyzerzon, Simeon <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> In an attempt to switch from drools 2.1 to 2.5, I am having various weird
> problems during the deployment of the .ear file to WebLogic 8.1sp2.
> I've been able to trace the bugs to the xercesImpl-2.7.1.jar which is on
> the list of the drools dependencies.  Switching back to
> xercesImpl-2.6.2.jar seems to fix the deployment bugs and I'm able to run
> all the tests.  But I'm not sure what else could break if we don't
> distribute with the latest version of the xercesImpl.   Are there any strong
> dependencies on that jar and a requirement that it needs to be at version
> 2.7.1??
>
> Thanks in advance.
>
> Simeon Leyzerzon
> Risk IT
>
>
>
>
> ==
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
>
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> ==
>
>


Re: [drools-user] Drools Conditions

2006-03-08 Thread Michael Neale
you have it correct.

There is an implicit and, and thats all there is really in Drools 2.

In Drools 3, there are other node types, such as Or, Not, and so on, but not
in Drools 2.

Michael.

On 3/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Guys:
>
> I wanted to ask about the condition element within a rule.  Take for
> example the rule below.  There are four conditions.  This rule is not
> 'asserted' unless all four conditions are true. This equates to an AND
> conditional set of statements.  Does drools support the OR behavior?  I
> guess it could if you wrote a separate rule reflecting the OR condition, but
> I would not like to design a solution this way as it could lead to
> conflicting behavior.
>
>   
>  
>  
>StockOffer
>  
>  
>  daoFactory.getStockDAO().isOnStockList(
> stockOffer.getStockName())
>  stockOffer.getRecommendPurchase() == null
> 
> 
>  stockOffer.getStockPrice() < 100
> 
>  stockOffer.getStockPrice() > 0 
>  
>   stockOffer.setRecommendPurchase(StockOffer.YES);
>   printStock(stockOffer);
>  
>   
>
> Thank you for sharing your thoughts.
>
> Russ
>
>


Re: [drools-user] Structuring conditions, alpha and beta networks (long)

2006-03-08 Thread Michael Neale
Best bet is to jump on #drools on irc.codehaus.org when you get a chance, we
can talk you though the design of drools 3 (and what is different with
drools 2 in that regard).

On 3/9/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
>
> My question is not really about java, but the implementation of the Rete
> network.
>
> Rete implementations typically have a pattern network and a join network.
> The pattern network is responsible for matching constants and
> 'intra-condition' variable references.  The join network is responsible
> for
> variable references across conditions.  Typically processing within the
> pattern network is much more efficient than the join network.
>
> Back to my original example, by testing each object property separately I
> create two conditions, hence two nodes in the pattern network.  By
> creating
> a single comparison function, I reduce this to one condition/pattern node.
> This may seem like '6 of one, half dozen of the other', but what if my
> test
> object has 10 properties?  Would it be better to have 10 conditions in my
> rule, or create a comparison method and have only one condition?
>
> It seems to me that in order to facilitate pattern sharing (one of the
> stated benefits of the Rete network) the use of more, simple conditions
> might be better.
>
> This whole thought process was triggered by a posting a few days back
> regarding building 'human readable' rules through the effective crafting
> of
> Java methods on the test objects.  I started to wonder what the impact of
> this would be to pattern matching within the Rete engine, which leads me
> to
> realize that I really didn't understand how pattern matching works in
> Drools.
>
> The general concept of differentiating between the pattern and join
> networks
> also has relevance to some work that is happening on my current project.
>
> Thanks.
> -Mitch
>
> -Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 07, 2006 3:43 PM
> To: user@drools.codehaus.org
> Subject: Re: [drools-user] Structuring conditions, alpha and beta networks
>
> The former would be more efficient, just as in java code. Its comparing to
> identies (integer comparison) versus a method call.
>
> (assuming the results are the same).
>
> On 3/8/06, Mitch Christensen <[EMAIL PROTECTED]> wrote:
> >
> > Hey,
> >
> > If I have a Java bean with two properties, p1 and p2 and want to have a
> > rule
> > that processes matching beans, which set of patterns is 'better' as far
> as
> > Drools is concerned?
> >
> > Assuming,
> >
> > MyBean
> > MyBean
> >
> > Then would
> >
> > b1.getP1() == b2.getP1()
> > b1.getP2() == b2.getP2()
> >
> > OR
> >
> > b1.equals(b2)
> >
> > (assuming I've properly implemented equals())
> >
> > Be more appropriate?
> >
> > Are there any performance implications between the two?
> >
> > My experience with other Rete implementations is that the alpha network
> > performs constant tests.  In Drools, I'm having a hard time visualizing
> > the
> > difference between what the alpha and beta portions of the network will
> be
> > processing.
> >
> > It seems to me that the alpha portion of the network should be
> responsible
> > for the parameter identification (is this true?), if so, does it also
> > apply
> > to conditions, and if so, to what extent?
> >
> > I have read most (if not all) of the Drools documentation and still
> > struggle
> > a bit understanding how this works.
> >
> > Any help or pointers to good documentation would be appreciated.
> >
> > Thanks.
> > -Mitch
> >
> >
> >
>
>
>


Re: [drools-user] Drools 2.5 error with import line with consequence: Syntax error on token "import", assert expected

2006-03-09 Thread Michael Neale
several parent ones - but the import is the same?

On 3/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I had few rules file that works fine with Drools 2.1 -
> however, when I downloaded the 2.5, it gives me
> following error for the import which I need to have
> within the consequeuce - The reason why I need the
> import within the consequence is because, I use same
> rule in several other parent rule files.
> org.drools.semantics.java.JavaSemanticCompileError: A
> problem occured compiling the embedded code:
>
> Syntax error on token "import", assert expected
>
> at
> org.drools.semantics.java.AbstractSemanticCompiler.handleAnyErrors(
> AbstractSemanticCompiler.java:72)
> at
> org.drools.semantics.java.AbstractSemanticCompiler.compile(
> AbstractSemanticCompiler.java:66)
> at
> org.drools.smf.RuleCompiler.compile(RuleCompiler.java:196)
> at
> org.drools.smf.RuleCompiler.compile(RuleCompiler.java:142)
> at
> org.drools.smf.RuleSetCompiler.compileRule(RuleSetCompiler.java:257)
> at
> org.drools.smf.RuleSetCompiler.compile(RuleSetCompiler.java:215)
> at
> org.drools.smf.RuleSetCompiler.(RuleSetCompiler.java:67)
> at
> org.drools.io.RuleSetLoader.addFromInputSource(RuleSetLoader.java:169)
> at
> org.drools.io.RuleSetLoader.addFromUrl(RuleSetLoader.java:68)
> at
> org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java:529)
> at
> org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java:494)
> at org.drools.io.RuleBaseLoader.loadFromUrl(RuleBaseLoader.java
> :479)
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


Re: [drools-user] Hot deploy in tomcat doesn't work

2006-03-09 Thread Michael Neale
so the problem is with the jar files? (locked?)

On 3/10/06, Kristofer Eriksson <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> i am having problems using drools together with tomcat (5.0). This is what
> happens: When I deploy an application with drools using the java, groovy
> or
> python semantics, the tomcat server and the application starts up without
> problems. But when I make a hot deploy on the application, the tomcat
> server
> seems to keep a lock on the core drools jar files preventing them from
> being
> deleted, and therefore making it impossible to redeploy.
>
> When using only the native (java) way of defining rules and rulebases,
> everything works fine. I did read in jira and this mailing list archive
> about some classloader issues on appservers that was solved, but no
> mentioning of tomcat.
>
> This problem occurs with both drools 2.1 and 2.5, just tried the latter
> one
> today.
>
> We are using tomcat 5.0.28 (upgrade not possble at the moment). I am
> personally no big fan of hot deploy but it is heavily used in the
> development phase in a quite large project so it sort of has to work.
>
> The questions if of course if anyone experienced the same, am I doing
> something stupid, does drools have to be loaded outside the applications
> classloader, or is it actually something of a problem with Drools? Is
> there
> maybe a workaround? Many questions that is!
>
> Any information is appreciated.
>
> Thanks
>
> Kristofer Eriksson
>
>


Re: [drools-user] Drools 2.5 error with import line with consequence: Synt

2006-03-12 Thread Michael Neale
it shouldn't have been from 2.5, but it is being removed from 3.0

On 3/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I have parent drl file with:
>
> 
>  
>  
> ]>
>xmlns="http://drools.org/rules";
>
> xmlns:java="http://drools.org/semantics/java";
>
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance";
>   xs:schemaLocation="http://drools.org/rules
> rules.xsd
>
> http://drools.org/semantics/java java.xsd">
>
> &rules-rulefile1;
> &rules-rulefile2;
>
> 
>
> rulefile1.drl and rulefile2.drl have simply rules
> defined.
> And both rulefile1.drl and rulefile2.drl - I use them
> in several other parent
> rule files.
>
> Because of that, to avoid having to add
> ... in each parent file,
> I use the "import xxx.yy" in the .
> This has been working fine for all previous releases
> of drools - until
> I got the Drools 2.5. With that, it gives compile
> error for the import that is within
> the consequence - Has the support been removed for
> import within consequence?
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


Re: [drools-user] Hot deploy in tomcat doesn't work

2006-03-12 Thread Michael Neale
I have no clues about that unfortunately, it does sound wierd. What would
cause a jar to be locked? Its almost as if tomcat hasn't finished
classloading or something.

On 3/10/06, Kristofer Eriksson <[EMAIL PROTECTED]> wrote:
>
> yes, the problem is exactly that. The core drools jar files (and only
> those)
> are beeing held by tomcat (locked) when the application restarts which
> prevents them from being deleted.
>
> Thx
>
> Kristofer
>
>
> On 3/10/06, Michael Neale < [EMAIL PROTECTED]> wrote:
> >
> > so the problem is with the jar files? (locked?)
> >
> > On 3/10/06, Kristofer Eriksson <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi all,
> > >
> > > i am having problems using drools together with tomcat ( 5.0). This is
> > what
> > > happens: When I deploy an application with drools using the java,
> groovy
> > > or
> > > python semantics, the tomcat server and the application starts up
> > without
> > > problems. But when I make a hot deploy on the application, the tomcat
> > > server
> > > seems to keep a lock on the core drools jar files preventing them from
> > > being
> > > deleted, and therefore making it impossible to redeploy.
> > >
> > > When using only the native (java) way of defining rules and rulebases,
> > > everything works fine. I did read in jira and this mailing list
> archive
> > > about some classloader issues on appservers that was solved, but no
> > > mentioning of tomcat.
> > >
> > > This problem occurs with both drools 2.1 and 2.5, just tried the
> latter
> > > one
> > > today.
> > >
> > > We are using tomcat 5.0.28 (upgrade not possble at the moment). I am
> > > personally no big fan of hot deploy but it is heavily used in the
> > > development phase in a quite large project so it sort of has to work.
> > >
> > > The questions if of course if anyone experienced the same, am I doing
> > > something stupid, does drools have to be loaded outside the
> applications
> >
> > > classloader, or is it actually something of a problem with Drools? Is
> > > there
> > > maybe a workaround? Many questions that is!
> > >
> > > Any information is appreciated.
> > >
> > > Thanks
> > >
> > > Kristofer Eriksson
> > >
> > >
> >
> >
>
>


Re: [drools-user] Out of Memory Errors

2006-03-12 Thread Michael Neale
what version of drools? Can you try both 2.1 and 2.5 as they do fairly
different stuff with loading/building (would be good to narrow it down).

On 3/10/06, Matias Otero <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Is there a limit to how many rules can be in a ruleset for a DRL file? I
> am getting java.lang.OutOfMemory exceptions when using the
> RuleBaseLoader.loadFromInputStream() method.  I have around 450 rules
> all up. When I reduce the number of rules I don't see it anymore.
>
> Cheers,
> Matias.
>
>
>
>


Re: [drools-user] Out of Memory Errors

2006-03-12 Thread Michael Neale
no there shouldn't be any specific size limits. How long/complex are your
rules?

I remember noticing errors like that when there were certain odd syntax
errors in the conditions/consequences (to do with the sax parser and some
unescaped characters). Unfortunately I wasn't able to reliably reproduce it
(and this was a while ago) but I do remember seeing that error.

Does it happen no matter what rules you pull out? (ie perhaps its the same
offending rule that you pull out each time).

Failing that, if you like and can, send me the ruleset (not sure if I will
be able to run it without the all the domain objects etc).

Michael.

On 3/13/06, Matias Otero <[EMAIL PROTECTED]> wrote:
>
> I'm currently running 2.1.
>
> -----Original Message-
> From: Michael Neale [mailto:[EMAIL PROTECTED]
> Sent: Monday, 13 March 2006 9:31 AM
> To: user@drools.codehaus.org
> Subject: Re: [drools-user] Out of Memory Errors
>
> what version of drools? Can you try both 2.1 and 2.5 as they do fairly
> different stuff with loading/building (would be good to narrow it down).
>
> On 3/10/06, Matias Otero <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > Is there a limit to how many rules can be in a ruleset for a DRL file?
>
> > I am getting java.lang.OutOfMemory exceptions when using the
> > RuleBaseLoader.loadFromInputStream() method.  I have around 450 rules
> > all up. When I reduce the number of rules I don't see it anymore.
> >
> > Cheers,
> > Matias.
> >
> >
> >
> >
>


  1   2   3   4   >