I think I have found a solution...
I have not create the "or" mapping in the DSL file but "or" is recognized when 
all rules are on the same line.
it seems to function ! Doesn't it ?


------------------------------ Sample.drl -------------------------------------
package com.sample
 
import com.sample.Person;
expander MyRules.dsl
 
rule "MyRule1"
  when
    There exists a Person with name of bob.
    Person is 15 years old or Person is 16 years old or Person is 17 years old
  then
    Log Hello Bob       
end

------------------------------ MyRules.dsl ------------------------------------

There exists a Person with name of {name}. --> Person(name=="{name}")
Person is {age} years old --> Person(age == {age})
Log {message} --> System.out.println("{message}");

------------------------------ Person.java ------------------------------------

public class Person {

        private String _name;
        private int _age;
        
        public Person() {
                _name = "bob";
                _age = 15;
        }
        
        public Person(String name, int age) {
                _name = name;
                _age = age;
        }

        public int getAge() {
                return _age;
        }

        public void setAge(int _age) {
                this._age = _age;
        }

        public String getName() {
                return _name;
        }

        public void setName(String _name) {
                this._name = _name;
        }

-------------------------------------------------------------------------------

Reply via email to