Help Problem with kind of minimization
by l'ami molette
Hi, I’m a
new user of JBossRules, and I have difficulties to solve a problem using
jBossRules.
I have two
classes (AClass.java & Bclass.java). Each one have a number (an
"int" value (AClass.getNum() & BClass.getNum())
, and I
want to extract a Aclass & a Bclass witch have the closest numbers. In fact
I want to minimize the value:
Math.abs(AClass.getNum()
- BClass.getNum()).
I tried to
write a rule like this:
rule
"My rule"
when
ACl : Agent ($AClNum :
num , $AClNom : nom)
BCl : Poste ($BClNum :
num , $BClNom : nom)
BCl2 : Poste ()
not Agent($ACl2Num : num
-> (Aminor(CalculAbsolue($ACl2Num.intValue(),BCl2.getNum()) ,
CalculAbsolue($AClNum.intValue(),$BClNum.intValue()) )))
then
System.out.println("Selected
: "+ ACl.getName() +" "+BCl.getName()+" diff: "+
CalculAbsolue(ACl.getNum(),BCl.getNum()));
retract(ACl);
retract(BCl);
end
function int CalculAbsolue(int a, int b){
return
Math.abs(b-a);
}
function boolean Aminor(int a, int b){
return
a < b;
}
--> But the rule doesn't work.
Does anyone have an idea to solve my
problem?
Thank you very much for your help.
Olivier Lafon
PS : (excuse
my English, I’m French)
_________________________________________________________________
Exprimez-vous : créez la page d'accueil qui vous ressemble avec Live.com.
http://www.live.com/getstarted
17 years, 7 months
Regarding using lessthan(<) and lessthan or equal(<=) operator in rules file
by Mahaan
Hi All,
I am using lessthan(<) and less than or equal (<=) operator in LHS part of a
XML rule file which is like this.
<eval> obj.getValue < 10 </eval>
but when i am giving it to rule engine for execution, its throwing the
following exception:
(null: 1, 214): cvc-elt.1: Cannot find the declaration of element 'package'.
(null: 1, 569): The content of elements must consist of well-formed
character data or markup.
RuleException(javax.rules.admin.RuleExecutionSetCreateException: cannot
create rule execution set), root cause(
org.drools.compiler.DroolsParserException)
at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(Unknown
Source)
at com.unisys.mint.admin.rules.MCPRuleEngine.applyRule(
MCPRuleEngine.java:104)
at com.unisys.mint.sdk.services.managerules.MCPRuleManager.applyRule(
MCPRuleManager.java:63)
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.applyRule(
TestNewRuleClass.java:124)
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.main(
TestNewRuleClass.java:40)
Caused by: org.drools.compiler.DroolsParserException
at org.drools.compiler.PackageBuilder.addPackageFromXml(Unknown Source)
... 5 more
Caused by: org.drools.compiler.DroolsParserException
at org.drools.compiler.PackageBuilder.addPackageFromXml(Unknown Source)
at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(Unknown
Source)
at com.unisys.mint.admin.rules.MCPRuleEngine.applyRule(
MCPRuleEngine.java:104)
at com.unisys.mint.sdk.services.managerules.MCPRuleManager.applyRule(
MCPRuleManager.java:63)
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.applyRule(
TestNewRuleClass.java:124)
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.main(
TestNewRuleClass.java:40)
java.lang.NullPointerException
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.applyRule(
TestNewRuleClass.java:125)
at com.unisys.mint.sdk.services.managerules.TestNewRuleClass.main(
TestNewRuleClass.java:40)
cannot create rule execution set
please help me to solve this.
Thanks in advance,
Mahantesh.
17 years, 7 months
multiple rule files
by liqundu@aol.com
Hi,
Does anyone know whether drools is thread safe? I need to create multiple RuleBase objects, and each loads its own rule file. Is this safe?
Thanks,
Liqun
________________________________________________________________________
AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com.
17 years, 7 months
Understanding "rule flow"
by Anstis, Michael (M.)
Hi,
So 4.0M2 will have "rule flow" ("Ruleflow: when you absolutely
positively have to make something happen in the right order", Michael
Neale 12/03/2007) bundled with it.
This will be a terrific benefit to our user base who will struggle
untold issues trying to understand and write rules that should have no
order of precedence (they like the procedural "do A", "do B", "do C"
approach!). What I would like explained though is how ruleflow affects
the function of a RETE network and hence the overall performance of a
ruleset. I see from Kris Verlaenen's blog that the ruleflow definitions
are divorced from the rule definitions and therefore suspect (as proven
by a trawl through the code) that ruleflow works with the current
concepts of agenda, agenda groups and activation groups.
I can see from the source that RuleFlowGroups control what activations
are added to the Agenda but am uncertain of the relationship between
RuleFlowGroups and RuleFlow definitions and rules themselves.
Is it possible, time permitting ;-), that somebody with the relevant
knowledge could put a few words together to explain how RuleFlow works?
With kind regards,
Mike
17 years, 8 months
Using drools within the Oracle JVM
by CaryD
Has anyone ever tried to load a version of drools into the Oracle database
such that it would reside in the Oracle JVM? The Oracle JVM only supports a
version of the JRE back at 1.3 or so. However, I would be interested in
trying one of the old versions of drools just to see. Of course this may be
swimming a little backstream in terms of Java development. However, I have
some Java code running in the database that I would like to use drools with
and I want an option to kicking out to an application server for the drools
interface.
Thank you in advance for you help.
Regards,
Cary
--
View this message in context: http://www.nabble.com/Using-drools-within-the-Oracle-JVM-tf3688933.html#a...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 8 months
ImputDrl
by fakhfakh ismail
Hello,
First sorry for my bad english,
I set all the class .java is in package hero.client.test
and the file .drl is in folser Drl
the call of file .drl
InputStream in = DroolsTest.class.getResourceAsStream("Drl/Sample.drl");
but the problem is they didn't find the file .drl
always an exception is affiched
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
at org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExecutionSet(Unknown Source)
at hero.client.test.DroolsTest.main(DroolsTest.java:34)
Please I need your help
Best regards
Ismail
---------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
17 years, 8 months
RE: [rules-users] error compilation
by Hehl, Thomas
If you download the jBoss rules with Dependencies file, it comes with
string-template.jar. Use this.
_____
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of fakhfakh ismail
Sent: Thursday, May 03, 2007 6:03 AM
To: jboss rules
Subject: [rules-users] error compilation
hello,
when I execute my code an error is affiched
[java] Exception in thread "main" java.lang.NoClassDefFoundError:
org/antlr/stringtemplate/StringTemplateGroup
[java] at org.drools.semantics.java.RuleBuilder.<clinit>(Unknown
Source)
[java] at org.drools.compiler.PackageBuilder.addRule(Unknown
Source)
[java] at org.drools.compiler.PackageBuilder.addPackage(Unknown
Source)
[java] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown Source)
[java] at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExe
cutionSet(Unknown Source)
[java] at
org.drools.jsr94.rules.admin.LocalRuleExecutionSetProviderImpl.createRuleExe
cutionSet(Unknown Source)
thank you for your help
Best regards
Ismail
_____
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes
sur Yahoo! <http://fr.rd.yahoo.com/evt=42054/*http:/fr.answers.yahoo.com>
Questions/Réponses.
17 years, 8 months