[rules-users] Re: Mixing dsl language and regular rule syntax in a rule file

Matt Geis mgeis at yahoo.com
Fri Mar 20 12:33:49 EDT 2009




>>  Is it possible to mix dsl language and regular rule syntax in a rule
file? 

Absolutely.  Last I checked, it was not documented, but you can see it in the samples that ship with Drools.  Your dslr file below has been rewritten to support what you want to do.  (The '>' character tells the parser to not perform DSL expansion on a given line)

animal.dslr file
#created on: Mar 12, 2009
package com.fedex.cc.expertsystem.test
import com.fedex.cc.expertsystem.fact.*

expander animal.dsl

rule "Set dog's ownership"
no-loop
    when
        There is an animal lover and dog in the system
    then 
        The person owns the dog
end

rule "Tell us person doesnt like dogs"
    when 
>        person : Person(animalLover == false)
    then 
>        System.out.println("Person does not like dog");
end


      



More information about the rules-users mailing list