5.2.5 immediateSubTypes

Introduction

The immediateSubTypes goal is used to get a list of the immediate subtypes of a given type.

Signature

immediateSubTypes(T,L)

Operation

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

Example

// Type hierarchy
Entity > Physical, Abstract.
Abstract > Point, Line, Circle.

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

Explanation

This example only has a very simple type-hierarchy.

Usage

If we ask the following query:

?- immediateSubTypes(Entity, L).

we get the following answer:

{L = (Physical, Abstract)}

This is precisely the list of all immediate subtypes of the type Entity.

Similarly, if we ask the following query:

?-immediateSubTypes(Abstract, L).

we get the following answer:

{L = (Point, Line, Circle)}

This is also the list of all immediate subtypes of the type Abstract.

Summary

Thus the immediateSubTypes goal returns a list of all of the immediate subtypes of a given type.


PrevLite: 5.2.4 superTypes
NextLite: 5.2.6 maxComSubType

Prev: 5.2.4 superTypes
Up: 5.2 Type goals
Next: 5.2.6 maxComSubType