Algernon Tutorial 1.c
Ground and non-ground Clauses
previous next
Variables
- In Algernon, a variable starts with a question mark.
- Examples: ?name, ?x, ?length
- The names have no meaning, but as in all programming languages, it is
a good idea to give them meaningful names.
- Variables do not have to be declared, but they are
implicitly assigned a type according to their first use.
- They keep that type throughout the scope of their current path.
- Each variable exists only in one path. That is, there are no global variables.
(You can store global values in the KB).
- Examples:
(length Box-7 ?length) ?length is of type number.
(expresses Gene-1 ?product) ?product's type is a class
in the KB determined by the range of the relation (or what Protege
calls the allowed classes of the slot).
- Algernon allows these types: Boolean, List, Number, String, Symbol, and any class in the KB.
Ground Clauses
- A ground clause either contains no variables, or all of its
variables have been bound by previous clauses in the path.
- When Algernon processes a ground clause, it will assert the
information into the KB if it is not there already. If it is
already there the clause will succeed, but will not change the KB.
- Asserting new information into the KB will cause Algernon
to fire relevant forward-chaining rules.
Non-ground Clauses
- A non-ground clause contains an unbound variable.
- When Algernon processes a non-ground clause, it will first
fire any relevant backward-chaining rules, then it will
query the KB for the information in the clause.
Examples
- ((Color DoorFrame ?color) (Color WindowFrame ?color))
- If the WindowFrame does not yet have a color or the Color slot has multiple cardinality,
this will assign the window frame the same color as the color of the door frame.
- If the WindowFrame already has a color and the Color slot is single-cardinality,
the path will succeed if the color of the window frame is the same as the color
of the door frame.
previous next
Author: Micheal Hewett
Email: mhewett@users.sf.net
Last Updated: Monday, June 06, 2005