hqRule is the business rules engine for Data Management teams who would rather focus on the features that make their business unique.
Here’s how to use it.
hqRule evaluates a set of Inputs against a Ruleset in order to match each Input to one or more Results. Depending on evaluation configuration, some subset of these matched Results will be returned as Output.
Results may be unrelated to one another, or may share a hierarchical relationship. Rules are evaluated in priority order, so ambiguous or even contradictory Rules can still match Inputs to Results so long as at least one Rule evaluates TRUE against a given Input.
A Result may be of one of two types:
The following image illustrates a Ruleset designed to classify private capital assets.
Note that the Results have a hierarchical relationship. This is optional: Results could also be represented as a flat list, which is accomplished by setting each Result’s ParentResultId to NULL. Deleting one Result—say, Equity—will cause the deletion of all descendant Results (Venture Capital, Early Stage, Expansion Capital, etc.) as well as all associated Rules, RuleTerms, and RuleTermValues.
Used in combination, these options have the following effects:
|F||F||–||Highest-performance mode of operation. RAR value not relevant because EAR = FALSE guarantees one or zero Outputs returned. Rules evaluated non-progressively, so Output may come from any Result in the hierarchy.|
|F||T||–||RAR value not relevant because EAR = FALSE guarantees one or zero Outputs returned. Rules evaluated progressively, so Output may only come from a Result at the top level of the hierarchy.|
|T||F||F||All Rules evaluated non-progressively, so Outputs may come from any Result in the hierarchy. When parent Results also evaluate TRUE, only lowest-level Outputs returned.|
|T||F||T||All Rules evaluated non-progressively, so Outputs may come from any Result in the hierarchy. When parent Results also evaluate TRUE, all levels returned.|
|T||T||F||Lowest-performance mode of operation. All Rules evaluated progressively, so Outputs only returned if all parent levels evaluate TRUE. Only lowest-level Outputs returned.|
|T||T||T||All Rules evaluated progressively, so Outputs only returned if all parent levels evaluate TRUE. All Output levels returned.|
This is the highest-performance mode of operation. RAR value is not relevant because EAR = FALSE guarantees one or zero Outputs returned. Rules are evaluated non-progressively, so Output may come from any Result in the hierarchy.
In the above examples, only one Rule is associated with most Results. This need not be the case: any number of Rules may be associated with a given Result (e.g. Late Stage and Early Stage). There is an implicit OR relationship between Rules on a given Result: if any one evaluates TRUE, then the Result is returned (assuming the Config options permit it).
Note that many of the Rules articulated in our example have multiple RuleTerms, meaning several Terms must be evaluated successfully against the Input for the Rule to evaluate TRUE. There is an implicit AND relationship between RuleTerms on a given Rule, so all of them must evaluate TRUE for the Rule to evaluate TRUE.
Also, a few of the RuleTerms in our example have multiple RuleTermValues (e.g. InvestmentType in the Rule with Priority = 9). There is an implicit OR relationship between RuleTermValues.
A RuleTerm brings together a Term, an Operator, and one or more RuleTermValues. So for the one RuleTerm on the Rule with Priority = 9…