Negation in Rules - Gnorion/BizVR GitHub Wiki

Negation in Rules

We need to be able to handle expressions of the form:

not 'red'          (meaning any value other than 'red')
not('red','green') (meaning any value other than 'red' and 'green')
other              (meaning any value not covered by any other rule in the current ruleset (DT)

Examples

image

image

image

Effectively the not operator applied to a set of (boolean) expressions is equivalent to determining the gaps in those expressions.

If you don't want the expression to include the null value then its better to use the equivalent positive phrasing rather than not

Expression Equivalent to
not (<18) >=18 or null
not (<18,>100) [18..100] or null
not (<100,>100) 100 or null
not (<100,>0) null or F cannot be true for any value
not (<0,[25..50],>100) [0..25),(50..100] or null

For strings

Expression Equivalent to Notes
not ('red') <'red',>'red' either before 'red' or after 'red' or null
not('red','green') <'green',('green'..'red'],>'red' or null
⚠️ **GitHub.com Fallback** ⚠️