is property type casting into variable supported ?
by Martin Minka
I filled bug https://issues.jboss.org/browse/DROOLS-136 because the way I
tried to use # symbol hangs Drools.
I would like to ask the group if following type casting is supported in
Drools in Java or in MVEL:
rule "calculate totalPrice per item"
salience -10
no-loop
dialect "java"
when
$q:Message(id=="item", answered==true, $v:value#DataItemPrice)
then
System.out.println("this works: " + ((DataItemPrice)$v).getName());
// will this also work ? at least in MVEL
System.out.println("will this work ?: " + $v.getName());
end
thank you,
Martin Minka
11 years, 7 months
Room to optimize or bug? Unnecessary calls to unused method
by Sonata
Hi, I am using 5.5.0.final on jdk7(64bit). To repeat the test, simply create
a new Drools project in Eclipse. Tick the option to create a default Hello
World project. Go to the DroolsTest.java file, edit main() to
and edit getMessage() to
Next, remove the two rules in Sample.drl, use this simple rule instead
Then you can see the output
Which means, getMessage() is called 4 times in this simple rule. I really
wonder why. Is this a bug? Some non-optimized routine? An edge case?
Now try this
and the output is
Just once. It seems all good. Because getMessage() is needed to call once to
check with null, which is very fair to me.
Now something really funny
and the output
An extra call to getMessage() at the end, total 5 times!
TBH, I really only expect calling getMessage() once in all these tests.
Please put it to my face and tell me my test is so flawed.
--
View this message in context: http://drools.46999.n3.nabble.com/Room-to-optimize-or-bug-Unnecessary-cal...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
[Planner] Planning problem - looking for tips, and advices for complicated case
by Mz
Hello,
I'm having a problem to plan my solver, I'm wondering if it's possible to
configure the solver, so that it picks the best solution from multiple
collections of planning variables. Here is an example, to be more precise:
I have 3 planning variables: X, Y, Z. and many collections of values of
these variables. For example, collection A contains three X values, five Y
values, and two Z values; other collection would contain different values
etc. And the problem is that the values from different collections can't be
mixed with each other, and I don't know how to prevent that.
I have tried different approaches but with no luck... Tried to mix all of
the values together identifying them with a collection ID, and setting in
rules a negative score for the ones that are not from the same collection,
but its very inefficient, and the solver never stops (despite the fact that
the timeout was set for 120sec).
I was thinking about using multiple @PlanningEntities, but as far as I know
it is not supported, so I have resigned from this idea.
I have also tried using @ValueRange type FROM_PLANNING_ENTITY_PROPERTY, and
in MoveFactory I have changed planningEntityProperty according to the
collection I was using, but it led to exception "Corrupted Undo Move", and
all in all I think it was a bad idea.
My last idea, which I have not tested yet, is to make two different solvers,
one would find best solution for the given collection, and from all of the
best solutions from these collections, the next solver would pick the best
one, but I think this might be a very inefficient way of doing it.
I'm really sorry if I made this post very hard to understand, but my problem
is a bit more complicated then it sound, and its hard to describe it :P I
would appreciate any tips/ideas how I could configure/plan my solver, and
rules so it would work better.
Thanks in advance,
Mateusz
--
View this message in context: http://drools.46999.n3.nabble.com/Planner-Planning-problem-looking-for-ti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Agenda-group in fact insert time
by Sonata
Hi, I just noticed that even I have different agenda-groups, all groups are
evaluated during fact inset time.
In an extreme case, if I have 1000 rules in agenda-group "A", and 1 rule in
agenda-group "B"
even though I just want to fire the 1 rule in agenda-group "B" by adding
AgendaFilter in fireAllRules()
all those 1000 rules in agenda-group "A" will be evaluated (i.e. methods in
the "when" part are being called)
even worst if I have complex logic in the "when" part for these 1000 rules,
e.g. accumulate/from, not to mention eval
Isn't that quite a performance impact? And forcing people to put their
logic/checking/matching in the "then" part?
How would you justify this? Or is there something I've missed that you can
actually evaluate the rule in agenda-group "B" ONLY, when fact is being
inserted?
Thank you
--
View this message in context: http://drools.46999.n3.nabble.com/Agenda-group-in-fact-insert-time-tp4023...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Deploying guvnor 5.5.1 Snapshot on websphere AS 7.0
by abhinay_agarwal
While Deploying guvnor 5.5.1 -Snapshot on websphere 7.0 i am getting the
following error
[5/9/13 12:11:18:521 IST] 00000007 AdminHelper A ADMN1009I: An attempt
is made to start the drools-guvnorEAR application.
[5/9/13 12:11:18:568 IST] 00000007 CompositionUn A WSVR0190I: Starting
composition unit WebSphere:cuname=drools-guvnorEAR in BLA
WebSphere:blaname=drools-guvnorEAR.
[5/9/13 12:11:51:421 IST] 00000007 ApplicationMg A WSVR0200I: Starting
application: drools-guvnorEAR
[5/9/13 12:11:51:421 IST] 00000007 ApplicationMg A WSVR0204I: Application:
drools-guvnorEAR Application build level: Unknown
[5/9/13 12:11:51:811 IST] 00000007 webapp I
com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0169I: Loading Web
Module: JBoss Guvnor for Drools.
[5/9/13 12:11:52:076 IST] 00000007 InjectionProc E CWNEN0044E: A resource
reference binding could not be found for the BeanManager resource reference,
defined for the JBoss Guvnor for Drools component.
[5/9/13 12:11:53:074 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.52.5753476655115778206616.txt
com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings 480
[5/9/13 12:11:53:121 IST] 00000007 InjectionEngi E CWNEN0011E: The
injection engine failed to process bindings for the metadata.
[5/9/13 12:11:53:215 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.53.1839095875068220164390.txt
com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace 640
[5/9/13 12:11:53:215 IST] 00000007 ComponentName E CNTR0125E: Unable to
process injection information for class: [class
org.drools.guvnor.server.repository.SafeWeldListener].
[5/9/13 12:11:53:386 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.53.2612645496587947147575.txt
com.ibm.ws.webcontainer.webapp.WebGroup 131
[5/9/13 12:11:53:386 IST] 00000007 webapp E
com.ibm.ws.webcontainer.webapp.WebGroupImpl WebGroup SRVE0015E: Failure to
initialize Web application JBoss Guvnor for Drools
[5/9/13 12:11:53:558 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.53.3864474793422569466133.txt
com.ibm.ws.webcontainer.WebContainer 736
[5/9/13 12:11:53:651 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.53.5581434492717138337900.txt
com.ibm.ws.runtime.component.WebContainerImpl.install 124
[5/9/13 12:11:53:683 IST] 00000007 DeployedAppli W WSVR0206E: Module,
drools-guvnor.war, of application,
drools-guvnorEAR.ear/deployments/drools-guvnorEAR, failed to start
[5/9/13 12:11:53:683 IST] 00000007 ApplicationMg W WSVR0101W: An error
occurred starting, drools-guvnorEAR
[5/9/13 12:11:53:683 IST] 00000007 ApplicationMg A WSVR0217I: Stopping
application: drools-guvnorEAR
[5/9/13 12:11:53:714 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.53.7148569466503349536987.txt
com.ibm.ws.wsaddressing.urimap.EndpointMappingListener 1:196:1.8
[5/9/13 12:11:54:010 IST] 00000007 ApplicationMg A WSVR0220I: Application
stopped: drools-guvnorEAR
[5/9/13 12:11:54:322 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.54.0106549968453388597889.txt
com.ibm.ws.runtime.component.ApplicationMgrImpl 1449
[5/9/13 12:11:54:322 IST] 00000007 CompositionUn E WSVR0194E: Composition
unit WebSphere:cuname=drools-guvnorEAR in BLA
WebSphere:blaname=drools-guvnorEAR failed to start.
[5/9/13 12:11:54:447 IST] 00000007 DMAdapter I
com.ibm.ws.ffdc.impl.DMAdapter getAnalysisEngine FFDC1009I: Analysis Engine
using data base: D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\properties\logbr\ffdc\adv\ffdcdb.xml
[5/9/13 12:11:54:556 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.54.3535465789859844096183.txt
com.ibm.ws.management.AdminServiceImpl.invoke 679
[5/9/13 12:11:54:556 IST] 00000007 AppManagement W Unable to start:
drools-guvnorEAR using:
WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=BHUKRK286014DNode01,version=7.0.0.11,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=BHUKRK286014DNode01Cell,spec=1.0
exception is: javax.management.MBeanException: Exception thrown in
RequiredModelMBean while trying to invoke operation startApplication
[5/9/13 12:11:54:619 IST] 00000007 FfdcProvider W
com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident
emitted on D:\Program
Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\ffdc\server1_6f6e6f6e_13.05.09_12.11.54.6198303816507559970350.txt
com.ibm.ws.management.application.AppManagementImpl.startApplication 1332
Any idea about this error ?
Thanks,
Abhinay
--
View this message in context: http://drools.46999.n3.nabble.com/Deploying-guvnor-5-5-1-Snapshot-on-webs...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Use of the binding variable
by IPatel
Hi,
I am having little bit difficulty in understanding "binding variable"
concept in the guvnor. During our POC a business user asked me question
around this and i was able to save myself by telling them that the binding
variable is used in case you want use the fact again in Then statement.
(This is how i see it in the examples of rules).
Can anyone please explaining me the real use of the binding variable so that
i can help my business partner understand it properly?
Thank you for your help in advance
Isha
--
View this message in context: http://drools.46999.n3.nabble.com/Use-of-the-binding-variable-tp4023744.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Odd behavior on timeInMillis after[15m, 96h] otherTimeInMillis
by ScalaEnthusiast
I am attempting to use the after[start, end] construct with two time values
being returned in milliseconds.
We are effectively using Drools 5.3 (BRMS 5.3.1).
Here is what I have (field names changed, etc due to nature of data):
//---------------------------------------------
global String someInsertedConstant;
global Calendar myCurrentTime; // calculated just before inserting as
global.
rule "compare time in millis"
dialect "java"
when
$someObject : SomeObjectClass ( field1 == someInsertedConstant,
field2 == null,
myCurrentTime.timeInMillis after[15m, 96h]
someObject.getTime().getTimeInMillis ) from entry-point "SomeEntryPoint"
then
System.out.println("Boo-yah!!!");
//-------------------------
This does not send out a Boo-yah!!! as I would expect, when myCurrentime is
15 minutes or more past someObject.getTime(). However, I have another rule
just like this, where the only difference is the after is [0m,15m] instead,
and it gives a Boo-yah!!! as it should when myCurrentTime is up to 15
minutes past someObject.getTime(). Both rules are together in the same
package.
Am I missing something here? In the first case, "after[15m, 96h]", I can
change that line to manually subtract the two times as longs and compare
against being >= 900000 and it fires as it should. This appears to be a bug,
but I am not entirely sure as I am fairly new to the rule world.
What am I missing?
Thanks,
ScalaEnthusiast
--
View this message in context: http://drools.46999.n3.nabble.com/Odd-behavior-on-timeInMillis-after-15m-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
Grid Node Null Pointer Exception
by Jason Barto
I am attempting to, using Camel, receive AMQP messages from RabbitMQ and
pass them into a Drools Fusion engine. As my starting point I have a 4
line bit of Java code that instantiates Camel and passes it the camel XML
pasted below. Is it apparent to anyone where I've gone wrong that I
receive a NPE while the system is calling the init method for 'node1'?
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="droolsPolicy" class="org.drools.camel.component.DroolsPolicy"
/>
<drools:grid-node id="node1"/>
<drools:kbase id="kbase1" node="node1">
<drools:configuration>
<drools:mbeans enabled="true"/>
</drools:configuration>
<drools:resources>
<drools:resource type="DRL"
source="classpath:drools-rules.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession1" type="stateful" name="ksession1"
kbase="kbase1" node="node1"/>
<bean id="drools" class="org.drools.camel.component.DroolsComponent"/>
<bean id="jsonMessageConverter"
class="amqp.spring.converter.XStreamConverter"/>
<bean id="textMessageConverter"
class="amqp.spring.converter.StringConverter"/>
<bean id="messageConverter"
class="amqp.spring.converter.ContentTypeConverterFactory">
<property name="converters">
<map>
<entry key="application/json"
value-ref="jsonMessageConverter"/>
<entry key="application/xml"
value-ref="textMessageConverter"/>
</map>
</property>
<property name="fallbackConverter" ref="textMessageConverter"/>
</bean>
<rabbit:connection-factory id="connectionFactory" host="127.0.0.1"
port="5672" />
<rabbit:template id="amqpTemplate"
connection-factory="connectionFactory" message-converter="messageConverter"
reply-timeout="60000"/>
<rabbit:admin connection-factory="connectionFactory"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="stream:in?promptMessage=Enter something: "/>
<to uri="spring-amqp:cml.direct:a.b.c?type=direct"/>
</route>
<route>
<from uri="spring-amqp:cml.direct:springd:a.b.c?type=direct" />
<transform>
<simple>${body.toUpperCase()}</simple>
</transform>
<to uri="spring-amqp:cml.topic:a.b.c"/>
</route>
<route>
<from uri="spring-amqp:cml.topic:springt:#?type=topic" />
<to uri="stream:out"/>
</route>
</camelContext>
</beans>
I'm still extremely new to Drools, Camel, BRMS and my ultimate goal is to
have BRMS running, receiving events from RabbitMQ. This is one step along
my learning to achieve that goal so any help that can be offered is very
much appreciated.
It's potentially worth noting that the JAR files I'm running for this are
from the Drools-jBPM Integration 5.5 distribution.
Sincerely,
Jason
11 years, 7 months
How to write Hibernate query lang(HQL) in .DRL file
by zeeshan
Hi !
According to my requirement I need to fetch and Insert data from database
using Hibernate Query from .DRL file.
I have idea how to execute HQL in Plain Java class but according to my
requirement,I need to fire query to database from .DRL file which I tried
but unable to get output instead I was getting errors.
Can anyone suggest me process to execute Hibernate Query from DRL file
or please provide me some sample code or any link.
Thanks !!
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months