Unexpected Token Exception
by Rajesh.Sachin10
I got the following exception when I tried to run the drl file rule.
org.drools.rule.InvalidRulePackage: unknown:13:37 mismatched token:
[@79,307:308='&&',<55>,13:37]; expecting type ')'
unknown:13:81 Unexpected token ')'
at org.drools.rule.Package.checkValidity(Unknown Source)
at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
at com.sample.DroolsTest.main(DroolsTest.java:47)
Rule:
package com.policy;
#expander Ex1.dsl;
#list any import classes here.
#import java.util.HashMap;
import java.util.Iterator;
import com.examples.Student;
import com.examples.Module;
#declare any global variables here
global java.util.List errorlist;
rule "Ex1"
when
exists( $student : Student() && Module( student == $student, score <
40 ))
then
System.out.println("fierd");
end
Files:
Class 1:
package com.examples;
public class Student {
private String name;
private Object[] modules;
public Object[] getModules() {
return modules;
}
public void setModules(Object[] modules) {
this.modules = modules;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
class 2:
package com.examples;
public class Module {
private String name;
private String studentName;
private int score;
public Module(String name, int score){
this.setName(name);
this.setScore(score);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
}
Anyone have any idea about it
--
View this message in context: http://www.nabble.com/Unexpected-Token-Exception-tf3848843.html#a10901896
Sent from the drools - user mailing list archive at Nabble.com.
18 years, 6 months
RE: [rules-users] installing eclipse plugin for rules v. 4
by Manukyan, Sergey
Thanks Mike & Mark,
It helped!
Here is what I did:
1. Downloaded
http://download.jboss.org/jbossrules/release/4.0.0.11754MR2/jbossrules-4
.0.0.11754MR2-eclipse.zip
2. Stopped RAD 7.0
3. Unzipped it to temporary folder and copied:
\features\org.drools.eclipse.feature_4.0.0.11754MR2 ->
IBM\SDP70\features
\plugins\org.drools.eclipse_4.0.0.11754MR2.jar ->
IBM\SDP70\plugins
3. Started RAD 7.0
4. The feature was disabled by default. So I went to menu:
Help/Software Updates/Manage Configuration
Clicked button show disabled feature and enabled it. Required another
restart and then it worked.
One more question, will JBoss Rules Engine v. 4 work on J2EE container
with JDK 1.4?
As I am using Webshphere 6.0 ...
Thanks again!
-Sergey
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Thursday, May 31, 2007 10:19 AM
To: Rules Users List
Subject: RE: [rules-users] installing eclipse plugin for rules v. 4
Works for me too.
I've got "org.drools.eclipse_4.0.0.11754MR2.jar" in "C:\Program
Files\IBM\SDP70\plugins".
Cheers,
Mike
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: 31 May 2007 15:10
To: Rules Users List
Subject: Re: [rules-users] installing eclipse plugin for rules v. 4
the download url works fine for me:
http://download.jboss.org/jbossrules/release/4.0.0.11754MR2/jbossrules-4
.0.0.11754MR2-eclipse.zip
You'll need to unzip that into your eclipse directory, you will also
need to make sure that GEF is installed, see the wiki for more details.
Mark
Manukyan, Sergey wrote:
> Folks,
>
> I have Rational Application Developer 7.0.0.2 , it uses Eclipse 3.2.2
>
> Need to install JBoss rules Eclipse plugin v. 4
>
> What is the best way to do it, and is it possible at all?
>
> I tried this URL:
>
http://anonsvn.labs.jboss.com/labs/jbossrules/updates/drools-ide-update/
>
> but it leads to installation of v 3.
>
> The I downloaded the zip file with v 4., but when installing it gives
an
> error:
>
>
************************************************************************
> **
> Network connection problems encountered during search.
> Unable to access
> "jar:file:C:/Sergey/jbossrules-4.0.0.11754MR2-eclipse.zip!/".
> Unable to access site:
> "jar:file:C:/Sergey/jbossrules-4.0.0.11754MR2-eclipse.zip!/" [no entry
> name specified]
> Unable to access site:
> "jar:file:C:/Sergey/jbossrules-4.0.0.11754MR2-eclipse.zip!/" [no entry
> name specified]
>
************************************************************************
> **
>
>
> Any ideas...?
>
> -Sergey
>
>
>
> **********************
> ** LEGAL DISCLAIMER **
> **********************
>
> This E-mail message and any attachments may contain
> legally privileged, confidential or proprietary
> information. If you are not the intended recipient(s),
> or the employee or agent responsible for delivery of
> this message to the intended recipient(s), you are
> hereby notified that any dissemination, distribution
> or copying of this E-mail message is strictly
> prohibited. If you have received this message in
> error, please immediately notify the sender and
> delete this E-mail message from your computer.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
18 years, 6 months
Extracting an boolean variable
by Rajesh.Sachin10
I tried to extract a boolean variable from a class using context. The
following is my code in DSL file.
context : Context(state == START_UP) Classname(aliasname :
booleanVariableName)
When I tried to run this statement I got the following error message in DRL
file.
Error Message: Unable to Create Field Extractor for 'booleanVariableName'.
But when I tried to extract a String Variable the Error is cleared.
Can Someone explain me about this problem in Drools.
Thanks.
--
View this message in context: http://www.nabble.com/Extracting-an-boolean-variable-tf3827902.html#a1083...
Sent from the drools - user mailing list archive at Nabble.com.
18 years, 6 months
Order of columns and of constraints
by Dirk Bergstrom
Does the order of columns in the rule definition, and the order of constraints
within a column matter?
For a given rule, I know which test is most likely to fail, and (probably) which
one is most "expensive" in terms of processing time (eg. 'someCollection
contains $var' is more expensive than 'field == "literal"'). I'd like to put
the fail-fast tests up front, and the expensive ones last.
Does that actually work in Drools? Can I "optimize" my rules by juggling the
order of the columns and constraints?
--
Dirk Bergstrom dirk(a)juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
18 years, 6 months
"Or" and Collect
by Dirk Bergstrom
In my ongoing efforts to abuse Drools syntax, I would like to write rules like this:
rule "severe bugs for which a member of your group is dev or support owner"
when
$group : UserGroup( )
$badBugs : List() from
collect( Bug( (devOwner memberOf $group or supportOwner memberOf $group),
severity == "hair-on-fire" )
then
$group.runAroundInStarkRavingPanicOver($badBugs)
end
Will that work? Is that the right syntax? Will it be performant if I've got
10000 Bugs and 1000 UserGroups?
According to Mark's "What's New in JBoss Rules 4.0" presentation, you can use &&
and || without subrule generation, and I have a vague memory of seeing something
about "and" & "or" as well, but I can't remember where I saw it.
Thanks.
--
Dirk Bergstrom dirk(a)juniper.net
_____________________________________________
Juniper Networks Inc., Computer Geek
Tel: 408.745.3182 Fax: 408.745.8905
18 years, 6 months
Need Help on using rules in Multiple Threads
by shilpa.raghavendra@wipro.com
Hi,
I need to know how to use rule engine in multiple thread
environment, the situation as given below
I have to handle huge records nearly 40000 so I will create
a thread contains 500 records and run it.
Each thread will execute the rules but I am not getting the
expected result.
May be the threads object are conflicting due to multiple
thread execution.
Please help me to come out of it
Regards
Shilpa
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
18 years, 6 months
How to use the value of a function in both the LHS and RHS side of the rule ?
by Krishnan
Hi,
I want to parse a file and match the file for several regular expressions.
Based on what I match, I write more
rules so that based on all the rules, I can set my results.
Brute force method : Parse the entire file and add all the lines into the
working memory. Write rules that
check each line for some regular expression. This works great.
I want to optimize the above, as we are checking each line, if we got we are
looking for, then I want to get out.
So, I wrote a function inside the rule file like the below
function String getLine(BufferedReader fileReader) {
String line;
try {
if ((line = fileReader.readLine()) != null) {
return line.toLowerCase();
} else {
System.out.println("This is an empty line.");
}
} catch (Exception ex) {
}
return line;
}
Now, I need to write the rules that will use this.
rule "Generate New Line"
when
eval (getLine(fileReader) != null)
then
System.out.println("Generate new line");
//assert(getLine(fileReader)); // need to somehow assert the line
specified in the eval condition
end
Also, I am confused, how to specify file end.
rule "File End"
when
eval (getLine(fileReader) == null)
then
System.out.println("Reached end of file"); // I am assuming this is
not needed since if all rules are executed, then it will get out of
fireRules() anyways ?
end
Any help is appreciated.
TIA,
Krishnan (newbie)
-
Sivaramakrishna Iyer Krishnan (Anand)
Never assume the obvious is true.
- William Safire
18 years, 6 months