[rules-users] Why this rule did't work?

2009-08-31 Thread zgbigman

I'm trying to formulate a condition like: 

package com.sample

import org.hibernate.Session;
import com.sample.entity.TempEntity;

global java.util.List myGlobalList;


rule Hello World
when 
$hibernateSession : Session();
$tmp1 :TempEntity($bin1 :bin) from 
$hibernateSession.createQuery(from
TempEntity).list()
$tmp2 : TempEntity($bin2 : bin) from myGlobalList
//eval($bin == ((TempEntity)(myGlobalList.get(0))).getBin())
eval($bin1 == $bin2)
then
System.out.println(success);
end

I'm trying to find an Entity by bin from DB.
there is only one entity  in the myGlobalList. NO complie error but it
shows the following:

log4j:WARN No appenders could be found for logger
(org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: 
select
tempentity0_.bin as bin0_,
tempentity0_.bank_name as bank2_0_,
tempentity0_.bank_id as bank3_0_,
tempentity0_.card_name as card4_0_,
tempentity0_.card_length as card5_0_,
tempentity0_.card_type as card6_0_ 
from
bin tempentity0_

what should I do if i want this rule works?
-- 
View this message in context: 
http://www.nabble.com/Why-this-rule-did%27t-work--tp25218669p25218669.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


Re: [rules-users] Conditional 'not' invalid for event streams?

2009-08-31 Thread Edson Tirelli
   Hi Barry,

   Yes, it would be awesome to add it to drools-contrib code.

   I am traveling to JBoss World tomorrow, but when I am back I will take a
look at your code. Also, please send all the feedback you have on this
experience my way. Drools Expert is a mature engine, but Fusion is brand
new, so we have a lot to do still, and having external views on the project
is a great way to guide us through development.

   Thanks,
  Edson

2009/8/31 Barry Kaplan grou...@memelet.com


 Good evening Edson,

 I am using insert time -- the event classes have no timestamps properties.

 BTW, I have git project with all this code, but I don't think this last bit
 is pushed yet... (http://github.com/memelet/drools-esper/tree/master).
 Maybe
 once I've gotten thru the pattersn we can add it to drools-contrib as
 additional examples?

 -barry


 --
 View this message in context:
 http://www.nabble.com/Conditional-%27not%27-invalid-for-event-streams--tp25217095p25218351.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




-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Drools-flowlification of an application

2009-08-31 Thread Ista Pouss
Hi,


I have an application swing / JCR mecanism.

I should want put some Drool / Flow functions for existant datas. I'm
a total newbee. Flow is good for my ends users and for my code,I hope.

How can I transform some POJO object, and some JCR datas, to enabled
drools flow ?

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


[rules-users] Maven Plugin to build pkg files

2009-08-31 Thread Bernd Rücker
Hi all.



I wonder if there exists a maven plugin to build pkg files out of the rule
base during the maven packaging. Because we don’t use the Guvnor
repository in this project and I want to package the pkg files with the
overall ear.



I searched a bit, but didn’t found anything… Okay, not hard to write
ourself, but would be nicer to reuse existing stuff…



Thanks

Bernd



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


[rules-users] sliding time in lhs

2009-08-31 Thread Francesco Chiarelli
Hi!
i'm new to use a drools-fusion, i've a next lhs condition in rule:
$o: Order(status!=EU_C_R1_INIT)
SystemConfig(value:value) from hbnSession.createQuery(from
SystemConfig where name=:name).setString(name,nRicMax).uniqueResult()
$nRic : Number(intValue   value) from accumulate($n:
Order(this==$o) over window:time(1d),count($n))
Data:
1) Order 1 date 28 aug 2009 EU_C_INIT
2) Order 1 date 31 aug 2009 EU_A_INIT
3) Order 1 date 31 aug 2009 EU_B_INIT
4) Order 1 date 30 aug 2009 EU_B_INIT
5) Order 1 date 28 aug 2009 EU_A_INIT
6) Order 1 date 01 aug 2009 EU_A_INIT
7) Order 1 date 28 aug 2009 EU_C_INIT
8) Order 1 date 28 aug 2009 EU_C_INIT

Only the first condition is verified [  Order(status!=EU_C_R1_INIT) ]
altough there are facts that verify Order(this==$o) over window:time(24h) ]
There are n-k facts that don't verify a previous condition but them come
count also:
I espect that drools count a 2-3-4 but it count also 5-6-7: i'm confused
P.S. i did set a stream mode, i' had set a timestamp attribute in event fact
@timestamp(myTimestampLong), i tried with pseudo clock (making it advance
for new Date().getTime() or at origin, therefore 01 jan 1970 [without event
@timestamp attribute] )
Regards
Francesco
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Calculating minimal value for a group of facts

