Verifies that one frame is a direct or indirect instance of another, or returns all
direct or indirect classes of an instance.
- The instance frame.
- Either a class to be tested or a variable to be bound.
- :INCLUSIVE (optional)
- If the :INCLUSIVE keyword is present and the class argument
is a variable, the instance will be included as one of the
bindings of the variable.
(:CLASS Rover Canines) ;; Succeeds because Canines is a superclass of Rover
(:CLASS Rover ?x) ;; Retrieves all direct and indirect superclasses of Rover
(:CLASS Rover ?x :INCLUSIVE) ;; Retrieves Rover and all superclasses of Rover
;; The following path is guaranteed to be true
((:INSTANCE Canines ?canine)
(:CLASS ?canine Canines))
The argument instance must be an instance.
If the clause is ground, succeeds if the relationship is true.
If the clause is not ground, succeeds if it retrieves at least one class.
Fails if instance is not an instance, if the instance-class relationship
is not true, or if the instance has no class (which is impossible in
- You usually want to retrieve the :DIRECT-CLASS of an instance.
- :CLASS can also be used to restrict the type of a variable.
For example, if the clause
(:CLASS ?x Horses) succeeds,
?x is guaranteed to be of type
The compiler restricts the type of
future clauses in the path.
This can help to bypass some compiler errors and adds very little overhead
to the computation.
Algernon Documentation Central
Algernon home page