Algernon Tutorial 2.d
Macros involving classes and instances
previous next
These exercises and examples use the newspaper project included
in the examples folder of your Protege installation.
Except for :CHILD and :PARENT, all of the commands discussed on
his page will work in two modes.
If the clause is ground, it verifies that the given relationship
exists in the KB. If the clause is not ground, it retrieves
data from the KB. They can not be used to assert information
into the KB.
:CHILD and :PARENT
:CHILD and :PARENT compare two frames across the class
abstraction hierarchy without regard to whether the
arguments are classes or instances.
((:CHILD :THING Author))
((:FAIL (:CHILD Author :THING)))
((:FAIL (:PARENT :THING Author)))
((:PARENT Author :THING))
:SUBCLASS, :SUPERCLASS and :CLASS, :INSTANCE
These return all subclasses or superclasses of a class
(not just direct subclasses or superclasses), or all
the classes of an instance, or all the instances of
a class.
((:SUBCLASS Layout_info ?a))
((:SUBCLASS :THING ?a))
((:SUPERCLASS Rectangle ?a))
((:INSTANCE Employee ?a))
:DIRECT-CLASS and :DIRECT-INSTANCE
Returns direct classes of an instance, or
direct instances of a class.
((:direct-class instance_00067 ?x))
((:direct-instance Editor ?x))
:DIRECT-SUBCLASS and :DIRECT-SUPERCLASS
Returns direct subclasses or superclasses of a class.
((:direct-superclass Author ?x))
((:direct-subclass Author ?x))
:ROOT-CLASS
Returns the root of the ontology tree above any frame.
((:root-class Author ?x))
((:root-class instance_00067 ?x))
:LEAST-COMMON-SUPERCLASS
Returns a class in the KB that is a superclass of both classes
and that has no subclass that is also a superclass of both
classes. Input can be classes or instances.
((:least-common-superclass Author Section ?lcs))
Related links
previous next
Author: Micheal Hewett
Email: mhewett@users.sf.net
Last Updated: Monday, June 06, 2005