[rules-users] accumulate funtion in xml

Fernando Meyer fmcamargo at gmail.com
Fri Sep 28 02:50:47 EDT 2007


Hi isabelle,

When I said instance class, I was meaning your instance source code ;)

Regards

On 9/28/07, Isabelle Hupont <ihupont at ita.es> wrote:
>
>
> Hi Fernando!
>
> Mi Instance class is the Weka class I attach....
> Thanks for your attention.
> Isabelle.
> http://www.nabble.com/file/p12935480/Instance.class Instance.class
>
>
>
> Fernando Meyer Camargo wrote:
> >
> > Could you please provide your Instance class ?
> >
> >
> > On 9/27/07, Isabelle Hupont <ihupont at ita.es> wrote:
> >>
> >>
> >> 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(&quot;tend&quot;)"/>
> >>                     </accumulate>
> >>                 </from>
> >>             </pattern>
> >>             <eval>_average &lt; 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.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> >
> >
> > --
> > Fernando Meyer http://fmeyer.org
> > JBoss Rules Core Developer
> > fmcamargo at gmail.com
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12935480
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
fmcamargo at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070928/9cf827e6/attachment.html 


More information about the rules-users mailing list