Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-382

Rule that operates on 2 facts uses the same fact for both arguments

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Minor
    • 3.0.3
    • None
    • None
    • None

    Description

      According to a reply on the thread "[drools-user] A few beginner drl questions" in the user mailing list, this is a bug.

      Rule:

      rule secondRule
      when
      $lesson1 : Lesson($teacher : teacher, $group : group, $timeslot : timeslot)
      $lesson2 : Lesson(teacher == $teacher, group == $group, timeslot == $timeslot)
      then
      System.out.println("secondRule: " + $lesson1 + " with " + $lesson2);
      end

      gives an output where both lessons are the same fact:

      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1

      I 'll attack a zip of my m2 configured app. To repreduce:

      • mvn install eclipse:eclipse idea:idea
      • Run net.sf.tabudrool.app.TabudroolApp
      • Click "Load unsolvedSchedule1.xml"
      • Click "Plan schedule"

      You'll get this output, which proves that the same lesson is used both facts of the rule:

      C:\develop\build\jdk1.5.0_05\bin\java -Didea.launcher.port=7546 "-Didea.launcher.bin.path=C:\develop\edit\IntelliJ IDEA 5.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\develop\build\jdk1.5.0_05\jre\lib\charsets.jar;C:\develop\build\jdk1.5.0_05\jre\lib\deploy.jar;C:\develop\build\jdk1.5.0_05\jre\lib\javaws.jar;C:\develop\build\jdk1.5.0_05\jre\lib\jce.jar;C:\develop\build\jdk1.5.0_05\jre\lib\jsse.jar;C:\develop\build\jdk1.5.0_05\jre\lib\plugin.jar;C:\develop\build\jdk1.5.0_05\jre\lib\rt.jar;C:\develop\build\jdk1.5.0_05\jre\lib\ext\dnsns.jar;C:\develop\build\jdk1.5.0_05\jre\lib\ext\localedata.jar;C:\develop\build\jdk1.5.0_05\jre\lib\ext\sunjce_provider.jar;C:\develop\build\jdk1.5.0_05\jre\lib\ext\sunpkcs11.jar;D:\projects\sf\tabudrool\target\test-classes;D:\projects\sf\tabudrool\target\classes;C:\Documents and Settings\ge0ffrey\.m2\repository\junit\junit\3.8.1\junit-3.8.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\apache\commons\commons-jci-eclipse\3.2.0.666\commons-jci-eclipse-3.2.0.666.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\concurrent\concurrent\1.3.4\concurrent-1.3.4.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\javax\transaction\jta\1.0.1B\jta-1.0.1B.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\xstream\xstream\1.1.3\xstream-1.1.3.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\apache\commons\commons-jci-janino\2.4.3\commons-jci-janino-2.4.3.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\log4j\log4j\1.2.12\log4j-1.2.12.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\janino\janino\2.4.3\janino-2.4.3.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\antlr\stringtemplate\2.3b6\stringtemplate-2.3b6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\colt\colt\1.2.0\colt-1.2.0.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\xpp3\xpp3\1.1.3.4.O\xpp3-1.1.3.4.O.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\com\servlets\cos\05Nov2002\cos-05Nov2002.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\commons-lang\commons-lang\2.1\commons-lang-2.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\antlr\antlr\2.7.6\antlr-2.7.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\commons-collections\commons-collections\3.1\commons-collections-3.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-remoting\1.2.6\spring-remoting-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\javax\resource\connector\1.0\connector-1.0.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\javax\servlet\jstl\1.0\jstl-1.0.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-core\1.2.6\spring-core-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\quartz\quartz\1.5.1\quartz-1.5.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\taglibs\standard\1.0.6\standard-1.0.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\oro\oro\2.0.8\oro-2.0.8.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\xerces\xercesImpl\2.6.2\xercesImpl-2.6.2.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-orm\1.2.6\spring-orm-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\commons-io\commons-io\1.1\commons-io-1.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-web\1.2.6\spring-web-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-beans\1.2.6\spring-beans-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-context\1.2.6\spring-context-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\javax\activation\activation\1.0.2\activation-1.0.2.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\jung\jung\1.7.2\jung-1.7.2.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-support\1.2.6\spring-support-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-webmvc\1.2.6\spring-webmvc-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-aop\1.2.6\spring-aop-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\ehcache\ehcache\1.1\ehcache-1.1.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-dao\1.2.6\spring-dao-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\drools\drools-compiler\3.0.3\drools-compiler-3.0.3.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\eclipse\jdt\core\3.2.0.666\core-3.2.0.666.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\antlr\antlr\3.0ea8\antlr-3.0ea8.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\apache\commons\commons-jci-core\1.0-406301\commons-jci-core-1.0-406301.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\springframework\spring-jdbc\1.2.6\spring-jdbc-1.2.6.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\commons-logging\commons-logging-api\1.0.4\commons-logging-api-1.0.4.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\javax\mail\mail\1.3.2\mail-1.3.2.jar;C:\Documents and Settings\ge0ffrey\.m2\repository\org\drools\drools-core\3.0.3\drools-core-3.0.3.jar;C:\develop\edit\IntelliJ IDEA 5.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain net.sf.tabudrool.app.TabudroolApp
      2006-07-30 17:13:45,062 [AWT-EventQueue-0] INFO net.sf.tabudrool.persistence.ScheduleDao.readSchedule(ScheduleDao.java:37)
      Loaded: class path resource [net/sf/tabudrool/persistence/unsolvedSchedule1.xml]
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher2 + group2 with 0: teacher2 + group2
      secondRule: 0: teacher3 + group3 with 0: teacher3 + group3
      secondRule: 0: teacher3 + group3 with 0: teacher3 + group3
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1
      secondRule: 0: teacher1 + group1 with 0: teacher1 + group1

      Attachments

        Activity

          People

            etirelli@redhat.com Edson Tirelli
            gdesmet@redhat.com Geoffrey De Smet (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty