Any limitation on the count of properties when declare new class in drl file?
by haoruiqian@gmail.com
Hi,
I encountered a strange problem these days, I declared a new class a.b in drl file using keyword "declare", it has too many properties, larger than 64, then when fire rules, it threw ClassCastException, told me class a.b cannot be casted to a.b, but actually these are same class.
I tried to remove some properties made it less than 64, no CCE when fire rules.
This just happened in my product environment, if I run the rules in a pure drools environment in Eclipse, no exception even the count is larger than 64, anybody know why this happened?
The version of drools we used in our production is 6.0, we forked the code from GitHub, so maybe it's not up to date.
Thanks,
Richie
12 years, 6 months
Multiple calculation on same object
by sriksama
I recently encountered below scenario for a rule. I want to know how to
proceed with the rule design for this.
Class Emp{
beingDate:Date
endDate:Date
}
Rule to determine annual income for the employee based on the given dates:
For dates before 3/5/2003 the hourly rate is $3.5 and annual multiplier is
2100.
For dates after 3/5/2003 the hourly rate changes every year (given data) and
annual multiplier is 2092.
There might be scenarios where begin date is before 3/5/2003 and end date is
after 3/5/2003.
What is the best way to design rules for this scenario.
--
View this message in context: http://drools.46999.n3.nabble.com/Multiple-calculation-on-same-object-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 6 months
A question about use sliding window with and without entry point
by Yu Changyuan
Hi, everyone,
I just find that, insert an event into a entry point or insert it
directly into session will cause different behaviour, is this expected?
Here is the details:
1. drools run in stream mode and use pseudo clock
2. insert a MyEvent into entry-point "stream" and a MyEvent into session
directly every 1 seconds, start at 500ms.
3. call fireAllRules every 1seconds, at second 1, second 2, etc
4. drools version 5.5.0.Final
Below is the rule:
package me.ycy.drools.test1.data
import java.util.List
declare MyEvent
@role(event)
@timestamp(timestamp)
end
rule "over 0.3s"
when
$list: List() from collect(MyEvent() over window:time(300ms))
then
System.out.println("Rule: with in 0.3s --> " + $list);
end
rule "over 1s"
when
$list: List() from collect(MyEvent() over window:time(1s))
then
System.out.println("Rule: with in 1s --> " + $list);
end
rule "over 3s"
when
$list: List() from collect(MyEvent() over window:time(3s))
then
System.out.println("Rule: with in 3s --> " + $list);
end
rule "over 0.3s ep"
when
$list: List() from collect(MyEvent() over window:time(300ms) from
entry-point "stream")
then
System.out.println("Rule: with in 0.3s use ep --> " + $list);
end
rule "over 1s ep"
when
$list: List() from collect(MyEvent() over window:time(1s) from
entry-point "stream")
then
System.out.println("Rule: with in 1s use ep --> " + $list);
end
rule "over 3s ep"
when
$list: List() from collect(MyEvent() over window:time(3s) from
entry-point "stream")
then
System.out.println("Rule: with in 3s use ep --> " + $list);
end
// ------- end of rule
Finally, the output(just run 5 seconds)
-------------- fire at 1000 ---------------
Rule: with in 3s use ep --> [MyEvent(event 0,500)]
Rule: with in 1s use ep --> [MyEvent(event 0,500)]
Rule: with in 0.3s use ep --> [MyEvent(event 0,500)]
Rule: with in 3s --> [MyEvent(event 0,500)]
Rule: with in 1s --> [MyEvent(event 0,500)]
Rule: with in 0.3s --> []
-------------- fire at 2000 ---------------
Rule: with in 3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
Rule: with in 1s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
Rule: with in 0.3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
Rule: with in 3s --> [MyEvent(event 0,500), MyEvent(event 1,1500)]
Rule: with in 1s --> [MyEvent(event 1,1500)]
Rule: with in 0.3s --> []
-------------- fire at 3000 ---------------
Rule: with in 3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500),
MyEvent(event 2,2500)]
Rule: with in 1s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500),
MyEvent(event 2,2500)]
Rule: with in 0.3s use ep --> [MyEvent(event 0,500), MyEvent(event 1,1500),
MyEvent(event 2,2500)]
Rule: with in 3s --> [MyEvent(event 0,500), MyEvent(event 1,1500),
MyEvent(event 2,2500)]
Rule: with in 1s --> [MyEvent(event 2,2500)]
Rule: with in 0.3s --> []
-------------- fire at 4000 ---------------
Rule: with in 3s use ep --> [MyEvent(event 1,1500), MyEvent(event 2,2500),
MyEvent(event 3,3500)]
Rule: with in 1s use ep --> [MyEvent(event 1,1500), MyEvent(event 2,2500),
MyEvent(event 3,3500)]
Rule: with in 0.3s use ep --> [MyEvent(event 1,1500), MyEvent(event
2,2500), MyEvent(event 3,3500)]
Rule: with in 3s --> [MyEvent(event 1,1500), MyEvent(event 2,2500),
MyEvent(event 3,3500)]
Rule: with in 1s --> [MyEvent(event 3,3500)]
Rule: with in 0.3s --> []
-------------- fire at 5000 ---------------
Rule: with in 3s use ep --> [MyEvent(event 2,2500), MyEvent(event 3,3500),
MyEvent(event 4,4500)]
Rule: with in 1s use ep --> [MyEvent(event 2,2500), MyEvent(event 3,3500),
MyEvent(event 4,4500)]
Rule: with in 0.3s use ep --> [MyEvent(event 2,2500), MyEvent(event
3,3500), MyEvent(event 4,4500)]
Rule: with in 3s --> [MyEvent(event 2,2500), MyEvent(event 3,3500),
MyEvent(event 4,4500)]
Rule: with in 1s --> [MyEvent(event 4,4500)]
Rule: with in 0.3s --> []
--
Best regards,
Changyuan
12 years, 7 months
Traverse object chain from Guvnor
by rockford
I am working on a risk scanning application and evaluation Drools / Guvnor
for the application.
The rules will be written to check messages with structure like:
<message>
<attribute>value</attribute>
<attribute>value</attribute>
<levelTwo>
<attribute>value</attribute>
<attribute>value</attribute>
<levelTwo>
<attribute>value</attribute>
<attribute>value</attribute>
<levelThree>
<attribute>value</attribute>
<attribute>value</attribute>
The desired value to check would be something like:
message.levelTwo.levelThree.attribute - where levelTwo and levelThree are
objects from a list.
I know that this is possible using drl/mvel/java, but I am wondering if this
will work with Guvnor UI? We have several users writing tens of rules and
the users don't necessarily have the technical ability to write drl style
rules.
Does anyone know of a way to do this with the Guvnor UI?
Ken
--
View this message in context: http://drools.46999.n3.nabble.com/Traverse-object-chain-from-Guvnor-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months