RE: [rules-users] Rules to detect states in an object graph?!?
by Anstis, Michael (M.)
Thanks Steve,
Is contains in 3.0.5 - I can't find reference to it in the bundled
documentation?
Also, do you know whether Object's equals() and Object's hashCode() are
used for normal equality conditions:-
when
h : house()
p : person ( residence == ( h ) )
...
Do you also know how the greater than and less than operators are
implemented (can we provide a comparator instance)?
when
r : rank()
p : person (rank >= ( r ) )
...
(If this is even possible!?!? - I haven't got this far yet).
Thanks in advance.
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Steven
Williams
Sent: 23 January 2007 23:00
To: Rules Users List
Subject: Re: [rules-users] Rules to detect states in an object
graph?!?
Hi Michael,
To do the opposite approach (where the relationship is navigable
from the parent only) you can use the following:
when
c : Child ( age > 18 )
Parent ( children contains c, type == "SMURF" )
Of course this requires either
* the child object in the children collection to be the
same as the asserted child object or
* the equals/hashcode method to be implemented
appropriately in Child
cheers
Steve
On 1/24/07, Anstis, Michael (M.) <manstis1(a)ford.com> wrote:
Sorry, me again,
I'm putting together some prototype rules that operate
on related objects in a graph of objects.
I'm adding all objects individually to working memory
and then checking the objects are related in the rule to ensure only
valid combinations are selected; for example:-
//Java code
parent.addChild(child)
wm.assertObject(parent);
wm.assertObject(child);
//Rule
rule "Adult smurfs"
when
c : Child ( age > 18, p : parent )
Parent ( parentId == ( p.parentId ) , type ==
"SMURF" )
then
System.out.println("Smurf " + p.getName() + " is
" + c.getAge() + " years old."
end
rule "Adult clangers"
when
c : Child ( age > 18, p : parent )
Parent ( parentId == ( p.parentId ) , type ==
"CLANGER" )
then
System.out.println("Clanger " + p.getName() + "
is " + c.getAge() + " years old."
end
This requires that the parent-child relationship is
navigable from the child end of the relationship -- child.getParent() .
What other approaches does anyone else use to implement
rules that span related objects?
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* < mailto:manstis1@ford.com <mailto:manstis1@ford.com>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
17 years, 11 months
Rules to detect states in an object graph?!?
by Anstis, Michael (M.)
Sorry, me again,
I'm putting together some prototype rules that operate on related
objects in a graph of objects.
I'm adding all objects individually to working memory and then checking
the objects are related in the rule to ensure only valid combinations
are selected; for example:-
//Java code
parent.addChild(child)
wm.assertObject(parent);
wm.assertObject(child);
//Rule
rule "Adult smurfs"
when
c : Child ( age > 18, p : parent )
Parent ( parentId == ( p.parentId ), type == "SMURF" )
then
System.out.println("Smurf " + p.getName() + " is " + c.getAge()
+ " years old."
end
rule "Adult clangers"
when
c : Child ( age > 18, p : parent )
Parent ( parentId == ( p.parentId ), type == "CLANGER" )
then
System.out.println("Clanger " + p.getName() + " is " +
c.getAge() + " years old."
end
This requires that the parent-child relationship is navigable from the
child end of the relationship -- child.getParent().
What other approaches does anyone else use to implement rules that span
related objects?
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com>
17 years, 11 months
Explicit cast in the conditions part of a JBoss rule.
by nicolae oana
Hi all,
I want to rectify my question: it is possible to do an explicit cast on java beans in the conditions part of a JBoss rule?
Oana
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
17 years, 11 months
RE: [rules-users] BRMS: Evaluation: JBoss Rules 3.2?
by Anstis, Michael (M.)
Thanks Mark,
I think I've got the hang of AgendaGroups!!
Presumably if I sub-class DefaultAgenda and override
setFocus(AgendaGroup ag) and getNextfocus() I can implement my own
flow-like mechanism instead of the standard stack. I'd need to add a way
in which to override the DefaultAgenda created in ReteooWorkingMemory's
constructor too but this again should be a simple sub-class (together
with a subclass of ReteooRulebase with override of newWorkingMemory and
a new RuleBaseFactory to allow me to construct these new objects).
Anything major I've missed - my experience with rules engines now totals
a couple of weeks and it's possible I'm missing the point!!
With kind regards,
Mike
________________________________
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: 22 January 2007 16:33
To: Rules Users List
Subject: Re: [rules-users] BRMS: Evaluation: JBoss Rules 3.2?
Anstis,
We don't have ruleflow, but we do have AgendaGroups which can
provide a form of rule flow, just that its actually stack based. I'm
working on a more general ruleflow idea at the moment, it may make it
into the end of Q1 release, but its not defnite yet.
Normally you cache the rulebase in a singleton and then just
creating working memory instances as and when you need to - creating a
working memory is light.
The guided gui builder is for 3.2, it's web only based on GWT, I
believe that it will also do DSLs (Mic will have to confirm that).
Mark
Anstis, Michael (M.) wrote:
Hi,
I'm evaluating BRMS's for a new project at work.
JBoss Rules today swung into pole position however I am
unclear on a number of features. I wonder whether this user-group can
help?
I list a number of aspects I "think" are currently
missing in JBoss Rules together with my thoughts: If anybody can clarify
the position, provide alternatives or help push JBoss Rules I'd be
pleased to hear!
* We require ruleflow (where rules run
sequentially; like "identify all machines X" then "calculate prices" -
not perhaps a good illustration as this could be written as one rule
"calculate all prices using machine XXX"!!!). Ideally "dynamic" ruleflow
is required too - where the next rule in a sequence is determined by the
outcome of a preceding rule (I have seen dynamic achieved with "trigger"
Facts asserted as the RHS of rules however our "Business Users" cannot
be expected to author rules following this design pattern. I have also
seen static implemented with salience). Is ruleflow (static or dynamic)
part of 3.2 - otherwise we'll need to categorise rules having different
types fired throughout a "coded" process in Java.
* A J2EE runtime to provide scalability of the
RETE engine. We need to have the engine being shared across sessions on
a web-server. What experiences have others had? Do you simply provide a
working memory instance per session (how does this scale horizontally?).
I also read that an Application Server runtime would be part of 3.2, is
this true?
* A rule authoring environment for end-users. I
read on Mark Proctor's blogg that this is in development but is it set
for inclusion in 3.2 and does it handle DSL too; otherwise we'd have to
write out own?
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com <mailto:manstis1@ford.com> >
________________________________
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 11 months
Null pointer while integer comparison
by Holla Sachin-a23031
i was just wondering if this behavior is consistent... say i have two
rules like these:
rule "Equals"
when
MyFact ( integerAttribute == 10 )
then
.....
end
rule "Greater Than"
when
MyFact ( integerAttribute > 10 )
then
.....
end
now, if MyFact returns null for integerAttribute the second rule results
in NullPointerException while asserting the fact.. but the first rule
does not. i am not able to reason out if this is expected
functionality... :(
please help..
thanks in advance
17 years, 11 months
RE: [rules-users] Out of Memory Issue of JBoss EnginedeployedonIBMWAS 6.0.2.7
by Dejia Wang
Millions of business rules per day.
- Dejia
_____
From: Joel G. Rivera-González [mailto:el_pio@yahoo.com]
Sent: Tuesday, January 16, 2007 11:19 AM
To: Rules Users List
Subject: Re: [rules-users] Out of Memory Issue of JBoss EnginedeployedonIBMWAS 6.0.2.7
quick question about this...
how many rules do you run on your app?
Joel G. Rivera-Gonzalez
PRT
----- Original Message ----
From: Dejia Wang <Dejia.Wang(a)tdemand.com>
To: Rules Users List <rules-users(a)lists.jboss.org>
Sent: Tuesday, January 16, 2007 2:28:14 PM
Subject: RE: [rules-users] Out of Memory Issue of JBoss Enginedeployed onIBMWAS 6.0.2.7
Thanks Mark. However, with the OOM issue in JBoss Rules 3.0.5, we cannot really use it in enterprise environment. It would be good if we can get 3.0.6 out sooner.
BTW, have your guys check in the fix? Is there anything we can help to get 3.0.6 out sooner?
Thanks- Dejia
_____
From: Mark Proctor [mailto:mproctor@codehaus.org]
Sent: Monday, January 15, 2007 6:33 PM
To: Rules Users List
Subject: Re: [rules-users] Out of Memory Issue of JBoss Enginedeployed onIBMWAS 6.0.2.7
Antlr 2.7.7 is just for the StringTemplate stuff, we are actually using Antlr 3. You could attempt to regenerate the grammar again with latest versions of antlrworks and antlr, although I'm not sure if it works without updates to the drl. Not sure when 3.0.6 will be out, probably not for a few weeks.
Mark
Dejia Wang wrote:
BTW, I noticed that current stable version of antlr is 2.7.7 (released November 1, 2006). Rule 3.0.5 has 2.7.6.
Edson, will antlr 2.7.7 work?
Thanks- Dejia
_____
From: Dejia Wang
Sent: Monday, January 15, 2007 5:40 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Out of Memory Issue of JBoss Engine deployed onIBMWAS 6.0.2.7
This is good news. Thanks very much, Mark and Edson! BTW, when will 3.0.6 release be out?
- Dejia
_____
From: Mark Proctor [mailto:mproctor@codehaus.org]
Sent: Monday, January 15, 2007 4:33 PM
To: Rules Users List
Subject: Re: [rules-users] Out of Memory Issue of JBoss Engine deployed onIBMWAS 6.0.2.7
I believe this was a bug in antlr that is now fixed. I'll see if we can get a 3.0.6 release done some time updated to the latest antlr. Edson knows more about this, as it was a bug he investigated.
Mark
Dejia Wang wrote:
BTW, I am using the JBoss Rules 3.0.5.
_____
From: Dejia Wang
Sent: Monday, January 15, 2007 3:56 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Out of Memory Issue of JBoss Engine deployed on IBMWAS 6.0.2.7
Importance: High
Hi All,
I ran into OOM (Out of Memory) issue of JBoss Rule Engine deployed on IBM WAS 6.0.2.7. Below is the log
...
[Loaded org.antlr.runtime.DFA from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/xxx.ear/lib/antlr-3.0ea8.jar]
[Loading superclass and interfaces of org/antlr/runtime/DFA]
[Preparing org/antlr/runtime/DFA]
[Loaded org.antlr.runtime.DFA$State from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/xxxApplications.ear/lib/antlr-3.0ea8.jar]
[Loading superclass and interfaces of org/antlr/runtime/DFA$State]
[Loaded org.drools.lang.RuleParserLexer$1 from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/xxxApplications.ear/lib/drools-compiler-3.0.jar]
[Loading superclass and interfaces of org/drools/lang/RuleParserLexer$1]
[Loaded org.drools.lang.RuleParserLexer$2 from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/ xxxApplications.ear/lib/drools-compiler-3.0.jar]
[Loading superclass and interfaces of org/drools/lang/RuleParserLexer$2]
[Loaded org.drools.lang.RuleParserLexer$3 from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/ xxxApplications.ear/lib/drools-compiler-3.0.jar]
[Loading superclass and interfaces of org/drools/lang/RuleParserLexer$3]
[Loaded org.drools.lang.RuleParserLexer$4 from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/ xxxApplications.ear/lib/drools-compiler-3.0.jar]
[Loading superclass and interfaces of org/drools/lang/RuleParserLexer$4]
....
[Loaded org.drools.lang.RuleParserLexer$228 from file:/D:/WebSphere/AppServer/profiles/AppSrv01/installedApps/xxxNode02Cell/xxxApplications.ear/lib/drools-compiler-3.0.jar]
[Loading superclass and interfaces of org/drools/lang/RuleParserLexer$228]
...
It looks like it loaded the same class hundreds of times until it exhausts the memory.
Any idea why this happens and how to fix this?
Thanks- Dejia
_____
_______________________________________________
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
17 years, 11 months
BRMS: Evaluation: JBoss Rules 3.2?
by Anstis, Michael (M.)
Hi,
I'm evaluating BRMS's for a new project at work.
JBoss Rules today swung into pole position however I am unclear on a
number of features. I wonder whether this user-group can help?
I list a number of aspects I "think" are currently missing in JBoss
Rules together with my thoughts: If anybody can clarify the position,
provide alternatives or help push JBoss Rules I'd be pleased to hear!
* We require ruleflow (where rules run sequentially; like
"identify all machines X" then "calculate prices" - not perhaps a good
illustration as this could be written as one rule "calculate all prices
using machine XXX"!!!). Ideally "dynamic" ruleflow is required too -
where the next rule in a sequence is determined by the outcome of a
preceding rule (I have seen dynamic achieved with "trigger" Facts
asserted as the RHS of rules however our "Business Users" cannot be
expected to author rules following this design pattern. I have also seen
static implemented with salience). Is ruleflow (static or dynamic) part
of 3.2 - otherwise we'll need to categorise rules having different types
fired throughout a "coded" process in Java.
* A J2EE runtime to provide scalability of the RETE engine. We
need to have the engine being shared across sessions on a web-server.
What experiences have others had? Do you simply provide a working memory
instance per session (how does this scale horizontally?). I also read
that an Application Server runtime would be part of 3.2, is this true?
* A rule authoring environment for end-users. I read on Mark
Proctor's blogg that this is in development but is it set for inclusion
in 3.2 and does it handle DSL too; otherwise we'd have to write out own?
With kind regards,
Michael Anstis
-------------------------------------------
Next Generation Estimating System
* Trafford House (Int) 8 718 2239
* Trafford House (Ext) +44 (0)1268 702239
* <mailto:manstis1@ford.com>
17 years, 11 months
Exception in thread "main" java.lang.NoClassDefFoundError: org/drools/RuleBase
by mike20043
Hi
I’m currently working on a program which uses a rule based expert system. I
am using eclipse with the expert system shell drools (3.0).
The program works fine when I run it in eclipse but when I try to export the
program as a jar file it does not seem to work. I did cmd java -jar to find
out what's going wrong and it gives me the following error messages:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/drools/RuleBase
at com.sample.GUI.<init>(GUI.java:34)
at com.sample.GUI.main(GUI.java:41)
and also:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError:
org/drool
s/RuleBase
at com.sample.beakAndBill.actionPerformed(beakAndBill.java:64)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown
Source
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
can anyone help me with this problem. I know that it’s probably missing the
drools classes and if that is the case can anyone tell me how to add the
classes and get the jar to work correctly.
Thanks in advance.
--
View this message in context: http://www.nabble.com/Exception-in-thread-%22main%22-java.lang.NoClassDef...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 11 months
jdk1.3 compatible??
by Arvind Patil
Hi,
We are contemplating using Drools in our project.
We need the following info:
Is Drools jdk1.3 compatible?
Can we use it for jdk1.3 based project?
Thanks
RV
17 years, 11 months
RE: [rules-users] Exception in thread "main" java.lang.Error:Unableto find unambiguously defined class
by Burr Sutter
http://jira.jboss.com/jira/browse/JBRULES
You will need to create a user profile first
http://www.jboss.com/index.html?op=checkage&module=user
in order to actually add a new Jira.
If you have a simple example/unit test that demonstrates the bug please
attach it to the Jira item.
Burr
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Anstis,
Michael (M.)
Sent: Monday, January 22, 2007 4:48 AM
To: Rules Users List
Subject: RE: [rules-users] Exception in thread "main"
java.lang.Error:Unableto find unambiguously defined class
Sorry, newbie question - JIRA?!?!
I can guess it's a bug reporting facility, but I don't know where to
access it.
I've had a good nose around on Jboss.com but am none the wiser.
Thanks,
Mike
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Mark Proctor
Sent: 20 January 2007 13:50
To: Rules Users List
Subject: Re: [rules-users] Exception in thread "main" java.lang.Error:
Unableto find unambiguously defined class
Actually this is also a bug, if you declare something as an import, it
should override the default java.lang.* imports - can you open a JIRA
for this bug.
Thanks
Mark
Edson Tirelli wrote:
> Michael,
>
> There is a java class named Process in java.lang package. As java
> imports all java.lang classes automatically, you will need to fully
> qualify your class name in this case.
>
> rule "A rule"
> when
> p:com.ford.nges.om.Process( )
> then
> System.out.println(p.toString());
> end
>
> I didn't test that, but shall work.
>
> []s
> Edson
>
> Anstis, Michael (M.) wrote:
>
>> Hi,
>>
>> I have a simple rule that references a "Process" fact:-
>>
>> package com.ford.nges.jboss.rules
>>
>> import com.ford.nges.om.Constants
>> import com.ford.nges.om.Component
>> import com.ford.nges.om.ResourceEntry
>> import com.ford.nges.om.Process
>> import com.ford.nges.om.Machine
>>
>> rule "A rule"
>> when
>> p:Process( )
>> then
>> System.out.println(p.toString());
>> end
>>
>> However I receive the following error on
>> builder.addPackageFromDrl(new
>> InputStreamReader(Main.class.getResourceAsStream("rules.drl"))); even
>> though I have an import statement.
>>
>> Exception in thread "main" java.lang.Error: Unable to find
>> unambiguously defined class 'Process', candidates are:
>> [java.lang.Process, com.ford.nges.om.Process]
>>
>> at
>> org.drools.semantics.java.ClassTypeResolver.resolveType(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.semantics.java.RuleBuilder.build(Unknown
>> Source)
>> at org.drools.compiler.PackageBuilder.addRule(Unknown
>> Source)
>> at
org.drools.compiler.PackageBuilder.addPackage(Unknown
>> Source)
>> at
>> org.drools.compiler.PackageBuilder.addPackageFromDrl(Unknown
>> Source)
>> at com.ford.nges.Main.main(Main.java:43)
>>
>> If "Process" is referred to in the RHS or the Class name is not
>> Process I don't get the error.
>>
>> Any thoughts?
>>
>> With kind regards,
>>
>> Michael Anstis
>> -------------------------------------------
>> *Next Generation Estimating System*
>> ( Trafford House (Int) 8 718 2239
>> ( Trafford House (Ext) +44 (0)1268 702239
>> * <_mailto:manstis1@ford.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
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
17 years, 11 months