Flow: "Multiple Instances" vs rule task
by Gabor Szokoli
Hi,
I'm looking into Drools Flow, because some of our rules are sequential
and procedural, resulting in salience nightmare (like line numbers in
BASIC, only backwards :-) ) with lots of repetition in conditions.
Besides our domain people just love the idea of executable flow charts :-)
Having read through the documentation, it is not clear how I can
conveniently use rule tasks in a "foreach" node: I would like the
"foreach" node to virtually partition the Working Memory for the rules
inside: each execution of the inner rules should see their own small
subset of the Working Memory.
My initial guess is to do "foreach" over the list of values that
discriminate between the facts, then the inside rules could all start
like this:
when
$processInstance : WorkflowProcessInstance()
$whatever:Whatever( discriminatorField == (
$processInstance.getVariable("forEachVariable") ) )
...
then
Is that the way, or am I missing something here?
Thanks in advance:
Gabor Szokoli
13 years, 11 months
Using GlobalArea in Guvnor
by John Peterson
Hi,
I'm working with Guvnor 5.1.1 and I'm having an issue accessing
Declarative Models defined in the Global Area in the Packages. Is it
possible to create a shared model in the Global Area and then write
rules against them in other packages? It would seem to me that the
answer would be yes (why else have a "Global" area), but, for some
reason, it doesn't seem to recognize them.
Here's a scenario:
I declare a DeclarativeModel in GlobalArea:
GenericFact
id: Integer
valueOne: Integer
label: String
end
I have a package called com.experiment. I'd like to write Business Rule
in it using that GenericFact. However, when I click the "+" sign to add
a Fact, I see a yellow background over "Note: No model has been
defined." Is there something that needs to be done to make the
GlobalArea stuff viewable from the individual packages?
13 years, 11 months
Error at inserting a fact
by Anais Martinez
Hi. I want to test several rules and I'm using pseudo-clock and stream mode.
When I insert the first fact, Drools generates an error of "timestamp must
be greater 0". But if I use real clock, the message doesn't appears.
The fact is a java class, but I haven't defined the timestamp. What is the
problem?
For this test I am not using events.
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Error-at-inserting-a-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months
getting all binary packages from Guvnor
by Kumar, Ravendra
Hi Guys,
I am just playing with Guvnor and my Knowledge Builder,
I am able to pull a single binary package by hard-coding it into
changeset.xml using Configuration Agent like below
<change-set>
<add>
<resource basicAuthentication='enabled' username='admin'
password='admin'
source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/pac
kage/mortgages/TEST' type='PKG' />
</add>
</change-set>
But my requirement is not to hard code all other packages into
change-set.xml, but I want to pull packages from Guvenor becasus a lot
of packages are being create and deleted frequently.
So is there any way that I can get all packages/ or whole knowledgebase
from Guvnor. May be like this
<change-set>
<add>
<resource basicAuthentication='enabled' username='admin'
password='admin'
source='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/pac
kags' type='PKG[]' />
</add>
</change-set>
And it should return all binary packages.
Any information will be highly appreciated.
Thanks,
Rav
Think green - keep it on the screen.
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
13 years, 11 months
Memory Consumption with 5000 Rules
by thomas.polzin@gmail.com
Dear all,
My setup includes about 5000 rules with the following pattern:
rule "1"
when
(
$c_0 : CFRO( fi.co == "1", su.co == "P", c.co == "C") or
$c_0 : CFRO( fi.co == "2", su.co == "P", c.co == "C") or
$c_0 : CFRO( fi.co == "3", su.co == "P", c.co == "C") or
$c_0 : CFRO( fi.co == "4, su.co == "P", c.co == "C") or
$c_0 : CFRO( fi.co == "5", su.co == "P", c.co == "C")
)
then
Bcf fact = new Bcf ();
fact.setC( "123");
insert( fact);
end
The number of disjunctions varies, it might go up to 80. Just loading these
5000 rules uses about 200mb. I use 5.1.1.
Is this to be expected or do I something fundamentally wrong. Any help
highly appreciated. For instance, would it
make sense to use a rule for each of the disjunction?
I add the rules the with the following code:
DroolsObjectInputStream stream = new DroolsObjectInputStream(inputStream);
Collection<KnowledgePackage> knowledgePackages =
(Collection<KnowledgePackage>)stream.readObject();
stream.close();
engine.addKnowledgePackages(knowledgePackages);
Many thanks in advance
Thomas
13 years, 11 months
Calling a function from another function in 5.0
by Chris Selwyn
I don't seem to be able to find how to call one function from another
function in Drools 5.0.
It works just fine in 5.1 but I am having to use 5.0 because my customer
requires me to use a supported version.
Is this a known problem or is there really no way to do it?
Chris Selwyn
13 years, 11 months
Understanding indexing
by Chris Selwyn
I would like to understand more about how my rules are being executed.
Is there a way that I can find out what indexes are being are being created.
I can see the drools.indexLeftBetaMemory (and friends) properties but I
would like to be able to observe the effects that they are having.
Chris Selwyn
13 years, 11 months
Does guvnor 5.1 uses hibernate ?
by Harshit Bapna
Hello All,
I am investigating Drools Guvnor for its rule authoring capabilities.
*The site says the Gunor License is ASL but it packages hibernate jars.
Hibernate license is LGPL.*
I removed the hibernate jars from Guvnor & still it is able to perform db
operations.
Note: Guvnor is using Oracle database as a repository (not using the default
file system repo). Repository file attached.
*Question:
1. Does Guvnor uses hibernate jars? If yes then in what scenarios. (I am
able to do create rules in repo (database) without hibernate jars)
2. Is hibernate a leftover from old versions of drools ? Why is it packaged
with drools 5.1 guvnor release ?*
*Tasks performed to proove that Guvnor does not have any dependency on
hibernate.*
1. Stopped the JBOSS server
2. Removed hibernate jars from guvnor lib folder.
3. Started Guvnor
3. Created rules in guvnor. I verified that the new rules were getting
stored in the database.
Hence no dependency of guvnor on Hibernate.
--harshit
13 years, 11 months
Multiple bindings with the same type
by Robert Miyashiro
Let¹s say there¹s a rule with multiple bindings of the same type evaluated
in a stateless session. For example:
rule
when
$list1 : ArrayList()
$list2 : ArrayList()
then
...
end
Now, I have 2 ArrayList objects to insert into the session, A1 and A2. How
can I make sure that A1 gets bound to $list1, and A2 gets bound to $list2?
Obviously, I can¹t just insert A1 first followed by A2 and expect that to
work. Is there some kind of evaluation mode or setting that will make
Drools pay attention to the order in which objects are inserted into the
session?
13 years, 11 months
DROOLS problem with sliding windows
by AberAber
I have been working with sliding windows, and they do not appear to work
properly in DROOLS 5.1.1 or I am misunderstanding how they work. My goal is
to have the last X number of samples averaged or summed. I've tried two
mechanism, the accumulate/from, and the collect, and they both behave
similarly wrong (or different than I expect), but this was much easier to
follow so I've posted it for help.
The way I have the code structured, I receive values for two nodes, 1 and 2
every second or two, which each contain random values. After each value
received I pass the CPUReportEvent and fire the rules. The results are
bizarre. Sometimes it resets back to 1 count, sometimes it keeps the value
to the previous one. It seems to also fire both rules when really only one
should've been triggered? Can someone explain the results and how to adjust
it to work for my specs? Thanks!
I can't see into the accumulate function, so here's the collect function,
but they perform identically.
package com.sample
import com.sample.DroolsTest.Message;
import com.sample.DroolsInput;
import com.sample.CPUReportEvent;
import com.ComEntity;
import java.util.Iterator
import java.util.ArrayList
declare CPUReportEvent
// declare a fact type as an event, default is 'fact'
@role( event )
end
rule "collect with length window"
no-loop true
when
$comEntity : ComEntity()
$list : ArrayList () from collect(
CPUReportEvent(comEntity == $comEntity)
over window:length(3) )
then
System.out.print("Entity " + $comEntity.getName() + " fired of count " +
$list.size() + " value");
Double sum = 0.0;
Double count = 0.0;
for(Iterator it = $list.iterator();it.hasNext();) {
CPUReportEvent report = (CPUReportEvent) it.next();
System.out.print(" " + report.getAmount());
sum = sum + report.getAmount();
count = count + 1.0;
}
if (count > 0.0)
{
Double avg = (sum / count);
System.out.print(" - Sum " + sum + " avg " + avg + " count " +
count);
}
System.out.println();
end
RESULTS:
Node1 : 7.0
Entity Node2 fired of count 0 value
Entity Node1 fired of count 1 value 7.0 - Sum 7.0 avg 7.0 count 1.0
Node2 : 94.0
Entity Node2 fired of count 1 value 94.0 - Sum 94.0 avg 94.0 count 1.0
Node1 : 43.0
Entity Node1 fired of count 2 value 7.0 43.0 - Sum 50.0 avg 25.0 count 2.0
Node2 : 85.0
Entity Node2 fired of count 2 value 94.0 85.0 - Sum 179.0 avg 89.5 count 2.0
Entity Node1 fired of count 1 value 43.0 - Sum 43.0 avg 43.0 count 1.0
Node1 : 88.0
Entity Node2 fired of count 1 value 85.0 - Sum 85.0 avg 85.0 count 1.0
Entity Node1 fired of count 2 value 43.0 88.0 - Sum 131.0 avg 65.5 count 2.0
Node2 : 47.0
Entity Node2 fired of count 2 value 85.0 47.0 - Sum 132.0 avg 66.0 count 2.0
Entity Node1 fired of count 1 value 88.0 - Sum 88.0 avg 88.0 count 1.0
Node1 : 39.0
Entity Node2 fired of count 1 value 47.0 - Sum 47.0 avg 47.0 count 1.0
Entity Node1 fired of count 2 value 88.0 39.0 - Sum 127.0 avg 63.5 count 2.0
Node1 : 0.0
Entity Node1 fired of count 2 value 39.0 0.0 - Sum 39.0 avg 19.5 count 2.0
When I set the window to 4, the results are similar but never get past a
count of 2.
Node2 : 87.0
Entity Node2 fired of count 1 value 87.0 - Sum 87.0 avg 87.0 count 1.0
Entity Node1 fired of count 0 value
Node1 : 39.0
Entity Node1 fired of count 1 value 39.0 - Sum 39.0 avg 39.0 count 1.0
Node2 : 11.0
Entity Node2 fired of count 2 value 87.0 11.0 - Sum 98.0 avg 49.0 count 2.0
Node1 : 48.0
Entity Node1 fired of count 2 value 39.0 48.0 - Sum 87.0 avg 43.5 count 2.0
Node2 : 33.0
Entity Node2 fired of count 2 value 11.0 33.0 - Sum 44.0 avg 22.0 count 2.0
Node1 : 69.0
Entity Node1 fired of count 2 value 48.0 69.0 - Sum 117.0 avg 58.5 count 2.0
Node2 : 63.0
Entity Node2 fired of count 2 value 33.0 63.0 - Sum 96.0 avg 48.0 count 2.0
Node1 : 82.0
Entity Node1 fired of count 2 value 69.0 82.0 - Sum 151.0 avg 75.5 count 2.0
Node2 : 94.0
Entity Node2 fired of count 2 value 63.0 94.0 - Sum 157.0 avg 78.5 count 2.0
Node1 : 65.0
Entity Node1 fired of count 2 value 82.0 65.0 - Sum 147.0 avg 73.5 count 2.0
And here's sliding window length of 5:
Node1 : 34.0
Entity Node2 fired of count 0 value
Entity Node1 fired of count 1 value 34.0 - Sum 34.0 avg 34.0 count 1.0
Node1 : 3.0
Entity Node1 fired of count 2 value 34.0 3.0 - Sum 37.0 avg 18.5 count 2.0
Node2 : 92.0
Entity Node2 fired of count 1 value 92.0 - Sum 92.0 avg 92.0 count 1.0
Node1 : 61.0
Entity Node1 fired of count 3 value 34.0 3.0 61.0 - Sum 98.0 avg
32.666666666666664 count 3.0
Node1 : 65.0
Entity Node1 fired of count 4 value 34.0 3.0 61.0 65.0 - Sum 163.0 avg 40.75
count 4.0
Node2 : 81.0
Entity Node2 fired of count 2 value 92.0 81.0 - Sum 173.0 avg 86.5 count 2.0
Entity Node1 fired of count 3 value 3.0 61.0 65.0 - Sum 129.0 avg 43.0 count
3.0
Node1 : 29.0
Entity Node1 fired of count 3 value 61.0 65.0 29.0 - Sum 155.0 avg
51.666666666666664 count 3.0
Node2 : 28.0
Entity Node2 fired of count 2 value 81.0 28.0 - Sum 109.0 avg 54.5 count 2.0
Node2 : 46.0
Entity Node2 fired of count 3 value 81.0 28.0 46.0 - Sum 155.0 avg
51.666666666666664 count 3.0
Entity Node1 fired of count 2 value 65.0 29.0 - Sum 94.0 avg 47.0 count 2.0
Node2 : 55.0
Entity Node2 fired of count 4 value 81.0 28.0 46.0 55.0 - Sum 210.0 avg 52.5
count 4.0
Entity Node1 fired of count 1 value 29.0 - Sum 29.0 avg 29.0 count 1.0
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/DROOLS-problem-with-s...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months