[rules-users] Negating a constraint group?

2008-04-07 Thread Dirk Bergstrom
I want to write a rule that says "Find all long-eared dogs that do not have
short, black hair".  This seems like the simple way to do it:

collect( Dog( ears=="long", not (hair=="short" && color=="black") )

But that doesn't parse.  Some digging through the archives unearthed a mention
of De Morgan's laws, which leads to:

http://en.wikipedia.org/wiki/De_Morgan's_laws

Which explains that I can instead write:

collect( Dog( ears=="long", (hair!="short" || color!="black") )

Which, after some mental effort, turns out to be the right thing.

However, had I not found the reference to De Morgan's Law, it would have taken
me a long time to get there (if indeed I ever would have).  The end result is
also quite difficult to parse if you're not a logician, and thus not very
user-friendly.

Does anyone think it would be worthwhile to open a Jira requesting the ability
to negate a constraint group?  And, if I did open such a thing, do the
developers think it would be reasonably easy to implement?

-- 
Dirk Bergstrom   [EMAIL PROTECTED]
_
Juniper Networks Inc.,  Computer Geek
Tel: 408.745.3182   Fax: 408.745.8905
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Issues when comparing attribute values to null

2008-04-07 Thread Joshua Undesser

I am not sure if anyone else is having this issue or not, but I can not do
in-line attribute compares to null.   

For instance.

when
ObjectA(
   objectBKey == null
)
then



objectBKey is a String in this case.  
This doesn't evaluate properly as the rule was firing even though the slot
contained the key of ObjectB.   


Then I did this as a test

when
ObjectA(
   $objBKey : objectBKey
)

not ObjectB(
   objectBKey == $objBKey
)
then
.


This works because if the slot is populated there must be an ObjectB in the
system with that unique key.If the $objBKey is null then there obviously
is not an ObjectB in the system.

I tried searching through the archieve but couldn't find anything for this
issue.   Also for what it's worth I'm using the official 4.0.5 release.

Thanks in advance!

Joshua


-- 
View this message in context: 
http://www.nabble.com/Issues-when-comparing-attribute-values-to-null-tp16541733p16541733.html
Sent from the drools - user mailing list archive at Nabble.com.

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RE: Hot Deployment

2008-04-07 Thread Brian Trezise
e(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at
junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUn
it3TestReference.java:130)

at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)

 

The goal here is to monitor the directory above for any changes to the
files or additional files that show up.  Any help would be appreciated.

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

From: Paul Browne [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 04, 2008 3:56 PM
To: [EMAIL PROTECTED]; Rules Users List
Subject: Re: [rules-users] Hot Deployment

 

Brian,

I'm guessing that you mean the RuleAgent Class. The Javadoc on this
class gives more info.

Code sample (assuming that you have the BRMS setup as per the doc).
You'll need to change to whatever settings are appropriate for your
BRMS.

Properties prop = new Properties(); 
prop.setProperty("url",uri);
prop.setProperty("newInstance", "true");
prop.setProperty("localCacheDir", ".");
prop.setProperty("poll", "300"); // poll every 300 seconds
for hot deployment.

//Get a new RuleBase using these properties
RuleAgent agent = RuleAgent.newRuleAgent(prop);
RuleBase rb = agent.getRuleBase(); 

Then use the RuleBase as normal

Paul

Brian Trezise wrote: 

In the What's New? Section of the Drools 4.0 documentation there is a
reference in 1.1.2 to a "Rules Engine Agent for hot deployment and BRMS
integration".  This would be ideal for the application I am currently
developing.  However, this is the only mention of this agent anywhere in
the documentation.  Does anybody know anything about this, how to use
it, any documentation about it?

Thanks,

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

 
 
 



____



 
 
 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
  

 

-- next part --
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20080407/207442a9/a
ttachment.html

--

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 17, Issue 18
***

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] short data type validation

2008-04-07 Thread jack wu
there is a regression in the latest 4.0.6 code base. with 4.0.2 the following 
rule would fail with an exception because i have defined a java "short" type 
for the variable "vshort" and the value "99" is too large for a short 
type. but now this rule will execute without exceptions. is it intended? thanks.

rule "checkshort"
dialect "java"
when
Message( vshort < 99 )
then
System.out.println( "===check short ok===" ); 
end
   
-
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Hot Deployment

2008-04-07 Thread Nico Schlebusch
Hi Brian,

 

>> The goal here is to monitor the directory above for any changes to
the files or additional files that show up.  Any help would be
appreciated.

 

If you want to monitor a local dir try using the "dir" property instead
of "url". In your case you would then have something like:

Properties prop = new Properties(); 
prop.setProperty("dir",
"c:/svn/code/sleuth/src/net/intellidata/sleuth/description/rules/");

prop.setProperty("poll", "300"); // poll every 300 seconds
for hot deployment.



I'm not sure if you would need these properties.

prop.setProperty("newInstance", "true");
prop.setProperty("localCacheDir", ".");



Have a look at Section 7.1.1. Deployment using the RuleAgent of the
online manual at
http://downloads.jboss.com/drools/docs/4.0.6.19326.GA/html/index.html

 

Regards,

Nico 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Trezise
Sent: 07 April 2008 10:19 PM
To: [EMAIL PROTECTED]; 'Rules Users List'
Subject: RE: [rules-users] Hot Deployment

 

Ok... I put that in but I'm having trouble getting it to recognize the
uri I'm passing in...  I'm passing in
"file:///c:/svn/code/sleuth/src/net/intellidata/sleuth/description/rules
/" and I'm getting the following exception:

RuleAgent(default) INFO (Mon Apr 07 13:14:40 MDT 2008): Configuring with
newInstance=true, secondsToRefresh=300

RuleAgent(default) INFO (Mon Apr 07 13:14:40 MDT 2008): Configuring
package provider : URLScanner monitoring URLs:
file:/c:/svn/code/sleuth/src/net/intellidata/sleuth/description/rules/
with local cache dir of .

java.lang.ClassCastException:
sun.net.www.protocol.file.FileURLConnection

at
org.drools.agent.HttpClientImpl.checkLastUpdated(HttpClientImpl.java:26)

at
org.drools.agent.URLScanner.hasChanged(URLScanner.java:141)

at
org.drools.agent.URLScanner.getChangeSet(URLScanner.java:108)

at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)

