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);
15 years, 8 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
15 years, 8 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.
15 years, 8 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.
15 years, 8 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
15 years, 8 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
15 years, 8 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.
15 years, 8 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
15 years, 8 months
Guvnor
by Thurow, Kimberly
Hi,
I don't know if this is the right place for questions about Guvnor but I haven't been able to find any other place. I'd like to know if anyone is using it. I'm having a hard time using it. There doesn't seem to be a concept of deleting a package or reimporting a model if the previous one had errors. Since the "menu items" appear rather than being present all the time, I can't get the import to reappear anywhere. I'm also having trouble getting an operator selection to appear when trying to enter a new rule in the Mortgages example. I've read the documentation but didn't see anything about this or about errors. Is there a forum specifically for Guvnor?
Thanks in advance.
Kimberly Thurow
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect(a)principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.
15 years, 8 months