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

Brackets are not always optional for non-existential quantifier "not"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 4.0.0.GA
    • Fix Version/s: 4.0.1
    • Component/s: drools-compiler
    • Labels:
      None

      Description

      According to the documentation, brackets are optional as illustrated by

      Example 6.37. No Busses

      not Bus()

      In case of the rule (class SpecialString in http://jira.jboss.com/jira/browse/JBRULES-1079)

      package test

      rule "Brackets"

      when
      not exists(x : SpecialString() and
      forall(y : SpecialString(this!=x)
      SpecialString(this==y, text=="Universe")))

      then
      System.out.println("Condition satisfied");
      end

      this is not true. Trying to load this rule leads to

      org.drools.rule.InvalidRulePackage: [8,8]: unknown:8:8 Unexpected token 'exists'
      at org.drools.rule.Package.checkValidity(Package.java:408)
      at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:288)
      at DroolsTest.<init>(Unknown Source)
      at DroolsTest.main(Unknown Source)

      When brackets are added:

      package test

      rule "Brackets"

      when
      not(exists(x : SpecialString() and
      forall(y : SpecialString(this!=x)
      SpecialString(this==y, text=="Universe"))))

      then
      System.out.println("Condition satisfied");
      end

      rule loading works without any exceptions.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michaelneale Michael Neale
                Reporter:
                marreitz Markus Reitz
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: