When modeling information systems, one often encounters subtyping aspects of the business domain that can prove challenging to implement in either relational databases or object-oriented code. In practice, some of these aspects are often handled incorrectly. This chapter examines a number of subtyping issues that require special attention (e.g. derivation options, subtype rigidity, subtype migration), and discusses how to model them conceptually. Because of its richer semantics, the main graphic notation used is that of second generation Object-Role Modeling (ORM 2). However, the main ideas could be adapted for UML and ER, so these are also included in the discussion. A basic implementation of the proposed approach has been prototyped in Neumont ORM Architect (NORMA), an open-source tool supporting ORM 2.
Basic Subtyping And The Need For Derivation Rules
Figure 1(a) shows a simple case of subtyping in ORM 2 notation. Patients are identified by their patient numbers and have their gender recorded. Patient is specialized into MalePatient and FemalePatient. Pregnancy counts are recorded for, and only for, female patients. Prostate status is recorded only for male patients. In ORM 2, object types (e.g. Patient) are depicted as named, soft rectangles. A logical predicate is depicted as a named sequence of role boxes, each connected by a line to the object type whose instances may play that role. The combination of a predicate and its object types is a fact type—the only data structure in ORM (relationships are used instead of attributes). If an object type is identified by a simple fact type (e.g. Gender has GenderCode) this may be abbreviated by placing the reference mode in parentheses.
Partitioning patient into subtypes in (a) ORM, (b) UML, and (c) Barker ER
A bar spanning one or more roles depicts a uniqueness constraint over those roles (e.g. Each Patient has at most one Gender). A large dot depicts a mandatory constraint (e.g. Each Patient has some Gender). The circled dot with a cross through it depicts an exclusive-or constraint (Each Patient is a MalePatient or is a FemalePatient but not both). Overviews of ORM may be found in Halpin (2005b, 2006, 2007), a detailed treatment in Halpin & Morgan (2008), and a metamodel comparison between ORM, ER, and UML in Halpin (2004). Various dialects of ORM exist, for example Natural language Information Analysis Method (NIAM) (Wintraecken, 1990) and the Predicator Set Model (PSM) (ter Hofstede et al., 1993).