drools-guvnor\modules
by Michael Anstis
Hi,
We're in the process of rationalising Guvnors code-base including the
removal of GWTEXT and came across use of GWTEXT's Grid in
drools-guvnor\modules\properties.
Anybody care to claim ownership? Otherwise we're probably delete it (if not
all drools-guvnor\modules) s we don't want to refactor stuff no longer
needed.
X-posted in case knowledge of the module has moved to the user list only.
With kind regards,
Mike
15 years
Decision Trees
by Petr Chelčický
I have quite a big decision tree (eligibility check) that I'd like to implement in Drools. To convert it to rules, I'd have to find every path from start leading to a leaf and check all the constraints. I feel like it'd be very messy. Is there a faster way? How about Drools Flow and decision trees? I tried to explain my use case here: http://stackoverflow.com/questions/4887456/decision-trees-and-rule-engine... where they recommend using Drools Expert. Is this the way to take?
John
15 years
Drools: how do I compare two fields in a Decision Table
by David Smith
Hi,
How do I compare two fields in a decision table e.g.
transactionDate==attachmentDate
I can create a rule that has a restriction using two fields such as
rule "check if risk is active"
when
$risk : Risk(transactionDate==attachmentDate)
then
...
end
I can do this using an eval statement in a decision table
Condition
$risk:Risk
eval($risk.getAttachmentDate().equals($risk.getTransactionDate()))
How do I write this without an eval?
I want to write something similar to the rule above:
Condition
$risk:Risk
attachmentDate == transactionDate
Thanks
David
15 years, 1 month
timer and duration
by OlliSee
Hello there.
I seem to have trouble with the "timer" operator which is documented to have
superseded the "duration" operator for use in the rule body. I might have
something to do with the "not" operator I use in my rule.
Scenario: A is a fact, B is an event
When I write something like this
rule "test"
timer(int: 5s 5s)
when
$a : A()
not (exists B(a == $a))
then
insert(new B($a)); // which means in the new B object: B.a
= $a
end
I expect this rule to fire every 5 seconds if and only if the LHS is true.
I just insert a few A objects at the beginning.
So I expect this rule to fire ONCE, because it will insert the B event which
makes this rule's LHS evaluate to false in the future.
BUT, reality is, this rule fires every 5 seconds, no matter what.
Using the deprecated duration operator with "duration(5s)" instead of the
timer operator, it works as expected.
I assume, that timer works differently compared to duration. So I conclude
that duration should coexist. Or am I missing something here on the usage of
the timer operator?
Thanks in advance.
Oliver
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/timer-and-duration-tp...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 1 month
Accumulating over a list of collected events (bug?)
by OlliSee
Hi folks, another bug discovered here?
This rule yields a really nice exception
rule "Test"
when
$list : List() from collect ( A() over window:time(5s) )
Number($avg : doubleValue) from accumulate( A($num : num)
from $list, average($num))
then
...
end
whereas
Number($avg : doubleValue) from accumulate( A($num : num) over
window:time(5s), average($num))
works fine.
So it seems I can't accumulate over the list. But would be quite handy if I
had more than one accumulation to do and didn't want to rewrite all the
constraints in each accumulation statement. I could just use the list, but
that results in the exception below.
Exception in thread "Thread-5" org.drools.RuntimeDroolsException: Unexpected
exception executing action
org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction@46fef3
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1473)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1159)
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 trafficsys.SessionInterface.insertAndFire(SessionInterface.java:144)
at
trafficsys.cep.SensorEventGenerator.generateEvents(SensorEventGenerator.java:80)
at de.trafficsimulation.MicroStreet.update(MicroStreet.java:393)
at de.trafficsimulation.SimCanvas.run(SimCanvas.java:401)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
at org.drools.reteoo.AccumulateNode.splitList(AccumulateNode.java:920)
at
org.drools.reteoo.AccumulateNode.removePreviousMatchesForLeftTuple(AccumulateNode.java:874)
at
org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:205)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:238)
at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTupleDestroyRightTuple(CompositeLeftTupleSinkAdapter.java:138)
at
org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:212)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:91)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:648)
at
org.drools.reteoo.AccumulateNode.removePreviousMatchesForRightTuple(AccumulateNode.java:903)
at
org.drools.reteoo.AccumulateNode.retractRightTuple(AccumulateNode.java:303)
at
org.drools.rule.SlidingTimeWindow.expireTuples(SlidingTimeWindow.java:167)
at
org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction.execute(SlidingTimeWindow.java:329)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1471)
... 9 more
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Accumulating-over-a-l...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 1 month
Drools: Compound Value Restriction in Decision Table
by David Smith
Hi,
I am pocing/learning drools and I am trying to implements Compound Value
Restrictions using 'In' in a decision table.
I can do this in a rule like
rule "CoverType Example"
when
$risk : Data( coverType in ("A","B", "C", "D"))
then
result.add("CoverType was one of A, B C or D");
end
I can also implement this in a decision table in a long winded fashion
Condition, Action
Data, result
coverType, add("$param")
A, CoverType was one of A, B C or D
B, CoverType was one of A, B C or D
C, CoverType was one of A, B C or D
D, CoverType was one of A, B C or D
Is there a compact way to do this using a Compound Value Restriction using
in?
Something like:
Condition, Action
Data, result
coverType in, add("$param")
"A,B,C,D", CoverType was one of A, B C or D
What goes in the script part "coverType in"?
The number of items in the list can be variable, so don't want to write
something that has $1, $2, $3, $4
Thanks
David
15 years, 1 month
Find facts in partially matching LHS
by David Jacobsson
Hi,
I'm currently working with a system where we have customers with different status flags. This could look something like:
customer has bought a car and a bicycle -> "wheel" status
customer has bought a tent, a jacket and food -> "camper" status
Since these rules can be quite complex and change often using Drools would be a good way so solve the problem. The problem now is that we want to answer the question, what's needed to achieve "camper" status? When it comes to DRL this becomes that we want to know which LHS facts that are missing for the "camper" rule to fire, i.e. so we can tell the customer that in order to achieve "camper" status you also need to buy a tent when he/she already have bought a jacket and food.
The solution we have so far is to add a number of "negative" rules in DRL that can identify the missing facts. Our concern though is that this doesn't scale since these extra rules become several more then the base rules that define the statuses.
Is it possible to solve this in a general way with Drools, i.e. to find missing facts leading to a specific conclusion?
And example of status rule in DRL would look something like:
-----
when
BoughtCar( $c : customer )
BoughtBicycle( customer == $c )
then
insert( new WheelStatus( $c ) );
end
-----
The example above is of course just an example and not actual rules from our system.
Regards,
David
15 years, 1 month
Can we use Multiple dsl in a dslr
by Bala
Hi,
Can we use multiple dsl files in a dslr i.e. expander dsl1.dsl expander
dsl2.dsl
Since my dsl file is going to be large, I find it difficult to store in
database.
Is there a way to split the dsl files and store. and combine back to the
original dsl for better use?
If i am going to keep my dsl file as a binary object and add that to the
builder, how can i specify the expander in dslr?
-----
Thanks,
Bala
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Can-we-use-Multiple-d...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 1 month