Subtype Definitions

Previous Next

Some supertypes are categorised using multiple schemes. Each categorisation scheme results in a group of subtypes. For example, branches of a car rental organisation could be categorised by owner (depending on whether the branch is owned or leased by the branch organisation) and, alternatively, by location.

This results in a model with multiple subtype sets. In the example, subtypes 'Owned Branch' and 'Leased Branch' are in one subtype set. Subtypes 'City Agency', 'Airport Branch', and 'Hotel Desk' are in another subtype set.

MR_clip0025

In USoft Definer, you can model subtype sets as subtype definitions of which each subtype in the set is an element. The purpose of doing this is that, as a next step, you can easily express certain rules that may apply to the subtype set:

You can express that the subtype set has the exclusivity rule. This applies when a supertype instance can be at most 1 one of the subtypes in the set. If the exclusivity rule is defined for Subtype Definition: BRANCH_LOCATION, then each Branch must be a city agency OR an airport branch OR a hotel desk. It cannot be a combination of these.

You can express that the subtype set has the totality rule. This applies when a supertype instance must be at least 1 of the subtypes in the set. If the totality rule is defined for Subtype Definition: BRANCH_LOCATION, then there can only exist Branches that are a city agency, airport branch, or hotel desk. There are no other locations.

CAUTION: It is not necessarily practical to define Subtype Definitions in USoft Definer, even if (conceptually) you can distinguish subtype sets. USoft Definer has many other constructs that may be more practical. For example, a good alternative to having the BRANCH_OWNER Subtype Definition could be to have 2 Relationships between BRANCH and ORGANISATION, one with Role "OWNS" and the other with Role "LEASES". The exclusivity rule could then be expressed by constraint SQL of the following type:

SELECT                ''
FROM                branch
WHERE                owned_by  IS NOT NULL
AND                leased_by IS NOT NULL
 

 

See Also

How to Define a Subtype Definition