Fact Bases
Facts are organized into fact bases. The fact bases are created automatically as new facts are asserted.
Facts
Think of a fact as a simple statement. It has a name and a set of arguments. The arguments may be:
- strings
- proper identifiers don't need quotes: Fred is the same as 'Fred'
- numbers
- None, True or False
- tuples of any of these (including nested tuples)
- singleton tuples don't require a comma: (1) is the same as (1,)
Duplicate facts are not allowed. An attempt to assert a fact that already exists is silently ignored. But note that to be a duplicate, all of the arguments must be the same too!
Facts are immutable. They may not be changed or retracted. That's why dictionaries, lists and user-defined objects are not allowed as arguments.
Case Specific Facts
Most facts are case specific facts. This means that they will be deleted when a reset is done to prepare for another run of the inference engine. Case specific facts are asserted through either:
*some_engine*.assert_(kb_name, fact_name, arguments) *some_engine*.add_case_specific_fact(kb_name, fact_name, arguments)
They may also be asserted by forward-chaining rules.
Universal Facts
Universal facts are never deleted, specifically, when a reset is done. Add universal facts by calling:
*some_engine*.add_universal_fact(kb_name, fact_name, arguments)
Typically, all universal facts are added once at program startup.