[rules-users] DSL Entry Question

jstroup jstroup at regenstrief.org
Fri May 27 10:24:17 EDT 2011


Hi,

The 5.2 docs list the following example DSL entry

  [when][][Tt]here is an? {entity:\w+}=${entity!lc}: ${entity!ucfirst} ()

and say the following about what follows the equals sign

"The remaining part of the line after the delimiting equal sign is the
replacement text for any DSLR text matching the regular expression. It may
contain variable references, i.e., a variable name enclosed in braces."

What does the colon following the first variable do? I'm guessing it acts as
an OR? I didn't see any explanation of this and I don't *think* this is
regex. 

Also, I'm used to (and actually understand) the following syntax which does
not prefix { with a $.

   [when]There is some {cheese} cheese available=Cheese(type=="{cheese}")

My best guess is that the $ denotes a class name that is specified
declaratively in the matching DSLR rule as opposed to a field {cheese} that
is simply a replaceable parameter that matches whatever you type between
"some" and "cheese available" and looks for Cheese objects of that type. So,
given the first DSL entry, if my rule text is

  when

    there is a cheese

the rule will fire if a Cheese object has been inserted. And, conversely

  when
  
    There is an Cheese

will also fire.


Am I on the right track here?

Thanks,

Jeff






--
View this message in context: http://drools.46999.n3.nabble.com/DSL-Entry-Question-tp2993076p2993076.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list