there is a package text file, you add all your imports there.

Mark
Edgardo wrote:
Hi, How I can import the package classes for MVEL? I import the Java Classes in the package configuration, is this sufficient one?

Really thanks

En Tue, 07 Aug 2007 15:59:29 -0400, Mark Proctor <[EMAIL PROTECTED]> escribió:

MVEL does not dynamically import package classes, they must be imported manually, so I actually imagine its that. the consequence syntax you have is valid for both java and MVEL.

Mark
Edgardo wrote:
Hi,finally the problem is the guided editor, the code generated in assert fact is not for the mvel compiler, the solution for mi problem was add a new dialect option with "java" parameter.

- The source code of the rule:

rule "Driver is crazy"
    dialect "java"
    when
Driver( age >= "20" && < "25" , locationRiskProfile == "HIGH" , name == "Fernando Meyer" )
         Policy( type == "PROBLEMATIC" )
    then
    insert(new Rejection(" Go away drunk "));
end

- The result:

RuleAgent(insuranceconfig) INFO (Tue Aug 07 09:56:30 CLT 2007): Configuring with newInstance=true, secondsToRefresh=30 RuleAgent(insuranceconfig) INFO (Tue Aug 07 09:56:30 CLT 2007): Configuring package provider : URLScanner monitoring URLs: http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.acme.insurance/InsuranceSnapshot RuleAgent(insuranceconfig) INFO (Tue Aug 07 09:56:31 CLT 2007): Applying changes to the rulebase. RuleAgent(insuranceconfig) INFO (Tue Aug 07 09:56:31 CLT 2007): Creating a new rulebase as per settings. RuleAgent(insuranceconfig) INFO (Tue Aug 07 09:56:31 CLT 2007): Adding package called org.acme.insurance
REJECTED:  Go away drunk

:):):)

I hope my solution work for anybody have the same problem

PD: The classpath was not the problem.

Thanks, see you in another post :)


En Mon, 06 Aug 2007 12:28:37 -0400, Mark Proctor <[EMAIL PROTECTED]> escribió:

Edgardo wrote:
Hi, when I use the BRL editor, I can't edit the source code of the rule, that is available in read-only mode, when you or other users fire this rules, you don't have this problem ?

The BRL editor does not allow the source code to be edited, so you'll have to accept what it generates for now.
RuleAgent(insuranceconfig) INFO (Fri Aug 03 16:05:58 CLT 2007):
Adding package called org.acme.insurance
org.mvel.CompileException: class or class reference not found: Rejection() at org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.optimizeObjectCreation(ASMAccessorOptimizer.java:1771)
This issue means the compiler cannot find your model, the class Rejection is not in the classpath.

Greetings

En Mon, 06 Aug 2007 08:00:47 -0400, Mark Proctor <[EMAIL PROTECTED]> escribió:

btw if you are using the mvel dialect you can just do
fact0 = new Rejection();
fact0.reason = "Go away drunk" ;
insert( fact0 );

MVEL has type inference, so it doesn't need to be used explicitley and also javascript style property accessors.

Mark
Edgardo wrote:
Hi fernando, the package source code is:

package org.acme.insurance
import org.acme.insurance.Driver
import org.acme.insurance.Approve
import org.acme.insurance.Policy
import org.acme.insurance.Rejection

...

rule "Driver is crazy"
    dialect "mvel"
    when
Driver( age >= "20" && < "25" , locationRiskProfile == "HIGH" , name == "Fernando Meyer" )
        Policy( type == "PROBLEMATIC" )
    then
        Rejection fact0 = new Rejection();
        fact0.setReason( "Go away drunk" );
        insert( fact0 );
end

...

I import this from repository_export.xml in the resource folder, and for fire "Driver is crazy" rule, I append the next code to InsuranceBusiness class:

public void executeExample() throws Exception {
        RuleBase ruleBase = loadRuleBase();

        testUnsafeDriver(ruleBase);
        testSafeMature(ruleBase);
        testUnsafeAreaAndPriors(ruleBase);
        testDriverIsCrazy(ruleBase);  //-----> This
    }

/*** And this method ***/

