[rules-users] Problem with Banking Tutorial

Stefan Schuster stefan.m.schuster at gmail.com
Tue Apr 23 04:50:41 EDT 2013


Hi all,

thanks a lot for your helpful answers.

I'm looking forward to the update to 5.6.0. Is the mentioned time horizon
("a few days") still realistic? I.e. could you recommend me to pause the
evaluation of drools, instead of downgrading to 5.4.0?

We consider to use drools in a larger project, and I have to
decide whether I recommend drools, or prefer a simpler design developed
from scratch. As far it's an fact that I cannot recommend drools 5.5.0.

What version is reasonable to use for further evaluation?

Stefan





2013/4/19 Wolfgang Laun <wolfgang.laun at gmail.com>

> On 18/04/2013, Stefan Schuster <stefan.m.schuster at gmail.com> wrote:
> >
> > Please don't misunderstand me, I have a deep respect for the developer of
> > such complex systems like DROOLS, and  I know from my own code that bugs
> > simply happen. But I wonder why there is still this version without any
> > warning the official release?
> >
>
> Not putting out warnings when some release is known to be broken is a
> rather dark spot on the gloss of Drools. I have urged this before,
> mainly because
> not warning users is a primary cause for them wasting time and effort.
>
> Keep carping...
> Wolfgang
>
>
>
>
> > Is it better to use an older version?
> >
> > best regards
> >
> > Stefan
> >
> >
> >
> >
> > 2013/4/18 Mark Proctor <mproctor at codehaus.org>
> >
> >> There are a lot of fixes in the 5.x master. Anyone verified their bugs
> >> against this? I suspect this is fixed in that.
> >>
> >>
> >> Mark
> >> On 18 Apr 2013, at 16:21, Wolfgang Laun <wolfgang.laun at gmail.com>
> wrote:
> >>
> >> > Ah, my memory :-)
> >> >
> >> > http://lists.jboss.org/pipermail/rules-dev/2013-January/004338.html
> >> >
> >> > Mark has promised a fix for 3 months ago, but of course 5.5.0 remains
> >> broken.
> >> >
> >> > -W
> >> >
> >> > On 18/04/2013, Stefan Schuster <stefan.m.schuster at gmail.com> wrote:
> >> >> Hi, thank you for your response.
> >> >> I'm using the latest stable release of Drools 5.5.0 final.
> >> >> Eclipse is Juno Service Release 2.
> >> >>
> >> >> Can you confirm, that the order 1,2,3 is the expected result?
> >> >>
> >> >> If this is a known bug, is there some kind of jira or bugzilla numer
> >> >> assigned to it?
> >> >>
> >> >>
> >> >>
> >> >> 2013/4/18 Wolfgang Laun <wolfgang.laun at gmail.com>
> >> >>
> >> >>> IIRC, this was a bug one or two minor versions ago. What version are
> >> you
> >> >>> using?
> >> >>> -W
> >> >>>
> >> >>> On 18/04/2013, Stefan Schuster <stefan.m.schuster at gmail.com> wrote:
> >> >>>> For the sake of  completeness, here is also the RuleRunner class
> >> >>>> used
> >> >>>> in
> >> >>>> this example:
> >> >>>>
> >> >>>> package org.drools.tutorials.banking;
> >> >>>>
> >> >>>> import java.util.Collection;
> >> >>>>
> >> >>>> import org.drools.KnowledgeBase;
> >> >>>> import org.drools.KnowledgeBaseFactory;
> >> >>>> import org.drools.builder.KnowledgeBuilder;
> >> >>>> import org.drools.builder.KnowledgeBuilderFactory;
> >> >>>> import org.drools.builder.ResourceType;
> >> >>>> import org.drools.definition.KnowledgePackage;
> >> >>>> import org.drools.io.ResourceFactory;
> >> >>>> import org.drools.runtime.StatefulKnowledgeSession;
> >> >>>>
> >> >>>> public class RuleRunner {
> >> >>>>
> >> >>>>    public RuleRunner() {
> >> >>>>    }
> >> >>>>
> >> >>>>    public void runRules(String[] rules,
> >> >>>>                         Object[] facts) {
> >> >>>>
> >> >>>>        KnowledgeBase kbase =
> >> >>>> KnowledgeBaseFactory.newKnowledgeBase();
> >> >>>>        KnowledgeBuilder kbuilder =
> >> >>>> KnowledgeBuilderFactory.newKnowledgeBuilder();
> >> >>>>
> >> >>>>        for ( int i = 0; i < rules.length; i++ ) {
> >> >>>>            String ruleFile = rules[i];
> >> >>>>            System.out.println( "Loading file: " + ruleFile );
> >> >>>>            kbuilder.add( ResourceFactory.newClassPathResource(
> >> >>>> ruleFile,
> >> >>>>
> >> >>>> RuleRunner.class ),
> >> >>>>                                  ResourceType.DRL );
> >> >>>>        }
> >> >>>>
> >> >>>>        Collection<KnowledgePackage> pkgs =
> >> >>>> kbuilder.getKnowledgePackages();
> >> >>>>        kbase.addKnowledgePackages( pkgs );
> >> >>>>        StatefulKnowledgeSession ksession =
> >> >>>> kbase.newStatefulKnowledgeSession();
> >> >>>>
> >> >>>>        for ( int i = 0; i < facts.length; i++ ) {
> >> >>>>            Object fact = facts[i];
> >> >>>>            System.out.println( "Inserting fact: " + fact );
> >> >>>>            ksession.insert( fact );
> >> >>>>        }
> >> >>>>
> >> >>>>        ksession.fireAllRules();
> >> >>>>    }
> >> >>>> }
> >> >>>>
> >> >>>>
> >> >>>> 2013/4/18 Stefan Schuster <stefan.m.schuster at gmail.com>
> >> >>>>
> >> >>>>> Hello,
> >> >>>>>
> >> >>>>> I have a problem with the banking tutorial number 3, which is part
> >> >>>>> of
> >> >>> the
> >> >>>>> examples of drools expert.
> >> >>>>> It simply adds some Numbers as facts, and retracts them in an
> >> >>>>> increasing
> >> >>>>> order.
> >> >>>>>
> >> >>>>> It is very short, therefore I post the whole Code:
> >> >>>>>
> >> >>>>>
> >> >>>>> BankingExample3.java
> >> >>>>> _________________________________________________
> >> >>>>> package org.drools.tutorials.banking;
> >> >>>>>
> >> >>>>> public class BankingExample3 {
> >> >>>>>    public static void main(String[] args) {
> >> >>>>>        Number[] numbers = new Number[] {wrap(3), wrap(1), wrap(4),
> >> >>>>> wrap(1), wrap(5)};
> >> >>>>>        new RuleRunner().runRules( new String[] { "Example3.drl" },
> >> >>>>>                                   numbers );
> >> >>>>>    }
> >> >>>>>
> >> >>>>>    private static Integer wrap(int i) {
> >> >>>>>        return new Integer(i);
> >> >>>>>    }
> >> >>>>> }
> >> >>>>> _________________________________________________
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> Example3.drl:
> >> >>>>> _________________________________________________
> >> >>>>> package org.drools.tutorials.banking
> >> >>>>>
> >> >>>>> rule "Rule 01"
> >> >>>>>    when
> >> >>>>>        $number : Number()
> >> >>>>>        not Number( intValue < $number.intValue )
> >> >>>>>    then
> >> >>>>>        System.out.println("Number found with value: " +
> >> >>>>> $number.intValue() );
> >> >>>>>        retract( $number );
> >> >>>>> end
> >> >>>>> _________________________________________________
> >> >>>>>
> >> >>>>>
> >> >>>>> Output:
> >> >>>>> _________________________________________________
> >> >>>>> Loading file: Example3.drl
> >> >>>>> Inserting fact: 3
> >> >>>>> Inserting fact: 1
> >> >>>>> Inserting fact: 4
> >> >>>>> Inserting fact: 1
> >> >>>>> Inserting fact: 5
> >> >>>>> Number found with value: 1
> >> >>>>> Number found with value: 1
> >> >>>>> Number found with value: 3
> >> >>>>> Number found with value: 4
> >> >>>>> Number found with value: 5
> >> >>>>> _________________________________________________
> >> >>>>>
> >> >>>>>
> >> >>>>> that seams absolute logically to me.
> >> >>>>> But now I alter the Numbers in the Java-Part:
> >> >>>>> Number[] numbers = new Number[] {wrap(3), wrap(1), wrap(2)};
> >> >>>>>
> >> >>>>> and the output destroys everything I thought I understood:
> >> >>>>> Loading file: Example3.drl
> >> >>>>> Inserting fact: 3
> >> >>>>> Inserting fact: 1
> >> >>>>> Inserting fact: 2
> >> >>>>> Number found with value: 1
> >> >>>>> Number found with value: 3
> >> >>>>> Number found with value: 2
> >> >>>>>
> >> >>>>>
> >> >>>>> Can someone  reproduce this behavior?? It seams absolutely strange
> >> >>>>> to
> >> >>> me.
> >> >>>>> I would have expected the order 1,2,3. Any explanations?
> >> >>>>>
> >> >>>>> Thanks in advance for helping me!
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>> _______________________________________________
> >> >>> rules-users mailing list
> >> >>> rules-users at lists.jboss.org
> >> >>> https://lists.jboss.org/mailman/listinfo/rules-users
> >> >>>
> >> >>
> >> > _______________________________________________
> >> > rules-users mailing list
> >> > rules-users at lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130423/53b1c506/attachment.html 


More information about the rules-users mailing list