You may find it convenient to break a large rule set into smaller pieces for ease of parallel development or re-use. Each rule set may contain Include statements to "pull in" other rule sets and classes. The root element in an included item must be either:
A single rule class; or
An entire rule set, which itself may contain its own Include statements which will be processed recursively.
Different types of Include statements are supported:
Includes an XML file with a path relative to the containing file; this mechanism may be useful during stand-alone development of the rule set by developers using a file-based development environment;
Includes an XML file which is present at the named location on the runtime classpath; this mechanism may be useful to refer to common rule sets which rarely change and are built into the application.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_Include" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <!-- This rule class is defined directly in this rule set --> <Class name="Person"> <Attribute name="firstName"> <type> <javaclass name="String"/> </type> <derivation> <specified/> </derivation> </Attribute> </Class> <!-- Include a rule set defined in another file. When assembled into a single rule set, the names of all the rule classes must be unique. --> <Include> <RelativePath value="./HelloWorld.xml"/> </Include> </RuleSet>
See CER Rule Set Consolidator for how to collapse a rule set which contains RelativePath inclusions into a single rule set file.