DSL Translation
by prashantmirajkar@gmail.com
In my project coding standard is as follows
class members names as nameWithEachWordWithFirstLetterUpperCase
and related getters and setters have
getNameWithEachWordWithFirstLetterUpperCase and
setNameWithEachWordWithFirstLetterUpperCase respectively.
While using the DSL unlike ucfirst which converts first letter to upper case
and rest to lower case, I want to have only first letter converted to upper
case leaving other letters as they are.
How can it be achieved? I am using drools 5.3.3
thanks in advance,
Prashant
--
View this message in context: http://drools.46999.n3.nabble.com/DSL-Translation-tp4021842.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Dedication to Wolfgang Laun - Thank You
by Reinis
I want to thank you all.
You, the members of drools community, for making this platform alive by
giving away your knowledge and contributing the development of drools by
sharing your thought and inducing the discussion.
You, the developers of drools, for having ability to make it work and
for actually making it work!
And this time I want to say a special thanks to you, Wolfgang Laun, for
being selfless, humble and having the gift of explaining things not
because you're a doctor (of math btw) but because you have it down pat.
And I thank you for sacrificing a lot of your private time to help me to
solve my drools problem.
So cheers to you, Wolfgang - a scientist, a mentor, a friend.
Reinis
13 years, 1 month
Duration rule attribute
by starfish15
Hello,
A project is trying to weigh between BLAZE & DROOLS. N am a Drools FAN
personally, since w/o doubt OPEN SOURCE always ROCKS. ;-)
It was mentioned that in BLAZE there is a manner in which they decide on the
rules validity period. Though even i mentioned that the same definitely
exists in Drools as well. Since i had read a bit about.
However, i did get confused with a part of the thing.
1. It was asked that in Drools will the rules be able to be valid for up til
a year. Cause it seems in Blaze it is possible to change the validity till a
year as well.
2. If yes, then i would appreciate if an example is given for the same
Kindly help with this.
Regards,
starfish
--
View this message in context: http://drools.46999.n3.nabble.com/Duration-rule-attribute-tp4021843.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Error selecting order decrease
by André Fróes
Hello there, i'm getting this error:
-------------------
11:26:50.394 [main] INFO o.d.p.core.solver.DefaultSolver - Solving
started: time spend (187), score (null), new best score (null), random seed
(0).
Exception in thread "main" java.lang.IllegalStateException: The
selectionOrder (DECREASING_DIFFICULTY) can not be used on a PlanningEntity
(com.swa.planner.domain.CloudProcess) that has no support for difficulty
sorting. Check the @PlanningEntity annotation.
at
org.drools.planner.core.heuristic.selector.entity.PlanningEntitySelector.validate(PlanningEntitySelector.java:53)
at
org.drools.planner.core.heuristic.selector.entity.PlanningEntitySelector.phaseStarted(PlanningEntitySelector.java:45)
at
org.drools.planner.core.constructionheuristic.greedyFit.selector.GreedyPlanningEntitySelector.phaseStarted(GreedyPlanningEntitySelector.java:41)
at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.phaseStarted(DefaultGreedyFitSolverPhase.java:111)
at
org.drools.planner.core.constructionheuristic.greedyFit.DefaultGreedyFitSolverPhase.solve(DefaultGreedyFitSolverPhase.java:57)
at
org.drools.planner.core.solver.DefaultSolver.runSolverPhases(DefaultSolver.java:190)
at
org.drools.planner.core.solver.DefaultSolver.solve(DefaultSolver.java:155)
at com.swa.planner.domain.CloudTest.main(CloudTest.java:51)
-------------------------
I know why it is happening though (at least i think so), but will I have to
implement the comparator to every planner I do or is there any other way to
make it work?
I'm reproducing the example from the guide, when it passes the drools rules
it gives that message. I didn't implement CloudComputerStrengthComparator
neither CloudProcessDifficultyComparator, will I have to implement those so
this example works?
13 years, 1 month
applyChangeSet slow
by rjr201
Hi,
I've created a rule package in Guvnor which I have been accessing using a
changeset.xml file. When calling applyChangeSet() on the KnowledgeAgent, it
is taking roughly 5 seconds to complete. Is this normal?
I don't have a large amount of rules. I have tried downloading the package
file and having the changeset.xml read it locally, but it is still taking a
long time to apply. Does anyone know of a way to speed this up?
I'm very grateful for any help/advice anyone can give me on this.
Cheers,
Rich.
--
View this message in context: http://drools.46999.n3.nabble.com/applyChangeSet-slow-tp4021861.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Stateful Session giving major issues
by starfish15
Hello,
I am using Drools 5.2. I am not sure why not able to find the result here.
I am supposed to get the value from the Action in this rule as shown below.
But its never found. Kindly assist me with what is it that i have'nt
included.
First the rules
//generated from Decision Table
import boa.poc.java.SSI;
import boa.poc.java.CMPG_REF;
import boa.poc.java.Result_Rules;
// rule values at C12, header at C7
rule "Access sql table_12"
when
ssi : SSI(CD == "ES", EOC_IN == "Y", IN == "N")
cmpgRef : CMPG_REF(CMPG == 123, 01_NO == "12")
result : Result_Rules(dummyCond == "result")
then
result.setDummyAction("Access I");
end
Second the code
@SuppressWarnings("rawtypes")
public HashMap<String, List> retrievRuleResult(HashMap hm) {
try {
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
SSI ssi = (SSI)hm.get("pa_cycle_ssi");
CMPG_REF cmpRef = (CMPG_REF)hm.get("pa_cmpg_ref");
Result_Rules rulesResult = (Result_Rules)hm.get("dummyCond");
StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
ksession.insert(ssi);
ksession.insert(cmpRef);
ksession.insert(rulesResult);
ksession.fireAllRules();
ksession.dispose();
System.out.println("Result 1 : "+rulesResult.getDummyAction());
return ;
}
public KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("poc/rules/rules.pkg"),
ResourceType.PKG);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
return kbase;
}
--
View this message in context: http://drools.46999.n3.nabble.com/Stateful-Session-giving-major-issues-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Drools with DB based rule
by starfish15
Hello,
I need to write a rule in a spreadsheet DT according to the below condition
*Fact1.key1 == Fact3.key2*
where the Facts have been designed on the basis of DB Tables and respective
columns. It is mentioned that these tables would be joined on the basis of
these columns i.e. key1and key2.
and further the Action should be the value of these keys. If the condition
satisfies, the action wud be *key1.getId();*
Let me mention that my DB funda are a little STALE, hence probably am not
able to write this rule.
It doesn't seem to be complex, but m absolutely not sure how should i b
writing the same.
Kindly assist ASAP.
Regards,
starfish
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-with-DB-based-rule-tp4021857.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
Drools locking threads
by nalvesp
I need some support with Drools. I'm using Drools 5.2 in a multi-threaded
environment. Basicaly, every login into a website is calling an execute
method in a StatelessKnowledgeSession. After some time, threads start to
lock as below:
"[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default
(self-tuning)'" id=18 idx=0xc0 tid=7267 prio=5 alive, in native, blocked,
daemon
-- Blocked trying to get lock:
org/drools/event/RuleBaseEventSupport@0x2aab52d6f518[fat lock]
at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)
at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1679)[optimized]
at jrockit/vm/Locks.lockFat(Locks.java:1780)[optimized]
at
jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1312)[optimized]
at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:1259)[optimized]
at
org/drools/event/AbstractEventSupport.addEventListener(AbstractEventSupport.java:65)[inlined]
at
org/drools/common/AbstractRuleBase.addEventListener(AbstractRuleBase.java:1018)[optimized]
at
org/drools/impl/KnowledgeBaseImpl.addEventListener(KnowledgeBaseImpl.java:127)[optimized]
at
org/jbpm/process/instance/ProcessRuntimeImpl.initProcessEventListeners(ProcessRuntimeImpl.java:201)
at
org/jbpm/process/instance/ProcessRuntimeImpl.<init>(ProcessRuntimeImpl.java:68)[optimized]
at
org/jbpm/process/instance/ProcessRuntimeFactoryServiceImpl.newProcessRuntime(ProcessRuntimeFactoryServiceImpl.java:10)
at
org/jbpm/process/instance/ProcessRuntimeFactoryServiceImpl.newProcessRuntime(ProcessRuntimeFactoryServiceImpl.java:6)
at
org/drools/runtime/process/ProcessRuntimeFactory.newProcessRuntime(ProcessRuntimeFactory.java:12)
at
org/drools/common/AbstractWorkingMemory.createProcessRuntime(AbstractWorkingMemory.java:359)[inlined]
at
org/drools/common/AbstractWorkingMemory.setKnowledgeRuntime(AbstractWorkingMemory.java:1260)[inlined]
at
org/drools/impl/StatefulKnowledgeSessionImpl.<init>(StatefulKnowledgeSessionImpl.java:116)[inlined]
at
org/drools/impl/StatelessKnowledgeSessionImpl.newWorkingMemory(StatelessKnowledgeSessionImpl.java:129)[inlined]
at
org/drools/impl/StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:293)[optimized]
at
br/com/cielo/engineRules/services/impl/CancelamentoRuleBean.validarRegrasCancelamento(CancelamentoRuleBean.java:79)[optimized]
at
br/com/cielo/engineRules/services/impl/CancelamentoRuleEJB_vyscvn_EOImpl.validarRegrasCancelamento(CancelamentoRuleEJB_vyscvn_EOImpl.java:205)[optimized]
at
br/com/cielo/engineRules/services/impl/CancelamentoRuleEJB_vyscvn_EOImpl_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown
Source)[optimized]
at
weblogic/rmi/internal/BasicServerRef.invoke(BasicServerRef.java:589)[optimized]
at
weblogic/rmi/cluster/ClusterableServerRef.invoke(ClusterableServerRef.java:230)[optimized]
at
weblogic/rmi/internal/BasicServerRef$1.run(BasicServerRef.java:477)[inlined]
at
weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)[inlined]
at
weblogic/security/service/SecurityManager.runAs(Lweblogic/security/acl/internal/AuthenticatedSubject;Lweblogic/security/acl/internal/AuthenticatedSubject;Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;(Unknown
Source)[inlined]
at
weblogic/rmi/internal/BasicServerRef.handleRequest(BasicServerRef.java:473)[inlined]
at
weblogic/rmi/internal/wls/WLSExecuteRequest.run(WLSExecuteRequest.java:118)[optimized]
at
weblogic/work/ExecuteThread.execute(ExecuteThread.java:201)[optimized]
at weblogic/work/ExecuteThread.run(ExecuteThread.java:173)
at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)
-- end of trace
I went to Drool's source code and there's a synchronized section right
before the lock. I'm afraid Drools doesn't support multi-thread processing.
Does anyone know anything about this issue???
Tks
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-locking-threads-tp4021732.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 1 month
.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, 1 month
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, 1 month