2009-08-31 Thread kothvandir kothvandir
Hi,

I need to calculate the min time for a set of jobs inserted in working
mermory to know wich job is going to be finished first.

Is there any way to obtain within a rule the current facts of some type to
pass then to a function/method?
somethin like this:

Another idea to acomplish this?


gobal MyService myservice

rule cmdCheckTime ruleflow-group comprobarExistencias
when
Job(time = eval(myService.getMinTime( jobs in working memory ))
then
go, go, go...

end

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


Re: [rules-users] Calculating minimal value for a group of facts

2009-08-31 Thread Steve Ronderos
You can use a collect statement to get all of the Job objects.

  $list : ArrayList() from collect ( Job() )

alternatively if all that your service method call is doing is comparing 
the values of a field in a list of Job objects, there are ways to do that 
without the eval

when
  $shortest : Job ( $min : min)
  not Job(min  $min)
then
  go go go!

Hope this helps!

Steve Ronderos 



From:
kothvandir kothvandir kothvan...@gmail.com
To:
rules-users@lists.jboss.org
Date:
08/31/2009 01:35 PM
Subject:
[rules-users] Calculating minimal value for a group of facts
Sent by:
rules-users-boun...@lists.jboss.org



Hi,

I need to calculate the min time for a set of jobs inserted in working 
mermory to know wich job is going to be finished first.

Is there any way to obtain within a rule the current facts of some type to 
pass then to a function/method? 
somethin like this:

Another idea to acomplish this?


gobal MyService myservice

rule cmdCheckTime ruleflow-group comprobarExistencias
when
Job(time = eval(myService.getMinTime( jobs in working memory ))
then 
go, go, go...

end

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


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


Re: [rules-users] Guvnor fails to vaildate rule, though same rule compiles and run successfully when compiled command line with ANT.

2009-08-31 Thread Codedrop

Since no replies as of yet I've done some more testing and have some more
detail.. this seems to be a bug but I could use some eyes on this as I'm a
drools newbie...  I now have two rules in a clean project in Guvnor...

First rule like this validates fine:

when
$root : Root()
then
logger.debug(PNRLookupRequest - Start);

Second rule is as follows:

  when
/*
$root : Root();
$id : IdentityRequest() from $root;
*/
Root($id:identityRequest != null)
  then
logger.debug(PNRLookupRequest - Check Data);


When I attempt to validate it generates a fatal error and logs the following
in the tomcat catalina.log:
ERROR 31-08 13:49:51,656
(RepositoryServiceServlet.java:doUnexpectedFailure:66) 
java.lang.reflect.InvocationTargetException
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
abstract org.drools.guvnor.client.rpc.BuilderResult[]
org.drools.guvnor.client.rpc.RepositoryService.buildAsset(org.drools.guvnor.client.rpc.RuleAsset)
throws com.google.gwt.user.client.rpc.SerializableException' threw an
unexpected exception: java.lang.reflect.InvocationTargetException
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
...
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
... 21 more
Caused by: java.lang.LinkageError: duplicate class definition:
org/drools/base/com/netid/idia/model/natal/rootIdentityRequest/Root274270528$getIdentityRequest
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
org.drools.base.ClassFieldAccessorCache$ByteArrayClassLoader.defineClass(ClassFieldAccessorCache.java:367)


If modify the rule to replace the failing when clause with the commented out
block it then validates fine.. These same rules compile fine through ANT..
any known bugs in Guvnor that would cause this?



Codedrop wrote:
 
 Reposting as last message was unledgible.
 
 Recently upgraded from Drools 4.0.7 to 5.1.0 and have imported our rules
 into Guvnor.  Unable to determine why the same rules will not correctly
 validate in Guvnor which prevents building a package for deployment.
 
 Sample Rule:
 
 salience 50
 agenda-group idia
 when
Root(identityRequest != null)
 then
 logger.debug(Main - Main Data
 Evaluation);
 System.out.println(Main - Main Data
 Evaluation);
 drools.getWorkingMemory().setFocus(mainAnalysis);
 Throws the following validation error when you select ‘Validate’:
 [Main - Data Evaluation] Unable to create Field Extractor for
 'identityRequest' of '[ClassObjectType
 class=com.netid.idia.model.natal.rootIdentityRequest.Root]' in rule 'Main
 - Data Evaluation'
 
 Unsure why identityRequest  is failing.  There is a valid getter in the
 java file and guvnor displays identityRequest in the list of attributes
 for ‘Root’. Oddly, if I change the when clause to be   
 Root(this.identityRequest != null)  it validates fine.  Did something
 change between 4.0.7 and 5.1.0 that I’m missing or do I have error
 somewhere that goes undetected outside the guvnor?
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Guvnor-fails-to-vaildate-rule%2C-though-same-rule-compiles-and-run-successfully-when-compiled-command-line-with-ANT.-tp25151401p25229899.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] Why so many ACTIVATION/DEACTIVATION events?

