[rules-users] Problem in Defining Rules

2007-02-21 Thread Niyas

I am trying to use Drools with Spring-Hibernate. I don't know whether
it's a proper way of using Drools with Spring and Hibernate.
I am having the MVC application in Spring. This MVC application is
having the form for adding the employee id and employee name. I have a
bean for Employee. And EmployeeContoller using SimpleFormController in
Spring. And I am having the DAO Interface with two methods
addEmp(Employee e) and displayEmp(empid) and the implementation for
this interface in Hibernate.

What I am trying to do is, I am checking a conditon in .drl file, if
it satisfies the condition in the then part I need to save the
employee bean into database.

My DRL:
package com.example;

import com.example.EmployeeBean;

rule My First Rule  
when
a:EmployeeBean(empName == Andrew)
then
System.out.println(Hi Andrew -- My First Rule is Fired 
Successfully!!);
a.getempDAOTarget().addEmp(a);
end


But I am getting the following error:

It's Endowment Policy -- My First Rule is Fired Successfully!!
java.lang.NullPointerException
at 
com.example.Rule_My_First_Rule_0.consequence(Rule_My_First_Rule_0.java:9)
at 
com.example.Rule_My_First_Rule_0ConsequenceInvoker.evaluate(Rule_My_First_Rule_0ConsequenceInvoker.java:22)
at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at com.example.PolicyController.onSubmit(PolicyController.java:41)
at 
org.springframework.web.servlet.mvc.SimpleFormController.onSubmit(SimpleFormController.java:356)
at 
org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:258)
at 
org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:249)
at 
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at 
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
at 
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:723)
at 
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:663)
at 
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:394)
at 
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:358)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] How to stop rules

2007-02-21 Thread Labuhn
Hello,

i want to stop the rule engine when some spezial rules fire.
I am working for rules for an online shop.

The Problem (example)
A rule finds out that we cannot put a book into the onlineshop besause
the price is to low, not defined, ! These rule has a high salience.
When this happends we can stop going on and create an error. In javacode
i can write my one exception and and throw it.
But what can i do in Jboss Rule?

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


[rules-users] Problems with Decision Table

2007-02-21 Thread helidesai

Hello,

I am using JBoss Rules 3.1.0M1. I am using the decision table. I don't know
how we can check something like DateField = currentDate? I have tried to
put Today() in data column and in condition I have put DueDt = $1. But this
gives error that 'Unexpected Token' .Is there any way to put current date
like new Date() in Dicision table.

Also I noticed that the 'Or' condition doesn't work properly. For example if
i have to enter the condition like Policy is Live or Policy is Cancelled
do this 'Msg'.  I have to repeat the Action (Msg) field for both the rows
with live and cancelled. Is there any other way to implement 'Or'?

Another thing is can we use the condition without passing the data field?
For example if I put DueDt = new java.util.Date() in condition table and no
fields in data column, will it work?

Please let me know.

Regards,
Heli. 
-- 
View this message in context: 
http://www.nabble.com/Problems-with-Decision-Table-tf3267439.html#a9083103
Sent from the drools - user mailing list archive at Nabble.com.

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


RE: [rules-users] Rules Repository and Rule Modeller

2007-02-21 Thread Anstis, Michael \(M.\)
Sorry to press; but is a release schedule available?




From: Anstis, Michael (M.) 
Sent: 15 February 2007 09:03
To: 'Rules Users List'
Subject: RE: [rules-users] Rules Repository and Rule
Modeller


Thanks Michael,
 
Just so that I can acquaintance myself with your release
numbering system; 3.0.5 is the current production release and 3.1.0-M1 I
assume to be 3.1 Milestone 1 (pre-release).
 
