Logical datamodels and disjoint subtyping - eclipse-efbt/efbt GitHub Wiki

Logical datamodels and disjoint subtyping

BIRD contains a logical datamodel and a relational model. The logical model contains a concept of ‘inheritance’ or ‘subtyping’ which is very easy to describe as inheritance Python Django Models (given that Python as a language allows inheritence as it is an Object Oriented language). It also contains a concept of ‘disjoint subtyping’ to describe concepts that group together entities from multiple hierarchies (known as arcs in SQLDeveloper). We describe this same concept of disjoint subtyping in Django as a ‘delegate’, this is a pattern sometimes known as ‘preferring aggregation over inheritance’, we show a typical comparison here.

In SQL developer we show here that Instrument table has 2 ‘arcs’ which contain sublclasses. The right hand arc is ‘is instrument type by origin ‘ containing subtypes ‘Instrument resulting directly from a Financial contract’ and ‘Instrument resulting directly from a Credit Facility’ and the right hand is ‘instrument type by product’ containing ‘Over the counter (OTC) Derivative instrument’ , ‘Off-balance instrument’ , ‘Securities financing transaction (SFT)’ and 2 others not in this screenshot. In a simplified manner we can say that we are going to need to choose one subtype from each arc when we represent an instrument. We show the 2 arcs here in blue, and then show refined diagrams showing the content of each arc:

arc_overview

Contents of ‘Instrument by Product’ Arc:

instrument_by_product_arc

Contents of ‘Instrument by Origin’ Arc:

instrument_by_origin_arc

In UML, and therefore in Python Django we describe the same as

ecore_disjoint

Note that the arrows black diamonds refer to ‘composition relationship’ in UML, and the lines with white arrow heads are inheritance/subtyping. This allows the same case as in disjoint subtyping where we must choose a subtype from each delegate.