equality-based assert behavior and findFactHandle
by Adam Lewandowski
If I set my rule base to use equality-based assert behavior, I'm
expecting to be able to use the getFactHandle(object) method to retrieve
a previously asserted fact by providing an equivalent (by equals() and
hashCode()) object as an argument. This appears to not be the case, as
AbstractWorkingMemory uses it's identityMap and associated
IdentityAssertMapComparator to do the getFactHandle lookup instead of
the assertMap and EqualityAssertMapComparator. This causes the lookup to
be done with the system hashCode() method and not the overridden version
supplied in my fact class. The lookup thus fails and returns null.
Is there a way to have getFactHandle or some equivalent code do what I
want? This is with 4.0.3.
Thanks,
Adam Lewandowski
18 years, 1 month
Parameterized Queries?
by Robert Crawford
Does anyone know how to use parameterized queries? I'm trying to retrieve
ONLY the results for a single installation, with a query like this:
query "find errors for site"
validationError: ValidationError(this.siteId == $1)
end
QueryResults results = session.getQueryResults("find errors for site", new
Object[] {siteId});
I get the error
"org.drools.RuntimeDroolsException: Exception executing predicate
org.drools.base.mvel.MVELPredicateExpression
Caused by: org.mvel.PropertyAccessException: unable to resolve property: $1"
I'm pretty sure I'm not writing the rule correctly in the DRL; does anyone
know the correct syntax? The manual isn't clear on this.
Thanks!
18 years, 1 month
Multithreading use of RuleBase.newStatefulSession orRuleBase.newStatelessSession seems to be causing the engine toget the wrong answer.
by Tate Moore
Hopefully this is something I am doing incorrectly, however, when running
the 4.0.X versions of the Drools engine in a multithreaded environment the
rule occasionally gets the wrong answer. I have attached a simple example
based on the drools-examples-drl structure which runs the engine and
compares the result to a strictly Java rule equivalent.
I have verified that the sample code will produce the incorrect results with
4.0.1, 4.0.2 and 4.0.3 version of the codebase. Additionally, it doesn’t
seem to matter if I use stateless (which we use in production) or stateful
sessions. The only work around we have found is to fully synchronize around
any use of the Drools RuleBase methods. This doesn’t do us much good on our
multi-cored systems.
Thanks for any help on the issue.
Tate Moore
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.12/1098 - Release Date: 2007-10-29
9:28 AM
18 years, 1 month
Is Remote Debugging Supported?
by Drools Questions
Hi all,
it looks like the only mode supported for rules debugging by the
Eclipse plugin is "Drools Application".
If my understanding is correct, are there any plans to support
debugging "in situ" - i.e. attaching Eclipse to an already running
application (server) - like Java debuggers can?
Thanks,
DQ
18 years, 1 month
Matching time diff
by Miguel Figueiredo
Hi listers,
I have a fact MyFact that has a Date field in it, and I want to check if the
difference between this date and the current date is greater than 10 seconds:
The function timediff() returns the difference in seconds between a date and
the current date.
Rule:
rule myRule
when
fact : MyFact(date : fact, eval(timediff(date) > 10));
then
System.out.println("Greater than 10 seconds");
end
When I fire the rules, and the difference is less than 10 seconds nothing
happens. The next time that I fire the rules and the difference is greater
than 10 seconds nothing happens as well.
How can I make this work?
Best regards,
Miguel
18 years, 1 month
drools 4.0.2 DRL to PKG (without BRMS)
by Arnaud Bouzinac
Just a little question.
I have a drl file, and i want to use a pkg file in my application
(without
using BRMS server)
is it possible ?
is there a simple way to generate a .pkg file from a drl file ?
i need to serialize my rulebase ( not human readable)
Thanks for your help
Arnaud
18 years, 2 months
Problem running JBRMS 4.0.3 on JBoss AS 4.2.1
by Aziz Boxwala
I cannot get the BRMS to run on JBoss AS 4.2.1. (on Windows Vista).
Any help/hints to fix this will be appreciated. This is the error I get:
12:19:03,577 INFO [STDOUT] ERROR 26-10 12:19:03,576 (Contexts.java:flushAndDestroyContexts:335) could not discover
transaction status
12:19:03,579 INFO [STDOUT] ERROR 26-10 12:19:03,578 (StandardWrapperValve.java:invoke:278) Servlet.service() for s
ervlet default threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2284)
at org.apache.catalina.connector.Request.getSession(Request.java:2066)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:87)
at org.jboss.seam.servlet.ServletRequestSessionMap.put(ServletRequestSessionMap.java:25)
at org.jboss.seam.contexts.BasicContext.set(BasicContext.java:80)
at org.jboss.seam.Component.newInstance(Component.java:1980)
at org.jboss.seam.Component.getInstance(Component.java:1878)
at org.jboss.seam.Component.getInstance(Component.java:1857)
at org.jboss.seam.Component.getInstance(Component.java:1834)
at org.jboss.seam.web.Session.getInstance(Session.java:122)
at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:375)
at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:132)
at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Thanks,
--Aziz
18 years, 2 months
Difference between constraint within a pattern and eval
by Mohan
Hi There,
I am facing a weird issue, following rule doesn't run
rule "test"
dialect "mvel"
when
Experience( primary == "SY") )
then
log.debug("SY");
end
but following works. :confused:
rule "test1"
dialect "mvel"
when
exp : Experience( eval(exp.getPrimary() == "SY") )
then
log.debug("SY");
end
Whats the difference between the two,mean why second works but the first one
doesnt? I have used former expression in many other rules but haven't
encountered this problem.
Advance thanks for your response.
--MRaj
--
View this message in context: http://www.nabble.com/Difference-between-constraint-within-a-pattern-and-...
Sent from the drools - user mailing list archive at Nabble.com.
18 years, 2 months
Scope of bindings, identical patterns
by Julian Morrison
Suppose I have a rule like:
rule "foo"
when
$a : Cheese(name="Stilton")
$b : Cheese(name="Stilton")
then
# etc
end
First question: is it possible that a == b ? In other words, can both
patterns end up matching the same object in one activation? I have been
assuming this is so, but it isn't covered in the docs so far as I can see.
Second question: why can't I add as a pattern, $a != $b ? The eclipse
IDE compiler complains they are undefined. What is the scope of the
bindings defined by $a and $b ?
--
Julian Morrison
Programmer
i-neda Ltd.
18 years, 2 months
Compilation time while debugging in 4.0.3
by Chris Woodrow
Hi,
Since we have moved to 4.0.3 (from 4.0.0), while runtime haven't sensibly
changed, compilation time during debugging (I mean the call of
"addPackageFromDrl") takes really long, about 10 times what it use to take,
the only visible difference is the appearance of "Source before MVEL
Compilation:" in the output.
I am the only one to face this issue?
Thanks,
Chris
18 years, 2 months