Verifies that one frame is a direct or indirect instance of another, or returns all
direct or indirect instances of an instance.
- The class frame.
- Either an instance to be tested or a variable to be bound.
- If the :INCLUSIVE keyword is present and the instance argument
is a variable, the class will be included as one of the
bindings of the variable.
(:INSTANCE Canines Rover)
(:INSTANCE Canines ?x)
(:INSTANCE Canines ?x :INCLUSIVE)
(:INSTANCE Physical_Objects Rover ?rover) ;; succeeds if Rover is an instance of Physical_Objects and binds a variable to Rover.
;; The following path is guaranteed to be true
((:INSTANCE Canines ?canine)
(:CLASS ?canine Canines))
The argument class must be a class.
If the clause is ground, succeeds if the relationship is true.
If the clause is not ground, succeeds if it retrieves at least one instance.
Fails if class is not a class, if the class-instance relationship
is not true, or if the class has no instances.
- More often, you will want to retrieve the :DIRECT-INSTANCEs of a class.
- :INSTANCE can also be used to restrict the type of a variable.
For example, if the clause
(:INSTANCE Horses ?x) 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