From v 3.0.6 to 4.0.0
by Chris Woodrow
Hi everyone,
I am new to this mailing list, I've had a quick look at archives and didn't
find anything ont this subject but sorry if this has allready been
underlined.
Here is my problem, while I was doing some test on v3.0.6, 4.0.0 came out,
so I started to migrate on the new version. Then I found out an unexpecteed
behavior on the 4.0.0.
I have been compiling both with Java 5 and running whith Java 1.5.0_11. And
I used versions with dependencies on both tests.
I have made an exemple for you to make it as clear as possible, here is the
rule :
---------------------------------------------------------------------------------------
package rules
rule "TwoCheeses"
when
$cheese1 : Cheese();
$cheese2 : Cheese();
then
System.out.println($cheese1);
System.out.println($cheese2);
System.out.println("TwoCheeses");
end
---------------------------------------------------------------------------------------
When I run it on V3.0.6, with this code :
---------------------------------------------------------------------------------------
package rules;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
public class Cheese {
public static void main(String[] args) throws Exception{
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(
Cheese.class.getResourceAsStream("rule.drl")));
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
WorkingMemory workingMemory = ruleBase.newWorkingMemory();
Cheese cheese = new Cheese();
workingMemory.assertObject(cheese);
workingMemory.fireAllRules();
}
}
---------------------------------------------------------------------------------------
The rule doesn't fire, which is normal AMHA since only one Cheese object is
asserted to the WM
When I run it on V4.0.0, whith this code :
---------------------------------------------------------------------------------------
package rules;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.PackageBuilder;
public class Cheese {
public static void main(String[] args) throws Exception{
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(
Cheese.class.getResourceAsStream("rule.drl")));
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
StatefulSession statefulSession = ruleBase.newStatefulSession();
Cheese cheese = new Cheese();
statefulSession.assertObject(cheese);
statefulSession.fireAllRules();
}
}
---------------------------------------------------------------------------------------
Now the rule fires and $cheese1 $cheese2 have the same reference.
I have been searching in all docs, this modification of behavior doesn't
seem to be expected, has anyone noticed this?
Thanks for your help.
Chris
17 years, 7 months
M2 release DSL support is partial?
by Sikkandar Nawabjan
Mark,
The DSL is enabled completely or partially(engine level).
(ie) can we use the Eclipse(plugin) to create and test dsl?
since we tested M2 with eclipse and it seems the Rules are not =
acticvated when using DSL.
Our rules are very complex and we required such a Guy support to =
configure DSL and it is almost not possible to use text editor to write =
dsl/.
Please let me know about the DSL feauture that were added in this =
release
Thanks and Regs,
Basha
17 years, 7 months
Using the Rule Flow Builder GUI
by Shahad Ahmed
I've been playing with the new Ruleflow stuff in 4.0MR2 - which is cool -
and it's raised a couple of questions and observations that I hope other
users can answer.
1. Is there a way of specifying a constraint(s) on a Split node. I can
see the Split node type property can be given an AND value, but there seems
to be no way of specifying which output connections(s) should be traversed
after the split. I quick peek at the source code did reveal that the core
ruleflow stuff seems to have constraint attributes in the split node
implementation, so is this still a "Todo", or is there a way of
specifying constraints in 4.0MR2 release?
2. Am I correct in assuming that a rule can only ever belong to a single
RuleFlowGroup node (i.e. ruleset), as the rules in a RuleFlowGroup seem to
be specified by a rules (single) ruleflowgroup attribute? It appears that if
you want to reuse a rule in another RuleFlowGroup node in the ruleflow then
you have to redefine a copy of the rule and give it a different
ruleflowgroup attribute. However, if a rule could belong to several ruleflow
groups then you could reuse a rule in other RuleFlowGroup nodes in the
same ruleflow, or even in a different ruleflow. In some the applications
I've developed with commercial rules engines, it's common to have a number
of ruleflows that implement different parts of a system, but where all the
rules are defined against a common model, thus allowing some reuse of rules.
3. The Eclipse GUI ruleflow builder doesn't seem to allow loops in the flow.
It may sound a bit perverse, but is there any reason why loops should not
allowed (assuming the rule modeler is aware of the potential of infinite
loops etc)? I've implemented applications with commercial rules engines,
where looping in the ruleflow has proved useful. As I said, it may sound
perverse, but several commercial rules engines are getting to the point
where the ruleflow tools are essentially Business Process Management Systems
(BPMS). These systems mix rules and process control flow, such as split
conditions, looping and much more, to define applications within a single
framework, but that's a whole different topic.
Thanks
Shahad
17 years, 7 months
repeat result
by fakhfakh ismail
hello,
first sorry for my bad english,
is there a soluttion to avoid the repeating result?
when I execute my programme
I get solution repeat more then one:
alain ne peut pas executer cette activite
alain ne peut pas executer cette activite
alain ne peut pas executer cette activite
alain ne peut pas executer cette activite
thank u for your help
Ismail
---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
17 years, 7 months
Re: [drools-dev] async stuff
by Mark Proctor
np I took a simplified approach in the end, but I think it should
capture the main use cases.
Mark
Greg Barton wrote:
> I haven't gotten the chance to look at it yet, but I
> will. Sorry I dropped the ball on that. It's been a
> craaaaaazy year. :)
>
> --- Mark Proctor <mproctor(a)codehaus.org> wrote:
>
>
>> Greg,
>>
>> Did you checkout what I did with the async apis in
>> 4.0 MR2, happy I got
>> the balance and implementation right?
>>
>> Mark
>>
>>
>>
>>
> ---------------------------------------------------------------------
>
>> To unsubscribe from this list please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
>
>
> ____________________________________________________________________________________Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
> http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
17 years, 7 months
change "assert" to "insert"
by Mark Proctor
We have been getting querries with regards to jdk assert collision and
jboss rules assert, for this reason we are thinking of changing it to
insert for 4.0. Further to that its causing language integrations issues
for us as we expand pluggeable dialects. For this reason we are thinking
of chaning assert to insert, this would be an api change and a language
level change. I'd thought I'd throw this out to the community before we
do it. This of course breaks backwards compatability.
Mark
17 years, 7 months
How to handle priority in a rule
by Maxime
Hello,
I'm trying to find how to manage priority within a rule. Let me explain
the problem. I'll try to be as clear as possible but bear with me since
I am new to rules.
We have two objects, the Product is the object I'm trying to price and
the object Price is the one that knows all the prices. Both products and
prices have fields amount and length. Product amount is initialized to
0 and prices are going to determine the product amount depending on its
length.
Let's see an example :
Product : P -> length = 5, amount = 0
Price : P1 -> length = 1, amount = 50
Price : P2 -> length = 3, amount = 100
With this configuration, after asserting the 3 objects to the WM, the
amount field of Product P should have a value of 200 ( 1*100 + 2*50)
because the price with the greatest length should be favored over the
other ones.
Here is the rule I made :
rule "Price Product rule using price length"
when
$s : Product (length > 0)
$price : Price($length: length)
then
$s.setAmount($s.getAmount() + $price.getAmount());
$s.setLength($s.getLength() - $length.intValue());
modify($s);
end
This is obviously wrong because it always takes the first asserted price
object. I don't know how to make a rule which would take the amount of
the price object with the greatest length in priority.
Any help would be very much appreciated.
Cheers,
Max
17 years, 7 months
(no subject)
by vijay
Hi all,
I need an help can anyone help please. this is to check the list using drools
i have 2 list in a bean as its variables and using set method im assigning them certain values i need to perform equal ,greater and lesser check on this list elemnts using drools. do any one has any idea how to do it .
anyone help please!!!
Thanks
Vijay
"Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world"
-- Albert Einstien
17 years, 7 months
(no subject)
by lucio@asteriski.com
---------------------------------
Lucio Piccoli
Director
Asterisk-i Pty Ltd
Software Design-Develop-Deploy
www.asteriski.com
17 years, 7 months
Exception occurs when deploy drools rule in jboss
by He Jianfei
Hi:
My drools rules application is deployed in JBoss, and my classpath
includes these jars:
activation.jar help.jar
jcs-1.2.5-dev.jar mail.jar
AdventNetLogging.jar
hsqldb.jar jcs.jar
mail-plugin.jar
AdventNetSnmp.jar
hsqldb-plugin.jar
JDHCP.jar montnets.jar
antlr-2.7.5.jar
janino-2.3.15.jar
jdom.jar
msbase.jar
antlr-3.0b6.jar
jaxp-api.jar
jfc_094.jar
mssqlserver.jar
asm-1.5.3.jar
jbcl.jar
jfc_common.jar
msutil.jar
autonumber-plugin.jar
jbossall-client.jar
jgroups.jar
mysql-connector-java-3.1.12-bin.jar
bcel.jar
jboss-common-jdbc-wrapper.jar
jh.jar
NetComponents.jar
bindingservice-plugin.jar
jbossha.jar
jmx-adaptor-plugin.jar
org.eclipse.jdt.core_3.2.0.v_642.jar
bsh-core-1.3.0.jar
jboss-j2ee.jar jmxri.jar
properties-plugin.jar
bsh-deployer.jar
jboss-jaas.jar
jnet.jar sax.jar
commons-collections-3.1.jar
jboss.jar jnp.jar
scheduler-plugin-example.jar
commons-lang-1.0.1.jar
jboss-jdbc_ext.jar
jnpserver.jar
scheduler-plugin.jar
concurrent.jar
jboss-jsr77.jar
jpl-pattern.jar
smproxy.jar
dnsjava-1.3.0.jar
jboss-management.jar
jpl-util.jar
snmp-support.jar
dom.jar
jboss-monitoring.jar
jsr94-1.1.jar
stringtemplate-3.0.jar
drools-compiler-3.1.0-M1.jar
jbossmq.jar
jsr94-tck-1.1.jar
xalan.jar
drools-core-3.1.0-M1.jar
jbosssx.jar jsse.jar
xercesImpl.jar
drools-decisiontables-3.1.0-M1.jar
jboss-transaction.jar
jython-20020827-no-oro.jar
xsltc.jar
dx.jar
jcert.jar
libmondem.so
groovy-all-1.0-jsr-04.jar
jconn2.jar log4j.jar
and my project is building in eclipse 3.2M5, and JBoss version 3.2.5
when JBoss runs, the following Exception occurs:
java.lang.NoSuchMethodError:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
22:17:19,159 INFO [STDOUT] at
org.apache.commons.jci.compilers.EclipseJavaCompiler$2.acceptResult(EclipseJavaCompiler.java:247)
22:17:19,159 INFO [STDOUT] at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:454)
22:17:19,160 INFO [STDOUT] at
org.apache.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:278)
22:17:19,160 INFO [STDOUT] at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:501)
22:17:19,160 INFO [STDOUT] at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:224)
22:17:19,161 INFO [STDOUT] at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:148)
22:17:19,161 INFO [STDOUT] at
com.dcampus.snms.event.mbean.RuleManage.readRules(Unknown Source)
22:17:19,162 INFO [STDOUT] at
com.dcampus.snms.event.mbean.RuleManage.initRuleBaseEngine(Unknown Source)
22:17:19,162 INFO [STDOUT] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
22:17:19,162 INFO [STDOUT] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
22:17:19,163 INFO [STDOUT] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
22:17:19,163 INFO [STDOUT] at
java.lang.reflect.Method.invoke(Method.java:585)
22:17:19,164 INFO [STDOUT] at
org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
22:17:19,164 INFO [STDOUT] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
22:17:19,164 INFO [STDOUT] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
22:17:19,165 INFO [STDOUT] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
22:17:19,165 INFO [STDOUT] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
22:17:19,166 INFO [STDOUT] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
22:17:19,166 INFO [STDOUT] at
org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:234)
22:17:19,166 INFO [STDOUT] at
org.jboss.jmx.adaptor.control.Server.invokeOp(Server.java:200)
22:17:19,167 INFO [STDOUT] at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOp(HtmlAdaptorServlet.java:241)
22:17:19,167 INFO [STDOUT] at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:79)
22:17:19,168 INFO [STDOUT] at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:61)
22:17:19,168 INFO [STDOUT] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
22:17:19,169 INFO [STDOUT] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
22:17:19,169 INFO [STDOUT] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
22:17:19,170 INFO [STDOUT] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
22:17:19,170 INFO [STDOUT] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
22:17:19,170 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
22:17:19,171 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
22:17:19,171 INFO [STDOUT] at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
22:17:19,172 INFO [STDOUT] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
22:17:19,172 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
22:17:19,172 INFO [STDOUT] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
22:17:19,173 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
22:17:19,173 INFO [STDOUT] at
org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
22:17:19,174 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
22:17:19,174 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
22:17:19,174 INFO [STDOUT] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
22:17:19,175 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
22:17:19,175 INFO [STDOUT] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
22:17:19,176 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
22:17:19,176 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
22:17:19,176 INFO [STDOUT] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
22:17:19,177 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
22:17:19,177 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
22:17:19,178 INFO [STDOUT] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
22:17:19,178 INFO [STDOUT] at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
22:17:19,179 INFO [STDOUT] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
22:17:19,179 INFO [STDOUT] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
22:17:19,180 INFO [STDOUT] at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
22:17:19,180 INFO [STDOUT] at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
22:17:19,181 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
and I get some solution from the website,
http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesTomcat, so i add the
following code in my application,
but after done, the same Exception occurs.
PackageBuilderConfiguration pkgBuilderCfg = new
PackageBuilderConfiguration();
pkgBuilderCfg.setCompiler(PackageBuilderConfiguration.JANINO);
isn't it some wrong with my following rule file?
package com.dcampus.snms.event.mbean
import com.dcampus.snms.event.model.EventLogInfo
rule "Event filter"
no-loop true
when
$e1:EventLogInfo(eventId1:eventId,time1:time,sourceIp1:sourceIp)
$e2:EventLogInfo(eventId2:eventId,time2:time,sourceIp2:sourceIp,
(eventId2 == eventId1),
(time2.getTime()-time1.getTime()<60000),
(time2.getTime()-time1.getTime()>0),
(sourceIp2.equals(sourceIp1))
)
then
$e2.setCorrelationId($e1.getCorrelationId());
$e2.setCause($e1.getCause());
System.out.println("Succeed!");
end
rule "virus"
when
$e1:EventLogInfo(eventId1:eventId,time1:time,sourceIp1:sourceIp,
(eventId1==2012)
)
$e2:EventLogInfo(eventId2:eventId,time2:time,sourceIp2:sourceIp,
(eventId2==2022),
(sourceIp2.equals(sourceIp1)),
(time2.getTime()-time1.getTime()<60000)
)
then
$e2.setCause("virus");
$e1.setCause("virus");
end
rule "high threshold"
when
$e1:EventLogInfo(eventId1:eventId,time1:time,sourceIp1:sourceIp,
(eventId1==2012)
)
$e2:EventLogInfo(eventId2:eventId,time2:time,sourceIp2:sourceIp,
(eventId2==2022),
(sourceIp2.equals(sourceIp1)),
(time2.getTime()-time1.getTime() >= 60000)
)
then
$e2.setCause("high threshold");
$e1.setCause("high threshold");
end
at the same time, i run the HelloWorldExample application in JBoss, it works well and no Exception occurs.
so i was very confused...please help me, urgently.
Best regards
--
------------------------------------------------------------
He Jianfei(何剑飞)
South China University of Technology
Communication & Computer Network key Laboratory of Guangdong
Guangzhou, P.R.China,510640
Email: jfhe(a)scut.edu.cn
jianfei.he(a)gmail.com
Tel: (86)13570352756
-----------------------------------------------------------
17 years, 7 months