[jboss-jira] [JBoss JIRA] Created: (JBRULES-2383) nesting of prefix-and and prefix-or conditional elements result in errors from the knowledge builder

Olli Knuuttila (JIRA) jira-events at lists.jboss.org
Thu Dec 17 02:31:30 EST 2009


nesting of prefix-and and prefix-or conditional elements result in errors from the knowledge builder
----------------------------------------------------------------------------------------------------

                 Key: JBRULES-2383
                 URL: https://jira.jboss.org/jira/browse/JBRULES-2383
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-compiler (expert)
    Affects Versions: 5.1.0.M1
         Environment: windows, jdk1.6.0_11
            Reporter: Olli Knuuttila
            Assignee: Mark Proctor


case 1 (gives the errors):
	import org.drools.Person;

	rule "rule1"
	when
		(and
			(or
				Person(name=="bob")
				Person(name=="june")
			)
			(or
				Person(name=="will")
				Person(name=="dorothy")
			)
		)
	then
		System.out.println("FIRED");
	end


case 2 (works):
	import org.drools.Person;

	rule "rule1"
	when
		(
			(
				Person(name=="bob")
			or
				Person(name=="june")
			)
		and
			(
				Person(name=="will")
			or
				Person(name=="dorothy")
			)
		)
	then
		System.out.println("FIRED");
	end


the errors:
	[ERR 101] Line 6:3 no viable alternative at input 'or' in rule "rule1"[8,3]: [ERR 102] Line 8:3 mismatched input 'Person' expecting ')' in rule "rule1"[14,1]: [ERR 102] Line 14:1 mismatched input ')' expecting 'then' in rule "rule1"


Code used to compile:
	KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
	kbuilder.add(ResourceFactory.newFileResource("C:\\temp\\test.drl"), ResourceType.DRL);

	if(kbuilder.hasErrors()) {
		System.err.println(kbuilder.getErrors().toString());
        } else {
		System.out.println("Success!!");
        }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list