2009-08-31 Thread Tom.E.Murphy
We have a fairly complex object model, but we're still puzzled - I thought that 
the definition of Activation was that the data matched on all conditions of a 
rule, and therefore the rule was entered into the agenda (activated).
If that is true, I cannot figure out why we're experiencing this.
As our number of rules increases, we're seeing exponential increases in 
repetitive activation/deactivation pairs, even on rules where we know the data 
does not match the conditions.

Example:
The following rule (abbreviated here) creates an object of type PolicySet if 
there are none that match the conditions.
I would expect this rule to activate once, then fire, wherein the matching 
PolicySet is created, and then never activate again since the absence of a 
matching PolicySet object is never again true.
However, in a rule base of ~4,000 rules, we see this rule activating 975 times 
and deactivating 975 times. This is just one example - nearly all our rules do 
this, and it is seriously impacting decisioning performance.

Have I misunderstood the meaning of activation? Can anyone help me understand 
this?

rule RS6090.1.12_RF7007_50001012
when
LendingProduct ( $exitStrategyType1 : exitStrategyType )
Features ( $lienPriority1 : lienPriority )
DecisionResultsInfo ( $dealRiskCategory1 : dealRiskCategory )
TransactionDetail ( $parentTransactionDetail1Id : myId )
not
(
PolicySet ( $parentPolicySet_1_Id : myId, parentId == 
$parentTransactionDetail1Id )
and
PolicySetIdentifier ( parentId == $parentPolicySet_1_Id
,  lienPriority == $lienPriority1
, exitStrategyType == $exitStrategyType1
, dealRiskCategory == $dealRiskCategory1)
)
then
// Content removed... rule creates the policy set and the 
policy set identifier, and initializes all appropriate elements
// After doing so, why does it activate/deactivate 1800+ times 
in a rule base of 4000 rules?
System.out.println(6090 fired.);
End

Thanks.

Tom Murphy
Business Process Consultant
Wells Fargo HCFG - CORE Deal Decisioning Platform
800 S. Jordan Creek Parkway | West Des Moines, IA 50266
MAC: X2301-01B
Office: 515 324 4853 | Mobile: 941 320 8014
This message may contain confidential and/or privileged information.  If you 
are not the addressee or authorized to receive this for the addressee, you must 
not use, copy, disclose, or take any action based on this message or any 
information herein.  If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message.  Thank you for 
your cooperation.



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


Re: [rules-users] Calculating minimal value for a group of facts

2009-08-31 Thread kothvandir kothvandir
it works great!!, thank you

2009/8/31 Steve Ronderos steve.ronde...@ni.com


 You can use a collect statement to get all of the Job objects.

   $list : ArrayList() from collect ( Job() )

 alternatively if all that your service method call is doing is comparing
 the values of a field in a list of Job objects, there are ways to do that
 without the eval

 when
   $shortest : Job ( $min : min)
   not Job(min  $min)
 then
   go go go!

 Hope this helps!

 Steve Ronderos


  From: kothvandir kothvandir kothvan...@gmail.com To:
 rules-users@lists.jboss.org Date: 08/31/2009 01:35 PM Subject: [rules-users]
 Calculating minimal value for a group of facts Sent by:
 rules-users-boun...@lists.jboss.org
 --



 Hi,

 I need to calculate the min time for a set of jobs inserted in working
 mermory to know wich job is going to be finished first.

 Is there any way to obtain within a rule the current facts of some type to
 pass then to a function/method?
 somethin like this:

 Another idea to acomplish this?


 gobal MyService myservice

 rule cmdCheckTime ruleflow-group comprobarExistencias
 when
 Job(time = eval(myService.getMinTime( jobs in working memory ))
 then
 go, go, go...

 end

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



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


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