at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)

at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)

at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)

at org.drools.agent.RuleAgent.init(RuleAgent.java:208)

at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)

at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)

at
net.intellidata.sleuth.description.rules.DescriptionRuleLoader.loadRules
(DescriptionRuleLoader.java:48)

at
net.intellidata.sleuth.description.rules.DescriptionRuleLoaderTest.testD
escriptionRuleLoader(DescriptionRuleLoaderTest.java:32)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at
junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUn
it3TestReference.java:130)

at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)

 

The goal here is to monitor the directory above for any changes to the
files or additional files that show up.  Any help would be appreciated.

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

From: Paul Browne [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 04, 2008 3:56 PM
To: [EMAIL PROTECTED]; Rules Users List
Subject: Re: [rules-users] Hot Deployment

 

Brian,

I'm guessing that you mean the RuleAgent Class. The Javadoc on this
class gives more info.

Code sample (assuming that you have the BRMS setup as per the doc).
You'll need to change to whatever settings are appropriate for your
BRMS.

Properties prop = new Properties(); 
prop.setProperty("url",uri);
prop.setProperty("newInstance", "true");
   

RE: [rules-users] Hot Deployment

2008-04-07 Thread Brian Trezise
Ok. I put that in but I'm having trouble getting it to recognize the uri I'm
passing in.  I'm passing in
"file:///c:/svn/code/sleuth/src/net/intellidata/sleuth/description/rules/"
and I'm getting the following exception:

RuleAgent(default) INFO (Mon Apr 07 13:14:40 MDT 2008): Configuring with
newInstance=true, secondsToRefresh=300

RuleAgent(default) INFO (Mon Apr 07 13:14:40 MDT 2008): Configuring package
provider : URLScanner monitoring URLs:
file:/c:/svn/code/sleuth/src/net/intellidata/sleuth/description/rules/ with
local cache dir of .

java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection

at
org.drools.agent.HttpClientImpl.checkLastUpdated(HttpClientImpl.java:26)

at org.drools.agent.URLScanner.hasChanged(URLScanner.java:141)

at org.drools.agent.URLScanner.getChangeSet(URLScanner.java:108)

at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)

