RuleFlow group as default or MAIN?
by Felipe Piccolini
Is there anyway to set a default ruleflow-group or a MAIN one so I
can put rules without
ruleflow-group in the same drl as those with ruleflow-group defined
and use a .rf where I define
a flow in the way that all rules without ruleflow-group (MAIN/
DEFAULT) are fired and then a
specific ruleflow-group?
In this way could be not necessary to use session.startProcess
("my_ruleflowgroup") in java, just
call fireAllRules() and design the process creating a RuleFlowGroup
called/id as "MAIN".
Actually I can do this programatic, but I'm forced to put ruleflow-
group in every rule... if I dont wanna to
group some rules in a specific ruleflow-group I have to call them as
ruleflow-group "MAIN"... and I dont
wanna the business people to worry about flows when they write rules
if they dont need to...
Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
no-loop
by Shai Bentin
I have a rule which I've added 'no-loop' to.
In RHS is change properties on a bean I have in the working memeory. I use a propertyChange listener to notify the working memory of this change. As I understand, by using 'no loop' in the rule, after being activated that first time it should not have run again, but it does and I get an endless loop.
here is an example: This rule was written in drools 3.0.6 but currently we are running on the lates 4GA release
rule "seniority_11"
salience 70
activation-group "seniority"
agenda-group "borrowers"
no-loop true
when
borrower:BorrowerLocal()
eval (borrower:getSeniorityAtWork() == null || borrower.getSenorityAtWork <=6)
person: PersonLocal(employmentTypeVlId == "EMPLOYED")
approvalParams: ApprovalParams(numOfExceptions >= 0)
then
approvalParams.setNumOfExceptions(approvalParams.getNumOfExceptions() + 1);
end
Any ideas
17 years, 3 months
Decision Tables: Probelm with sequence=true
by Arjun Dhar
Hi,
I usually use decision tables without sequence. But there was a request Not to
use priority and if there was a conflict then the rule on top should get
priority.
I thought, sequence = true was a good way of ensuring that. But in the rules I
call update(); this forces all the rules to fire twice.
I think this is a bug; without sequence the update does not cause such problems.
Please advise,
Arjun
17 years, 3 months
drools 4.0 compilation
by fuadhamidov
hi,
i developed my project using drools 2.5. now i want to upgrade to drools
4.0. in my project i
(1) create xml file,
(2) compile xml file & get jar file,
(3) save jar file
(4) and load jar file when i need to run rules
i was able to upgrade xml file to drools 4.0 xml format, but i can not do
necessary modification in code to compile xml and get "jar or any reloadable
file".
There is my code that is developed for drools 2.5. Can you help me to
upgrade it for drools 4.0?
void compile() throws Exception {
// read xml file, returns data in xml format
String rulecontent = readRuleFromFile();
byte[] bytes = null;
// codes for drools 2.5. i want to develop corresponding code for 4
statement bellow that runs with drools 4.0
// RuleSetReader reader = new RuleSetReader();
// RuleSet ruleSet = reader.read(new BufferedReader(new
StringReader(rulecontent)));
// RuleSetCompiler compiler = new RuleSetCompiler(ruleSet, "com.sample",
"knowledgeHelper");
// bytes = compiler.getBinaryDeploymentJar();
// some codes for drools 4.0, but it is not finilized
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromXml(new BufferedReader(new
StringReader(rulecontent)));
Package pkg = builder.getPackage();
//... and then what? how do it get bytecode from package?
//may be 3 statements are not necessary for compilation
// save to disk as a jar file
writeRuleToJar(bytes);
}
void runrule(Object usg) throws Exception {
// runs both, drools 2.5 and drools 4.0
ConflictResolver[] conflictResolvers = new ConflictResolver[] {
SalienceConflictResolver.getInstance(),
ComplexityConflictResolver.getInstance(),
FifoConflictResolver.getInstance() };
CompositeConflictResolver compositeConflictResolver = new
CompositeConflictResolver(conflictResolvers);
byte[] bytecode = readRuleFromJar();
// i can not develope this part also
// RuleBaseLoader loader = new RuleBaseLoader(compositeConflictResolver);
// loader.addFromByteArray(bytecode);
// RuleBase ruleBase = loader.buildRuleBase();
// modification in code for drools 4.0
// WorkingMemory workingMemory = ruleBase.newWorkingMemory();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
// workingMemory.assertObject(usg);
workingMemory.insert(usg);
workingMemory.fireAllRules();
}
--
View this message in context: http://www.nabble.com/drools-4.0-compilation-tf4204509.html#a11959523
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Featured Drools Job - Tier One Investment Bank
by Mark Proctor
http://blog.athico.com/2007/08/featured-drools-job-tier-one-investment.html
<original blog link>
Caspian One <http://www.caspian1.co.uk/> is the first company to place a
job advert on the Drools Job Board <http://jobs.athico.com>, as such I
thought I'd give it wider promotion :)
Intro: Caspian One is working with a tier one investment bank who is
looking to recruit a Java Developer to work within the Credit
Derivatives Front Office. Project description the successful candidate
will be given the opportunity to develop MiFID integration feeds in the
Drools framework. The team is responsible for hands on development of
implementation, feeds, integration and database infrastructure for an
in-house MiFID solution. This is all using SOA strategies, JBoss Drools
framework, JDBC, relational database design and SQL coding with either
MS SQL or Sybase. Also an essential is good knowledge of modern Java
development; Spring /Hibernate. The candidate must have a proven track
record of being able to work in a highly dynamic environment with some
experience in investment banking. As such we are looking for candidates
with good Java skills, who can design database using either MS SQL
coding or Sybase and the must is good experience using Drools.
Sales bit: The successful candidate will gain excellent exposure to
investment banking business areas, as well as the opportunity to work in
a technically challenging, delivery focused environment, within a fast
moving business areas.
You can view and apply for this this role at the Drools Job Board here
<http://jobs.athico.com/job/4e3e3d8ab8e221b47f90d5d5924f574f/?d=1>.
17 years, 3 months
JBoss Rules IDE Error on StringEvaluator
by Ronald R. DiFrango
Anyone ever seen this error in the IDE:
Severity and Description Path Resource Location Creation Time
Id
Operator '50' does not exist for StringEvaluator
RtvDecisionEngine/src/rules/com/circuitcity/rtvcrms/rules rtv.drl
Unknown 1179954317638 29080
And if so what do you do about it? My rules file is just under 1000 lines
[and growing] and shows no other errors.
17 years, 3 months
no-loop using PropertyChangeListeners instead of update() in rules...doesnt work
by Felipe Piccolini
Hi,
I have a problem with no-loop, I run the integration test for no-
loop and it works fine because
it uses "update" and the fact dont use propertychangelisteners...
But if I run the same test but the rule doesnt have update(cheese)
and Chesse has propertyChangeListeners to
notify when an attribute change/is-updated then no-loop doesnt work...
Is this a bug or do i have to look another way to write my rules?
I really likes the way beans can control property changes using
listeners and dont have to force business ppl to write
update in rules :)
Thanks.
PD: I copied this email because used a reply for an old email (and I
dont wanna be lost in time) :)
On 26-04-2006, at 8:30, Mark Proctor wrote:
no-loop is in the integration tests and works fine. think it has for
a while. We will be releasing RC3 any day now, try it then and if its
still a problem let us know.
Mark
Unknown wrote:
I try to use the rule attribute no-loop but it seems not to function...
I set it to true but each rule is evaluated two or several times.
Is it OK with the RC2??
Thank you
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
join array and object
by Manukyan, Sergey
Folks,
I have a Parent and Children, but need to do aggregate function on
collection of Parent WITH Children, to find the minimum expiration date
on them, how can I create in LHS expression a collection of Parent WITH
Children?
Like:
rule ...
when
p : Parent()
c : Date() from accumulate( Child( d: date)
from ($p.children and $p), min($d) ) // ?? what can I use to
join collection of $p.children with $p to get another collection with
them all ??
then
....
end
Thanks!
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
17 years, 3 months
Cannot set RuleBase configuration options using RuleAgent
by Shahad Ahmed
Does anyone know how you can set RuleBase configuration options for a
RuleBase created using the RuleAgent? The RuleAgent does not seem to have a
mechanism for passing in a RuleBaseConfiguration object to set options like
Sequention mode etc.
I know that you can set RuleBase options for all RuleBases by setting the
appropriate System properties when calling the java VM, but it would be nice
to be able to set these individually via the API for each RuleBase created
using a RuleAgent. I guess this could be done fairly easily by adding an
extra constructor to RuleAgent that takes a RuleBaseConfiguration object --
rbConfig, say -- and in RuleAgent when it creates a new RuleBase instead of
just using RulebaseFactory.newRuleBase() use
RulebaseFactory.newRuleBase(rbConfig)
instead.
Regards,
Shahad
17 years, 3 months
[Drools] Order of sequence of execution of Conditions and Actions
by Yv RamaRao
Hi all,
I has a problem in executing the drool code. I have
2 rules with a condition and an action.
The order of execution is
executeCondition1
executeCondition2
executeAction2()
executeAction1()
but to fullfill my requirements i need the sequence to be executed as
executeCondition1
executeAction1()
executeCondition2
executeAction2()
Is there any to get way to execute the sequence as above. Kindly suggest
Here is Drool Code and Implementation Java Code
Sample.drl
========
package com.sample
import com.sample.DroolsTest.MyDeligate;
rule "Rule1"
salience 2
when
delegate: MyDeligate()
eval(delegate.executeCondition1());
then
delegate.executeAction1();
end
rule "Rule2"
salience 1
when
delegate: MyDeligate()
eval(delegate.executeCondition2());
then
delegate.executeAction2();
end
DroolTest.java
===========
package com.sample;
import java.io.InputStreamReader;
import java.io.Reader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.rule.Package;
public class DroolsTest {
public static final void main(String[] args) {
try {
RuleBase ruleBase = readRule();
WorkingMemory workingMemory = ruleBase.newWorkingMemory();
MyDeligate delegate = new MyDeligate();
workingMemory.assertObject(delegate);
workingMemory.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static RuleBase readRule() throws Exception
{
Reader source = new InputStreamReader( DroolsTest.class.getResourceAsStream( "/Sample.drl" ) );
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( source );
Package pkg = builder.getPackage();
RuleBase ruleBase =
RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
public static class MyDeligate
{
public boolean executeCondition1()
{
System.out.println("Executed Condition1");
return true;
}
public boolean executeCondition2()
{
System.out.println("Executed Condition2");
return true;
}
public boolean executeCondition3()
{
System.out.println("Executed Condition3");
return true;
}
public boolean executeAction1()
{
System.out.println("Executed Action1");
return true;
}
public boolean executeAction2()
{
System.out.println("Executed Action2");
return true;
}
public boolean executeAction3()
{
System.out.println("Executed Action3");
return true;
}
}
}
Regards
Ramarao
Why delete messages? Unlimited storage is just a click away. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
17 years, 3 months