Tomcat 6.0 + BRMS
by john.shepherdson@bt.com
I got the Guvnor component of Drool 5M5 working with Tomcat 6.0 by doing
the following (but it doesn't seem to work for Drools 5CR1):
Remove tomcat-6.x\webapps\drools-guvnor\WEB-INF\lib\el-api-x.jar
Remove existing tomcat-6.x\lib\jsf-api.jar and jsf-impl.jar
Replace with contents of jboss_jsf_libs.zip
(downloaded from
http://download.jboss.org/drools/dependencies/jboss_jsf_libs.zip)
Edit 'repositoryConfiguration' in
webapps\drools-guvnor\WEB-INF\components.xml to point to a directory
that exists
John S
15 years, 7 months
Guvnor's Scenario returning "Error rebuilding RuleBase"
by Ingold, Jonathan
Hello,
I am receiving an "Error rebuilding RuleBase" error in Guvnor anytime I
run a scenario against rules that reference a constant. Also the
constants are not available in the scenario tool.
An example of a rule that I have used that references a constant would
be:
***********************************************
rule "First"
salience 10
when
$a : Action(task == ConstantC.UNO)
then
System.out.println("First Rule Fired");
end
*************************************************
Note "task" is a ConstantC object.
The constant UNO is declared in my java class with the line:
*******************************************************************
public static ConstantC UNO = new ConstantC(1, "One");
********************************************************************
The rule fires perfectly in Eclipse with the expected result. Could
this possibly be a bug with Guvnor? I couldn't find anything in JIRA
relating to this.
Any input is appreciated!
Thanks,
Jon
15 years, 7 months
Integrated User Configurable Rules Templates and DSL Example
by Tim Langford
Hello All,
I am very new to Drools and thinking about using it in a project.
Apologies if these questions are naive - I have read the excellent
documentation and written and run some examples but am still feeling a
little lost.
Due to the nature of the existing system the project will depend on we
want to utilize the engine such that it operates and behaves like a
'function':
1) The system will always assert a single hierarchical object into the
working memory of the required type.
2) Global variables will be attached to the working memory to provide
visibility of system objects ; and also defined a set of return
objects (to be retrieved by the host system after execution.
3) The rules will be execute to produce a set of results that will
then be acted on externally by the host system.
For example:
We assert a 'Journey' (or another object) into a working memory with
the following rule:
rule "Journey No Charge Cancellation Option"
dialect "java"
when
# There are at least "{days}" days before the journey begins
$journey : Journey( )
eval(daysToDeparture($itinerary) > 30)
then
>toDebugLog("Journey 'no charge' cancellation.", logger);
>CancelOption option =
instanceOfCancellationOption(kcontext.getRule().getName(),
"CancelProcessor", 0);
>cancelOptions.add(option);
end
function CancelOption instanceOfCancellationOption(
String ruleName,
String targetProcessor,
Integer percentageBasedCharge) {
CancelOption option = new CancelOption();
option.setInvokingRule(ruleName);
option.setTargetProcessor(targetProcessor);
option.setDepositBasedChargePercentage(percentageBasedCharge);
return option;
}
The system must support different users from different companies - so
these rules need to be 'templated'. We need to allow users to define
their own instances and constraints on any of the template rules
defined. Furthermore, they maybe from different countries so system
must use the DSL functionality to wrap the rules and parameters in
something meaningfully to them. Finally, we need to be to be able add
constraints over the rules to ensure users do not misconfigure the
rules and rules values (for example only a set of date ranges for
canceling a journey that don't overlap). We don't want to use the
spreadsheet templating mechanism. Rule configuration will have to be
provided in our weblication (and backed by the guvnor).
I could easily achieve this in pure java, groovy, etc. but would like
to condsider drools due to 1) Wanting it to be a bit more dynamic than
java (whilst not being so dynamic a user can easily make a mistake or
get confused); 2) Getting the DSL features; 3) taking advantage of the
all the rule versioning and management performed by the RMS.
Sorry for the long introduction. My questions are:
1) Is Drools an overkill such functionality? (I am no expert).
2) Is there an example that uses templating (without spreadsheets) and
DSL's somewhere? Does this work with the 'guvnor'? I have tested most
Drools functionality, but don't seem to be able to get a handle on
using all together to achieve this goal.
Any insight or recommendations will be greatully recieved.
Thanks
Tim
15 years, 7 months
Drools-4.0.7 + OC4J
by Vir
Hi all,
I am new to drools. I am facing a very strange issue while working with
JDeveloper + OC4J 10 + Drools 4.0.7. If I execute my "hello world" program
in "debug" mode of JDeveloper then all my rules are working properly. But
when I execute it in "run" mode then execution stops at following line
builder.addPackageFromDrl(new
InputStreamReader(CreditExample.class.getResourceAsStream("/abc.drl")));
Also there is no exception thrown. I don't know what is the problem at
run time. Can anyone please help me out
Thanks
Vir
--
View this message in context: http://www.nabble.com/Drools-4.0.7-%2B-OC4J-tp23190680p23190680.html
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
"==" operator does not work on float and double type
by Zeke
Hi, All:
My drl file is like below:
package org.drools.examples;
import org.drools.examples.HelloWorldExample.Message;
rule "check deep int"
dialect "java"
when
m:Message( sec.fir.d == "99.9" )
then
System.out.println( "===check deep double ok===" );
end
I find that "==" operator does not work well on double and float type.
This condition can not be satisfied. If I change the condition to sec.fir.d
< "100" or sec.fir.d > "99.8", it works well. Is it a bug?
I attach my test code. And I add below jars into classpath:
antlr-runtime-3.0.jar
core-3.2.3.v_686_R32x.jar
drools-compiler-4.0.7.jar
drools-core-4.0.7.jar
drools-decisiontables-4.0.7.jar
drools-jsr94-4.0.7.jar
janino-2.5.10.jar
jsr94-1.1.jar
mvel-1.3.12-java1.5.0.jar
Can anyone kindly help me?
Thanks!
- Zeke
15 years, 7 months
When-becomes-true semantics
by Allan Terry
I am looking for the following semantics:
Lets say I have a Boiler class with location, temperature, and pressure
fields.
I write a rule like When Boiler(temperature > 240) then ....
I want the rule to trigger when its condition becomes true, not when it
is true in all cases. I don't want it to trigger again if the facts
change but the condition is still true. The actions may have adverse
consequences if fired too freely.
Example:
Event with temperature set to 250. Rule should fire
Another event for the same boiler with temperature = 270. Rule is still
true, should not fire
Now set its temperature to 100. Rule should not fire
Set temperature to 260. It has become true again and should fire.
Multiple clauses should not change things. When the entire condition
becomes true, the action is activated. The facts tested in the various
clauses will vary with time, but as long as the condition remains true,
the action should not be triggered with each change.
I tried this with one class and one event which I repeatedly modified.
It fires when a new value satisfies the condition, whether or
not it was true before.
Interestingly, this worked for classes with a single field, but as soon
as I added multiple fields I started getting the "is true" semantics.
If that isn't native semantics for RETE, is there a reasonable approach I
could take to layer it on, considering I want all my rules to act this way?
thanks, Allan
15 years, 7 months
drl file in Oracle database
by Lindy hagan
We cannot deploy drl files in the file system, looking at storing the drl
file as CLOBs or BLOBs in our Oracle database. Our servers are clustered
across different machines. Has anyone run into any issues or have any
recommendations on this approach?
15 years, 7 months
I want only first rule to be executed even more than one rule are fulfilling the LHS
by Manish1985
Hi All,
Assume that following is the case,
rule "Rule1"
when
t:Test(status==10)
Test(testValue > 90)
then
t.percent=5;
modify(t);
end
rule "Rule2"
when
t:Test(status==10)
Test(testValue> 80)
then
t.percent=10;
modify(t);
end
rule "Rule3"
when
t:Test(status==10)
Test(testValue > 50)
then
t.percent=15;
modify(t);
end
Here, based on each condition i will assign percentage value.
Assume that testValue is 100 and status is 10 so it will be evaluated true
for each rule
but i dont want that. i want Rule1 to be evaluated and then it should stop
executing other rules other wise percetage value will be different from what
i want.
(15 instead of 5).
I can do this by adding one more condition in every rule like
Test(percent==0)
and initially i will intialize Test.percent by zero so only first Rule will
be evaluated/executed.
But is there any other way apart from these?
One more thing is that in decision table i want to add OR between two
conditions.
How can i do that? please give me example for doing that.
Thanks a lot in advance.
Regards,
Manish
--
View this message in context: http://www.nabble.com/I-want-only-first-rule-to-be-executed-even-more-tha...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 7 months
Problem using 'not contains'
by Bagwell, Allen F
This is in Drools 4.0.7
I have a class called SatManager with a field:
ArrayList<Satellite> listOfOverheadSats
That has an appropriate getter method.
I have a relatively simple rule that goes something like this:
when
$sat : Satellite(isOverhead == true)
$sm : SatManager($ls : listOfOverheadSats not contains $sat)
then
$ls.add($sat);
My problem is that Drools doesn't understand that the ArrayList has been modified, therefore this rule always fires on the same satellite if the sat object changes in any other way.
I've tried adding:
update($sm);
To the consequence, but that only caused the rule to re-fire infinitely -- even with the no-loop keyword applied.
So my question is how does Drools manage its knowledge of changes to Collections embedded in fact objects? The documention for the 'contains/not contains' keyword did not explain this.
I'm really stumped here.
Allen F. Bagwell
e-mail: afbagwe(a)sandia.gov
phone: 505/284-4517
fax: 505/ 844-7886
Ask your doctor if medical advice from a TV commercial is right for you.
15 years, 7 months