Variable Notation in rule Condition
by sumatheja
Hi All,
I have this doubt regarding the notation used inside the rule's
condition. I have a fact HOST having the variables* HostName* and *
CPUSockets*. I have the following rule
rule "Test"
when
HOST(HostName!=null, CPUSockets>3)
then
# do something
Is throws an error saying cannot extract field *HostName*. It works fine
when i use *hostName*. Can anyone explain me the concept behind this.
Thanks in advance :)
--
cheers
Sumatheja Dasararaju
14 years, 2 months
Drools-Spring Config for Knowledge Agent
by KiranP
Hello Everybody,
I've used Drools5.1.0 and I have following Config In Spring :
<drools:resource id="profileChangeProcess" type="DRF"
source="classpath:/process/profilechangeprocess.rf"></drools:resource>
<drools:resource id="documentsRule" type="DRL"
source="classpath:/rules/documentsrule.drl" />
<drools:resource id="ChangeSet" type="CHANGE_SET"
source="classpath:/ChangeSet.xml"></drools:resource>
<drools:resource-change-scanner id="scanner" interval="10" />
<drools:kagent id="agent" kbase="knowledgeBase" new-instance="true">
<drools:resources>
<drools:resource ref="profileChangeProcess"></drools:resource>
<drools:resource ref="documentsRule"></drools:resource>
<drools:resource ref="ChangeSet"></drools:resource>
</drools:resources>
</drools:kagent>
<drools:kbase id="knowledgeBase"></drools:kbase>
now when i run the code i get following exception :
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'kSession': Error setting property values; nested exception
is org.springframework.beans.NotWritablePropertyException: Invalid property
'knowledgeAgent' of bean class
[org.drools.container.spring.beans.StatefulKnowledgeSessionBeanFactory]:
Bean property 'knowledgeAgent' is not writable or has an invalid setter
method. Does the parameter type of the setter match the return type of the
getter?
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1341)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:820)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:762)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:680)
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:475)
... 30 more
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid
property 'knowledgeAgent' of bean class
[org.drools.container.spring.beans.StatefulKnowledgeSessionBeanFactory]:
Bean property 'knowledgeAgent' is not writable or has an invalid setter
method. Does the parameter type of the setter match the return type of the
getter?
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1012)
at
org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:857)
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
at
org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1338)
... 41 more
any help or pointers to examples may help.............
-----
Keep Working >>
KiranP
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Spring-Config-...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Resuming a simple process involving human task
by Touma
Hi all,
For the past few weeks I've been trying to get a simple drools flow example
involving human tasks up and running. I've done quite a bit to the point
that my session, process, task and workitems are being persisted in the
database. Here is what my flow looks like:
Start -> Ruleflow -> Decision node -> Human Task -> Printing Node -> End
The work item handler for the Human task simply performs the task of
persisting the Task instance. After reaching the Human Task, the flow stops
and the state is persisted. But how would I go about restarting/resuming the
flow so that the 'Printing node' is reached? I've tried using the
loadStatefulKnowledgeSession(sessionId) to load the session but querying the
list of all the processes for the given session returns an empty list. Ditto
with the list of all the process events. I have all the ID's with me
(workitem, process, task, session) but am pretty confused as to how these
can be put to use to resume my suspended workflow.
Any pointers would be much appreciated. TIA.
Peace,
/T\
--
View this message in context: http://n3.nabble.com/Resuming-a-simple-process-involving-human-task-tp716...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Constants and BigDecimals
by Evert Penninckx
Hi
I've got the following rule:
when
$sale : Sale( amount > 300 )
then
modify($sale) { amount = 300; }
end
First problem: I don't like putting the constant value "300" two times in my
rule.
Second problem: amount is a BigDecimal. I read that mvel2 supports
BigDecimal literals like 300.00B, but drools won't compile this.
An ideal solution would look like something like this:
when
$maxAmount : 300.00B
$sale : Sale( amount > $maxAmount )
then
modify($sale) { amount = $maxAmount; }
end
1. Is it possible to attribute values to a variable?
2. If not, is it possible to use mvel's BigDecimal support? Because amount
> 300.00B says a lot more than eval(amount.compareTo(new
BigDecimal("300.00")) > 0).
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Constants-and-BigDeci...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Re: [rules-users] Is it possible to use CEP features in Guvnor?
by John Peterson
I've done some additional experimentation and verified that you can't
run Test Scenarios (at least, can't run them successfully). I did
discover that I could create a "Technical Rule" that has the declare to
establish our object as an event. I'm sure this isn't intended, but it
works....
For technical rules, adding the "from entry-point "X" " is easy.
For DSL rules, I can hide it in the translation for the literal values
the user can specify
For the Guided Rule Editor, it appears that adding "Free Form DRL" to
the LHS of the rule under the Fact block to enter the "from entry-point
"X" " part as well and it parses and runs okay.
jp
> Date: Tue, 12 Oct 2010 20:50:28 +0100
> From: Michael Anstis <michael.anstis(a)gmail.com>
> Subject: Re: [rules-users] Is it possible to use CEP features in
> Guvnor?
> To: Rules Users List <rules-users(a)lists.jboss.org>
> Message-ID:
> <AANLkTingb2zOtR3WZsKkn6rEqfAGcLg60axGZuYLvnM1(a)mail.gmail.com>
> Content-Type: text/plain; charset="windows-1252"
>
> I assume you mean using ther guided editor rather than a vanilla "DRL
Rule"
> (free format text)?
>
> If the former then I don't believe it is possible (nor would testing
with Guvnor's QA facility).
>
> DRL rules could be defined but not tested.
>
> 2010/10/12 John Peterson <john.peterson.gv3k(a)statefarm.com>
>
> > I was wondering if it was possible to leverage the CEP features in
> > Guvnor. I am not sure how we?d set the ?@role(event)? in Guvnor or
> > putting the ?entry-point? in the rule unless you use DSL (embedding
it
> > in the translation) or doing technical rules.
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
14 years, 2 months
Interfaces without inputs and with multiple operations
by sam.squire@paretopartners.com
Hello there,
I am using BPMN and trying to call a ServiceTask without any input
messages. Unfortunately the BPMN specification seems to require exactly
one inMessageRef. Is there a way to get it to call a method without
arguments, like doStuff() ?
Is there any way to get around this without having to change the class and
add a nonce parameter? This works but it is not ideal.
Does drools support the <operations> tag in BPMN? It seems to complain If
I try to use it. I can only have a single operation in each interface.
Thanks,
Sam Squire
This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses.
Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.
14 years, 2 months
Parallel processing of large batches of facts
by Tim Jones
Hello,
I’m working on a project that needs a high performance rules system for
processing batches of objects. Typically I’ll have a dozen or so rules, the
most complex of which will aggregate several objects based on timestamps and
specified data patterns. The objects will come in batches of a few 100ks.
The system is reset back to the starting point after each batch is
processed.
My guess at doing this with Drools is that you load up all the rules and
enter all the objects as “facts”. You then hit fireallrules and sit back and
wait. Doing this, I only get so much performance and I can see that its only
using a single thread. Is there a way to process the whole lot in a
parallel, or multithreaded way? Unfortunately there's no natural way to
partition the objects that would make things easier.
Cheers,
Tim
14 years, 2 months
unexpected ClassCastException when dealing with sliding windows
by will_lauer
I'm playing with Drools Fusion 5.1.1 a bit to try and evaluate whether it is
an appropriate tool for a project I'm working on. As part of that, I'm
playing a bit with its event capabilities, but I'm running into a problem
and I'm not sure whether its a bug or something that I'm doing.
I'm trying to write a rule that looks for a series of two events and I want
to preclude another specific type of event from coming between the two. I've
tried a couple of ways of doing this, and am now trying to use a sliding
window with the following rule:
declare Event
@role(event)
@expires(30ms)
end
rule TestWindow
when
$up : Event (type == "linkup", $inf : extra)
$window : ArrayList () from collect (
Event (extra == $inf) over window:length(2))
$down : Event (type == "linkdown", this before $up) from $window
then
channels["up"].send($up);
end
This is the only rule in my knowledge base. I create a stateful session and
start inserting facts into it. First a "linkdown" event and then a "linkup"
event with the same "extra" value. I get the following exception when
inserting the second event:
Exception in thread "main" java.lang.ClassCastException:
org.drools.common.DefaultFactHandle cannot be cast to
org.drools.common.EventFactHandle
at
org.drools.base.evaluators.BeforeEvaluatorDefinition$BeforeEvaluator.evaluateCachedLeft(BeforeEvaluatorDefinition.java:333)
at
org.drools.rule.VariableRestriction.isAllowedCachedLeft(VariableRestriction.java:110)
at
org.drools.rule.VariableConstraint.isAllowedCachedLeft(VariableConstraint.java:115)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(SingleBetaConstraints.java:142)
at
org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:274)
at org.drools.reteoo.FromNode.assertLeftTuple(FromNode.java:138)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:64)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:662)
at
org.drools.reteoo.AccumulateNode.assertLeftTuple(AccumulateNode.java:181)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:148)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:145)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:368)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
at
net.wlauer.DroolsEngine.NonSpringRulesEngine.main(NonSpringRulesEngine.java:71)
Browsing the mailing list seems to indicate that this means that for some
reason Drools is interpretting one of my facts as of role fact instead of
role event. I'm not sure why this would be event that the only things I'm
inserting are Event objects, which can be seen above to have the role of
event.
Am I doing something wrong here? Is there something wrong with my rule (and
is it going to do what I think its doing)? Or have I encountered a bug with
the sliding window implementation?
Any thoughts or help would be appreciated.
Will
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/unexpected-ClassCastE...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months