How to get rid of the imports
by FlaviusVesp
Hello,
I am currently developing a project with intensive usage of Drools. Users
should write their rules in DSL, but I want to not burden them with writing
the right "import com.sample.my.own.Class;", because they shouldn't know
anything about my classes. They should know only the DSL I provide them
(they should be psychology teachers and so on, not the IT folk).
One solution is to fully qualify every usage of the class in DSL, but this
isn't a nice solution, because it will bloat the mapping.
I could provide the the imports and globals file separately, merge them with
some rules file and then load it into drools, but this would probably break
the ability to debug the rules in Eclipse (well, I am even not sure how it
is possible, but it works).
Has anyone provided some solution coded in drools? I can't find it.
Thanks for any reply.
--
View this message in context: http://www.nabble.com/How-to-get-rid-of-the-imports-tp22404890p22404890.html
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 10 months
how to use drools4 implements similar function like drools5M?
by 王磊
Hi
EveryBody,I want to write code like this in drools4,but I got a problem
that no class defined as FactType, how to refactor it ?
RuleAgent agent = RuleAgent.newRuleAgent("/rules.properties");
RuleBase rb = agent.getRuleBase();
//constructor a model ,
FactType appType = rb.getFactType("test.MerInfo");
Object merinfo = appType.newInstance();
appType.set(merinfo, "resp_code", "00");
appType.set(merinfo, "avg_amt", 5000.0);
StatelessSession ss = rb.newStatelessSession();
ss.execute(merinfo);
16 years, 10 months
Strange exit in RuleFlow
by Femke De Backere
Hi!
I have a really strange problem with my ruleflow. I have a ruleflow
process with some workhandlers. The flow seems to work perfectly,
until I arrive at the timer. The timer itself executes well, if it
delays for a period of only 4 milliseconds. The flow stops running on
the join component (because I don't reach the workhandler CheckRass,
in the debugging).
If I give the timer a delay period of 1 minute (60 000
milliseconds), the flow stops running at the timer component. The
action nodes before and after the timer contain print statements and
in this case I never reach the printstatement after the timer.
I really don't understand why my flow stops running at these points,
as I never reach an end node. Does anyone see the problem? (I added a
printscreen of my ruleflow)
Thx!
Femke
If I
16 years, 10 months
Literal representation for value objects
by David Boaz
Hi,
In my application we use few value objects. For example, Dates, Quantities
and Durations. These objects are immutable and have some behavior. For
example, comparing two quantities may involve quantity-conversion
computations (“2 foot” < “3 meter”).
In drools documentation I found an interesting example (section
6.5.2.1.1.3.2. Literal Restrictions, example 6.20):
Cheese( bestBefore < “27-Oct-2007”)
How Does the parser knows to create a Date object from that String? Does
Date has a ‘specialized’ behavior in drools? Is it possible to ‘plugin’
similar behavior for my value classes? How?
I’d like to achieve the following functionality:
Person(height < “2-meter”)
Thanks, David
--
View this message in context: http://www.nabble.com/Literal-representation-for-value-objects-tp22397729...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 10 months
Agenda events in a Stateless session
by David Boaz
Hi all,
Im trying to listen to the events fired during the evaluation of a stateless
session. I implemented org.drools.event.rule.AgendaEventListener. The events
fire as expected. From the event I can extract the Activation, the Rule and
the list of FactHandles. Now, from each FactHandle I want to retrieve the
associated fact (Object). For that, I need a WorkingMemory. But the WM
doesn't participate in the event signature. In addition, since Im using a
stateless session, the working memory does not exist until I execute()
method.
Can you please help?
Thanks, David
--
View this message in context: http://www.nabble.com/Agenda-events-in-a-Stateless-session-tp22332020p223...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 10 months
sequential execution mode throws an exception
by Michal Bali
Hi,
The sequential execution mode throws an exception when working with the new
API. It works fine with the old API.
I used the following configuration:
KnowledgeBaseConfiguration configuration =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
configuration.setOption(SequentialOption.YES);
This exception has been thrown:
java.lang.ArrayIndexOutOfBoundsException: -1
at org.drools.common.ArrayAgendaGroup.add(ArrayAgendaGroup.java:136)
at org.drools.common.DefaultAgenda.addActivation(DefaultAgenda.java:354)
at
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:247)
at
org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:165)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78)
at
org.drools.reteoo.LIANodePropagation.doPropagation(LIANodePropagation.java:47)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:671)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:659)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:213)
at com.sample.DroolsTest.main(DroolsTest.java:47)
For this rule:
rule "Hello World"
when
Message()
then
System.out.println( "test" );
end
Tested with snapshot from 7. Mar 2009
Best Regards,
Michal
16 years, 10 months
Difference between join type XOR and Discriminator
by David Sinclair
Anyone give me a better explanation of the differences between these two
joins node types? Per the documentation
*XOR means that it continues if one of its incoming branches has been
completed.
**Discriminator means that it continues if one of its incoming branches has
been completed. *
Reading this, they seem to be the same thing.
thanks
16 years, 10 months
Drools Flow, constraint parametrization
by Ricardo Gil Alcañiz
Hi,
I'm not a new drools user but I started to test rule flows (5.0M5) recently
and I'm stucked, so any clue will be welcomed :). I'm testing how to share a
StatefulKnowledgeSession between N rule flow instances. I'm trying to
parametrize each instance with process variables at start time but I don't
know how to use them from rule constraints (in event waits, splits, etc.).
I've read the documentation and I've found this text related to constraints
"Both rule and code constraints have access to globals that are defined for
the process and can reuse imports at the process level." I tried it
assigning (from an action) a variable value to a global variable but it's
not working for me. ¿I'm missing something?
Thanks in advance!
Ricardo.
16 years, 10 months
Timer isn't firing
by Cristiano Gavião
Hi,
I've created a simple process flow with a start node followed by a
timer (with delay = 1 and period = 0), an workitem node, and an end
node.
Its simple but isn't working properly. The problem is that process
isn't getting out from the timer node. Nothing happens...
Its something more needed to get timer working?
This is the output generated:
BEFORE RULEFLOW STARTED process:ProcessoX[id=ProcessoX]
BEFORE RULEFLOW NODE TRIGGERED node:Start[id=20]
process:ProcessoX[id=ProcessoX]
null process:ProcessoX[id=ProcessoX]
BEFORE RULEFLOW NODE TRIGGERED node:Timer[id=19]
process:ProcessoX[id=ProcessoX]
AFTER RULEFLOW NODE TRIGGERED node:Timer[id=19]
process:ProcessoX[id=ProcessoX]
null process:ProcessoX[id=ProcessoX]
AFTER RULEFLOW NODE TRIGGERED node:Start[id=20]
process:ProcessoX[id=ProcessoX]
AFTER RULEFLOW STARTED process:ProcessoX[id=ProcessoX]
thanks in advance
_________________________
Cristiano V. Gavião
16 years, 10 months