How to import functions from other package?
by Zhao Yi
I have two drl files. They are in different packages. In one
drl(function.drl) file, I declare some functions and in the other
file(logic.drl), it needs to use these function. But when I build the drl
file, I always get the error when add logic.drl file. If I remove the
package in logic.drl, then it works fine. The functions will go into default
package. How can I import the functions from other package name?
Thanks,
Zhao Yi
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-import-functions-from-other-pack...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
List in for Decision Table
by debchamps
Hi,
I need to have a action where I need to insert all the element of a list
specified in a excel cell into a ArrayList. The number of member specified
in the cell can vary. So how can I add them
So the excel sheet will look something like
the cell will contain
"1","2","3"
and If a list was initially "4" "5" Then now it will be "1","2","3","4","5"
??
--
View this message in context: http://drools.46999.n3.nabble.com/List-in-for-Decision-Table-tp4018230.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Drools-guvnor simple example Help
by abhinay_agarwal
i m pretty new to this tool..ve started using it a few days ago...
now wat i need to do is to create rules for a bank account..
i ve different rules for opening a savings account and different for
creating a current account..
and der are some rules which sud be satisfied by both the customers..(common
rules)
for ex : if rule1 and rule2 are common rules
rule 3 and rule 4 for opening a savings a/c
rule 5 and rule 6 for opening a current a/c
For savings a/c and current a/c i created two different packages and created
rules in dem..
Now wat do i do for the common rules and how do i maintain the flow that 1st
rule1 sud b checked then rule 2..den either rule3/4 sud b checked n
likewise..
hope you understand my question..if any doubts..please ask..m new to this
tool..dun ve much idea so plz b as explanatory as you can while explaining
!!!
tnxx in advance !! :)
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-guvnor-simple-example-Help-tp401...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Drools & JBPM Persistence
by Alberto R. Galdo
Hi,
I'm opening this thread in the aim of generating a debate about the
approach to session persistence in Drools and JBPM for BPMN processes which
by definition are able to generate asynchronous human tasks.
IMHO the current approach needs to be refactored in favor of joining the
management of the different Drools and JBPM entities in an unique manager.
The current implementation offers two managers one in Drools, one in
JBPM. Each of this managers are wrappers of a shared JPA EntityManager
context and manage their own entities.
When the integration of JBPM into Drools was done ( leaving behind
drools flow ), the approach seemed to be to make the entities in JBPM (
workitems, processinstance and so on ) look like the entities in Drools. As
a result, the implementation of those entities in JBPM now implement the
interfaces of the same entities in Drools. That looked like a good
approach, but the experience, at least mine, seems to reveal it as not that
good.
In my opinion, the first problem with that approach is that Drools, the
reteoo algorithm, runs in a single-threaded environment. Drools persistence
was designed having this in mind, so for the code in Drools, there's no
doubt that when in a persistent enviroment, the transaction, if any, will
be bound to the same thread as the one in which the reteoo algorithm is
executed. That leads to situations where whenever a class in JBPM calls
drools in a JBPM's thread ( the mina handler thread, a NIO one for instance
), Drools thinks that is being executed in it's own thread ( where things
are expected, as the JTA transaction bound for example ) and clearly, in
some situations it is not the case. Then Drools expects to find certain
resources and certain environment which are not always there. Leading to
failure.
As Drools now is a dependency for JBPM through the Knowledge-API, I
think that the management of the persistence for Drools and JBPM should be
merged in one that makes no assumptions and manages the needs for
persistence in a coherent way for both products.
What do you think?
"There can be only one" ->
http://en.wikipedia.org/wiki/Highlander_%28film%29
Alberto R. Galdo
argaldo(a)gmail.com
13 years, 8 months
Does a StatefulKnowledgeSession still change when it is being serialized?
by chrisLi
Hi All,
The business requirement needs me to serialize a statefule session into
a file. However, the session
object may be huge, which may take 500M memory space. So it will take
several seconds to serialize it.
During the serialization process, the session may still in use, such as
asserting an object, executing
fireAllRules command, which will cause the session to change.
Is there any way to pause or halt the session? Otherwise, Is there any
good practice to serialize a big
session object which may still be in change?
Thank you very much. Any response will be appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Does-a-StatefulKnowledgeSession-still-c...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Accumulator being executed depending on the number of events
by ekzl@yahoo.com
Hi,
I'm experimenting with Drools and have troubles understanding the way
accumulators work. Before i go and look at the source code i was wondering
if the way the accumulators work is designed as described below or of it has
something to do with my rules configuration.
I'm using drools distibution 5.4.0. So this is my test case:
I have 3 similar events and 1 rule containing an accumulator. So when firing
the alerts obviously as the events are similar the same rule is fired. So
accorrding to me when the rule is fired drools creates a new accumulator and
passed data for all events but at the same time the first accumulator still
exists and receives only the datza for the second event. The 3rd event will
trigger accumulate for context1 and context2 and then create a new
accumulator with all the 3 events. This results in actually having 3
accumulators with exactly the same data.
I have created a dummy accumulator to test this:
Here is the DRL
rule "update profile"
salience 1000 // Make sure this rule is always executed by giving it a
very high salience
no-loop true
when
$event: TestEvent()
$profile: Profile( key == $event.key)
$total : Number() from accumulate( TestEvent( $p : value, key ==
$event.key), test( $p ) )
then
System.out.println("Total:" + $total);
end
Here is the output
Event 1
Context created:137
Init called for context:137
accumulate called for context:137 object:80
Total called for context:137
Total:80
Event 2
Context created:858
Init called for context:858
accumulate called for context:858 object:80
Total called for context:858
accumulate called for context:137 object:41
accumulate called for context:858 object:41
Total called for context:858
Total called for context:137
Total:121
Total:121
Event 3
Context created:724
Init called for context:724
accumulate called for context:724 object:80
accumulate called for context:724 object:41
Total called for context:724
accumulate called for context:137 object:53
accumulate called for context:858 object:53
accumulate called for context:724 object:53
Total called for context:724
Total called for context:858
Total called for context:137
Total:174
Total:174
Total:174
How can i remove the accumulator after the rule is finished?
Regards,
e
--
View this message in context: http://drools.46999.n3.nabble.com/Accumulator-being-executed-depending-on...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Setting unused globals on a session
by gqmulligan
I save many different knowledge packages for different accounts to a
database. Most accounts use a particular service to pull data from the
database but not all of them. Because of this I wanted to set this service
as a global on the session.
However, because not all accounts use the service I get an exception when I
try to set it on the session for an account that does not use the service
anywhere in its rules. Does an exception really need to be thrown in this
case?
Also, do I have any options to work around this exception without having
some sort of "master" rule that is automatically put into all accounts and
declares all globals? The service is being pulled from a bean so I would
like to stay away from having to find it by name and keep to injecting any
global services if possible.
Thanks.
--
View this message in context: http://drools.46999.n3.nabble.com/Setting-unused-globals-on-a-session-tp4...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
how to handle the overwrinting values in drools planner
by Ricardo
Hi,
First Thanks for helping me with your valuable time,
I have 2 boxes, lets say each size of 5x5 and I have 3 items two size 4x4
and one item size is 3x3. planner initially planner assigning as follows...
item1 --> box1
item2 --> box2
item3 --> box1
When I use 2 item, result as follows...
item1 --> box1
item2 --> box2
item3 --> box1
When I increase one more box....
item1 --> box1
item2 --> box2
item3 --> box3
in the above 3 scenarios...first one (2 boxes and 3 items), is the
overwriting the item1 with iem3 into box1.
I am beginner for drools-planner.....any tips or help will be most
appreciated....
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/how-to-handle-the-overwrinting-values-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
planning entity value range type
by Ricardo
Hi,
*/"A planning entity should not use other planning entities to determinate
its value range. That would only try to make it solve the planning problem
itself and interfere with the optimization algorithms."/*
reference to the above from the drools-planner user guide, I can use the
other planning entity property but not to use other planning entity to
determine its value range. Am I correct?
thanks,
-----
with kind regards,
--
View this message in context: http://drools.46999.n3.nabble.com/planning-entity-value-range-type-tp4018...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months