In this example, we're determining whether a given airline passenger is eligible to have their coach seat upgraded to a first-class seat. In order to be eligible, a passenger must:
In order to determine this, we must compare a passenger's facts with our rule.
We fetch the rule from our RuleBase, which, for simplicity's sake, is merely a text file with a .rul extension. It's contents are in Reverse Polish Notation (to handle precedence):
# Rule establishing when an airline passenger may be # allowed to upgrade his/her seat. passengerIsEconomy IS true passengerIsGoldCardHolder IS true passengerIsSilverCardHolder IS true OR AND passengerCarryOnBaggageAllowance EQUALS 15.0 passengerCarryOnBaggageWeight EQUALS 10.0 LESSTHANOREQUALTO AND
We get facts pertaining to a Rule from our FactBase, which again is simply a text file. Note the difference between a sql.con file and a txt.con file.
passengerIsEconomy IS true passengerIsGoldCardHolder IS true passengerIsSilverCardHolder IS false passengerCarryOnBaggageWeight EQUALS 10.0 passengerCarryOnBaggageAllowance EQUALS 15.0
Proposition statement = ( ( passengerCarryOnBaggageWeight <= passengerCarryOnBaggageAllowance ) AND ( ( passengerIsSilverCardHolder OR passengerIsGoldCardHolder ) AND passengerIsEconomy ) ), value = TRUE
Page executed in 0.4870 seconds.