how to check reference
by Sikkandar Nawabjan
Hi,
we are using drools version 3.0.6. I want to check the object references of t inserted objects in working memory.
How to check the condition in LHS?
right now am doing the following way
when
$obj1:object()
$obj2:object()
then
if($obj1!=$obj2)
System.out.println("Fired");
how to move the if(if($obj1!=$obj2)) statement to LHS? am not able to use this operator in version 3.0.6
Thanks and Regs.
Basha
17 years, 6 months
problem in DRL to XML conversion
by Niloy Debnath
hi ,
i want to convert a DRL file into its equivalent XML file using JbossRules-3.0.5. i have used two methods for this conversion
Method 1:
In this method i've taken a DRL file as an input and converted it into its equivalent XML file. i've attached a sample program named FibonacciDrl2Xml which will help you to understand my first method.
Method 2:
In this method i dont want to take any rule file as an input. i want to create the rule objects and through dump method of XmlDumper class i want to convert it into XML
now problem arises here...i can bind the RHS part with PackageDescr but not the LHS part because we can not bind LiteralDescr,FieldBindingDescr,ColumnDescr etc with the PackageDescr and dump method only take PackageDescr object as a parameter.so i've modified the existing XmlDumper class as per my requirement and converted HelloWorldExample into its equivalent XML.
i've attached HelloWorldXml file which will give you a clear view about my program where i created the rule objects and xmlDump which is modified version of XmlDumper as per my requirement .
now i need to make xmlDump class more generic for method 2. How do i do that? i've tried lot but i failed. i need your help.
thanking you,
with regards,
Niloy Debnanth
(student)
---------------------------------
Heres a new way to find what you're looking for - Yahoo! Answers
17 years, 6 months
Drools basic questions.
by Mithun
hi all,
I am new to Drools, so i have some basic questions. I am sorry if my
questions sound silly. Please help.
1. What does it mean when you prefix a variable with a dollar sign in a .drl
file? If possible give a simple example please.
2. Please explain the following line of code:
- Person( likes : favouriteCheese )
This is my understanding of the above code.
- 'favouriteCheese' is a global variable which we are assingining
to 'likes' and an object of type 'Person' is created
by seding 'likes' as a paramerter to the constructor. Please
correct me if i am wrong. Thank you.
--
View this message in context: http://www.nabble.com/Drools-basic-questions.-tf3770127.html#a10659146
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
Drools basic questions.
by Mithun
I am new to drools, so i have some basic doubts.
1. what does the dollar sign represent in the following rule? what is the
difference when u prefix and dont prefix a variable with the dollar sign?
- $stilton : Cheese( type == "stilton" )
Cheesery( cheeses contains $stilton )
2. what is the difference between the following rule statements ?
- cheapStilton : Cheese( type == "stilton", price < 10 ) and
- cheapStilton : Cheese( type == "stilton", price < newPrice)
how does the rule base get access to the variable newPrice, in the above
rule statement? Please help.
Thank you.
--
View this message in context: http://www.nabble.com/Drools-basic-questions.-tf3770003.html#a10658753
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
Checking Attributes of objects contained within other ones
by Ronald R. DiFrango
All,
I want to do the following:
CmAdjustment( status != "Full Match", adjCmNumber : cmNumber, adjCmQuantity
: availableQuantity, originalRepaymentCode.tolPercent ==
Constants.ACCEPT_ALL)
But it seems like I can not inspect the attributes of class that is
contained within the top level one that is passed into working memory.
Is utilizing eval my only option or are there others? I was thinking
something like the following:
CmAdjustment( status != "Full Match", adjCmNumber : cmNumber, adjCmQuantity
: availableQuantity, repayCode: originalRepaymentCode)
eval(repayCode.tolPercent == Constants.ACCEPT_ALL)
The problem I see with this is performance as I have large data sets and a
fairly large rule set.
Thanks,
Ron
17 years, 6 months
Alpha Node Sharing Issue
by Shahad Ahmed
I have a question about alpha node sharing in release 4.0MR2. In the API for
class RuleBaseConfiguration there is a method to turn alpha node sharing on
and off. However, I get some odd behaviour when I turn it off and I was
hoping someone can help me understand what's going on. I'll illustrate the
behaviour with the two rules "First" and Second" defined below. Both rules
work with a class Customer, which is a simple object with attribute age.
rule "First"
salience 10
when
c: Customer(age <= 10)
then
System.out.println("First - Customer age less than 10");
end
rule "Second"
salience 5
when
c: Customer(age <= 10)
then
System.out.println("Second - Customer age less than 10");
end
In the default case where alpha node sharing is on, I assert a customer with
age 5 and fireAllRules to get the following (hopefully, correct) output:
First - Customer age less than 10
Second - Customer age less than 10
However, if I set the setShareAlphaNodes(false) to turn off alpha node
sharing I get the following output:
First - Customer age less than 10
Reading the manual, I had assumed that the alpha node sharing was just an
optimization, and switching it off may be inefficient, but would give the
same output for the example rules. Is this correct, or have I missunderstood
alpha node sharing. I've tried switching off alpha node sharing both
directly via the API method, and using the system property option, but the
behaviour is the same in both cases.
Regards
Shahad
17 years, 6 months
RE: [rules-dev] Rule-Flow in Rules 4.0 M2 and ruleFlowGroups
by Anstis, Michael (M.)
Have you set the RuleFlowId of the Rule Flow you're designing?
Click on the white background and change the RuleFlowId in the properties view.
This is the Id of the RuleFlow to invoke with startProcess(<RuleFlowId>).
Any rules with "ruleflow-group" attribute set to match those in your RuleFlow will execute.
Any rules without a "ruleflow-group" attribute set will execute on FireAllRules().
I hope this solves your problem.
CC'ed to Users Group for information.
-----Original Message-----
From: rules-dev-bounces(a)lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of Mahler, Bjoern (EXTERN: LINEAS)
Sent: 14 May 2007 12:18
To: rules-dev(a)lists.jboss.org
Subject: [rules-dev] Rule-Flow in Rules 4.0 M2 and ruleFlowGroups
Hello...
I don't know whether it's a bug or something else... - i'm currently
evaluating the new version m2 and especially the rule-flow feature, which
would be the yet missing part for us to use drools.
So after creating a testflow.rf with your editor i've put the created
.rfm-file in the context as sugested on the blog/release-notes:
processBuilder.addProcessFromFile(new
InputStreamReader(DroolsTest.class.getResourceAsStream( "/testflow.rfm" ) )
);
After invoking the rules with workingMemory.startProcess("test"); and/or
workingMemory.fireAllRules(); nothing happened... A look in the sources and
the rfm-xml-file shows, that the element <ruleFlowGroup> is empty! I would
have expected the name of the group at this point... After changing this to
the desired string, the behaviour looks more expecting ;)
The problem is, that the .rfm file is regenerated after editing the rf-file
so changes to that will be lost...
Is it a bug or did i something wrong?
TIA
Björn
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
17 years, 6 months
exception
by fakhfakh ismail
hello,
first sorry for my bad english
I want to trigg an exception in the RHS
rule "userrole1"
no-loop true
when
$user1: Users($nameuser : name,isconnect == true)
and
$CurrentAct : Nodes($name1 : name, isthecurrent==true)
and
$PrecedentAct : Nodes($name:name ,executor==$nameuser )
and
$lien: Edges(nodeOut == $name1,nodeIn ==$name )
then
try
{
throw new EngineException("Project cannot be terminated. Some nodes are still active");
}catch(Exception e)
{
}
end
but the problem is an error is affiched:
at hero.client.test.Rule_userrole5_0.consequence(Rule_userrole5_0.java:1
1)
at hero.client.test.Rule_userrole5_0ConsequenceInvoker.evaluate(Rule_use
rrole5_0ConsequenceInvoker.java:18)
at org.drools.common.DefaultAgenda.fireActivation(Unknown Source)
at org.drools.common.DefaultAgenda.fireNextItem(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.common.AbstractWorkingMemory.fireAllRules(Unknown Source)
at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at hero.client.test.Rule1.fireRules(Rule1.java:49)
at hero.client.test.Rule1.fireRules(Rule1.java:63)
at hero.client.test.ExecuteRegle.Execute(ExecuteRegle.java:39)
at hero.hook.TestHook.afterStart(TestHook.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at hero.hook.JavaHook.execute(JavaHook.java:48)
at hero.session.EngineBean.hookExecute(EngineBean.java:909)
at hero.session.EngineBean.execute(EngineBean.java:559)
at hero.session.EngineBean.startActivity(EngineBean.java:225)
at org.objectweb.jonas_gen.hero.interfaces.JOnASEngine_911450835Local.st
artActivity(JOnASEngine_911450835Local.java:47)
at hero.session.UserSessionBean.startActivity(UserSessionBean.java:3371)
at org.objectweb.jonas_gen.hero.interfaces.JOnASUserSession842454493Remo
te.startActivity(JOnASUserSession842454493Remote.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.j
ava:397)
at org.apache.axis.providers.java.EJBProvider.invokeMethod(EJBProvider.j
ava:459)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider
.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454
)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:69
9)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at sun.reflect.GeneratedMethodAccessor172.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243
)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:2
75)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.
java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(Applicatio
nFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilt
erChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:524)
at org.objectweb.jonas.web.catalina55.ResetAuthenticationValve.invoke(Re
setAuthenticationValve.java:62)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
at java.lang.Thread.run(Thread.java:595)
org.drools.spi.ConsequenceException: hero.util.EngineException: Project is hidde
n. You cannot terminate an instance of a hidden model !!
hello world
fdfdfsdfsd
---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
17 years, 6 months
declare variable
by fakhfakh ismail
Hello,
first sorry for my bad english.
I want to declare a variable of type List
rule "userrole"
when
$user1: User (userid1: userId)
$user2: User (userId == userid1)
then
List L = new ArrayList();
if (L.contains($user1.getname())== false)
{
L.add($user1.getname());
System.out.println("hello");
}
end
the problem is everytime the List don't save all element every execution the variable list is intialised as empty is there other place to declare List?
(I try after when but error of parsing)
---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
17 years, 6 months