Bug with removePackage/removeRule
by Dirk Bergstrom
I believe this is a bug. After I remove a rule or package from the ruleBase,
newly added rules fail to "see" objects in the working memory. Attached is a
test case, and below is the output from it.
Drools 4.0.4
Java 1.5.0.13
Start
RuleBase created
Adding rules about 'tom':
package tom;
import test.Tester.Record;
rule "Find tom"
when
$rec : Record( field1 == "tom" )
then
System.out.println("Find 'tom' " + $rec.dump());
end
inserting record 1:"tom",
inserting record 2:"fred",
inserting record 3:"harry",
inserting record 4:"fred",
inserting record 5:"ed",
inserting record 6:"tom",
inserting record 7:"sreeni",
inserting record 8:"jill",
inserting record 9:"ed",
inserting record 10:"tom",
fireAllRules()
Find 'tom' 10:"tom",
Find 'tom' 6:"tom",
Find 'tom' 1:"tom",
adding rules about 'fred':
package fred;
import test.Tester.Record;
rule "Find fred"
when
$rec : Record( field1 == "fred" )
then
System.out.println("Find 'fred' " + $rec.dump());
end
Find 'fred' 4:"fred",
Find 'fred' 2:"fred",
As expected, 'fred' is found.
Removing package tom (same bug if you use "ruleBase.removeRule").
ruleBase.removePackage("tom");
adding rules about 'ed':
package ed;
import test.Tester.Record;
rule "Find ed"
when
$rec : Record( field1 == "ed" )
then
System.out.println("Find 'ed' " + $rec.dump());
end
No 'ed' is found!
Changing record 3 to 'ed'
fireAllRules()
Find 'ed' 3:"ed",
Only the newly updated 'ed' is found.
--
Dirk Bergstrom dirk(a)juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
16 years, 11 months
Re: [rules-users] Re: Date problem
by Xiandong Su
I just played with it and it works fine for my 4.0.3 version.
----- Original Message ----
From: jack wu <jackxwu(a)yahoo.com>
To: rules-users(a)lists.jboss.org
Sent: Wednesday, January 23, 2008 10:54:39 PM
Subject: [rules-users] Re: Date problem
i copy the following from the Documentation. i thought it means that drools is going to auto convert the string "27-Oct-2007" into a java Date object.
+++++++++
DateThe date format "dd-mmm-yyyy" is supported by default. You can customize this by providing an alternative date format mask as a System property ("drools.dateformat" is the name of the property). If more control is required, use the inline-eval constraint.
Example 6.20. Date Literal Restriction
Cheese( bestBefore < "27-Oct-2007" )
+++++++++++++++++++++++++
Newsgroups: gmane.comp.java.drools.user
Date: 2008-01-23 23:32:42 GMT (4 hours and 13 minutes ago)
Were you compairing Date agaist string here, as your double quotes indicate?
Xiandong
Sent from my iPhone
On Jan 23, 2008, at 17:33, jack wu <jackxwu <at> yahoo.com> wrote:
if i have several levels of java beans, the Date is not working. example:
m:Message( first.second.date > "01-jan-2007" )
Never miss a thing. Make Yahoo your homepage.
16 years, 11 months
BRMS & Remoting API
by safi
Hi,
Accordingly to my last post
(http://www.nabble.com/BRMS-locks-jackrabbit-td15018752.html) I would like
to ask somebody how I can control BRMS via Seam Remoting API.
There is a small example in the Seam documentation which says something
about how to configure the remoting. Documentation says that it is necessary
to insert this piece of code into the web.xml:
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
After I’ve done this I recompiled BRMS and deployed. Now when I point my
browser to the URL where JavaScript files should reside
(http://...../seam/resource/remoting/resource/remote.js
) I get HTTP 404.
Any idea? Thx
Safi
--
View this message in context: http://www.nabble.com/BRMS---Remoting-API-tp15063314p15063314.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 11 months
Re: [rules-users] Date problem
by Xiandong Su
Were you compairing Date agaist string here, as your double quotes indicate?
Xiandong
Sent from my iPhone
On Jan 23, 2008, at 17:33, jack wu <jackxwu(a)yahoo.com> wrote:
if i have several levels of java beans, the Date is not working. example:
m:Message( first.second.date > "01-jan-2007" )
receive exceptions such as:
Caused by: java.lang.ClassCastException: java.lang.String
at java.util.Date.compareTo(Date.java:112)
at org.mvel.math.IEEEFloatingPointMath.doOperationNonNumeric(IEEEFloatingPointMath.java:111)
at org.mvel.math.IEEEFloatingPointMath._doOperations(IEEEFloatingPointMath.java:90)
at org.mvel.math.IEEEFloatingPointMath.doOperation(IEEEFloatingPointMath.java:41)
at org.mvel.util.ParseTools.doOperations(ParseTools.java:798)
at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:20)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
at org.mvel.MVEL.executeExpression(MVEL.java:230)
at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:210)
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
16 years, 11 months
Date problem
by jack wu
if i have several levels of java beans, the Date is not working. example:
m:Message( first.second.date > "01-jan-2007" )
receive exceptions such as:
Caused by: java.lang.ClassCastException: java.lang.String
at java.util.Date.compareTo(Date.java:112)
at org.mvel.math.IEEEFloatingPointMath.doOperationNonNumeric(IEEEFloatingPointMath.java:111)
at org.mvel.math.IEEEFloatingPointMath._doOperations(IEEEFloatingPointMath.java:90)
at org.mvel.math.IEEEFloatingPointMath.doOperation(IEEEFloatingPointMath.java:41)
at org.mvel.util.ParseTools.doOperations(ParseTools.java:798)
at org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:20)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
at org.mvel.MVEL.executeExpression(MVEL.java:230)
at org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
at org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:210)
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
16 years, 11 months
Re: [rules-users] Drools and event based decisions, i.e. streaming market quotes
by Mark Proctor
Henry Canterburry wrote:
> Mark,
>
> Thanks for the reply. My timeframe matches the one you mentioned
> although I would naturally be looking for working and production ready
> functionality. In the meantime, did any of the approaches I mentioned
> make any sense or would you say that drools is not the right tool at
> this point? I do have helper classes and other intermediary data
> caching approaches at this time that permit me to query past data and
> an entire streaming architecture to feed data.
>
> Thanks
> HC
>
>
> Mark Proctor wrote:
>> What's your time scale for this? We are currently implementing CEP
>> extendions to the language and engine which will do all of this for
>> you, we'll have a milestone release out in february when you can
>> first play with this and aiming to get a full release end of Q1 start
>> of Q2.
>>
>> Mark
>> Henry Canterburry wrote:
>>> What would be the best approach using drools to handle event driven
>>> decisions based on streaming data? In my case I am looking for a
>>> typical stock market scenario. Ticker quotes usually come in at
>>> second increments and depending on how many ticker symbols you
>>> subscribe to at any one time, there can be a lot of data coming and
>>> and changing every second. However, there probably isn't a need to
>>> keep large quantities of historic data in memory...maybe the last
>>> 200-500 ticks. The outputs are if a stock should be sold or bought,
>>> at what quantity and what price. Once the decision has been made, we
>>> need to make sure it does not persist past the point of being valid
>>> given the state of that data.
>>>
>>> If I have rules that are meant to derive/calculate info and
>>> decisions from the streaming data, what is the best integration
>>> architecture for the rule engine with the rest of the application?
>>>
>>> Stateful session which constantly updates the ticks in working
>>> memory and queries the memory for results on an ongoing basis? In
>>> this case, the session would be kept alive for as long as the data
>>> stream is going (i.e. hours)? This approach would require very
>>> rigorous working memory management and all the objects in it.
>>>
>>> Or...loop constantly over a stateless session for each tick? This
>>> would reduce the need to manage the number of objects in working
>>> memory since only the amount needed would be inserted in the first
>>> place and read back the results? Sounds inefficient and with lots of
>>> overhead.
really don't know. Try the stateful approach first and see how that pans
out.
>>>
>>> Also, what about multi-threaded environments? Any potential for
>>> conflicts between concurrent session instances?
events are normally stateless, so you should have no problem there.
Mutable objects in different threads being updated is of course a
problem, shadow proxies can help a little there - but you still need to
be careful.
>>>
>>> Thanks
>>> HC
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>
>
16 years, 11 months
WorkingMemory and JUnit
by John.Dubchak@wellsfargo.com
Hi,
We are using Drools 3.0.6 using a test-driven approach. This works
really well in allowing us to get good test coverage around our rules
and to create those rules rather easily. However, as the number of
tests grows, the execution speed of the test suite in our Continous
Integration environment is taking longer and longer (expected, I know).
We've broken our rules out into separate .drl files and try to test them
in isolation by instantiating a new WorkingMemory in the setup method of
each test and then setting the WorkingMemory variable to null in the
tearDown method.
Is there a way to re-use the WorkingMemory object such that we don't
have to create a new one, at the start of a test, and have it
garbage-collected, at the end? How are others doing similar things?
Our goal is to reduce the execution time of our testsuite.
Thanks for any and all replies.
John
16 years, 11 months