Presumably M2 and M3 are other milestones on the way to
production release of 3.1 (you're going to call it 3.2 I think?)?!?!
 
Is there a release schedule available - so we can pile the
pressure on when (if) they're late? ;-)
 
Cheers,
 
Mike




From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Neale
Sent: 14 February 2007 23:59
To: Rules Users List
Subject: Re: [rules-users] Rules Repository and Rule
Modeller


yeah, very much so. Hopefully have a demo of it in M2 or
M3. 

I have been meaning to update the blog with the latest
on package management, but haven't found time, I will do ASAP. 



On 2/15/07, Anstis, Michael (M.) [EMAIL PROTECTED]
wrote: 

Hi, 

Just a note to enquire as to the status of the
captioned? 

Have they progressed towards release since
http://markproctor.blogspot.com/2007/01/relocation-relocation-repository
.html
http://markproctor.blogspot.com/2007/01/relocation-relocation-repositor
y.html ?

With kind regards, 

Michael Anstis
---
COSMO(S) 
* Trafford House (Int) 8 718 2239 
* Trafford House (Ext) +44 (0)1268 702239 
*  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
Ford Motor Company Ltd. 
Registered in England: No. 235446 
Registered Office: Eagle Way BRENTWOOD Essex
CM13 3BW 


___
rules-users mailing list
rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users




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


[rules-users] Another upgrade to 3.0.5 question

2007-02-21 Thread Ronald R. DiFrango

All,

OK, in my current 2.1 version of my app, I have 8 different rules files that
have different sets of rules.  In looking at 3.0.5 [and maybe this existed
previously, but I missed it], there is a method on PackageBuilder called
addPackageFromDrl.  Can I load all the individual sets into 1 rule package?
Then Drools will determine which rules to fire based upon what objects are
asserted into working memory?

The reason I came to this is I was looking at the Spring integration and was
wondering if I should have 1 RuleBased of the 8 individual ones like I have
today.

Thoughts and Suggestion Welcome!

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


RE: [rules-users] Problems with Decision Table

2007-02-21 Thread Grimshaw, Jeffrey
Hi Heli.  I was doing something similar in a DT and it took ages to
figure it out.  I was trying to compare dates from two different bound
objects.  I wanted to know if one date was later than the other.  To
compund the problem, the value in the condition cell (the user editable
part) needed to be true or false.  I ended up putting the whole thing in
an eval() statement like this:

eval(obj1.getDate().before(obj2.getDate()) == $1)

Using similar logic, yours might look like this:

eval(obj1.getDateField().before(new Date()) == $1)

The construct new Date() should be the current date/time.  The eval()
statement will return either true or false, so put that in your
condition cell.  Hope this helps.


--Jeff


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of helidesai
Sent: Wednesday, February 21, 2007 7:41 AM
To: rules-users@lists.jboss.org
Subject: [rules-users] Problems with Decision Table


Hello,

I am using JBoss Rules 3.1.0M1. I am using the decision table. I don't
know how we can check something like DateField = currentDate? I have
tried to put Today() in data column and in condition I have put DueDt =
$1. But this gives error that 'Unexpected Token' .Is there any way to
put current date like new Date() in Dicision table.

Also I noticed that the 'Or' condition doesn't work properly. For
example if i have to enter the condition like Policy is Live or Policy
is Cancelled
do this 'Msg'.  I have to repeat the Action (Msg) field for both the
rows with live and cancelled. Is there any other way to implement 'Or'?

Another thing is can we use the condition without passing the data
field?
For example if I put DueDt = new java.util.Date() in condition table
and no fields in data column, will it work?

Please let me know.

Regards,
Heli. 
--
View this message in context:
http://www.nabble.com/Problems-with-Decision-Table-tf3267439.html#a90831
03
Sent from the drools - user mailing list archive at Nabble.com.

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

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


[rules-users] accumulate / collect behaviour question - another stupid question

2007-02-21 Thread Olenin, Vladimir (MOH)
Hi,

 

Edson quoted the following sample rule some time ago:

 

rule transaction consistency

when

Transaction( $id : id )

$credits: Double( )

  from accumulate( TransactionEntry( id == $id, operation ==
credit, $amount : amount ),

  init( double balance = 0 ),

  action(  balance += $amount ),

  result( new Double( balance ) ) );

$debits: Double( )

  from accumulate( TransactionEntry( id == $id, operation ==
debit, $amount : amount ),

  init( double balance = 0 ),

  action(  balance -= $amount ),

  result( new Double( balance ) ) );

eval( ! $credits.equals( $debits ) ) then

   // inconsistency for transaction $id

End

 

 

If there are 100 transactions overall and only 10 unique transaction ids
(eg, id = 1..10), so that we have on average 10 Transaction facts per id,

 

- how many times will 'eval' be called?

- how many times will the action be called, assuming 'eval' always returns
'true'?

 

I guess the answer for the above should be '10 times', once per each id?
What if I put another eval statement like eval($id == 1) after existing
'eval'? Would that be evaluated 100 times (for all Transaction facts) or
only 10 times (once per unique id)?

 

I think I'm missing quite significant piece on how tuples are selected in
DROOLS and how 'eval' and new 'from accumulate' features work Any
pointers would be greatly appreciated! (would some general literature on
rule engines help to clear up this types of questions?...)

 

Thanks,

 

Vlad

 

PS: sorry for posting so many questions and answering so few.

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