[rules-users] accumulate funtion in xml
Isabelle Hupont
ihupont at ita.es
Thu Sep 27 03:43:56 EDT 2007
Hi!
I want to program the following drl rule in xml:
rule "average calculation"
no-loop true
when
_i : Instance()
_average : Double()
from accumulate(accInst: Instance(),
average(accInst.value("tend")))
eval(_average < 20000)
then
_i.setValue("tend",2000);
end
For it, I have implemented the following xml file:
<?xml version="1.0" encoding="UTF-8"?>
<package name="org.prophet.fuzzy" xmlns="http://drools.org/drools-4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-4.0 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"/>
<lhs>
<pattern identifier="_i" object-type="Instance"/>
<pattern identifier="_average" object-type="Double">
<from>
<accumulate>
<pattern identifier="accInst"
object-type="Instance"/>
<external-function evaluator="average"
expression="accInst.value("tend")"/>
</accumulate>
</from>
</pattern>
<eval>_average < 20000.0</eval>
</lhs>
<rhs>
_i.setValue("tend", 2000.0); manageRuleFired("Rule1", null, _i);
modify(_i);</rhs>
</rule>
</package>
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: http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12916380
Sent from the drools - user mailing list archive at Nabble.com.
More information about the rules-users
mailing list