.BRL in Eclipse
by rjr201
Hi,
I'm creating rules within the Guided Editor in Guvnor as this is how my
client wants to view and edit them.
Looking at the documentation here
<http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/pdf/d...>
it seems to say that I can create and edit .brl files in Eclipse?
I can't seem to work out how to do this. I have what I think is the latest
version of JBoss tools. Does anyone know if this feature has been removed?
It would be very useful to be able to develop the rules in Eclipse rather
than having to create them in Guvnor.
Also, another quick question.. is it possible to convert from .dsl files to
.brl files?
Thanks for any advice that anyone can give.
--
View this message in context: http://drools.46999.n3.nabble.com/BRL-in-Eclipse-tp4021844.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Re: [rules-users] Why all rule condition fired when insert object in drools session?
by FrankVhh
Hi Zhao,
You could insert a helper fact and use it as a first pattern in your
conditions. That way, the engine will not evaluate too many patterns from
rules that are not to be executed.
When
ActiveGroup(name == "GroupA")
...
Then
...
Implications
* You will have to take care of the status of ActiveGroup and update its
value yourself. Make sure you do it at the appropriate moment. (Low salience
rule?)
* You would have to re-evaluate the need for the agenda-group. Its
functinos are taken over by the fact, do you still need the group?
* Whether it will improve performance or not is a whole different question
all together and is depending on your ruleset. I never did severe testing on
it, but imho, there are certainly cases where the agenda-group is faster
than the fact. As a rule of thumb, I would say that if you do a lot of
update/modify calls in your consequences, you might get an improvement by
blocking the evaluation of patterns early.
Regards,
Frank
PS You could also create a different fact per agenda-group. It should be
mildly faster while providing quite a lot less flexibility.
--
View this message in context: http://drools.46999.n3.nabble.com/Why-all-rule-condition-fired-when-inser...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Re: [rules-users] Question about Drools Spring, StatelessKnowledgeSession and globals
by Patrick van Kann
Hello fellow Droolers,
A while ago I asked why the <drools:batch> element seemed to work
differently in the case of a StatelessKnowledgeSession and a
StatefulKnowedgeSession (see below).
I just wanted to update those interested with the answer and ask some
further questions, probably aimed at any developers who happen to be
reading.
I checked out the 5.1.1.34858 tag and had a look at how the Spring
integration works. I found that the reason that the global is not set in the
case of a StatelessKnowledgeSession is because the <spring:batch> element is
effectively ignored in the StatelessKnowledgeSessionBeanFactory, which lacks
the following code present in the StatefulKnowledgeSessionBeanFactory (in
the internalAfterPropertiesSet() method):
if ( getBatch() != null && !getBatch().isEmpty()) {
for ( Command<?> cmd : getBatch() ) {
ksession.execute( cmd );
}
}
So, either by accident or design the <spring:batch> element has no effect
when using a StatelessKnowledgeSession (but is perfectly allowable in the
XSD/Spring namespace).
So my questions are:
1) Is this the intended behaviour or a bug? On reflection, I am now not sure
the idea of a "batch/script" makes sense for a StatelessKnowledgeSession
since execute() is a one-shot method and any globals set this way would not
be available to later executions, which is what I was looking for.
2) If so, should the XSD be changed to disallow the batch element within a
stateless session (difficult, given that this is determined via the "type"
attribute) or should the documentation simply warn people that the
<spring:batch> element doesn't do anything if you set the type attribute to
stateless (somewhat confusing, I suppose)
3) If not, should the code above be added to the
StatelessKnowledgeSessionBeanFactory.internalAfterPropertiesSet() method?
4) Should there be another way to declare a global that isn't through the
batch element (one that would cause globals to be set via the
setGlobal(String, Object) method rather than using the SetGlobalCommand via
the execute() method.
I am happy to try and contribute something along these lines if I can get
some guidance as to what was actually intended.
Hope this helps and thanks again for Drools.
Patrick
=====================================
Hello,
I've been trying out the Spring integration package in Drools 5.1.1 and it
works really well, but I have run into one issue I can't figure out.
I've defined 2 knowledge sessions from the same knowledge base in the app
context - one stateless, one stateful but otherwise identical. They both
refer to a collaborator defined as a bean in the app context which is to be
used as a global in my rules. This is just an excerpt of my full Spring
context, the kbase definition itself is not an issue.
<bean id="applicantDao" class="com.acme.app.dao.impl.ApplicantDaoImpl" />
<drools:ksession id="statelessKSession" type="stateless"
name="statelessKSession" kbase="kbase">
<drools:batch>
<drools:set-global identifier="applicantDao" ref="applicantDao" />
</drools:batch>
</drools:ksession>
<drools:ksession id="statefulKSession" type="stateful"
name="statefulKSession" kbase="kbase">
<drools:batch>
<drools:set-global identifier="applicantDao" ref="applicantDao" />
</drools:batch>
</drools:ksession>
The issue is that this configuration works for the stateful but not the
stateless session, in the sense that the stateful session appears to have a
valid reference to the applicantDao object in the Globals object but the
stateless session doesn't.
<at> Test
public void testStatelessGlobal() {
Globals globals = statelessKSession.getGlobals();
Object global = globals.get("applicantDao");
Assert.assertNotNull(global);
}
<at> Test
public void testStatefulGlobal() {
Globals globals = statefulKSession.getGlobals();
Object global = globals.get("applicantDao");
Assert.assertNotNull(global);
}
The first test fails (the global variable is null) but the second passes. No
errors are thrown by Drools during the setup of the Spring container.
What am I doing wrong? Should I be able to define globals in this way for
stateless sessions? The XSD seems to indicate this is a valid configuration,
but it just doesn't work.
Is anyone else working with the Spring integration that can point out my
error here?
Many thanks,
Patrick
13 years, 5 months
Drools Guvnor Repository Reports
by Aseem Belsare
Hi,
I wish to obtain the version history from Guvnor repository. Stumbled upon
http://drools.46999.n3.nabble.com/Guvnor-Repository-Report-td3376667.html...
seems to be related to the same topic, but the link in there is not
working which points to the documentation for using REST API to get the
assets/package version history info.
Is there a way of doing it? I started working on Guvnor just recently and
I've setup a simple rule and making changes to it to be saved in the Guvnor
repo. I wish to pull the version history and generate a report using JAVA
based off of it.
Any help would be appreciated.
Thanks,
Aseem
13 years, 5 months
Planner: The entity ... was never added to this ScoreDirector
by Michiel Vermandel
Hi,
Since I am using my custom move implementation I get:
Exception in thread "main" java.lang.IllegalArgumentException: The entity ({T= Inspect B747-AX1.I#0 [2->2] Andy TL}) was never added to this ScoreDirector.
at org.drools.planner.core.score.director.drools.DroolsScoreDirector.afterVariableChanged(DroolsScoreDirector.java:125)
at my.planner.solver.ProjectMove.moveTask(ProjectMove.java:182)
at my.planner.solver.ProjectMove.doMove(ProjectMove.java:125)
at org.drools.planner.core.localsearch.decider.DefaultDecider.doMove(DefaultDecider.java:143)
at org.drools.planner.core.localsearch.decider.DefaultDecider.decideNextStep(DefaultDecider.java:116)
at org.drools.planner.core.localsearch.DefaultLocalSearchSolverPhase.solve(DefaultLocalSearchSolverPhase.java:62)
at org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
at org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)
at my.planner.app.InspectionSchedule.solve(InspectionSchedule.java:188)
at my.planner.app.InspectionPlanning.main(InspectionPlanning.java:27)
It happens during LocalSearch Phase in my custom move implementation.
I caught this exception and printed the hashcode of the entity.
I also printed the hashcodes of all entities in my cloneSolution method and they match.
Furthermore when catching the exception I loop through the
((InspectionSchedule)scoreDirector.getWorkingSolution()).getTasks() array and again I find the task with that hashcode.
It is ((InspectionSchedule)scoreDirector.getWorkingSolution()).getTasks() that holds the tasks and that is populated when cloning the solution.
It does not happen in every test... only in some, but then it's consistently.
Are there any other things I can check to see where I'm going bad?
Thanks
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 5 months
Planner: duplicate moves within a single step?
by Michiel Vermandel
Hi,
I noticed something really strange in my trace logging: certain moves are made multiple times, even consecutive.
How is this possible?
I am using Planner 5.5.0.Final and no custom move factories (see config below).
TRACE: [2013-01-25 14:12:28,309] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (12), score (-515hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P4) ).
TRACE: [2013-01-25 14:12:28,309] main org.drools.planner.core.localsearch.decider.DefaultDecider - Ignoring not doable move ({T= Inspect A380-TR1.I#0 [5->6] Kristof IV} => IV).
TRACE: [2013-01-25 14:12:28,310] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (14), score (-2090hard/0soft), accepted (true) for move ({T= Inspect A380-TR1.I#1 [5->6] Gerald IV} => (P9) ).
TRACE: [2013-01-25 14:12:28,310] main org.drools.planner.core.localsearch.decider.DefaultDecider - Ignoring not doable move ({T= Inspect A320-CZ4.I#0 [7->9] Kristof IV} => IV).
TRACE: [2013-01-25 14:12:28,310] main org.drools.planner.core.localsearch.decider.DefaultDecider - Ignoring not doable move ({T= Inspect A380-TR1.I#1 [5->6] Gerald IV} => IV).
TRACE: [2013-01-25 14:12:28,311] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (17), score (-230hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => Andy).
TRACE: [2013-01-25 14:12:28,312] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (18), score (-120hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#0 [5->5] Andy IV} => (P7) ).
TRACE: [2013-01-25 14:12:28,313] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (19), score (-120hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#0 [5->5] Andy IV} => (P7) ).
TRACE: [2013-01-25 14:12:28,313] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (20), score (-30hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => TL).
TRACE: [2013-01-25 14:12:28,315] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (21), score (-2180hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#0 [5->5] Andy IV} => (P1) ).
TRACE: [2013-01-25 14:12:28,316] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (22), score (-515hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P4) ).
TRACE: [2013-01-25 14:12:28,317] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (23), score (-515hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P4) ).
TRACE: [2013-01-25 14:12:28,318] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (24), score (-3180hard/0soft), accepted (true) for move ({T= Inspect A320-CZ4.I#1 [7->8] Andy IV} => (P1) ).
TRACE: [2013-01-25 14:12:28,318] main org.drools.planner.core.localsearch.decider.DefaultDecider - Ignoring not doable move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => IV).
TRACE: [2013-01-25 14:12:28,320] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (26), score (-120hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P5) ).
TRACE: [2013-01-25 14:12:28,322] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (27), score (-45hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P8) ).
TRACE: [2013-01-25 14:12:28,323] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (28), score (-30hard/0soft), accepted (true) for move ({T= Inspect A380-TR1.I#0 [5->6] Kristof IV} => TL).
TRACE: [2013-01-25 14:12:28,324] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (29), score (-2635hard/0soft), accepted (true) for move ({T= Inspect A320-CZ4.I#1 [7->8] Andy IV} => (P2) ).
TRACE: [2013-01-25 14:12:28,325] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (30), score (-650hard/0soft), accepted (true) for move ({T= Inspect A320-CZ4.I#0 [7->9] Kristof IV} => (P6) ).
TRACE: [2013-01-25 14:12:28,334] main org.drools.planner.core.localsearch.decider.DefaultDecider - Ignoring not doable move ({T= Inspect A380-TR1.I#2 [5->6] Jesse IV} => Jesse).
TRACE: [2013-01-25 14:12:28,335] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (32), score (-230hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#0 [5->5] Andy IV} => Gerald).
TRACE: [2013-01-25 14:12:28,336] main org.drools.planner.core.localsearch.decider.DefaultDecider - Move index (33), score (-515hard/0soft), accepted (true) for move ({T= Inspect B747-AX1.I#1 [7->7] Jesse IV} => (P4) ).
Config:
<?xml version="1.0" encoding="UTF-8"?>
<solver>
<environmentMode>DEBUG</environmentMode>
<!-- Domain model configuration -->
<solutionClass>be.axi.planner.app.InspectionSchedule</solutionClass>
<planningEntityClass>be.axi.planner.domain.Task</planningEntityClass>
<!-- Score configuration -->
<scoreDirectorFactory>
<scoreDefinitionType>HARD_AND_SOFT</scoreDefinitionType>
<scoreDrl>/inspectionRules.drl</scoreDrl>
</scoreDirectorFactory>
<constructionHeuristic>
<constructionHeuristicType>BEST_FIT_DECREASING</constructionHeuristicType>
<constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType>
</constructionHeuristic>
<!--customSolverPhase>
<customSolverPhaseCommandClass>be.axi.planner.solution.SolutionInitializer</customSolverPhaseCommandClass>
</customSolverPhase-->
<localSearch>
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumSecondsSpend>3600</maximumSecondsSpend>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
<unionMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>type</planningVariableName>
</valueSelector>
</changeMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>spector</planningVariableName>
</valueSelector>
</changeMoveSelector>
<changeMoveSelector>
<valueSelector>
<planningVariableName>period</planningVariableName>
</valueSelector>
</changeMoveSelector>
</unionMoveSelector>
<acceptor>
<planningEntityTabuSize>7</planningEntityTabuSize>
</acceptor>
<forager>
<minimalAcceptedSelection>1000</minimalAcceptedSelection>
</forager>
</localSearch>
</solver>
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
13 years, 5 months
business guided rule editor
by neha.gupta19@wipro.com
Hi,
Business guided rule editor is not working in drools.i am not able to open the rule defined in business guided rule editor
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
13 years, 5 months
DSRL rule access in web editor
by riri
Hello everyone,
I need to provide a way to allow non technical users to modify and possibly
create rules by using a web based editor. I thought about using Guvnor
because it already has validation functionality for the dsrl rule files and
I wouldn't have to implement that from scratch. The problem is that the
interface seems very complex and I have to provide something very simple, in
the style of "drag and drop".
Would there be a way to achieve this without having to dig through the whole
Guvnor source code? Is there a way to recover rule objects from rule
packages and modify the conditions parameters? The idea is not to modify the
.dsrl file directly but having a tool to display the information in a way
that the user can interact with the rule in a safe way.
Thank you very much for any help you can give me.
--
View this message in context: http://drools.46999.n3.nabble.com/DSRL-rule-access-in-web-editor-tp402179...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months