matches / not maches
by Peter Troelsen
Hey..
I have encountered a problem using the 'maches' operator in drool.. I wanna
write something like this (just made a simple example)
rule "Hello World"
when
m: Message("5" matches "5")
then
System.out.println("Test");
end
But eclipse tells me " '"5" ~= "5"' must be an boolean expression ", and i
get an runtime error if i try to run it.. However if I use 'not matches' it
works! Forcing me to do something like this:
when
not m: Message("5" not matches "5")
then
Any ideas how to fix this?
- Thanks!
--
Peter
12 years, 3 months
Jetty NoSuchMethodError Lorg/eclipse/jdt/core/compiler/CategorizedProblem
by captainrhino
I am running some drools application code through Jetty and I get the
following error. I'm guessing its something to do with a conflicting jar or
dependency? Any help would be much appreciated. It does not happen when I
run it through tomcat 7.
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
at
org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:375)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335)
at
org.drools.compiler.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:405)
at
org.drools.compiler.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
at
org.drools.compiler.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:405)
at
org.drools.compiler.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:46)
at
org.drools.compiler.compiler.PackageRegistry.compileAll(PackageRegistry.java:107)
at
org.drools.compiler.compiler.PackageBuilder.compileAll(PackageBuilder.java:1218)
at
org.drools.compiler.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:955)
at
org.drools.compiler.compiler.PackageBuilder.addPackage(PackageBuilder.java:943)
at
org.drools.compiler.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:507)
at
org.drools.compiler.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:714)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
--
View this message in context: http://drools.46999.n3.nabble.com/Jetty-NoSuchMethodError-Lorg-eclipse-jd...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
CurriculumCourse - extending for multiple teachers per course
by clients
Hi,
I have been playing around with the optaplanner library for the past couple
of weeks trying to learn a bit of the basics. I have been making some
progress but I have a simple variation I am trying to accomplish to the
stock CurriculumCourse example and am hitting a wall.
What I am trying to do is modify the CurriculumCourse example to also allow
the teachers to be planning variables. I plan on extending it to give
constraints on which courses individual teachers can teach, but to start I
am just assuming each teacher can teach any class to make things easier.
- First I tried to add the Course entity as a second planning entity with
the teacher being a PlanningVariable but keep on running into an exception
based on the solver configuration
java.lang.IllegalArgumentException: The entityPlacerConfig
(QueuedEntityPlacerConfig(null, null)) has no entitySelector configured and
because there are multiple in the planningEntityClassSet ([class
org.optaplanner.examples.curriculumcourse.domain.Lecture, class
org.optaplanner.examples.curriculumcourse.domain.Course]), it can not be
deducted automatically. at
org.optaplanner.core.config.constructionheuristic.placer.EntityPlacerConfig.deduceEntityDescriptor(EntityPlacerConfig.java:43)
I can't seem to figure out where the entitySelector is missing or what the
entityPlacer is used for or where it is configured. I have read that
multiple planning entities are possible, but can't determine how to get this
*simple* example to work.
- Second I tried to see if i could move the teacher planning variable to the
Lecture planningEntity, but cant figure out a way to keep all of the
lectures of one course stuck with the same teacher. I dont believe I can
change other planning entities on my own when one is updated.
I am still new to looking at these problems and determining the best model
to fit it, so hoping someone might have some tips/help on how to handle this
scenario.
Thanks in advanced,
--
View this message in context: http://drools.46999.n3.nabble.com/CurriculumCourse-extending-for-multiple...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Multiple rule violation
by Chaturvedi Dewashish
Hi,
I have a problem scenario.
I insert two facts
- obj1 (on which rules needs to be validated, used in when part),
- obj2 (to retrieve output, used in then part)
Let's say there are two rules Rule1 and Rule2 for this fact type and both of
them get violated. In this case I am getting only one instance of updated
obj2.
I need two instances of obj2 as both rules are violated. So, that I can
perform operation on based on those.
I have also seen on internet that DROOLS skips checking for other rules if
any one gets violated. So, requirement is as
1. DROOLS should check for all rules (What is performance cost for this.
Does fire all rules work this way?)
2. All instances of obj2 to perform actions accordingly (What is best way to
do this. Should I insert an array of this type? If so please, say how to
achieve this?)
Thanks and regards,
Chaturvedi Dewashish
Nirvana Solutions
Cell: +91-8373915350
12 years, 3 months
Optaplanner rule to assign employee only to shift when he/she has the skills
by ns
I am trying to create a rule that adds a hard constraint when an employee
gets assigned to a shift for which he does not have the skills.
I have created a table in MySQL that assigns an employee to a certain
shiftType. In my code I stated that once an employee is assigned to a
shiftType, he or she automatically has the skills needed for that shiftType,
hence the skill == $shiftType part in the rule.
rule "alternativeSkill"
when
$assignment : ShiftAssignment($employee : employee, $shiftType :
shiftType)
not SkillProficiency(employee == $employee, skill == $shiftType)
then
scoreHolder.addHardConstraintMatch(kcontext, -1);
end
With the above rule employees still get assigned to shifts they do not have
the skill for. What is wrong with this rule? Thanks.
Kind regards,
Nick
--
View this message in context: http://drools.46999.n3.nabble.com/Optaplanner-rule-to-assign-employee-onl...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
no-loop and 6.0 : DROOLS-353
by Mark Proctor
We’ve just found (and fixed) a no-loop bug.
https://issues.jboss.org/browse/DROOLS-353
In general we recommend @PropertyReactive over no-loop (and lock-on-active), for best practice.
If you hit this bug, which is caused by a modify, and you cannot migrate your stuff to @PropertyReactive you can fall back to using ReteOO mode for your execution. Or use our latest SNAPSHOT builds from master.
As mentioned this is fixed and will be in the next binary release - but that will not likely happen until january(guesstimate) now, as our time is focused on preparing the BRMS 6.0 product release.
Mark
12 years, 3 months
drools 5.5 property reactive issue
by gboro54
I am seeing a weird pattern(or at least unexpected one) when running drools
5.5 in property reactive mode. I have to rules such as:
rule "Rule 1"
when
$order:Order(orderType=="A", orderVolume>1000)
then
insert(new Charge($order,"code1",-.25));
end
rule "Rule 2"
when
$order:Order(orderType=="A")
then
insert(new Charge($order,"code2",-.24));
end
rule "Set best price"
when
$order:Order($id:id, $setCharge:charge)
$charge:Charge(orderId=$id,$setCharge==null ||
chargeAmount<$setCharge.chargeAmount)
then
modify($order){setCharge($charge)};
end
If I insert and Order of 1001 I see all 3 activations get created, Rule 2
fires first thus triggering set price rule and the activation of Rule 1 is
cancelled. If I add a @watch(charge) to the end of the rules or set up
salience Rule 1 fires.
Could someone help me understand why the firing of Rule 2 and thus the set
best price rule cause rule 1 to get cancelled without the @watch?
--
View this message in context: http://drools.46999.n3.nabble.com/drools-5-5-property-reactive-issue-tp40...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools templates header arguments
by petert
I am working on a project, using templates to generate all my rules. I have
one problem though, I wanna parse my arguments to the template as a
ArrayList, and do somthing like this:
template header
ruleId
args
package dk.prks
import com.poc.entity.Bill;
import com.poc.entity.BillLine;
import com.poc.entity.Description;
import java.util.ArrayList;
template "01"
rule "@{ruleId}_(a){row.rowNumber}"
dialect "mvel"
when
$bill : Bill ($line : lines) and
BillLine( service == @{args.get(0)}, $lineNr : lineNr) from $line and
BillLine( service == @{args.get(1)}, lineNr < $lineNr) from $line
then
$bill.setColor(1);
end
end template
However, this is not possible. Furthermore I want to stretch that
performance is an issue, and i want the generated file to only contain the
values from the list, and not make any look ups in the array when running my
rules
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-templates-header-arguments-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools 6 getting started
by captainrhino
Basically I have a web app in which I would like to run some drools rules
from the new KIW-WB objects. e.g. KieContainer objects
Does anyone have a link to an idiots guide to getting started to Drools 6?
I'm looking to build a drools 6 maven project from one of the standard
example KIE-WB projects. What do i need MAven , GIthub etc and how do I
build it?
I then need to be able to use this project within a non-maven project, i.e.
build a jar from within the maven project that can then be used by my
non-maven java project. With the old deprecated KnowledgeBase classes I
used to be able to do this really easily.
Any suggestions would be most welcome and appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-getting-started-tp4026911.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months