Drools facts using POJO accessor methods error
by aliosha79
Hi,
i have some troubles to undestand how drools processes FACTS. I have a POJO
class resulted from an UnMarshal jaxb processing like this:
public MyClass {
protected String className = "Class1";
public getClassName(){
return className;
}
public setClassName(String className){
this.className = className
}
}
Now i have to compose a drl file with a rule like this:
when
$Class : MyClass()
eval ($Class.getClassName() == "Class1")
then
System.out.println("ok!!!");
end
This syntax doesn't rise errors BUT doesn't match the real name... no ok
message are printed.
when
$Class : MyClass (getClassName() == "Class1")
then
System.out.println("ok!!!");
end
This syntax raises me a null pointer exception!!!
What's the right syntax?
Can i use the accessor methods building drools facts?
Thanks a lot!
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-facts-using-POJO-accessor-method...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
jboss tohu
by Olfa h
hi,
can someone help me to deploy jboss tohi 1.2.0 into jboss 4.3.2 and eclipse
indigo ?????????????????
thx
12 years, 10 months
A problem in sliding windows.
by Hassan
when I was testing the sliding windows, I was blocked becouse this concept
doesn't work for me, It's becouse of my misunderstanding of the concept, I
looking for the error which I do:
for exemple:
==> the rule:
*/
rule "sliding windows"
when
$a : Event1() over window:time(2s)
then
System.out.println("ok");
end /*
==> Events
Event1 ev1=new Event1((long)1000,(long)2000); // the event will occur in 1s
and finish in 3s
Event1 ev2=new Event1((long)3000,(long)4000); // the event will occur in 3s
and finish in 4s
session.insert(ev1);
session.insert(ev2);
clock.advanceTime(4, TimeUnit.SECONDS); // we are now in 4s so only event
that happen in [2s,4s] have
session.fireAllRules(); // to fire -ev2-.
// But the probleme that, it gives me 2 ok so the 2 object are fired !! I
don't inderstand why ??
--
View this message in context: http://drools.46999.n3.nabble.com/A-problem-in-sliding-windows-tp3781402p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
CLOUD mode Vs Stream Mode.
by Hassan
Hello,
It's clair that to work with thae events we have to put our base
configuration into STREAM mode like this:
*/KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );/*
But in my code bellow I didn't use this mode and I didn't use Entry-points,
Although my events work very well !!
Help please !!
--
View this message in context: http://drools.46999.n3.nabble.com/CLOUD-mode-Vs-Stream-Mode-tp3780295p378...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
POJO accessors method in Drools facts
by aliosha79
Hi,
i have some troubles to undestand how drools processes FACTS. I have a POJO
class resulted from an UnMarshal jaxb processing like this:
public MyClass {
protected String className = "Class1";
public getClassName(){
return className;
}
public setClassName(String className){
this.className = className
}
}
Now i have to compose a drl file with a rule like this:
when
$Class : MyClass()
eval ($Class.getClassName() == "Class1")
then
System.out.println("ok!!!");
end
This syntax doesn't rise errors BUT doesn't match the real name... no ok
message are printed.
when
$Class : MyClass (getClassName() == "Class1")
then
System.out.println("ok!!!");
end
This syntax raises me a null pointer exception!!!
What's the right syntax?
Can i use the accessor methods building drools facts?
Thanks a lot!
--
View this message in context: http://drools.46999.n3.nabble.com/POJO-accessors-method-in-Drools-facts-t...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
CLOUD mode Vs Stream Mode.
by Hassan
Hello,
It's clair that to work with thae events we have to put our base
configuration into STREAM mode like this:
*/KnowledgeBaseConfiguration config =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
config.setOption( EventProcessingOption.STREAM );/*
But in an exemple, I didn't use this mode and I didn't use Entry-points,
Although my events work very well !!
Help please !!
--
View this message in context: http://drools.46999.n3.nabble.com/CLOUD-mode-Vs-Stream-Mode-tp3780297p378...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Drools (Planner) getting confused between list and map access
by aitchnyu
I am trying to find the total of an attribute of`SubjectTeacherPeriod`. The
`numAttributeMap`property (a map with `String` keys and `int` values) stores
the value. But trying to access it is problematic as Drools thinks that
`$num_value[$attribute]` is a list operation, not a map operation.
I listed my rule and runtime errors:
rule "insertAttributeDayTotal"
//salience 1 // Do these rules first (optional, for performance)
when
$sum_regression_constraint : SumRegressionConstraint(
$class : class_,
$attribute : attribute//,
//$weight : weight;
)
$day_of_week : DayOfWeek()
$attribute_day_total : Number() from accumulate(
SubjectTeacherPeriod(
//period != null,
period.class_ == $class,
period.dayOfWeek == $day_of_week,
$num_value : numAttributeMap
//$total : num_attribute_map.get($attribute)
),
sum($num_value[$attribute]) //PROBLEM LINE??
)
then
//System.out.println("BUCKET TOTAL "+$id+" "+$bucket_total.intValue());
insertLogical(new AttributeDaySum($class, $attribute, $day_of_week,
$attribute_day_total.intValue()));
end
*Errors:*
jesvin@Jesvin-Technovia:~/dev/drools/timetabler$ java -server
in.co.technovia.timetabler.TimeTableApp
Exception in thread "main" java.lang.IllegalStateException: There are errors
in the scoreDrl's:
Rule Compilation error : [Rule name='insertAttributeDayTotal']
in/co/technovia/timetabler/domain/Rule_insertAttributeDayTotal_fd3f7d4f98084049887c1596f5a56805.java
(9:1093) : The type of the expression must be an array type but it resolved
to Map
in/co/technovia/timetabler/domain/Rule_insertAttributeDayTotal_fd3f7d4f98084049887c1596f5a56805.java
(9:1104) : Type mismatch: cannot convert from String to int
at
org.drools.planner.config.solver.SolverConfig.buildRuleBase(SolverConfig.java:238)
at
org.drools.planner.config.solver.SolverConfig.buildSolver(SolverConfig.java:170)
at
org.drools.planner.config.XmlSolverConfigurer.buildSolver(XmlSolverConfigurer.java:103)
at
in.co.technovia.timetabler.TimeTableApp.createSolver(TimeTableApp.java:55)
at in.co.technovia.timetabler.TimeTableApp.main(TimeTableApp.java:39)
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Planner-getting-confused-between...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months