Re: [rules-users] accessing session clock from accumulation function or rule body?
You can assign the session clock to a global and access it from LHS conditions and inline accumulate functions. However, be aware that the value obtained from the session clock during LHS evaluations is anything between one WM operation and rule evaluation starts and another WM operation and the activation is created or recreated. This is particularly true with accumulate, where insertions and retractions result in partial re-evaluations so that different evaluations of the action or reverse part are bound to obtain different values. Depending on what you want to achieve, a more consistent notion of now can be obtained by inserting a fact containing the current time (obtained from the session clock), evaluating whatsoever against this value, and advancing this clock in a predictable way. -W On 24/05/2012, radai rosenblatt radai.rosenbl...@gmail.com wrote: hi. i'm writing an accumulation function taht needs access to the session clock - is this possible from within the accumulation function ? if not, is this possible from the rule code (the when section) ? i could pass the current time as an argument ... thanks in advance for any assistance. -- View this message in context: http://drools.46999.n3.nabble.com/accessing-session-clock-from-accumulation-function-or-rule-body-tp4012348.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] can't put formula on Guvnor screen
Hi Mike ! Its working on 5.4.0 Beta1 thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-can-t-put-formula-on-Guvnor-screen-tp3987830p4013151.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
Hi ! Can I put Power in Fromula box of THEN part...?? this is the formula that I have to apply I want to put this formula in THEN section *deathBenefit=sumAssured * [(1 - 1/(1 + (interestRate/100)^(policyTerm-policyYear+1) / 1 - 1/(1 + (interestRate/100)^(policyTerm) ]* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154.html Sent from the Drools: User forum 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] can't put formula on Guvnor screen
It should be working in 5.5.0.beta1. 5.4.0.Final is what we released. I would not recommend using 5.4.0.beta1 as it is pre-release and some of it's internals could have changed for 5.4.0.Final (and later). Consequentially, and I believer other community members have been caught out this way, there is a risk something you author in 5.4.0.beta1 cannot be opened in 5.5. With kind regards, Mike On 24 May 2012 09:59, zeeshan zeeshan.spr...@gmail.com wrote: Hi Mike ! Its working on 5.4.0 Beta1 thanks ! -- View this message in context: http://drools.46999.n3.nabble.com/rules-users-can-t-put-formula-on-Guvnor-screen-tp3987830p4013151.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
The THEN part is either (depending upon the rule's dialect) a Java or MVEL code block. Java defines the ^ operators as a bitwise exclusive or. I suspect you should probably use Math.pow. Math is in the java.lang package so you shouldn't need to explicitly import. With kind regards, Mike On 24 May 2012 10:02, zeeshan zeeshan.spr...@gmail.com wrote: Hi ! Can I put Power in Fromula box of THEN part...?? this is the formula that I have to apply I want to put this formula in THEN section *deathBenefit=sumAssured * [(1 - 1/(1 + (interestRate/100)^(policyTerm-policyYear+1) / 1 - 1/(1 + (interestRate/100)^(policyTerm) ]* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
Hi Mike and many thanks for replying ! shall I use *Math.pow* in free form DRL of THEN or can I use in Formula Box...??? thanks !! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013297.html Sent from the Drools: User forum 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] KnowledgeRuntimeLogger
Hi,I am using KnowledgeRuntimeLogger to log inference activities in StatefulKnowledgeSession, can someone help me on how to add a time stamp on each entry in the log file? ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
Formula box should be OK, but check the generated DRL. On 24 May 2012 11:50, zeeshan zeeshan.spr...@gmail.com wrote: Hi Mike and many thanks for replying ! shall I use *Math.pow* in free form DRL of THEN or can I use in Formula Box...??? thanks !! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013297.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] strict-mode and nested object property access in drools 5.4.0.Final - can i cast?
hello. I have the following 2 classes: public class ClassWithPayload { private String key; private Object payload; // getters setters etc ommitted } public class PayloadClass { public String someProp; //getters setters etc ommitted } and im trying to get the following rule to compile: rule Naive Payload Access when $container : ClassWithPayload(key == someKey, (payload != null payload.someProp == someValue)) then System.err.println(boom); end which results in the following error: java.lang.AssertionError: Unable to Analyse Expression payload.someProp: [Error: unable to resolve method using strict-mode: java.lang.Object.someProp()] [Near : {... payload.someProp }] is there some way for me to cast payload.someProp to the proper class ? (PayloadClass in this case). this is a simplification of a bigger migration issue from drools 5.1 to 5.4 so the payload property has to remain an Object in the general case. there's a casting syntax mentioned here (https://community.jboss.org/wiki/DroolsPatternLanguage) but i take it its not been implemented yet? (or maybe i just cant understand it properly?) i've tried this: rule Naive Payload Access when $container : ClassWithPayload(key == someKey, (payload != null payload.#PayloadClass(someProp == someValue))) then System.err.println(boom); end but it doesnt compile: java.lang.AssertionError: [8,51]: [ERR 101] Line 8:51 no viable alternative at input '(' in rule Naive Payload Access [0,0]: Parser returned a null Package and if i cant cast, how can i get this sort of rule to behave as it did in 5.1.1 ? thanks in advance for any assistance, Radai. -- View this message in context: http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-access-in-drools-5-4-0-Final-can-i-cast-tp4013373.html Sent from the Drools: User forum 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] accessing session clock from accumulation function or rule body?
thanks for your reply. if i place the session clock as a fact, will this have any issues with session serialization, or will it just work ? -- View this message in context: http://drools.46999.n3.nabble.com/accessing-session-clock-from-accumulation-function-or-rule-body-tp4012348p4013375.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
Hi Mike ! I have decomposed the formula into several small partsI was trying with Free form DRL, then I validated it...it is giving error *[DeathBenefitRule] Unable to Analyse Expression int $interestNumerator=1+($deathBenefit.getInterestRate()/100); int $interestRateNumerator=1; int condition=$deathBenefit.getPolicyTerm()-$deathBenefit.getPolicYear()+1; for(int i=0; i=condition; ++i ){ $interestRateNumerator=$interestRateNumerator*$interestNumerator; }; double numerator=1-1/$interestRateNumerator; System.out.println(numerator);: [Error: no such identifier: condition] [Near : {... for(int i=0; i=condition; ++i ){ }] ^ [Line: 6, Column: 17]* I put this in the box--- *int $interestNumerator=1+($deathBenefit.getInterestRate()/100); int $interestRateNumerator=1; int condition=$deathBenefit.getPolicyTerm()-$deathBenefit.getPolicYear()+1; for(int i=0; i=condition; ++i ){ $interestRateNumerator=$interestRateNumerator*$interestNumerator; } double numerator=1-1/$interestRateNumerator; System.out.println(numerator);* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013418.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
Hi Mike ! I have decomposed the formula into several small parts http://drools.46999.n3.nabble.com/file/n4013423/error.png I was trying with Free form DRL, then I validated it...it is giving error *[DeathBenefitRule] Unable to Analyse Expression int $interestNumerator=1+($deathBenefit.getInterestRate()/100); int $interestRateNumerator=1; int condition=$deathBenefit.getPolicyTerm()-$deathBenefit.getPolicYear()+1; for(int i=0; i=condition; ++i ){ $interestRateNumerator=$interestRateNumerator*$interestNumerator; }; double numerator=1-1/$interestRateNumerator; System.out.println(numerator);: [Error: no such identifier: condition] [Near : {... for(int i=0; i=condition; ++i ){ }] ^ [Line: 6, Column: 17]* I put this in the box--- *int $interestNumerator=1+($deathBenefit.getInterestRate()/100); int $interestRateNumerator=1; int condition=$deathBenefit.getPolicyTerm()-$deathBenefit.getPolicYear()+1; for(int i=0; i=condition; ++i ){ $interestRateNumerator=$interestRateNumerator*$interestNumerator; } double numerator=1-1/$interestRateNumerator; System.out.println(numerator);* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013423.html Sent from the Drools: User forum 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] accessing session clock from accumulation function or rule body?
On 24/05/2012, radai rosenblatt radai.rosenbl...@gmail.com wrote: thanks for your reply. if i place the session clock as a fact, will this have any issues with session serialization, Don't know what you mean by that. or will it just work ? No, because the clock will change, but the rules engine will not be instructed about these changes, so some frozen value will be used in some evaluations; some other frozen value in others... -W -- View this message in context: http://drools.46999.n3.nabble.com/accessing-session-clock-from-accumulation-function-or-rule-body-tp4012348p4013375.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] strict-mode and nested object property access in drools 5.4.0.Final - can i cast?
Try using the getter, Java style, rather than the simple field name. -W On 24/05/2012, radai rosenblatt radai.rosenbl...@gmail.com wrote: hello. I have the following 2 classes: public class ClassWithPayload { private String key; private Object payload; // getters setters etc ommitted } public class PayloadClass { public String someProp; //getters setters etc ommitted } and im trying to get the following rule to compile: rule Naive Payload Access when $container : ClassWithPayload(key == someKey, (payload != null payload.someProp == someValue)) then System.err.println(boom); end which results in the following error: java.lang.AssertionError: Unable to Analyse Expression payload.someProp: [Error: unable to resolve method using strict-mode: java.lang.Object.someProp()] [Near : {... payload.someProp }] is there some way for me to cast payload.someProp to the proper class ? (PayloadClass in this case). this is a simplification of a bigger migration issue from drools 5.1 to 5.4 so the payload property has to remain an Object in the general case. there's a casting syntax mentioned here (https://community.jboss.org/wiki/DroolsPatternLanguage) but i take it its not been implemented yet? (or maybe i just cant understand it properly?) i've tried this: rule Naive Payload Access when $container : ClassWithPayload(key == someKey, (payload != null payload.#PayloadClass(someProp == someValue))) then System.err.println(boom); end but it doesnt compile: java.lang.AssertionError: [8,51]: [ERR 101] Line 8:51 no viable alternative at input '(' in rule Naive Payload Access [0,0]: Parser returned a null Package and if i cant cast, how can i get this sort of rule to behave as it did in 5.1.1 ? thanks in advance for any assistance, Radai. -- View this message in context: http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-access-in-drools-5-4-0-Final-can-i-cast-tp4013373.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
Hi Laune and thanks for replying !! *1.* I am using *5.4.0 Beta* 1... I also tried by using *Math.pow* as Mike posted above but by validating got error... *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm) ); drools.update( $deathBenefit );: [Error: unbalanced braces ( ... )] [Near : {... enefit.setSumAssured( sumAssured*(1-1/ Math.pow((1 }] ^ [Line: 1, Column: 28]* *2.* This I put in the Formula box -- *=sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm)* *3.* This is generated source code --- 1*. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013466.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
The variables in the RHS's DRL aren't prefixed with $ as they are in the LHS. sent on the move On 24 May 2012 13:52, zeeshan zeeshan.spr...@gmail.com wrote: Hi Laune and thanks for replying !! *1.* I am using *5.4.0 Beta* 1... I also tried by using *Math.pow* as Mike posted above but by validating got error... *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm) ); drools.update( $deathBenefit );: [Error: unbalanced braces ( ... )] [Near : {... enefit.setSumAssured( sumAssured*(1-1/ Math.pow((1 }] ^ [Line: 1, Column: 28]* *2.* This I put in the Formula box -- *=sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm)* *3.* This is generated source code --- 1*. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( sumAssured*(1-1/ Math.pow((1+(interestRate/100),policyTerm-policYear+1)/1-1/(Math.pow(1+(interestRate/100),policyTerm) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013466.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
Hi Mike ! I tried with prefix $ too on the RHS, still giving error *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); drools.update( $deathBenefit );: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.sumAssured()] [Near : {... efit.setSumAssured( sumAssured * ( 1 - (1 / (Math. }] ^ [Line: 1, Column: 30]* the sorce code *1. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013548.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
I still see a sumAssured without $ on line 6. sent on the move On 24 May 2012 14:35, zeeshan zeeshan.spr...@gmail.com wrote: Hi Mike ! I tried with prefix $ too on the RHS, still giving error *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); drools.update( $deathBenefit );: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.sumAssured()] [Near : {... efit.setSumAssured( sumAssured * ( 1 - (1 / (Math. }] ^ [Line: 1, Column: 30]* the sorce code *1. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013548.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] strict-mode and nested object property access in drools 5.4.0.Final - can i cast?
i tried this: rule Naive Payload Access @typesafe( false ) when $container : ClassWithPayload(key == someKey, (payload != null ((PayloadClass)payload.getSomeProp()) == someValue)) then System.err.println(boom); end which results in java.lang.AssertionError: Unable to Analyse Expression ((PayloadClass)payload.getSomeProp()): [Error: unable to resolve method using strict-mode: java.lang.Object.getSomeProp()] [Near : {... ((PayloadClass)payload.getSomeProp()) }] and: rule Naive Payload Access @typesafe( false ) when $container : ClassWithPayload(key == someKey, (payload != null payload.getSomeProp() == someValue)) then System.err.println(boom); end which, similarly, leads to: java.lang.AssertionError: Unable to Analyse Expression payload.getSomeProp(): [Error: unable to resolve method using strict-mode: java.lang.Object.getSomeProp()] [Near : {... payload.getSomeProp() }] was that what you meant? -- View this message in context: http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-access-in-drools-5-4-0-Final-can-i-cast-tp4013373p4013569.html Sent from the Drools: User forum 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] How to put Power in Formula box of THEN ?
oops..now I tried by putting $ before sumAssuredstill same error *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); drools.update( $deathBenefit );: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.,$policyTerm()] [Near : {... ($interestRate/100),$policyTerm-$policYear+1) ) ) }] ^ [Line: 1, Column: 91]* the source code -- *1. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013590.html Sent from the Drools: User forum 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] Can we retrieve the rules as XML from guvnor using java code?
Hi, I am using Guvnor as knowledge repository and using drools rule engine to evaluate the rules stored in Guvnor. Now I have one more rule engine for which we are planning to use the same rules stored in Guvnor, but I am not sure how to expose the rules present inside Guvnor to new system. Can someone let me know if there's a way to retrieve the rules as XML or some other format that I can use in another system? Thanks, Barani -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660.html Sent from the Drools: User forum 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] Can we retrieve the rules as XML from guvnor using java code?
Guvnor can provide rules to any instance, thus used as a shared repository... Are you trying to duplicate Guvnor rules from one Guvnor instance to another ? If yes : - You can use repository export / import (Administration panel under Guvnor) - You can use the REST api of Guvnor to query assets and their raw content, and send to another guvnor instance - Original Message - From: bbarani bbar...@gmail.com To: rules-users@lists.jboss.org Sent: Jeudi 24 Mai 2012 16:41:18 Subject: [rules-users] Can we retrieve the rules as XML from guvnor using java code? Hi, I am using Guvnor as knowledge repository and using drools rule engine to evaluate the rules stored in Guvnor. Now I have one more rule engine for which we are planning to use the same rules stored in Guvnor, but I am not sure how to expose the rules present inside Guvnor to new system. Can someone let me know if there's a way to retrieve the rules as XML or some other format that I can use in another system? Thanks, Barani -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Can we retrieve the rules as XML from guvnor using java code?
It is true Guvnor stores some asset types as XML internally. There is however no schema (we simply use XStream to serialise) and it most certainly is not compliant with any industry standard on rule representation (if indeed there is a single well defined open standa sent on the move On 24 May 2012 15:46, bbarani bbar...@gmail.com wrote: Hi, I am using Guvnor as knowledge repository and using drools rule engine to evaluate the rules stored in Guvnor. Now I have one more rule engine for which we are planning to use the same rules stored in Guvnor, but I am not sure how to expose the rules present inside Guvnor to new system. Can someone let me know if there's a way to retrieve the rules as XML or some other format that I can use in another system? Thanks, Barani -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Can we retrieve the rules as XML from guvnor using java code?
oops... hit send too soon... ...open standard, although OMG is working on a Decision Model Notation standard that will help with the interchange of some types). So, in short, the answer is no. sent on the move On 24 May 2012 16:01, Michael Anstis michael.ans...@gmail.com wrote: It is true Guvnor stores some asset types as XML internally. There is however no schema (we simply use XStream to serialise) and it most certainly is not compliant with any industry standard on rule representation (if indeed there is a single well defined open standa sent on the move On 24 May 2012 15:46, bbarani bbar...@gmail.com wrote: Hi, I am using Guvnor as knowledge repository and using drools rule engine to evaluate the rules stored in Guvnor. Now I have one more rule engine for which we are planning to use the same rules stored in Guvnor, but I am not sure how to expose the rules present inside Guvnor to new system. Can someone let me know if there's a way to retrieve the rules as XML or some other format that I can use in another system? Thanks, Barani -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Can we retrieve the rules as XML from guvnor using java code?
Supporting industry standards (RuleML, RIF), at least to some extent, has been on the TODO-list for quite some time, but we're simply lacking the time :( any contribution would be well appreciated -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660p4013689.html Sent from the Drools: User forum 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] Can we retrieve the rules as XML from guvnor using java code?
With reference to Vincent's comments I assumed you meant a Rule Engine other than Guvnor/Drools. sent on the move On 24 May 2012 16:04, Michael Anstis michael.ans...@gmail.com wrote: oops... hit send too soon... ...open standard, although OMG is working on a Decision Model Notation standard that will help with the interchange of some types). So, in short, the answer is no. sent on the move On 24 May 2012 16:01, Michael Anstis michael.ans...@gmail.com wrote: It is true Guvnor stores some asset types as XML internally. There is however no schema (we simply use XStream to serialise) and it most certainly is not compliant with any industry standard on rule representation (if indeed there is a single well defined open standa sent on the move On 24 May 2012 15:46, bbarani bbar...@gmail.com wrote: Hi, I am using Guvnor as knowledge repository and using drools rule engine to evaluate the rules stored in Guvnor. Now I have one more rule engine for which we are planning to use the same rules stored in Guvnor, but I am not sure how to expose the rules present inside Guvnor to new system. Can someone let me know if there's a way to retrieve the rules as XML or some other format that I can use in another system? Thanks, Barani -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Can we retrieve the rules as XML from guvnor using java code?
Yes your assumption is right, I am trying to use the rules present inside Guvnor in other rule engines (other than Guvnor / drools rule engine). -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660p4013776.html Sent from the Drools: User forum 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] Can we retrieve the rules as XML from guvnor using java code?
Which engines in particular, if we may ask? -- View this message in context: http://drools.46999.n3.nabble.com/Can-we-retrieve-the-rules-as-XML-from-guvnor-using-java-code-tp4013660p4013807.html Sent from the Drools: User forum 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] Persist JPA Entity fact in session
Hi, We are in a fireUntilHalt during a persistent StatefulKnowledgeSession using JTA JPA with Hibernate ... Our session consists in a series of facts ( well, we are not different of anyone else for that matter ... xD ) but some of our facts are also JPA @Entity . What we want is to persist those entities on their own database tables as well as the SessionInfo each time Drools considers the knowledge session needs to be persisted. We are aware that Drools uses org.drools.persistence.jpa.persist(SessionInfo) What would be the best approach to get certain facts that are JPA Entities persisted along with the Session taking advantage of the Drool's SessionInfo persistence loop? Best regards, Alberto R. Galdo arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Persist JPA Entity fact in session
You can use the Variable Persistency Strategies, that will store your facts in the database for you. You need to configure in the environment the strategies for example: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/task/service/persistence/variable/VariablePersistenceStrategiesSyncHTTest.java Notice that you will need to provide your domain specific entityManager to the JPAPlaceholderResolverStrategy Cheers On Thu, May 24, 2012 at 1:30 PM, Alberto R. Galdo arga...@gmail.com wrote: Hi, We are in a fireUntilHalt during a persistent StatefulKnowledgeSession using JTA JPA with Hibernate ... Our session consists in a series of facts ( well, we are not different of anyone else for that matter ... xD ) but some of our facts are also JPA @Entity . What we want is to persist those entities on their own database tables as well as the SessionInfo each time Drools considers the knowledge session needs to be persisted. We are aware that Drools uses org.drools.persistence.jpa.persist(SessionInfo) What would be the best approach to get certain facts that are JPA Entities persisted along with the Session taking advantage of the Drool's SessionInfo persistence loop? Best regards, Alberto R. Galdo arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] strict-mode and nested object property access in drools 5.4.0.Final - can i cast?
as Wolfgang said, try using true java casting... instead of ((PayloadClass)payload.getSomeProp()) try ( ((PayloadClass)payload).getSomeProp() ) -- View this message in context: http://drools.46999.n3.nabble.com/strict-mode-and-nested-object-property-access-in-drools-5-4-0-Final-can-i-cast-tp4013373p4013965.html Sent from the Drools: User forum 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] Persist JPA Entity fact in session
That was really fast! Thank you. Maybe I'm not getting this properly ... let me extend this thing a bit... what we are trying to get is to store the state of a set of facts living in the knowledge session in the database, one tuple for each update of it's state along ( or at least syncronized ) with the updates of SessionInfo persistence that drools executes during the fireUntilHalt loop. It's some sort of historic log of the different states of given variables inside certain facts when they are alive ( as in not retracted ) in the knowledge session. Does this makes sense to you given the persistence strategy you've defined in your previous message? Alberto R. Galdo arga...@gmail.com On Thu, May 24, 2012 at 6:34 PM, Mauricio Salatino sala...@gmail.comwrote: You can use the Variable Persistency Strategies, that will store your facts in the database for you. You need to configure in the environment the strategies for example: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/test/java/org/jbpm/task/service/persistence/variable/VariablePersistenceStrategiesSyncHTTest.java Notice that you will need to provide your domain specific entityManager to the JPAPlaceholderResolverStrategy Cheers On Thu, May 24, 2012 at 1:30 PM, Alberto R. Galdo arga...@gmail.comwrote: Hi, We are in a fireUntilHalt during a persistent StatefulKnowledgeSession using JTA JPA with Hibernate ... Our session consists in a series of facts ( well, we are not different of anyone else for that matter ... xD ) but some of our facts are also JPA @Entity . What we want is to persist those entities on their own database tables as well as the SessionInfo each time Drools considers the knowledge session needs to be persisted. We are aware that Drools uses org.drools.persistence.jpa.persist(SessionInfo) What would be the best approach to get certain facts that are JPA Entities persisted along with the Session taking advantage of the Drool's SessionInfo persistence loop? Best regards, Alberto R. Galdo arga...@gmail.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ 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] Using declared type from decision table/drl with Guvnor Test Scenario
No this is not possible. We build lists of available types from Model assets. With kind regards, Mike On 23 May 2012 19:45, mpgong michael.p.g...@lmco.com wrote: Hello, Is it possible to use a declared type from the decision table or drl as a given item with Guvnor test scenario? When i create a new test scenario and click on given, i don't see the declared type I only see items from my model jar. I can only see declared types if i define them in Guvnor but i don't want to do it that way unless i have to. I want all of that contained in my xls or drl and just upload utility classes that are needed in the xls/drl. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Using-declared-type-from-decision-table-drl-with-Guvnor-Test-Scenario-tp4010325.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
I'd try using free-format DRL and breaking the expression down into smaller parts until it works. I can't see anything wrong with the syntax - unless it relates to the bug Wolfgang said was fixed for 5.4.0 (I *assume* he'd mean FINAL). The advice, as I have given before, would not to use a beta version as it is bound to have bugs in that were fixed for FINAL. I know you use it for the free-format text Formula TextBox in the RHS of the Guided Editor, but free-format DRL (with 5.4.0.FINAL) is a suitable workaround. On 24 May 2012 14:55, zeeshan zeeshan.spr...@gmail.com wrote: oops..now I tried by putting $ before sumAssuredstill same error *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); drools.update( $deathBenefit );: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.,$policyTerm()] [Near : {... ($interestRate/100),$policyTerm-$policYear+1) ) ) }] ^ [Line: 1, Column: 91]* the source code -- *1. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013590.html Sent from the Drools: User forum 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is it possible to select multiple enumerations?
This is not possible. The nearest we have is to select for is contained in (a comma separated) list and type the values manually :( We have this JIRA: https://issues.jboss.org/browse/GUVNOR-1857. Please add additional information if required, or raise a new JIRA if you feel this one is not suitable... With kind regards, Mike On 24 May 2012 00:21, online.re...@gmail.com wrote: I am using version 5.3.0.Final and would like to know if anyone knows of a way to select multiple enumerations in a guided decision table. Using the SHIFT or CNTL keys when trying to select multiple enumerations from a drop down list does not work either. If anyone has found a way to do this, your advice would be appreciated? ___ 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] How to put Power in Formula box of THEN ?
A dollar sign '$' is valid in Java, so this shouldn't be an issue of LHS or RHS. -W On 24 May 2012 20:36, Michael Anstis michael.ans...@gmail.com wrote: I'd try using free-format DRL and breaking the expression down into smaller parts until it works. I can't see anything wrong with the syntax - unless it relates to the bug Wolfgang said was fixed for 5.4.0 (I *assume* he'd mean FINAL). The advice, as I have given before, would not to use a beta version as it is bound to have bugs in that were fixed for FINAL. I know you use it for the free-format text Formula TextBox in the RHS of the Guided Editor, but free-format DRL (with 5.4.0.FINAL) is a suitable workaround. On 24 May 2012 14:55, zeeshan zeeshan.spr...@gmail.com wrote: oops..now I tried by putting $ before sumAssuredstill same error *[DeathBenefitRule] Unable to Analyse Expression $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); drools.update( $deathBenefit );: [Error: unable to resolve method using strict-mode: org.drools.spi.KnowledgeHelper.,$policyTerm()] [Near : {... ($interestRate/100),$policyTerm-$policYear+1) ) ) }] ^ [Line: 1, Column: 91]* the source code -- *1. | rule DeathBenefitRule 2. | dialect mvel 3. | when 4. | $deathBenefit : DeathBenefitFactModel( $sumAssured : sumAssured, $interestRate : interestRate, $policYear : policYear, $policyTerm : policyTerm) 5. | then 6. | $deathBenefit.setSumAssured( $sumAssured * ( 1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm-$policYear+1) ) ) ) ) / (1 - (1 / (Math.pow ( (1 + ($interestRate/100),$policyTerm) ) ) ) ) ); 7. | update( $deathBenefit ); 8. | end* -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4013590.html Sent from the Drools: User forum 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 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] Is it possible to select multiple enumerations?
Micheal, thanks for letting me know. :) Early versions of our program did use manually entered values however, in our latest update we started using a fact model pojo with set enumerators. Looks like there is no easy way around this for now, so I will just have to expand my rules to cater for each enumerator. :( On 25/05/2012, at 4:46 AM, Michael Anstis michael.ans...@gmail.com wrote: This is not possible. The nearest we have is to select for is contained in (a comma separated) list and type the values manually :( We have this JIRA: https://issues.jboss.org/browse/GUVNOR-1857. Please add additional information if required, or raise a new JIRA if you feel this one is not suitable... With kind regards, Mike On 24 May 2012 00:21, online.re...@gmail.com wrote: I am using version 5.3.0.Final and would like to know if anyone knows of a way to select multiple enumerations in a guided decision table. Using the SHIFT or CNTL keys when trying to select multiple enumerations from a drop down list does not work either. If anyone has found a way to do this, your advice would be appreciated? ___ 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
[rules-users] Want to host IntelliFest (previously RuleFest)?
IntelliFest (previously RuleFest) is currently trying to find premises on the west coast of USA, with near by accomodation, to host 150 people for 4 days. Interested in hosting? If so contact me on mproctor at codehaus d0t org ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to put Power in Formula box of THEN ?
Thanks Mikey and Laune for replying gonna try with 5.4.0 final version and free form DRL..I already broke the formula into several small partswill let u know thanks !! -- View this message in context: http://drools.46999.n3.nabble.com/How-to-put-Power-in-Formula-box-of-THEN-tp4013154p4014669.html Sent from the Drools: User forum 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] Is it possible to select multiple enumerations?
Rule Templates work like decision tables and IIRC support multi-selection enums... have a look. sent on the move On 25 May 2012 00:25, online.re...@gmail.com wrote: Micheal, thanks for letting me know. :) Early versions of our program did use manually entered values however, in our latest update we started using a fact model pojo with set enumerators. Looks like there is no easy way around this for now, so I will just have to expand my rules to cater for each enumerator. :( On 25/05/2012, at 4:46 AM, Michael Anstis michael.ans...@gmail.com wrote: This is not possible. The nearest we have is to select for is contained in (a comma separated) list and type the values manually :( We have this JIRA: https://issues.jboss.org/browse/GUVNOR-1857. Please add additional information if required, or raise a new JIRA if you feel this one is not suitable... With kind regards, Mike On 24 May 2012 00:21, online.re...@gmail.com wrote: I am using version 5.3.0.Final and would like to know if anyone knows of a way to select multiple enumerations in a guided decision table. Using the SHIFT or CNTL keys when trying to select multiple enumerations from a drop down list does not work either. If anyone has found a way to do this, your advice would be appreciated? ___ 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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users