samples/basic/tutorial/shopping.kb
KnowledgeWright supports a wide variety of date calculations that can be used in conditions in rule_sets and rules_tables.
The full set of date capabilities are described under Expressions.
As an example, we'll create a knowledgebase that helps plan your shopping activities for Christmas.
conditions value today >= christmas "Too late; find new friends.
Your family might forgive you." today = christmas "Too late for shopping;
bake cookies quick." tomorrow = christmas "Go shopping at the mall right
this minute." christmas - 1 weeks < today "Either order today from the
Internet with overnight shipping
(hope you've got alot of money)
or go shopping as soon as possible
at the mall (hope you like crowds)." christmas - 1 months < today "Order all your presents on the
Internet." true "Take your time and shop on the Internet."Notice the last row the conditions are true, so if none of the other rows match, this one will.