private void testDriverCrazy(RuleBase ruleBase) {
        StatefulSession session = ruleBase.newStatefulSession();
               Driver driver = new Driver();
        driver.setAge(new Integer(23));
        driver.setLocationRiskProfile("HIGH");
        driver.setName("Fernando Meyer");
               Policy policy = new Policy();
        policy.setType("PROBLEMATIC");
        policy.setApproved(false);
               session.insert(driver);
        session.insert(policy);
        session.fireAllRules();
    }

In the example you dont fire the rules where I have the problems

Thanks and sorry again for my english

Greetings

En Sun, 05 Aug 2007 11:46:14 -0400, Fernando Meyer <[EMAIL PROTECTED]> escribió:

Hi Eduardo,

Probably you missed some importing statement in your package configuration, check this please;

Regards

Fernando Meyer http://fmeyer.org
[EMAIL PROTECTED]
PGP: 0xD804DDFB



On Aug 4, 2007, at 4:49 PM, Edgardo wrote:

Hi list, I post my problem in the rules-dev list. The problem is execute the "Driver is Crazy", "Driver is too old" and "Driver special age Approved" rules. I have the problem of the next section:

Edgardo wrote:
Yes, I did it, in the package configuration. I use the drools-4.0.0-brms version. The problem is at the moment to evaluate the next generate code of the rule:

then
        Rejection fact0 = new Rejection();
        fact0.setReason( "Driver too old" );
        insert( fact0 );

If I use the Technical rule text editor, i dont have any problem.

Greetings from Chile :)

En Fri, 03 Aug 2007 19:06:05 -0400, Mark Proctor <[EMAIL PROTECTED]> escribió:

did you upload your model and import it?

Mark
Edgardo wrote:
Hi rules-dev list, (my english is very poor, sorry) I am interested in using the BRMS of JBoss Rules, but when I use the guided editor, this rules dont work, and in drools-examples-brms example, this dont work too, the error message (in the
"Driver is Crazy" rule)is:

RuleAgent(insuranceconfig) INFO (Fri Aug 03 16:05:58 CLT 2007): Adding
package called org.acme.insurance
org.mvel.CompileException: class or class reference not found: Rejection()
    at
org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.optimizeObjectCreation(ASMAccessorOptimizer.java:1771) at org.mvel.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.java:49) at org.mvel.MVELRuntime.execute(MVELRuntime.java:87) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:98) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:93) at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:36) at org.mvel.MVELRuntime.execute(MVELRuntime.java:87) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:98) at org.mvel.MVEL.executeExpression(MVEL.java:202) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:32) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:392) at org.acme.insurance.launcher.InsuranceBusiness.testDriverCrazy(InsuranceBusiness.java:93) at org.acme.insurance.launcher.InsuranceBusiness.executeExample(InsuranceBusiness.java:19) at org.acme.insurance.launcher.MainClass.main(MainClass.java:13) org.drools.spi.ConsequenceException: org.mvel.CompileException: class or
class reference not found: Rejection()
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:549) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:392) at org.acme.insurance.launcher.InsuranceBusiness.testDriverCrazy(InsuranceBusiness.java:93) at org.acme.insurance.launcher.InsuranceBusiness.executeExample(InsuranceBusiness.java:19) at org.acme.insurance.launcher.MainClass.main(MainClass.java:13) Caused by: org.mvel.CompileException: class or class reference not found:
Rejection()
    at
org.mvel.optimizers.impl.asm.ASMAccessorOptimizer.optimizeObjectCreation(ASMAccessorOptimizer.java:1771) at org.mvel.ast.NewObjectNode.getReducedValueAccelerated(NewObjectNode.java:49) at org.mvel.MVELRuntime.execute(MVELRuntime.java:87) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:98) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:93) at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:36) at org.mvel.MVELRuntime.execute(MVELRuntime.java:87) at org.mvel.CompiledExpression.getValue(CompiledExpression.java:98) at org.mvel.MVEL.executeExpression(MVEL.java:202) at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:32) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:545) ... 6 more

Thanks :), I am waiting for you response...


_______________________________________________
rules-dev mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-dev




_______________________________________________
rules-dev mailing list
[EMAIL PROTECTED]
https://lists.jboss.org/mailman/listinfo/rules-dev



--Edgardo Ibañez O.
_______________________________________________
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




_______________________________________________
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

Reply via email to