Hi Isabelle, <br><br>I didn't paid enough attention to your rhs block :) <br>You are welcome and tks for your feedbak. <br><br><div><span class="gmail_quote">On 9/28/07, <b class="gmail_sendername">Isabelle Hupont</b> <
<a href="mailto:ihupont@ita.es">ihupont@ita.es</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi Fernando!!<br><br>
I have fixed the problem... I didn't changed drools v3 modify(_i) statement<br>by drools v4 update(-i).<br>Now everything works well!<br>Thanks a lot for your attention.<br><br><br><br><br>Isabelle Hupont wrote:<br>>
<br>> Sorry!! I mixed the .class and. java files!! ;)<br>> Here is the source code. I also paste the code I am using to read the rule<br>> package:<br>><br>> public RuleBase readRulePackage() throws PersistenceException{
<br>> // Reads a set of rules from XML file<br>> try {<br>><br>> PackageBuilder builder = new PackageBuilder();<br>> builder.addPackageFromXml
(new InputStreamReader(new<br>> FileInputStream(ruleFile)));<br>><br>> ruleBase = RuleBaseFactory.newRuleBase();<br>> ruleBase.addPackage(builder.getPackage());<br>> return ruleBase;
<br>><br>> } catch (Exception e){<br>> e.printStackTrace();<br>> throw new PersistenceException("Error reading rules file");<br>> }
<br>> }<br>><br>> thx! <a href="http://www.nabble.com/file/p12935779/Instance.java">http://www.nabble.com/file/p12935779/Instance.java</a> Instance.java<br>><br>><br>> Fernando Meyer Camargo wrote:
<br>>><br>>> Hi isabelle,<br>>><br>>> When I said instance class, I was meaning your instance source code ;)<br>>><br>>> Regards<br>>><br>>> On 9/28/07, Isabelle Hupont <
<a href="mailto:ihupont@ita.es">ihupont@ita.es</a>> wrote:<br>>>><br>>>><br>>>> Hi Fernando!<br>>>><br>>>> Mi Instance class is the Weka class I attach....<br>>>> Thanks for your attention.
<br>>>> Isabelle.<br>>>> <a href="http://www.nabble.com/file/p12935480/Instance.class">http://www.nabble.com/file/p12935480/Instance.class</a> Instance.class<br>>>><br>>>><br>>>>
<br>>>> Fernando Meyer Camargo wrote:<br>>>> ><br>>>> > Could you please provide your Instance class ?<br>>>> ><br>>>> ><br>>>> > On 9/27/07, Isabelle Hupont <
<a href="mailto:ihupont@ita.es">ihupont@ita.es</a>> wrote:<br>>>> >><br>>>> >><br>>>> >> Hi!<br>>>> >><br>>>> >> I want to program the following drl rule in xml:
<br>>>> >><br>>>> >> rule "average calculation"<br>>>> >> no-loop true<br>>>> >> when<br>>>> >> _i : Instance()
<br>>>> >> _average : Double()<br>>>> >> from accumulate(accInst: Instance(),<br>>>> >> average(
<br>>>> >> accInst.value("tend")))<br>>>> >> eval(_average < 20000)<br>>>> >> then<br>>>> >> _i.setValue("tend",2000);
<br>>>> >> end<br>>>> >><br>>>> >><br>>>> >> For it, I have implemented the following xml file:<br>>>> >><br>>>> >> <?xml version="
1.0" encoding="UTF-8"?><br>>>> >> <package name="org.prophet.fuzzy"<br>>>> xmlns="<a href="http://drools.org/drools-4.0">http://drools.org/drools-4.0</a>"<br>
>>> >> xmlns:xs="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"<br>>>> >> xs:schemaLocation="<a href="http://drools.org/drools-4.0">
http://drools.org/drools-4.0</a> drools-4.0.xsd"><br>>>> >> <import name="weka.core.*"/><br>>>> >> <import name="org.prophet.gui.docking.*"/><br>
>>> >> <import name="org.prophet.persistence.*"/><br>>>> >> <import name="org.prophet.persistence.hibernate.*"/><br>>>> >> <import name="
org.prophet.rules.*"/><br>>>> >> <import name="org.prophet.*"/><br>>>> >> <rule name="Rule1"><br>>>> >> <rule-attribute name="no-loop" value="true"/>
<br>>>> >> <lhs><br>>>> >> <pattern identifier="_i" object-type="Instance"/><br>>>> >> <pattern identifier="_average" object-type="Double">
<br>>>> >> <from><br>>>> >> <accumulate><br>>>> >> <pattern identifier="accInst"<br>>>> >> object-type="Instance"/>
<br>>>> >> <external-function evaluator="average"<br>>>> >> expression="accInst.value(&quot;tend&quot;)"/><br>>>> >> </accumulate>
<br>>>> >> </from><br>>>> >> </pattern><br>>>> >> <eval>_average &lt; 20000.0</eval><br>>>> >> </lhs>
<br>>>> >> <rhs><br>>>> >> _i.setValue("tend", 2000.0); manageRuleFired("Rule1", null, _i);<br>>>> >> modify(_i);</rhs><br>>>> >> </rule>
<br>>>> >> </package><br>>>> >><br>>>> >> And I have the following error when reading the rule package:<br>>>> >><br>>>> >> org.drools.rule.InvalidRulePackage
: Rule Compilation error _average<br>>>> >> cannot<br>>>> >> be resolved _i cannot be resolved _i cannot be resolved _i__Handle__<br>>>> >> cannot<br>>>> >> be resolved _i cannot be resolved
<br>>>> >><br>>>> >><br>>>> >> I also have tried to replace the xml identifier <pattern> by <column><br>>>> >> with<br>>>> >> no result. Can you help me, please?
<br>>>> >><br>>>> >><br>>>> >> --<br>>>> >> View this message in context:<br>>>> >><br>>>> <a href="http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12916380">
http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12916380</a><br>>>> >> Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>>>> >>
<br>>>> >> _______________________________________________<br>>>> >> rules-users mailing list<br>>>> >> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br>>>> >> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>>>> >><br>>>> ><br>>>> ><br>>>> >
<br>>>> > --<br>>>> > Fernando Meyer <a href="http://fmeyer.org">http://fmeyer.org</a><br>>>> > JBoss Rules Core Developer<br>>>> > <a href="mailto:fmcamargo@gmail.com">fmcamargo@gmail.com
</a><br>>>> ><br>>>> > _______________________________________________<br>>>> > rules-users mailing list<br>>>> > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br>>>> > <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>>>> ><br>>>> ><br>>>><br>>>> --
<br>>>> View this message in context:<br>>>> <a href="http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12935480">http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12935480</a>
<br>>>> Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>>>><br>>>> _______________________________________________<br>>>> rules-users mailing list
<br>>>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br>>>><br>>><br>>><br>>><br>>> --<br>>> Fernando Meyer <a href="http://fmeyer.org">http://fmeyer.org</a><br>>> JBoss Rules Core Developer<br>>> <a href="mailto:fmcamargo@gmail.com">
fmcamargo@gmail.com</a><br>>><br>>> _______________________________________________<br>>> rules-users mailing list<br>>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<br>>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>>><br>>><br>><br>><br><br>--<br>View this message in context: <a href="http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12938379">
http://www.nabble.com/accumulate-funtion-in-xml-tf4526879.html#a12938379</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><br>_______________________________________________
<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Fernando Meyer <a href="http://fmeyer.org">http://fmeyer.org</a><br>JBoss Rules Core Developer<br><a href="mailto:fmcamargo@gmail.com">fmcamargo@gmail.com</a>