Writing rules using java..
by Kolla, Sandeep
Hi Rahul,
Its not about storing the whole file into the database.
I would have a Table representing the parameteres required to construct
a rule.
For example.
Tables:
RuleSetTable:
Ruleset_id
Ruleset_name
RuleTable:
Rule_id
Rule_name
Rule_saliance
Rule_condition
Rule_consequence
Ruleset_id
Now while loading the rules the application basically should read from
the DB, and construct the rules, as everything required to construct the
rules is avaliable in the tables.
This requirement had come up because as the rules keep changing quite
frequently, we don't want to bring down the application to load a new
DRL file.
Hope you understood what I want to achieve.
Thanks much,
Sandeep.
16 years, 2 months
wrapping drools api?
by thomaskukofka@web.de
Hello,
some people write about wrapping the Drools API with an own access API
for integration in the application.
Sorry for the perhaps stupid question, but what is the reason for this?
Does this only make sense if I'm thinking about changing the rule
engine one day?
If I'm not intending to change the rule engine from Drools to another,
so isn't it the same if the developpers has to use the native Drools API
or an self-written access API?
Regards
Tom
16 years, 3 months
activationCancelled() not being executed?
by Fermion
Hi!
I'm using a JTable to display rules that have been activated.
My goal is to have the table display a set of activations ordered by their
salience. The user should then choose which one of them to fire (if you want
to know why, be invited to read the background).
Of course this makes only sense as long as the activations are valid. Rules
whose activation has been cancelled should still be displayed, but in a
different style (like greyed out).
In order to accomplish this, I want to use an implementation of the
AgendaEventListener-interface, implementing the
activationCancelled()-method.
The Listener itself works, as I use the activationCreated()-method to add
the rule as a row to my table (which works fine).
Unfortunately the activationCancelled()-method doesn't seem to be executed
at all!
I assume that I have a fundamental misunderstanding of what should trigger
an activationCancelled() event?
Background: (just if you're curious...)
I'm working as a PhD student in physics at the CERN international
high-energy physics laboratory, for the ATLAS experiment.
As a member of the Detector Control System (DCS) group, I'm going to write
an expert system in order to assist the shift crew with the detector
operation.
The operation of the detector is a difficult task, because more than 70000
parameters (like voltages, currents and temperatures) have to be controlled.
A Finite State Machine (FSM) computes a defined and limited number of states
from the given parameters (like ON, OFF, STANDBY,...).
I'm going to synchronize the expert system application to ERROR states of
the FSM, in order to extract the relevant parameters from the system (as it
would be impossible to feed all parameters into the XPS all the time).
This is handled by quite some control rules that decide which data has to be
requested, released and so on.
Once all necessary data has been received, this might lead to activations of
the (more interesting) user rules.
Those rules have an explanatory character like "The temperature of this XYZ
is too high, so please try ABC."
For a given set of facts I assume more then one rule to be activated. Whilst
the rule engine should take care of the execution (firing) of all control
related rules, the execution of the user rules should be under direct user
control.
Displaying all activations in a GUI will allow the user to pick one (try it)
and rate it (the proposed solution solved the problem "yes/no"). Changing
the rules salience according to the answer, will allow the system to
dynamically reflect the current system status. (Rules that are related to
broken connections / wrongly connected cables are likely to be found at the
beginning of the experiment but hopefully only on rare occasion later on.)
In order to ensure that no information is lost during the absence of DCS
experts (which will not always be around), a log file should be written for
each major FSM-ERROR. At the moment the WorkingMemoryFileLogger seems to be
predestined for this job. This way I hope to collect large amounts of ERROR
data during the initial phase of the experiment that helps to extract rules
for numerous error conditions.
This will become especially handy, as such errors have a tendency to come
back, even if the original detector experts are gone for years...
--
View this message in context: http://www.nabble.com/activationCancelled%28%29-not-being-executed--tf434...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 3 months
RuleML-2008: Deadline Extension
by Adrian Paschke
[ our apologies should you receive this message more than one time ]
=====================================================================
Due to a number of requests we have to decided to extend
the submission deadline by 2 weeks.
NEW deadline for paper/demo submission: June 16
=====================================================================
2008 International RuleML Symposium
on Rule Interchange and Applications (RuleML-2008)
October 30-31, 2008, Orlando, Florida
http://2008.ruleml.org
--------------------------------------------------------------------
RuleML-2008 Highlights:
- Keynote speakers:
* Michael Kifer (State University of New York at Stony Brook, USA),
on "Rule Interchange Format: Not Just Syntax".
Joint keynote between RuleML-2008 and RR2008.
* David Luckham (Stanford University, USA) on complex event processing.
* Paul Haley (Haley Ltd) on business rules.
* Benjamin Grosof (Vulcan Inc, USA) on the SILK KRR system of the HALO
project.
(Details at: http://2008.ruleml.org/keynote.php )
- Joint Lunch Panel with the Business Rules Forum about "Rules on the Web"
- RuleML-2008 Challenge with prestigious prices
(Details at: http://2008.ruleml.org/challenge.php )
(Submissions at: http://ruleml-challenge.cs.nccu.edu.tw/ )
- Lightning talks / Highlight talks
Accepted papers will be published in Springer LNCS proceedings and
a journal special issue (IEEE TKDE pending) is forthcoming.
PRESS RELEASES: http://www.targetwire.com/vpo/rm/
--------------------------------------------------------------------
Call for Papers
Collocated with the 11th International Business Rules Forum, the 2008
International Symposium on Rule Interchange and Applications
(RuleML-2008) is
the second symposium (after last year's highly successful RuleML-2007 -
http://2007.ruleml.org/) devoted to work on practical distributed rule
technologies and rule-based applications which need language standards for
rules operating in the context of, e.g., the Semantic Web, Intelligent
Multi-
Agent Systems, Event-Driven Architectures and Service-Oriented Computing
Applications. The RuleML symposium is a new kind of event where the Web
Rules
and Logic community joins the established, practically oriented Forum of the
Business Rules community (http://www.businessrulesforum.com) to help cross-
fertilizing between Web and Business Logic technology.
The goal of RuleML-2008 is to bring together rule system providers,
representatives of, and participants in, rule standardization efforts (e.g.,
SBVR, RuleML, RIF, PRR, CL) and open source rules communities (e.g., jBoss
Rules, CLIPS/Jess, Prova, OO jDrew, Mandarax, XSB, XQuery),
practitioners and
technical experts, developers, users, and researchers. They will be offered
an exciting venue to exchange new ideas, practical developments and
experiences on issues pertinent to the interchange and application of rules
in open distributed environments such as the Web.
The Symposium gives emphasis on practical issues such as technical
contributions and show case demonstrations of effective, practical,
deployable rule-based technologies, rule interchange formats and
applications
as well as discussions of lessons learned that have to be taken into account
when employing rule-based technologies in distributed, (partially) open,
heterogeneous environments. We also welcome groundwork that helps to
build an
effective, practical, and deployable rule standard, improve rule technology,
provide better understanding of the integration and interchange of
rules, and
make the current generation of rule engines and rule technology more usable
for advanced Web and Service Oriented Architectures.
More details in: http://2008.ruleml.org/cfp.pdf
--------------------------------------------------------------------
RuleML-2008 Challenge
The RuleML-2008 Challenge is one of the highlights of RuleML-2008. It
addresses the system demonstration for practical use of rule technologies in
distributed and/or Web-based environments. The focus of the challenge is on
rule technologies (including rule languages and engines), interoperation and
interchange. The challenge offers participants the chance to demonstrate
their commercial and open source tools, use cases, and applications. Prizes
will be awarded to the two best applications. All accepted demos will be
presented in a special Challenge Session.
More details in: http://2008.ruleml.org/challenge.php
--------------------------------------------------------------------
Important Dates
- Paper Submissions due June 16, 2008 (EXTENDED)
- Notification of acceptance July 22, 2008
- Final submissions due August 13, 2008
- Symposium date October 30-31, 2008
- RuleML Challenge October 30, 2008
--------------------------------------------------------------------
Submission Site is open:
http://www.easychair.org/conferences/?conf=ruleml2008
Submission guidelines:
http://2008.ruleml.org/submissions.php
Topics of Interest:
http://2008.ruleml.org/topics.php
Organizing Committee:
http://2008.ruleml.org/oc.php
Program Committee:
http://2008.ruleml.org/pc.php
=====================================================================
Co-located with:
The 11th International Business Rules Forum
http://www.businessrulesforum.com
=====================================================================
Sponsored by:
Gold level : Vulcan Inc (pending)
Silver level: Model Systems
Bronze level: STI Innsbruck, ruleCore, JBoss
Sponsoring opportunities: http://2008.ruleml.org/sponsoring/
=====================================================================
In Co-operation with:
AAAI, W3C, BPM-Forum, Business Rules Forum , ECCAI, OASIS, OMG,
Dallas Rules Group, Belgium Business Rules Forum,
MIT Sloan CIO Symposium,
ACM, ACM SIGART, ACM SIGMIS, ACM SIGWEB, Open Research Society,
IEEE Systems Man and Cybernetics Society
IEEE SMCS TC on Intelligent Internet Systems
IEEE SMCS TC on Distributed Intelligent Systems
IEEE Computer Society TC on Autonomous and Autonomic Systems
=====================================================================
Media Partners:
Springer LNCS, MoDo Marketing
=====================================================================
16 years, 3 months
Can drools work in multithreaded environment?
by Barath
Hi,
While doing a load test with jmeter,my web service application with drools
works fine for few clients(5 simultaneous hits for 10 times)
but when i increase my clients(120 simultanious hits for 100 times) i am
gettin the following exception for
few client, (out of 12,000 hits 200 throws this exception)
problem encountered at node [11] 5{170,189}: unable to resolve property:
null pointer exception in property: declr.identifier
org.mvel.TemplateInterpreter.execute(TemplateInterpreter.java:528)
org.mvel.TemplateInterpreter.parse(TemplateInterpreter.java:341)
org.drools.rule.builder.dialect.java.AbstractJavaBuilder.generatTemplates(AbstractJavaBuilder.java:113)
org.drools.rule.builder.dialect.java.JavaConsequenceBuilder.build(JavaConsequenceBuilder.java:95)
org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:67)
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:446)
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:304)
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
com.drools.util.RuleEngine.applyRule(RuleEngine.java:47)
com.drools.util.DroolsController.getAdvertisement(DroolsController.java:94)
com.drools.util.DroolsController.routeBusinessMethod(DroolsController.java:67)
com.drools.util.DroolsController.getAdvertisement(DroolsController.java:43)
com.drools.MyEndpoint.getAdvertisement(MyEndpoint.java:237)
com.drools.MyEndpoint.process(MyEndpoint.java:144)
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:595)
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
java.lang.Thread.run(Thread.java:619)
drl file has 6 rules,
5 rules - which retract facts which passes the rule.
1 rule(low salience) - will add the fact to java.util.List (set as global)
which passes the rule.
1 . Am i getting this error bcoz of the global list? or any other reason?
2 . How to solve this problem?
here the rules,
<code>
global java.util.List feasibleAdv;
rule " percentage rule "
when
$adv : Advertisement( percentageLimit != 0 , percentageLimit <
playedPercentage )
then
System.out.println("remove this adv (failed percentage):
"+$adv.getAdvertisementID());
retract($adv);
end
rule "per day rule"
when
$adv : Advertisement( limitperday != 0 , limitperday <= playedperday
)
then
//System.out.println("remove this adv (failed day):
"+$adv.getAdvertisementID());
retract($adv);
end
rule "per week rule"
when
$adv : Advertisement( limitperweek != 0 , limitperweek <=
playedperweek)
then
//System.out.println("remove this adv (failed week):
"+$adv.getAdvertisementID());
retract($adv);
end
rule "per month rule"
when
$adv : Advertisement( limitpermonth != 0 , limitpermonth <=
playedpermonth)
then
//System.out.println("remove this adv (failed month) :
"+$adv.getAdvertisementID());
retract($adv);
end
rule "total played rule"
when
$adv : Advertisement( totallimit != 0 , totallimit <= totalplayed )
then
//System.out.println("remove this adv (failed total played) :
"+$adv.getAdvertisementID());
retract($adv);
end
rule "advertisement select rule"
salience -1
when
$adv : Advertisement( $playedPercentPerAdvertisement :
playedPercentPerAdvertisement)
not( Advertisement( playedPercentPerAdvertisement <
$playedPercentPerAdvertisement ) )
$advertisementCount : Integer()
then
boolean status = true;
if($advertisementCount-1 < 0){
//System.out.println("halted");
status = false;
drools.halt();
}
if(status){
feasibleAdv.add($adv);
drools.update(
drools.getWorkingMemory().getFactHandle($advertisementCount), new
Integer($advertisementCount-1) );
retract($adv);
}
end
</code>
--
View this message in context: http://www.nabble.com/Can-drools-work-in-multithreaded-environment--tp170...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 3 months
Re: Ruleflow-group attribute causing rule to not fire
by Roger Tanuatmadja
> From: "Roger Tanuatmadja" <rogerst(a)gmail.com>
> To: rules-users(a)lists.jboss.org
> Date: Mon, 19 May 2008 11:55:19 -0700
> Subject: Ruleflow-group attribute causing rule to not fire
> Hi,
>
> I am new to both rules engine and Drools. I am currently evaluating Drools
> 4.0.7 for use in our new project.
> Basically I have been writing a bunch of individual rules and things have
> been fine, the rules that I expected to fire were fired, etc, etc. I then
> proceeded to investigate rule flows. I started innocently enough i.e. adding
> the ruleflow-group attribute to some of my rules. I also defined a ruleflow
> mapping (.rfm).
>
> I then reran my unit-tests (WITHOUT reading the rules in as rule flows) and
> some of my rules were no longer firing!!. I added an Agenda Listener to my
> code and
> 1. without the ruleflow-group attribute, activations were created, and
> fired.
> 2. with the ruleflow-group attribute, activations were created but not
> fired.
>
> Using the debugger yielded the same logical outcomes i.e. without the
> ruleflow-group attribute, my breakpoints were hit, but with the attribute
> specified, none of my breakpoints were hit.
>
> My question is: Is this behavior expected? And why? Especially since some
> other rules (with the attribute specified) continued to work. I've read the
> documentations as much as possible, but I am really new to this field so I
> might not even know what questions to ask either.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Roger
>
>
>
>
16 years, 3 months
More than one agenda group for a rule?
by Bagwell, Allen F
I was wondering (hoping) that there is a way to put a rule into more than one agenda group?
I've tried writing:
rule "example"
agenda-group "process x stuff"
agenda-group "process y stuff"
when
(blah, blah, blah)
then
(blah, blah, blah)
end
But while the compiler has no problems with this it really only includes the rule in the last agenda-group listed.
Thanks,
Allen
16 years, 3 months
rule algorithm
by thomas kukofka
Hello,
I search a rule implementation for the following calculation:
I have n Objects of differents types (A, B, C, ...) each with a parameter
certainty.
the overall certainty is calculated as follows: certaintyOverall =
(certaintyA * weightA + certaintyB * weightB + ... ) / (weightA + weightB +
...)
If it can be assumed that all Objects in the formula always exist it's quite
easy:
when
A (certaintyA: certainty)
B (certaintyB: certainty)
...
then
certaintyOverall = (certaintyA * weightA + certaintyB * weightB + ... ) /
(weightA + weightB + ...)
But if one ore more objects are missing the formula should be reduced to the
certainty and weights of the existing objects. But there are too many
combinations of existing/nonexisting objects. How can this be implemented in
Drools?
Regards
Thomas
16 years, 4 months
Rule engine comparison/due diligence
by Stephen Kestle
Has anybody tried to evaluate the different rules engines in the
interests of using it in their companies' technology stack? I've got to
do some due diligence, so need to evaluate the others.
Specifically, we're looking at a dynamic data model (not OO), and so
that needs to be supported in some way (which I am heavily evaluating
for drools :)). There are plenty of other criteria, but the show
stoppers are:
* unable to support a dynamic data model (being able to type
different structures with the same object base, and to a lesser
degree being able to compose those types into other dynamic types)
* Lack of support (either community or commercial)
* Lack of rule management (activation and expiry dates for rules)
Also high on the list are:
* DSL support
* rule composition and reuse (I don't really know much about how
this this concept plays out with rules yet)
* Testing: the person creating the rules can write the tests, in the
same designer
* Auditing and understanding how the engine got to the state it's in
So far I've found about 15-20 engines. Hopefully most of them will fall
out of the early criteria :)
Cheers
Stephen
16 years, 4 months
Rule compilation error
by Ravi Krishnamurthy
Hello:
I had generated the decisiontable using the eclipse plugin for drools
4.x. using the eclipse the DecisionsampleTest works fine but on running
it from the command line gets the following error:
/C:\FirstDroolPrj\bin>java com.sample.DecisionTableTest
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=HelloWor
ld_11, agendaGroup=MAIN, salience=0, no-loop=false]
com/sample/Rule_HelloWorld_11_0.java (8:411) : The method
update(Decisio
nTableTest.Message) is undefined for the type Rule_HelloWorld_11_0
com/sample/Rule_HelloWorld_11_0.java (9:453) : The method
update(Decisio
nTableTest.Message) is undefined for the type Rule_HelloWorld_11_0
at org.drools.rule.Package.checkValidity(Package.java:419)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:2
92)
at
com.sample.DecisionTableTest.readDecisionTable(DecisionTableTest.java
:62)
at com.sample.DecisionTableTest.main(DecisionTableTest.java:35)
/
Have attached the .xsl and the DecisionTableTest for the reference.
Thanks for your help and time,
Regards,
Ravi
16 years, 4 months