at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)

at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)

at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)

at org.drools.agent.RuleAgent.init(RuleAgent.java:208)

at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)

at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)

at
net.intellidata.sleuth.description.rules.DescriptionRuleLoader.loadRules(Des
criptionRuleLoader.java:48)

at
net.intellidata.sleuth.description.rules.DescriptionRuleLoaderTest.testDescr
iptionRuleLoader(DescriptionRuleLoaderTest.java:32)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at junit.framework.TestCase.runTest(TestCase.java:154)

at junit.framework.TestCase.runBare(TestCase.java:127)

at junit.framework.TestResult$1.protect(TestResult.java:106)

at junit.framework.TestResult.runProtected(TestResult.java:124)

at junit.framework.TestResult.run(TestResult.java:109)

at junit.framework.TestCase.run(TestCase.java:118)

at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3T
estReference.java:130)

at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
8)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:460)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:673)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:386)

at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:196)

 

The goal here is to monitor the directory above for any changes to the files
or additional files that show up.  Any help would be appreciated.

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

From: Paul Browne [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 04, 2008 3:56 PM
To: [EMAIL PROTECTED]; Rules Users List
Subject: Re: [rules-users] Hot Deployment

 

Brian,

I'm guessing that you mean the RuleAgent Class. The Javadoc on this class
gives more info.

Code sample (assuming that you have the BRMS setup as per the doc). You'll
need to change to whatever settings are appropriate for your BRMS.

Properties prop = new Properties(); 
prop.setProperty("url",uri);
prop.setProperty("newInstance", "true");
prop.setProperty("localCacheDir", ".");
prop.setProperty("poll", "300"); // poll every 300 seconds for
hot deployment.

//Get a new RuleBase using these properties
RuleAgent agent = RuleAgent.newRuleAgent(prop);
RuleBase rb = agent.getRuleBase(); 

Then use the RuleBase as normal

Paul

Brian Trezise wrote: 

In the What's New? Section of the Drools 4.0 documentation there is a
reference in 1.1.2 to a "Rules Engine Agent for hot deployment and BRMS
integration".  This would be ideal for the application I am currently
developing.  However, this is the only mention of this agent anywhere in the
documentation.  Does anybody know anything about this, how to use it, any
documentation about it?

Thanks,

 

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 

 



  _  



 
___
rules-users mailing list
rules-users@lists.jboss.org
h

RE: [rules-users] decision tables and attributes as parameters in function calls

2008-04-07 Thread Jonathan Guéhenneux

Thanks a lot, I will try this.

From: [EMAIL PROTECTED]
To: rules-users@lists.jboss.org
Subject: RE: [rules-users] decision tables and attributes as parameters in  
function calls
Date: Mon, 7 Apr 2008 14:31:49 +








Jonathan,

 

The decision table mandates atleast one condition. I have faced this problem 
before. Assuming you always have some +ve value for cheese.price, do you want 
to try following?

 

 

 









RuleSet
Cheese rules



Import
com.xxx.entity.Cheese

Variables





Sequential
TRUE










RuleTable Rules for Cheese



CONDITION
ACTION



$c : Cheese
$c



$price : price >
setPrice($price * $1)








0
2





Thanks

mahesh



From: [EMAIL PROTECTED]
To: rules-users@lists.jboss.org
Date: Mon, 7 Apr 2008 08:56:34 +
Subject: [rules-users] decision tables and attributes as parameters in function 
calls








hi,

I have no problem for this kind of rule :

rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end 
but I would like to know what is the decision table for this small rule

rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end

I've tried a lot of syntax and I read the section abour the decision table in 
the manual but ididnt find anything.


Centralisez tous vos comptes mails dans Hotmail ! Créez un compte Hotmail, 
c'est gratuit ! 
Exclusive Marriage Proposals!
Find UR life partner at Shaadi.com Try it!

_
Avec Hotmail, vos e-mails vous suivent partout ! Mettez Hotmail sur votre 
mobile !
http://www.messengersurvotremobile.com/?d=hotmail___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] decision tables and attributes as parameters in function calls

2008-04-07 Thread Mahesh Gadgil

Jonathan,
 
The decision table mandates atleast one condition. I have faced this problem 
before. Assuming you always have some +ve value for cheese.price, do you want 
to try following?
 
 
 








RuleSet
Cheese rules


Import
com.xxx.entity.Cheese

Variables



Sequential
TRUE






RuleTable Rules for Cheese


CONDITION
ACTION


$c : Cheese
$c


$price : price >
setPrice($price * $1)





0
2

Thanks
mahesh


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Mon, 7 Apr 2008 08:56:34 
+Subject: [rules-users] decision tables and attributes as parameters in 
function calls





hi,I have no problem for this kind of rule :rule "Primitive support"when$c 
: Cheese( price < 10 )then$c.setPrice( 10 )end but I would like to know 
what is the decision table for this small rulerule "Primitive support"when
$c : Cheese( $price : price )then$c.setPrice( $price * 2 )endI've tried a 
lot of syntax and I read the section abour the decision table in the manual but 
ididnt find anything.

Centralisez tous vos comptes mails dans Hotmail ! Créez un compte Hotmail, 
c'est gratuit ! 
_
Technology : Catch up on updates on the latest Gadgets, Reviews, Gaming and 
Tips to use technology etc.
http://computing.in.msn.com/___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] refire all rules

2008-04-07 Thread Sibylle Duerr

Hi there,

is there a way to "reset" the working memory so that all the rules are 
run again when fireAllRules() is called?


I know that normaly rules will only be run again when there was a change 
and the fact was updated. but in my case I like to run all rules again 
in some situations without having a change on the facts.


so is there a way to do this?

best regards
sibylle
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] decision tables and attributes as parameters in function calls

