5.2.4 superTypes

Introduction

The superTypes goal is used to get a list of the supertypes of a given type.

Signature

superTypes(T,L)

Operation

This goal returns, in the list L, all the supertypes of the type T.

Example

// Type hierarchy
Entity > Physical, Abstract.
Physical > Animate, Inanimate.
Animate > Animal, Human.
Human > Man, Woman.
Abstract > Point, Line, Circle.

This example is available in the AAU directory as superTypes.plgCG.

Explanation

This example only has a somewhat elaborate type-hierarchy.

Usage

If we ask the following query:

?-superTypes(Woman, L).

we get the following answer:

{L = (Human, Animate, Physical, Entity)}

This is precisely the list of all supertypes of the type Woman.

Similarly, if we ask the following query:

?- superTypes(Circle, L).

we get the following answer:

{L = (Abstract, Entity)}

This is also the list of all supertypes of the type Circle.

Summary

Thus the superTypes goal returns a list of all of the supertypes of a given type.


PrevLite: 5.2.3 isInstance
NextLite: 5.2.5 immediateSubTypes

Prev: 5.2.3 isInstance
Up: 5.2 Type goals
Next: 5.2.5 immediateSubTypes