"From" clause and connection time outs - suggestion
by Arjun Dhar
Hi,
in a load intensive operation, if a pool of JDBC connections is exausted
the 'from' breaks. Ok, it should! (Not expecting magic :o) ) ,.. but I'm
concerned about the trace it generates.
The stack trace does not suggest the ground reality and is very abstract. Can
you have an enhacement to wrap the actual exception or atleast say somewhere
he "from" failed?
org.mvel.MVEL.executeExpression(MVEL.java:219)
org.drools.base.dataproviders.MVELDataProvider.getResults
(MVELDataProvider.java:45)
... I could figure out from the following lines what was wrong, but someone
else may not be able to figure it out. It's not that big a deal, but just a
suggestion since I think in high load conditions this would be a common error.
Full trace below
===============
java.lang.reflect.InvocationTargetException
org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:54)
org.mvel.optimizers.impl.refl.VariableAccessor.getValue
(VariableAccessor.java:39)
org.mvel.ASTNode.getReducedValueAccelerated(ASTNode.java:174)
org.mvel.MVELRuntime.execute(MVELRuntime.java:87)
org.mvel.CompiledExpression.getValue(CompiledExpression.java:98)
org.mvel.MVEL.executeExpression(MVEL.java:219)
org.drools.base.dataproviders.MVELDataProvider.getResults
(MVELDataProvider.java:45)
org.drools.reteoo.FromNode.assertTuple(FromNode.java:61)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple
(SingleTupleSinkAdapter.java:20)
org.drools.reteoo.JoinNode.assertObject(JoinNode.java:162)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:317)
org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130)
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject
(CompositeObjectSinkAdapter.java:308)
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:168)
org.drools.reteoo.Rete.assertObject(Rete.java:168)
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)
org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:70)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:848)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:623)
org.drools.reteoo.ReteooStatelessSession.execute
(ReteooStatelessSession.java:135)
com.gryphonnetworks.brms.sessions.RulesEngineSessionJBossRules4.execute
(RulesEngineSessionJBossRules4.java:113)
17 years, 3 months
Support for MVEL-Projections in Drools
by Manjax23
Does Drools support MVEL-Projections?
If yes, could someone please illustrate an example.
>Projections allow you to extract elements out of a complex object graph
into a single uniform collection.
> For example, if you have a list of User objects, and you want to get a
> list of the names of the users, assuming the User has a bean property for
> name:
userNames = (name in users)
Thanks,
manjax23
--
View this message in context: http://www.nabble.com/Support-for-MVEL-Projections-in-Drools-tf4267685.ht...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
dsl mapping for and/or
by hypnosat7
hi is it possible to have a dsl providing users to write somthing like :
bool1 AND bool2 OR (bool4 AND bool5)
I tried to use eval and the mapping bellow :
TELS QUE {v1} ET ({v2} OU {v3}) --> eval({v1} && ({v2} || {v3}));
In my drl I have this condition : TELS QUE EA001 ET ( N OU F )
But it seems not working :
testFromMessage/Rule_indicateur___facturer_0.java (15:551) : Syntax error
on token "OU", invalid AssignmentOperator
testFromMessage/Rule_indicateur___facturer_0.java (15:554) : F cannot be
resolved
--
View this message in context: http://www.nabble.com/dsl-mapping-for-and-or-tf4266238.html#a12141603
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Re: [rules-users] DSL editor
by hypnosat7
hi,
I have the same question concerning the "Object" in the dsl editor.
Thanks
megoy1 wrote:
>
> Did you ever get an answer to this? I was thinking the same thing.
>
>
> cmathrusse wrote:
>>
>> I'm using JBoss Rules 4.0MR2. I've installed the Eclipse IDE as well and
>> begining to work with the DSL editor. It seems to be rather easy and
>> intuitive
>> except for one thing. The editor provides edit fields for Expression,
>> Mapping,
>> Object and scope. All of which make sense except for Object. What is this
>> used
>> for? There doesn't seem to be any reference to this field in the
>> documentation.
>> Can someone please privde me with an explanation and perhaps an example?
>>
>> Thanks very much....
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
--
View this message in context: http://www.nabble.com/DSL-editor-tf3885450.html#a12140875
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Problems with BRMS
by Felipe Piccolini
Im having problems using the BRMS 4.0GA and BRMS 4.0 stand alone (v
1.0).
Things just crash without reason... importing models crash sometimes,
and trying to create LHS in business rules
got stall... not showing any option to add fact or whatever...
In standalone version I have this error trying to load a model jar:
ERROR 13-08 18:14:32,552 (ApplicationContext.java:log:675)
Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException:
java.lang.ClassNotFoundException: org.drools.brms.client.rpc.RuleAsset
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese
rialize(ServerSerializationStreamReader.java:156)
at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.re
adObject(AbstractSerializationStreamReader.java:61)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese
rializeValue(ServerSerializationStreamReader.java:70)
at
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall
(GWTRemoteServiceServlet.java:285)
at org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost
(GWTRemoteServiceServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:173)
at org.jboss.seam.web.ContextFilter.doFilter
(ContextFilter.java:56)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:541)
at org.apache.catalina.connector.CoyoteAdapter.service
(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassNotFoundException:
org.drools.brms.client.rpc.RuleAsset
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:
319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.dese
rialize(ServerSerializationStreamReader.java:135)
... 24 more
PD: I checked the classes/enums in my model jar and all of them are
Serializable...
PD2: Also have this error trying to show rule source from a business
rule in the insurance example which is included with the stand alone
brms.
Thanks
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
expander mappings empty !
by hypnosat7
Hi,
I have an error when I try to buil a package using a dsl Reader :
org.drools.lang.ExpanderException@983d95[16,1]: unknown:16:1 Unexpected
token 'une'
I try to debug it with eclipse and I find no mappings in the variable
"expander"
final String expanded = expander.expand( source );
I'ts in the method DrlParser.parse(final String source, final Reader dsl)
throws DroolsParserException
So what can be the problem
--
View this message in context: http://www.nabble.com/expander-mappings-empty-%21-tf4260034.html#a12123116
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
NoClassDefFoundError for
by Barfield Steve
Michael,
Thanks for your reply. I havn't got the hang of adding to an existing
thread in this forum, I keep starting a new one.
The original post was by Jesse Stockall jstockall at embotics.com on Tue
Jul 17 08:55:23 EDT 2007
My problem seems to be the same as Jesse's, Fernando thought it might be
a bug but I'm not sure if that was proved.
I have been having a problem with a web service loading a package
downloaded from JBRMS.
When I try this from a simple main method :
package com.fs.pidp.risk;
import org.drools.util.BinaryRuleBaseLoader;
public class readPkg {
public static void main(String[] args) {
readPkg rP=new readPkg();
rP.methodReadPkg();
}
private void methodReadPkg(){
String curDir = System.getProperty("user.dir");
System.out.println("curDir-"+curDir);
String curPath = System.getProperty("java.class.path");
System.out.println("curPath-"+curPath);
System.out.println(new java.util.Date());
try{
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream(
"/pMessage.pkg" ) );
System.out.println("readPkg.methodReadPkg - end");
}
catch(Exception e){
System.out.println("readPkg.methodReadPkg,
Exception="+e.toString());
}
}
}
this is with the pkg pMessage.pkg in the directory
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg
and the class Message.class in
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\com\fs
\pidp\risk
it loads ok :
curDir-D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg
curPath-D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPk
g;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\xs
tream-1.1.3.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\an
tlr-runtime-3.0.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\co
re-3.2.3.v_686_R32x.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\dr
ools-compiler-4.0.0.SNAPSHOT.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\dr
ools-core-4.0.0.SNAPSHOT.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\dr
ools-decisiontables-4.0.0.SNAPSHOT.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\dr
ools-jsr94-4.0.0.SNAPSHOT.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\ja
nino-2.5.7.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\js
r94-1.1.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\jx
l-2.4.2.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\mv
el14-1.2beta26.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\xe
rcesImpl-2.4.0.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\xm
l-apis-1.0.b2.jar;
D:\bea\user_projects\w4WP_workspaces\workspace1\readDownLoadedPkg\lib\xp
p3-1.1.3.4.O.jar
Tue Aug 14 01:02:12 BST 2007
readPkg.methodReadPkg - end
________________________________________________________________________
___________________________________________
When I try this from a simple web service :
package com.fs.pidp.risk;
import javax.jws.*;
import org.drools.util.BinaryRuleBaseLoader;
import weblogic.jws.Context;
import weblogic.wsee.jws.JwsContext;
@WebService
public class WsSimple {
@Context
JwsContext context;
// This is called when WL creates an instance of web service
public void context_onCreate() {
System.out.println("Webservice Object is being Created!");
}
@WebMethod
public String loadPkg() {
String curDir = System.getProperty("user.dir");
System.out.println("curDir-"+curDir);
String curPath = System.getProperty("java.class.path");
System.out.println("curPath-"+curPath);
System.out.println(new java.util.Date());
try{
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader();
loader.addPackage( this.getClass().getResourceAsStream(
"/pMessage.pkg" ) );
System.out.println("readPkg.methodReadPkg - end");
}
catch(Exception e){
System.out.println("readPkg.methodReadPkg,
Exception="+e.toString());
}
return "/pMessage.pkg";
}
}
this is with the pkg pMessage.pkg in the directory
D:\bea\weblogic92\samples\domains\wl_server
and the class Message.class in
D:\bea\weblogic92\samples\server\examples\build\serverclasses\com\fs\pid
p\risk
I get:
Webservice Object is being Created!
curDir-D:\bea\weblogic92\samples\domains\wl_server
curPath-D:\bea\weblogic92\samples\server\examples\build\serverclasses;
D:\bea\patch_weblogic920\profiles\default\sys_manifest_classpath\weblogi
c_patch.jar;
D:\bea\JROCKI~1\lib\tools.jar;D:\bea\WEBLOG~1\server\lib\weblogic_sp.jar
;
D:\bea\WEBLOG~1\server\lib\weblogic.jar;
D:\bea\WEBLOG~1\server\lib\webservices.jar;;
D:\bea\WEBLOG~1\common\eval\pointbase\lib\pbembedded51.jar;
D:\bea\WEBLOG~1\common\eval\pointbase\lib\pbupgrade51.jar;
D:\bea\WEBLOG~1\common\eval\pointbase\lib\pbclient51.jar;
D:\bea\WEBLOG~1\server\lib\xqrl.jar;;
Tue Aug 14 00:24:59 BST 2007
<WSEE>
Error invoking com.fs.pidp.risk.WsSimple (POJO):
java.lang.NoClassDefFoundError
<ComponentHandler.handleRequest:115>
<WSEE>java.lang.NoClassDefFoundError:
org/drools/base/com/fs/pidp/risk/Message$g
etStatus :
org/drools/base/extractors/BaseIntClassFieldExtractor<ComponentHandle
r.handleRequest:115>
java.lang.NoClassDefFoundError:
org/drools/base/com/fs/pidp/risk/Message$getStat
us : org/drools/base/extractors/BaseIntClassFieldExtractor
at
java.lang.ClassLoader.defineClass(Ljava.lang.String;[BIILjava.securit
y.ProtectionDomain;)Ljava.lang.Class;(Unknown Source)
at
org.drools.base.ClassFieldExtractorFactory$ByteArrayClassLoader.defin
eClass(ClassFieldExtractorFactory.java:455)
at
org.drools.base.ClassFieldExtractorFactory.getClassFieldExtractor(Cla
ssFieldExtractorFactory.java:114)
at
org.drools.base.ClassFieldExtractor.init(ClassFieldExtractor.java:77)
at
org.drools.base.ClassFieldExtractor.<init>(ClassFieldExtractor.java:5
7)
at
org.drools.base.ClassFieldExtractorCache.getExtractor(ClassFieldExtra
ctorCache.java:35)
at
org.drools.base.ClassFieldExtractor.readResolve(ClassFieldExtractor.j
ava:72)
at
java.lang.LangAccessImpl.readResolve(Ljava.lang.Class;Ljava.lang.Obje
ct;)Ljava.lang.Object;(Unknown Source)
at
java.io.ObjectStreamClass.invokeReadResolve(Ljava.lang.Object;)Ljava.
lang.Object;(Unknown Source)
at
java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unk
nown Source)
at
java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown So
urce)
at
java.io.ObjectInputStream.defaultReadFields(Ljava.lang.Object;Ljava.i
o.ObjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readSerialData(Ljava.lang.Object;Ljava.io.O
bjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unk
nown Source)
at
java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown So
urce)
at
java.io.ObjectInputStream.readObject()Ljava.lang.Object;(Unknown Sour
ce)
at java.util.ArrayList.readObject(ArrayList.java:592)
at
java.lang.LangAccessImpl.readObject(Ljava.lang.Class;Ljava.lang.Objec
t;Ljava.io.ObjectInputStream;)V(Unknown Source)
at
java.io.ObjectStreamClass.invokeReadObject(Ljava.lang.Object;Ljava.io
.ObjectInputStream;)V(Unknown Source)
at
java.io.ObjectInputStream.readSerialData(Ljava.lang.Object;Ljava.io.O
bjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unk
nown Source)
at
java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown So
urce)
at
java.io.ObjectInputStream.defaultReadFields(Ljava.lang.Object;Ljava.i
o.ObjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readSerialData(Ljava.lang.Object;Ljava.io.O
bjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unk
nown Source)
at
java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown So
urce)
at
java.io.ObjectInputStream.defaultReadFields(Ljava.lang.Object;Ljava.i
o.ObjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readSerialData(Ljava.lang.Object;Ljava.io.O
bjectStreamClass;)V(Unknown Source)
at
java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unk
nown Source)
at
java.io.ObjectInputStream.readObject0(Z)Ljava.lang.Object;(Unknown So
urce)
at
java.io.ObjectInputStream.readArray(Z)Ljava.lang.Object;(Unknown Sour
ce)
Regards, Steve Barfield, Developer
Application Services
FUJITSU SERVICES
Cavendish Road, Stevenage, Herts, SG1 2DY
* +44 (0) 870 234 8197 (Int: 7444 8197)
* +44 (0) 7867 828474
* <mailto:steve.barfield@uk.fujitsu.com
<mailto:steve.barfield@uk.fujitsu.com> >
Web: http://uk.fujitsu.com <http://uk.fujitsu.com/>
Fujitsu Services Limited, Registered in England no 96056, Registered
Office 22 Baker Street, London, W1U 3BW
This e-mail is only for the use of its intended recipient. Its contents
are subject to a duty of confidence and may be privileged. Fujitsu
Services does not guarantee that this e-mail has not been intercepted
and amended or that it is virus-free.
17 years, 3 months
Problem with "!=" field constraint
by Markus Reitz
Hi,
I have a problem with a rule which uses a "!=" field
constraint. The following code illustrates the
problem.
import org.drools.*;
import org.drools.compiler.*;
import org.drools.rule.Package;
import java.io.*;
public class DroolsTest {
private RuleBase rules;
private StatefulSession memory;
public DroolsTest(File file) throws Exception {
rules =RuleBaseFactory.newRuleBase();
memory=rules.newStatefulSession();
rules.addPackage(loadPackage(file));
}
protected Package loadPackage(File file) throws
IOException {
FileInputStream stream=null;
try {
stream=new FileInputStream(file);
return(loadPackage(stream));
}
finally {
if (stream!=null)
stream.close();
}
}
protected Package loadPackage(InputStream stream)
throws IOException {
try {
PackageBuilder builder=new PackageBuilder();
builder.addPackageFromDrl(new
InputStreamReader(stream));
return(builder.getPackage());
}
catch(Exception ex) {
throw new IOException();
}
}
public StatefulSession getSession() {
return(memory);
}
public static void main(String ... args) {
try {
DroolsTest test=new DroolsTest(new
File(args[0]));
SpecialString first42 =new SpecialString("42");
SpecialString second42=new SpecialString("42");
test.getSession().insert(new
SpecialString("World"));
test.getSession().insert(first42);
test.getSession().insert(second42);
System.out.println("Fact handle:
"+test.getSession().getFactHandle(first42));
System.out.println("Fact handle:
"+test.getSession().getFactHandle(second42));
System.out.println("Firing rules ...");
test.getSession().fireAllRules();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
I'm inserting three different objects in the working
memory of the Drools 4 Engine. Two of the three
objects have the same text - "42". When I'm using the
following rule
package test
rule "A test"
when
x : SpecialString()
y : SpecialString(this!=x)
then
System.out.println(x+"/"+y);
end
I get the output
Fact handle: [fid:2:2:42[SpecialString@fde8da]]
Fact handle: [fid:3:3:42[SpecialString@e4d6ef]]
Firing rules ...
42[SpecialString@e4d6ef]/World[SpecialString@faa824]
World[SpecialString@faa824]/42[SpecialString@e4d6ef]
42[SpecialString@fde8da]/World[SpecialString@faa824]
World[SpecialString@faa824]/42[SpecialString@fde8da]
which is not what I expect. Why are combinations of x
and y with the two "42"-instances not listed, i.e.
Why doesn't the output contain
42[SpecialString@e4d6ef]/42[SpecialString@fde8da]
42[SpecialString@fde8da]/42[SpecialString@e4d6ef]
The class SpecialString uses the standard equals(...)
and hashCode(...) implementation, so these should be
based on the object references, not the content:
public class SpecialString {
private String text;
public SpecialString(String text) {
this.text=text;
}
public String getText() {
return(text);
}
@Override public String toString() {
return(getText()+"["+super.toString()+"]");
}
}
Best regards
Markus
Wissenswertes für Bastler und Hobby Handwerker. BE A BETTER HEIMWERKER! www.yahoo.de/clever
17 years, 3 months
Question on OR operator
by Sarika Khamitkar
Hi,
I am currently using JBoss Rules 4.0 and need help with the OR operator.
The rules look similar to the following:
rule "rule1"
(Field (ID == 1, strValue matches "test") and Field (ID == 2,
lookupValue contains 7337 || lookupValue contains 3901) and Field (ID ==
3, dateValue >= "04-Jul-2000")) or (Field (ID == 4, strValue == "foo"))
then
System.out.println("rule fired");
end
The rules are constructed with data from UI and there can be multiple
nesting of OR and AND operators. As mentioned in the documentation and
earlier postings, the expected behavior is that this rule fires twice if
both the 1st and 2nd halves of the OR operator are true. As per our
requirement, the 2nd half of OR should be evaluated only if the 1st half
is false. So that way the rule can fire only once. I do not want to
retract the inserted objects as I want other rules to fire too. How can
I write this rule to get the required behavior?
Thank you.
17 years, 3 months
OR operator
by Jaikiran Pai
Hi,
This is a very newbie question. I have a Person object which contains a collection named "interests". This collection will contain the activities that the Person is interested in. If the person is interested in Golf, Soccer and Baseball, then this collection will contain these 3 strings. I am trying to write a rule which checks whether a person is interested in Soccer OR Golf and if he's interested then do further logic. I looked at the documentation for Drools syntax, and looks like this is how i have to write the rule:
rule Testing
when
person : (Person (interests contains "Golf") or Person (interests contains "Soccer") )
then
System.out.println("I am interested");
end
Is this the correct way to do this? Is there a simpler construct like:
person : Person (interests contains "Golf" or interests contains "Soccer" )
I was thinking on the lines of the "," (and) operator :
person : Person (interests contains "Golf", interests contains "Soccer" )
Thank you.
---------------------------------
Why delete messages? Unlimited storage is just a click away.
17 years, 3 months