Data Driven Object Models and BRMS validation
by Barry K
Question:
What is the best way to customize the validation in the BRMS? Is there a
callout method that exists in JBoss Rules already to override the current
validator with a custom validator?
Reason:
I have a data driven object models and my users create rules in decision
tables.
I will have a decision table column header such as
<Attribute> equals <value>
and the user will enter a value in the cell for the 3 parameters
DRIVER, age, 23
The java mapping for the condition column would be like:
eval($1.isHashmapValueEqual("$2", "$3"))
After parsing the decision table, the DRL would look like this
DRIVER.isHashmapValueEqual("age", "23");
In this scenario, I do not have a DRIVER class until the rule is parsed and
I create a proxy DRIVER class to use for rules execution. This proxy class
generation is performed on the execution side on application startup and not
on the management side. The management side never has a DRIVER to validate
the rule against.
Thanks
Barry
--
View this message in context: http://www.nabble.com/Data-Driven-Object-Models-and-BRMS-validation-tf431...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Re: [rules-users] Trouble upgrading to Drool 4.0
by Andrew Thompson
http://labs.jboss.com/jbossrules/downloads
Which is where you'll land once you navigate through from www.jboss.com instead of .org
--
Andrew Thompson
----- Original Message ----
From: Edson Tirelli <tirelli(a)post.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Thursday, August 23, 2007 8:19:17 PM
Subject: Re: [rules-users] Trouble upgrading to Drool 4.0
4.0GA is the final version. MR3 was an old milestone release, meaning, it was not feature complete and there were some changes between it and final version.
What site were you looking at? Please let us know because we need to take it down... the correct one is this:
http://labs.jboss.com/drools/downloads.html
[]s
Edson
2007/8/23,
Tim.Nguyen(a)expeditors.com <Tim.Nguyen(a)expeditors.com>:
Thanks Edson,
I am more like migrating from 3.06 to 4.0. What's the different between 4.0
GA and MR3, and where could I find the download for 40 GA? I couldn't find
any link from the website.
Best Regards,
Tim Nguyen
"Edson Tirelli"
<tirelli(a)post.com
> To
Sent by: "Rules Users List"
rules-users-bounc <rules-users(a)lists.jboss.org>
es(a)lists.jboss.or cc
g
Subject
Re: [rules-users] Trouble upgrading
08/23/2007 02:01 to Drool 4.0
PM
Please respond to
Rules Users List
<rules-users@list
s.jboss.org>
If you are upgrading, you should be upgrading to 4.0GA, not MR3.
The error is because you need to add mvel jar to your classpath.
[]s
Edson
2007/8/23, Tim.Nguyen(a)expeditors.com <Tim.Nguyen(a)expeditors.com>:
Hi,
I have been using JBoss Drool
3.06 for a few months, and now I want to
upgrade it to 4.0 to take advantage of some new features. So I downloaded
the JBoss Rules 4.0.0.MR3 Binaries, then drop 4 core drool jar files to
my
project lib
drools-core.jar
drools-compiler.jar
drools-jsr94.jar
drools-decisiontables.jar
Then I rebuilt my project, changed a few Drool java code to adapt with
4.0,
then Run. I got the following error message:
java.lang.NoClassDefFoundError:
org/mvel/intergration/VaribaleResolverFactory.
Could anyone please let me know if I am mising anything? Thank you!
PS: My Java drool was working fine with 3.0.6
Tim
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com
_______________________________________________
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
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
17 years, 3 months
Problem with BRMS (null and modify with variable)
by Felipe Piccolini
Hi,
When I try to compare an attribute against a null I got a "null"
instead... the field is an Object. (Date).
When I try to modify an attribute using the last value captured on
LHS, I cant use the variable name in the textfield.
The field type is numeric, but I need to use a formula ($var + 1)
to modify the value in the BRMS.
rule "Age uninformed"
no-loop true
ruleflow-group "age"
when
$p: Person(birthDate == null, $score: score)
then
$p.setScore($score + 5);
update($p);
end
Do I have to open a Jira for this?
Also: I didnt see a Jira, but Is it possible in the business rules
editor to add new multiple comparators in new lines???
Like this:
$p: Person(codProfession == 103 ||
== 201 ||
== 203 ||
== 204 ||
== 211 ||
== 218 ||
== 220 ||
== 403 )
Because actually this is aranged in the right side making it dificult
to manage when you have several comparatos...

Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
Re: [rules-users] Getting a NoClassDefinitionFoundError while using JBoss Drools.
by Manjax23
Put all the dependent jar files - all the drools and dependent jar files in
the classpath.
~manjax
Gaurav2007 wrote:
>
> Hi,
> I wish to use JBoss Drools rule Engine for evaluating Rules in my RCP
> Application based on Eclipse 3.2. I do this by extracting source files
> included in the Drools binary files.
>
> I get the follwing stacktrace:
>
> Unable to load dialect
> 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
> at
> org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:138)
> at
> org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:114)
> at org.drools.compiler.PackageBuilderConfiguration.
> (PackageBuilderConfiguration.java:87)
> at org.drools.compiler.PackageBuilder. (PackageBuilder.java:122)
> at org.drools.compiler.PackageBuilder. (PackageBuilder.java:88)
> at
> my package..................................
>
> caused by: java.lang.ClassNotFoundException:
> org.drools.rule.builder.dialect.java.JavaDialectConfiguration
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:402)
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:347)
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:83)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at
> org.drools.compiler.PackageBuilderConfiguration.buildDialectRegistry(PackageBuilderConfiguration.java:132)
> ... 50 more
>
>
--
View this message in context: http://www.nabble.com/Getting-a-NoClassDefinitionFoundError-while-using-J...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
BRMS Business rules Editor - RHS using variables and functions
by Felipe Piccolini
How can I use variables from LHS to modify an attribute in RHS using
business rules editor GUI??
Also I added a new function trying to work around but didnt work....
I need to get this using business rules editor (GUI):
rule "my rule"
no-loop true
when
$f: Fact(number >= 10, $s: score)
then
$f.setScore($s + 5);
update($f);
end
Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
Problems using Packages from BRMS (urls, serialization, enums..)
by Felipe Piccolini
Hi,
Im trying to test the RuleAgent to get a pkg from BRMS (url) but it
cant load the pkg (which was succesfuly
created) from the snapshot url given by BRMS. If I try to connect to
that URL I inmediatly get the pkg to download...
Tryed to debug but I stoped at
DroolsObjectInputStream oin = new DroolsObjectInputStream(in);
return (Package) oin.readObject();
at HttpClientImpl.java... the readObject() fails from ObjectInputStream.
Here is the stacktrace....
RuleAgent(testSolcredProfesion) INFO (Tue Aug 21 10:12:02 CLT 2007):
Configuring with newInstance=true, secondsToRefresh=30
RuleAgent(testSolcredProfesion) INFO (Tue Aug 21 10:12:06 CLT 2007):
Configuring package provider : URLScanner monitoring URLs: http://
localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/
cl.bluesoft.test/test_1.0 with local cache dir of /tmp/drools
RuleAgent(testSolcredProfesion) WARNING (Tue Aug 21 10:12:08 CLT
2007): Falling back to local cache.
java.lang.NullPointerException
at org.drools.agent.FileScanner.readPackage(FileScanner.java:101)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:93)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:297)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:265)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:251)
at org.drools.agent.RuleAgent.init(RuleAgent.java:183)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:140)
at cl.bluesoft.drools.api.RulesFactory.addRules(RulesFactory.java:149)
at cl.bluesoft.test.TestBRMS.main(TestBRMS.java:36)
-------
Also downloaded the pakage from the BRMS and used simple
BinaryRuleBaseLoader:
BinaryRuleBaseLoader loader = new BinaryRuleBaseLoader(ruleBase);
loader.addPackage( CONTEXT_CLASS_LOADER.getResourceAsStream
( binaryPackageFilePath ) );
but I have a problem with serialization... my first thought was about
different mvel jars, replaced mvel jar in my classpath with the one
in BRMS war, but
the problem is still there... Im using Enum clases (enum types from
1.5), maybe this is the problem?... because I cant set the
serialVersionID in enums.
org.drools.RuntimeDroolsException: java.io.InvalidClassException:
org.mvel.CompiledExpression; local class incompatible: stream
classdesc serialVersionUID = -8459552198577984707, local class
serialVersionUID = -1994048675652702021
at org.drools.util.BinaryRuleBaseLoader.addPackage
(BinaryRuleBaseLoader.java:100)
at org.drools.util.BinaryRuleBaseLoader.addPackage
(BinaryRuleBaseLoader.java:67)
at cl.bluesoft.drools.api.RulesFactory.addRulesBinPkg
(RulesFactory.java:105)
at cl.bluesoft.solcred.TestSolcredProfesionBinPkg.main
(TestSolcredProfesionBinPkg.java:35)
Caused by: java.io.InvalidClassException:
org.mvel.CompiledExpression; local class incompatible: stream
classdesc serialVersionUID = -8459552198577984707, local class
serialVersionUID = -1994048675652702021
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:
1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields
(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:
1832)
at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields
(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:
1832)
at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at java.util.HashMap.readObject(HashMap.java:1013)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:
946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:
1809)
at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.rule.Package.readExternal(Package.java:184)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:
1755)
at java.io.ObjectInputStream.readOrdinaryObject
(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.BinaryRuleBaseLoader.addPackage
(BinaryRuleBaseLoader.java:82)
... 3 more
Thanks for help... I really need to use enums in my model... :)
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
17 years, 3 months
Dynamic changes to drl file
by pns77
I was checking if changes could be made to the rule file at runtime and the
following is the block of code that i tried
RuleBase ruleBase = readRule();
WorkingMemory workingMemory =
ruleBase.newStatefulSession(false); // to keep reference
// Create a message object
workingMemory.insert( message );
workingMemory.fireAllRules();
When i try chaning the "drl" file at run time the change doesnt get
reflected. Is there anything else i need to be doing here? Any additional
jar files ?
To have this change take effect at runtime - do i need to create a new
session for each run or do i need to retain the session - i tried both
"newStatefulSession(false)" and "newStatefulSession()" - get the same result
with both.
--
View this message in context: http://www.nabble.com/Dynamic-changes-to-drl-file-tf4317491.html#a12293461
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
How to limit results from a collect statement
by pentarious
Does anyone know a method to limit the number of results from a collect
statement? I was just wondering how to do something like this:
$myList : List() from collect( MyObject(myField == "something") ) limit 3
//it should put in $myList just the first 3 objects retrieved
I'm quite sure there is nothing in Drools which can natively support
something like that. So, how to do that, if needed? I tried this, but it
seems not to be working (I can't understand why, though):
$myList : List() from collect( MyObject(myField == "something") )
$myObject : MyObject() from $myList
eval( $myList.indexOf($myObject) < 3 )
Indeed, it doesn't work because the link beetween $myList and $myObject
seems to be released during any execution of the rule (In fact
$myList.contains($myObject) returns false! Again, I can't understand why...)
Any advice would be really appreciated!
Regards,
CG
--
View this message in context: http://www.nabble.com/How-to-limit-results-from-a-collect-statement-tf423...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 3 months
Simple rulebase not behaving as expected : Part 2
by Dean Jones
Hello again,
I'm probably missing something fundamental here, but I have the
following rulebase:
package org.drools.examples
rule "Hello World"
when
Integer()
then
System.out.println("Hello world");
end
rule "Goodbye World"
when
not Integer()
then
System.out.println("Goodbye cruel world");
end
and the following code:
public class TestReadRuleFile {
public static void main(String[] args) throws Exception {
PackageBuilder builder = new PackageBuilder();
InputStreamReader is = new InputStreamReader(
TestReadRuleFile.class.getResourceAsStream("test.drl"));
builder.addPackageFromDrl(is);
Package pkg = builder.getPackage();
RuleBase jbossRulebase = RuleBaseFactory.newRuleBase();
jbossRulebase.addPackage(pkg);
StatelessSession session = jbossRulebase.newStatelessSession();
session.execute(new Float(1));
}
}
Neither of the rules fire, which is not what I expected - I thought
that the "Goodbye world" rule would fire. When I switch to using a
StatefulSession, the rules behave as I expect. Any thoughts on what's
going on here? Thanks,
Dean.
17 years, 3 months