[Drools4]: Filter executed rules by *.drl file
by magendo
Before I start do explain my problem I should say that I have already
searched through the older posts and found similiar problems but not exactly
the following one:
My Application has multiple RuleFiles (*.drl each with its own package)
which can be dynamically added/removed. Based on a context (lets say String
foo = "bar") only the rulepackage which fits to "bar" should be executed.
Usually that isnt a problem, because drools just executes the rules with the
fitting facts. But in this case all the rules in the rulepackages check the
same type of facts.
Currently I am using an AgendaFilter (if rulepackage == xyz { accept =
true}) to achieve this goal, but firstly it doesnt effect inserting of facts
(LHS of every rule is executed) and secondly I have read that it should only
be used for unit testing, since it couples java code with rule behavior.
While reading older posts I have found two possible solutions that could
work:
1. Using a contextObject which has foo and is checked in the first rule of
each rulepackage. This first rule and the remaining rules in the rulepackage
have the same agenda group. So if the first rule doesnt fit, the other rules
wont be executed, either (does this really work? ;)).
2. Putting every rulepackge in its own rulebase. Then I would check the
context in java and execute the fitting rulebase.
Let's say I have about 300 *.drl files. Which solution would be better?
Maybe there is a better solution 3) of which I didnt think yet. Then dont
hesitate and tell it to me :)
Thanks in advance for any help.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools4-Filter-executed-rules-by-drl-fi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Unexpected variable binding behavior and conditional logic
by ChrisG
Apologies if this has been addressed elsewhere: I couldn't find anything
quite like my issue.
My (greatly simplified and completely made-up) example:
Let's say I have this java class:
public class BaseballPitcher
{
public String getName();
public boolean isRightHanded();
public boolean isKnuckleBaller();
}
Multiple instances of this class are created with a variety of combinations
for the name and two boolean parameters.
Now I have a rule:
rule "Match pitchers: righties or knuckle-ballers"
when
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded == true
||
$knuckleballer: knuckleBaller == true)
$kbPitcher2: BaseballPitcher(name != $name, rightHanded == $righty,
knuckleBaller == $knuckleballer)
then
// Do something with these two pitchers $kbPitcher1 and $kbPitcher2
end
I am getting the curious result that this rule fires its conclusion when
$kbPitcher1 is in fact NEITHER right-handed nor a knuckle-baller (i.e.
rightHanded == false && knuckleBaller == false).
I've worked around this by changing the first condition in either of the
following two ways:
*// eval() the condition*
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,
$knuckleballer: knuckleBaller,
*eval(isRightHanded() == true || isKnuckleBaller() == true)*)
...or....
*// bind the variables before checking values*
$kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,
$knuckleballer: knuckleBaller,
*rightHanded == true || knuckleBaller == true*)
Does this make sense? Both are easy workarounds, and I believe the second
option (i.e. the one NOT using the eval) is the better solution from a
performance perspective, allowing the engine to index the these facts rather
than dynamically evaluate the condition every time.
But I'm a little surprised the first approach didn't work. Any ideas why
not?
--
View this message in context: http://drools.46999.n3.nabble.com/Unexpected-variable-binding-behavior-an...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
I'm on google+ follow me there
by Mark Proctor
follow me at google+ on mdproctor(a)gmail.com. Mention you are a expert
system person, so I add you to the right circle.
Mark
14 years, 8 months
Sheriff rota
by Mark Proctor
Toni, Jervis, Michael, Geoffrey,
Starting from next month I'd like a Guvnor "sheriff" rota. I want you
each to take it in turns, a month at a time, to wear the Sheriff badge.
That person is then responsible for keeping the build blue, managing
jira (keeping it up to date) and chasing people to fix bugs. So in
general handling communications and keeping the project running
smoothley. Also they will be responsible for the minute taking of the
weekly minutes, so it's not all geoffrey.
Please work out a rota between yourselves and update that "holiday"
google sheet that michael made with that information. I also suggest you
update #guvnor with that month's Sheriff. Make sure john and prakash
have access to that google sheet.
Mark
14 years, 8 months
concurrent modification of a rule by more than one user in Guvnor
by puja nandamuri
Hi All,
I am currently testing 5.2.0.CR1 version of Guvnor.
Can multiple users modify a rule in Guvnor at the same time? what are the issues involved in say, two users trying to change
1. the same row in a decision Table at the same time and saving it.
2. different rows in a decision table at the same time and saving it.
Are there any documentation or articles to get more information on concurrent access within Guvnor?
Thank You,
ram.
14 years, 8 months
BPMN editor not working
by Jamie
I'm trying to move from Drools 5.1.1 to 5.2 and I'm reworking my .rf files
into .bpmn files, but I've run into an issue - I use the wizard to create a
new file like MainFlow.bpmn. After I create it, I open it using the BPMN2
process editor and all is well. However, if I add anything to the diagram
and close it, I get an error when I try to reopen it. "An exception
occurred while reading in the RuleFlow XML:null See the error log for more
details".
Any ideas what might be wrong? Where would I find the error log?
--
View this message in context: http://drools.46999.n3.nabble.com/BPMN-editor-not-working-tp3182776p31827...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
priority based on object properties
by Simon Chen
Hi all,
I am curious if we can inform Drools' execution based on properties
within objects.
In particular, the salience value is defined for each rule, in the
sense that rule A has priority over rule B to execute. I am wondering
if we can define some kinda of salience metric, such that object X has
higher priority than object Y to be executed in the same rule.
To give an example, I am (still) playing with implementing shortest
path using a few rules. I have a rule for selecting a shortest path on
a node (among all the paths received from its neighbors) to a source
node, and another rule for propagating the shortest path on a node to
neighboring nodes. When I have many nodes in my graph, I found that
the paths propagated (via the second rule) are not always the
shortest, while Dijkstra's algorithm always "propagate" from the node
with the shortest distance to the source. The effect is that my rules
are wasting most of the time propagating paths that would be dropped
in the end anyway...
Any ideas?
Thanks.
-Simon
14 years, 8 months
jaxb generated fact loaded into Guvnor throws errors when using the ' is contained in the comma separated list' operator
by Sreeram.Vadlamudi@wellsfargo.com
Hello ,
I am using 5.2.0.CR1 version of Guvnor .
I have a jaxb generated class loaded through the model jar into Guvnor to be used as a fact in the Guided Decision Table editor.
When I use a field ACTIVITYCODE of type String from the JAXB generated class with ' is contained in the comma separated list' operator, I get compilation errors.
Unable to Analyse Expression ACTIVITYCODE == "A" || ACTIVITYCODE == "B": [Error: no such identifier: ACTIVITYCODE] [Near : {... ACTIVITYCODE == "A" || ACTIVI ....}] ^ [Line: 1, Column: 1]
But when I use equal to operator to compare value to just a string value, it compiles fine.
This rule fails.
3. | rule "Row 1 dds"
4. | ruleflow-group "None"
5. | dialect "mvel"
6. | when
7. | factClass : FACTCLASS( ACTIVITYCODE in ("A", "B")
8. | then
9. | factClass.setRATE( "5.25" );
10. | end
The below rule compiles fine.
3. | rule "Row 1 dds"
4. | ruleflow-group "None"
5. | dialect "mvel"
6. | when
7. | factClass : FACTCLASS ( ACTIVITYCODE =="A")
8. | then
9. | factClass.setRATE( "5.25" );
10. | end
Is this issue being caused by jaxb generated class? If so, is there a way to fix this problem?
When I use a regular pojo that is not jaxb generated, the
is contained in the comma separated list' operator works fine.
Can someone provide any direction or thoughts on this?
Thanks,
Ram
14 years, 8 months
Global variable in LHS
by pamerida
Hi everybody,
I would like to analyze a global value in the LHS of my rule without using
an eval, something like this:
global String globalVariable;
rule 'SI-002-NAD-6'
salience 5000
when
global (globalVariable in ("X","Y")
then
logger.log("[SI-002-NAD-6] Debe colocar la información del propietario del
medio de transporte.");
end
I cant use eval because it doesnt recognize the keyword "in", for example
this code would throw me an error in the validation
global String globalVariable;
rule 'SI-002-NAD-6'
salience 5000
when
eval (globalVariable in ("X","Y")
then
logger.log("[SI-002-NAD-6] Debe colocar la información del propietario del
medio de transporte.");
end
any suggestions? thanks so much for your help :)
--
View this message in context: http://drools.46999.n3.nabble.com/Global-variable-in-LHS-tp3180063p318006...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months