2008-04-07 Thread Jonathan Guéhenneux







 







hi,

I have no problem for this kind of rule :

rule "Primitive support"
when
$c : Cheese( price < 10 )
then
$c.setPrice( 10 )
end 

but I would like to know what is the decision table for this small rule

rule "Primitive support"
when
$c : Cheese( $price : price )
then
$c.setPrice( $price * 2 )
end

I've tried a lot of syntax and I read the section abour the decision table in 
the manual but ididnt find anything.
_
Découvrez les profils Messenger de vos amis !
http://home.services.spaces.live.com/___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Rules File Design Consideration

2008-04-07 Thread Anstis, Michael (M.)
If you cannot combine the rules into new rules I would suggest looking at
rule flow.


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chong Minsk Goh
Sent: 04 April 2008 10:57
To: rules-users@lists.jboss.org
Subject: [rules-users] Rules File Design Consideration


Hi,
 
Any help to the problem below is much appreciated : )
 
Here is the problem:
 
I have a set of rules. Intially these rules are evaluated individually.
However, now there is a need to fire these rules in groups which is similar
to a logic gate AND or OR. And, the results of this "groups of rules" are
collected and returned to the user/
 
For example:
 
There are 4 rules:
Rule 1
Rule 2
Rule 3
Rule 4
 
Now, need to evaluate (Rule 1 AND Rule 2 AND Rule 3) OR Rule 4 
And I need to know what are the results of Rule 1 to Rule 4 individually.
 
 
What is the best way to implement a AND or OR using Drools?
 
 
Best regards
Chong Minsk



smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Short circuiting evaluations on LHS

2008-04-07 Thread Anstis, Michael (M.)
All facts are matched against all patterns upon insertion into working
memory. The (Drools) techniques you describe affect the execution of
activations (i.e. RHS) not pattern matching.
 
