Rulesets

How to build expressions with multiple logical operators

 

What is a "ruleset"?

A "ruleset" is a group of multiple logical rules that functions as a single logical rule within a broader logical expression.

As an example, you might say that it's safe to eat a piece of chicken if:

  1. it was purchased less than a week ago; and
  2. it has been "properly cooked".

The above is the broader logical expression.  You might then say that a piece of chicken will be considered "properly cooked" if either:

  • it has been deep-fried for at least 5 minutes; or
  • it has been cooked on a BBQ until the centre is at least 165°F/74°C.

When you combine these together, the test for whether the chicken has been properly cooked becomes a "ruleset" that functions as rule #2 in the broader logical expression, like this:

  1. (rule)  it was purchased less than a week ago; and
  2. (ruleset)  either:
    1. it has been deep-fried for at least 5 minutes; or
    2. it has been cooked on a BBQ until the centre is at least 165°F/74°C.

If either (a) or (b) in the ruleset is satisfied, then rule #2 in the broader logical expression will validate as true.

How do I add a ruleset in the graphical logic builder?

Adding a ruleset in the graphical logic builder is extremely easy: just click the solid "⨁" button in the top-right corner of the logic builder and an empty ruleset will be added. You can then add logical rules (and even further rulesets) within it.

Rulesets are designated in boxes in the graphical logical builder, so it's easy to see how they fit together visually.

 

Complex logic with nested rulesets

Rulesets can be used to build complex logic, with multiple layers of conditionality, quickly and easily. You can see this in action in one of the later modules of our Tutorial Series. We recommend starting the tutorial series from the beginning so that the example makes sense to you when you reach that later module.

What if I need to add a rule around my existing rules/rulesets?

We'll often find ourselves in a situation where we've built a complex expression and we need to add a 'wrapping' rule around it.  For example, we might think of a completely separate set of rules our expression needs to satisfy that is independent of our existing rules. 

To carry on with the example used above, we might want to say that, regardless of other criteria, a piece of chicken is safe to eat if our Mom or Dad cooked it.  Here we would need to add an OR 'wrapping rule' by clicking on the icon in the top-right corner of the Graphical Logic Builder and then adding another rule using the 'OR' option.

Adding Wrapping Rules