Rule Groups

[Previous] [Next]

By default, all OmniMark rules are active all the time. You can change this by bundling your rules into groups:

 group duck find "walks" output "#walks#" find "waddles" output "#waddles#" group bar find "bartender" output "#bartender#" find "beer" output "#beer#" group #implied process-start using group duck do submit "A duck walks into a bar." done using group bar do submit "He says to the bartender, 'gimme a beer'." done 

In this program, only rules in the group duck are used to process "A duck walks into a bar." Only rules in the group bar are used to process "He says to the bartender, 'gimme a beer'."

Why group #implied before process-start? The process-start rule is a rule like any other, so it is affected by groups like any other rule. The group #implied statement stands for the default group. (In a program with no groups, all rules are in the default group.) Only the default group is active when a program starts. All other groups are inactive. So you have to have at least one rule in the default group to activate any of the other groups. If we didn't place the process-start rule into the default group, no rules would ever be active in this program.

Any rule that occurs before the first group statement in your program automatically belongs to the default group. However, if you use groups, you should place your global rules explicitly into group #implied. (Consider what would happen if you included a file that contained group statements at the top of your main program file and didn't explicitly assign your global rules to group #implied.)

All rules in the default group are global. You cannot disable the default group, so rules in the default group are always active. For this reason, you might want to keep the number of rules in the default group to a minimum. (Remember, however, that you must have at least one.)

Can you have more than one group active at a time? Certainly.

 using group duck & bar & dick & harry 

You can also add a group to the current set of active groups by using #group to represent all active groups.

 using group duck & bar & #group 



XML and SOAP Programming for BizTalk Servers
XML and SOAP Programming for BizTalk(TM) Servers (DV-MPS Programming)
ISBN: 0735611262
EAN: 2147483647
Year: 2000
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net