I think (but it's a vague recollection) however that the sequence of
patterns has an affect (so you want most restrictive first and least
restrictive last). So my thought would be to try to add a pattern to the
start of each rule that checks whether there are more than one survivor
before the other (more expensive) patterns. Just a thought from what I
recall - I haven't tried it:-
 
rule "expensive"
when
ArrayList( size > 1 ) from collect( SuperClassOfAllFacts( ) )
someExpensivePattern( )
then
something();
end
 
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Newman, Jason
Sent: 03 April 2008 20:07
To: rules-users@lists.jboss.org
Subject: [rules-users] Short circuiting evaluations on LHS



I am currently using Drools 4.0 to determine the best choice out of a data
set based on business rules. The rules eliminate (retract) facts until a
single fact survives, and is used for additional processing. I have found
Drools to be a great solution for this problem, and plan to role it out for
additional survivor rules. My problem is in optimization - this is
essentially a batch processing application, and speed is very important (of
course it is  - show me the case where it isn't, right?).

Some of the later evaluations in the rules are fairly expensive (invoking
complex queries from the database), and generally apply to only a small set
of the use cases. For most use cases, the survivor will have been determined
after the first or second rule, so I only want to perform the expensive
evaluations if necessary. I have not found a way to avoid or schedule the
LHS evaluations from firing when inserting the fact into the working memory.
I have played around with agenda groups and rule flows, but haven't had any
luck. The only way I can think of at this point is to break my rules into
separate rule bases, and "manually" copy survivors from one working memory
to the next, performing my own short circuiting outside of the rules being
fired. 

Is there any other technique that I have missed? From a maintenance
standpoint, I would prefer to be able to use one rule base/rule flow to
manage the rules (there are only about 10 total rules, so the base is not
very large - and I would have to break it into 4 or 5 different rule bases,
which seems like it will be a pain across the 5 different areas I need to
implement the rules.)

Thanks, 

-Jason 


The information transmitted (including attachments) is

covered by the Electronic Communications Privacy Act,

18 U.S.C. 2510-2521, is intended only for the person(s) or

entity/entities to which it is addressed and may contain

confidential and/or privileged material. Any review,

retransmission, dissemination or other use of, or taking

of any action in reliance upon, this information by persons

or entities other than the intended recipient(s) is prohibited.

If you received this in error, please contact the sender and

delete the material from any computer.





smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


RE: [rules-users] Simple question

2008-04-07 Thread Anstis, Michael (M.)
Each fact inserted into working memory will be checked against each rule
pattern.
 
Java
 
wm.insert(pto1);
wm.insert(pto2);
 
DRL
 
rule "smurf"
when
$p : PersonTO( )
then
System.out.println("Property = " + $p.getSomeProperty());
end
 
Output
 
Property = pto1 property
Property = pto2 property
 
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Saleem Lakhani
Sent: 03 April 2008 15:08
To: rules-users@lists.jboss.org
Subject: [rules-users] Simple question



Hi,

 

I am having trouble with accessing two same objects with different data in
working memory. When I print the list of working memory I see two objects:

 

Com.model.PersonTO

Com.model.PersonTO

 

But I am not sure how to access each of them individually e.g; Person object
exists = person: PersonTO()

 

Please help.

 

Saleem Lakhani

 

 



smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Unable to fire Rules

2008-04-07 Thread Hanumesh Mekala
Hi Markus,

   Thanks a lot.. Now I am able to fire the rules dynamically by fetching
rules from Database.

   I have modified the code as follows:

   While filling the VO's iteself, I am concatinating the .* to the field
fileMask, and the drl code.

   And the .drl is as follows:

rule "Process ALL"
   no-loop
   when
t:TransactionVO();
m:Message(fileName matches t.fileMask)
  then
System.out.println( "Reading Rule for ..." + t.getFileMask() );
m.setFromQ(t.getFrom_Q());
   m.setToQ(t.getTo_Q());
   m.setTransType(t.getTrans_type());
   update( m );
end

Thanks again,

Hanumesh M


On 4/4/08, Markus Helbig <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> your rules represent the following Java Code (the system.out are just
> to see the result of matches)
>
>public static void main(String[] args)
>{
>// You're rule
>
>
> System.out.println("ABC-834".matches("ABC-834-test-100.edi")); //false
>
> System.out.println("XYZ-834".matches("ABC-834-test-100.edi"));  // false
>
> System.out.println("834".matches("ABC-834-test-100.edi"));  // false
>
> so it could never work
>
> but maybe this is what you want to have
>
>
>// m.fileName matches .*+fileMask+.*
>
>
>
> System.out.println("ABC-834-test-100.edi".matches(".*ABC-834.*")); //true
>
> System.out.println("ABC-834-test-100.edi".matches(".*XYZ-834.*"));
> //false, if this should also be true because fo the 834 you have to
> use regex grouping with an optional group before the -
>
> System.out.println("ABC-834-test-100.edi".matches(".*834.*")); //true
>}
>
> Cheers
>
> Markus
>
> On Fri, Apr 4, 2008 at 9:28 AM, hanumesh.m <[EMAIL PROTECTED]> wrote:
> >
> >  Hi,
> >
> >   I am inserting message(fileName, fromQ,toQ,transType) to
> WorkingMemory.
> >  fileName as "ABC-834-test-100.edi"
> >
> >   I am inserting 3 instances of TrasactionVO's to workingmemory as
> follows:
> >   TransactionVO transVO = new TransactionVO("ABC-834",
> "ABC.834.EDI",
> >  "ABC.834.XML", "834");
> >   TransactionVO transVO1 = new TransactionVO("XYZ-834",
> "XYZ.834.EDI",
> >  "XYZ.834.XML", "834");
> >   TransactionVO transVO2 = new TransactionVO("834",
> "INBOUND.834.EDI",
> >  "INBOUND.834.XML", "834");
> >
> >   In drl, which ever object of TransactionVO matches the fileName of
> Message,
> >  then update Message's rest of the details with TransactionVO. But the
> rules
> >  are not getting fired.
> >
> >   Follewed is the testCase and .drl file along with FactObjects.
> >
> >  TestCase:
> >  -
> >  package com.sample;
> >
> >  import java.io.InputStreamReader;
> >  import java.io.Reader;
> >
> >  import org.drools.FactException;
> >  import org.drools.RuleBase;
> >  import org.drools.RuleBaseFactory;
> >  import org.drools.WorkingMemory;
> >  import org.drools.compiler.PackageBuilder;
> >  import org.drools.rule.Package;
> >  import com.sample.MessageEA;
> >  import com.sample.TransactionVO;
> >
> >  /**
> >   * This is a sample file to launch a rule package from a rule source
> file.
> >   */
> >  public class DroolsTest2 {
> >
> > public static final void main(String[] args) {
> > try {
> >
> > //load up the rulebase
> > RuleBase ruleBase = readRule();
> > WorkingMemory workingMemory = ruleBase.newStatefulSession();
> > MessageEA messageEA = new MessageEA();
> > messageEA.setFileName("ABC-834-test-100.edi");
> > workingMemory.insert( messageEA );
> >
> > TransactionVO transVO = new TransactionVO("ABC-834",
> >  "ABC.834.EDI", "ABC.834.XML", "834");
> > TransactionVO transVO1 = new TransactionVO("XYZ-834",
> >  "XYZ.834.EDI", "XYZ.834.XML", "834");
> > TransactionVO transVO2 = new TransactionVO("834",
> >  "INBOUND.834.EDI", "INBOUND.834.XML", "834");
> > workingMemory.insert( transVO );
> > workingMemory.insert( transVO1 );
> > workingMemory.insert( transVO2);
> > try{
> > workingMemory.fireAllRules();
> > }catch (FactException e ){
> > System.out.println("err: "+e.getMessage());
> > }catch(Exception ee){
> > System.out.println("Err2 : "+ee.getMessage());
> > }
> >
> > System.out.println("fName: "+messageEA.getFileName());
> > System.out.println("frQ: "+messageEA.getFromQ());
> > System.out.println("toQ: "+messageEA.getToQ());
> >
> >
> > } catch (Throwable t) {
> > t.printStackTrace();
> > }
> > }
> >
> > /**
> >  * Please note that this is the "low level" rule assembly API.
> >  */
> > private static RuleBase readRule() throws Exception {
> > //read in the source
> > Reader source = new InputStreamReader(
> >  DroolsTest.class.getResourceAsStream( "/EA