Could you please provide your Instance class ?

On 9/27/07, Isabelle Hupont <> wrote:


I want to program the following drl rule in xml:

rule "average calculation"
        no-loop true
                _i : Instance()
                _average : Double()
                                from accumulate(accInst: Instance(),
                                                       average( accInst.value("tend")))
                eval(_average < 20000)

For it, I have implemented the following xml file:

<?xml version="1.0" encoding="UTF-8"?>
<package name="org.prophet.fuzzy" xmlns=""
xs:schemaLocation=" drools-4.0.xsd">
    <import name="weka.core.*"/>
    <import name="org.prophet.gui.docking.*"/>
    <import name="org.prophet.persistence.*"/>
    <import name="org.prophet.persistence.hibernate.* "/>
    <import name="org.prophet.rules.*"/>
    <import name="org.prophet.*"/>
    <rule name="Rule1">
        <rule-attribute name="no-loop" value="true"/>
            <pattern identifier="_i" object-type="Instance"/>
            <pattern identifier="_average" object-type="Double">
                        <pattern identifier="accInst"
                        <external-function evaluator="average"
            <eval>_average &lt; 20000.0</eval>
_i.setValue("tend", 2000.0); manageRuleFired("Rule1", null, _i);

And I have the following error when reading the rule package:

org.drools.rule.InvalidRulePackage: Rule Compilation error _average cannot
be resolved _i cannot be resolved _i cannot be resolved _i__Handle__ cannot
be resolved _i cannot be resolved

I also have tried to replace the xml identifier <pattern> by <column> with
no result. Can you help me, please?

View this message in context:
Sent from the drools - user mailing list archive at

rules-users mailing list

Fernando Meyer
JBoss Rules Core Developer