Database management: UML model simply explained

UML or unified modeling language model is object oriented system modeling notation that is used to conceptualize data requirements. Since UML is object oriented, it uses classes and objects as its building blocks. Class is basically set of objects and object is an instance of a class. In relative to ER/EER model, class is entity type and object is an entity. Each object or entity has variables and methods where variables are attribute types and methods is a new add-on which is a way to access the variables.

Let’s go over classes in more detail. Class in UML is a rectangle that is broken down into three parts with top part being the name of the class, middle part being the variables, and bottom part being the methods. Top part is similar to entity type rectangles, middle part is list of all attribute types, and bottom part is basically a way to access the variables.

Variables in the UML aren’t uniquely supported since all object is already assigned a unique and immutable identifier and serves as a key. All variables are followed by a colon with primitive types like string, integer, and boolean that is used to define the variables to ensure good domain definition. Variables should be decomposed if it is composite and multi valued variables should have [number] following the primitive types to state how many values of the variables will be created for the object.

Access modifiers are utilized for variables as well as access methods. To add security, symbols -, +, and # are added where – means it’s private and the variable or method can only be accessed by the class itself while + public and it means variable and methods can be accessed by any other class, and lastly # means protect where variable or method can be accessed by both class and its subclasses.

When it comes to relationships in UML, cardinality N is replaced with asterisk * sign. If the association has variables and or methods on its own, it’s modeled as association class. It’s similar to rhombus in a relationship having its own attributes. Additionally, relationships or associations have arrows if it’s unidirectional and no arrows if it’s bidirectional. This means that in a unidirectional association, one class can retrieve variables from another class in one way but not the other way around.

UML has a qualified association design where you can specify one or more variables to be an index key for navigating from qualified class to the target class. Qualified association is used to represent weak entity type that depends on another existence in UML model. For example, a room number that needs hotel room number as well. Hotel class can have a small rectangle attached to it with a index key room number to specify the qualified association.

Specialization/generalization is also supported just like EER model and constraints are written between curly brackets separated by a semi colon like shown {partial;overlap}. The subclasses are pointed and connected to superclass with an arrow. UML also supports inheritance, so all subclass will inherit variables, methods, and associations from the superclass.

Lastly, aggregation can be represented in two ways (shared and composite aggregation). Shared is hollow rhombus while composite is a filled in rhombus where shared aggregation part object can belong to multiple composite objects simultaneously while composite aggregation states that part object can only belong to one composite.

UML adds a little more concepts to add more semantics in the data model like changeability property, object constraint language, and dependency relationship. Changeability property basically specifies type of operations that are allowed. For example, it has default, add only, and frozen. These are added in the variables within {} curly brackets as follows (-SUPPLIERNUMBER: Integer {frozen}). Frozen simply means it can no longer change and addonly means you can only add and not remove.

OCL (Object constraint language) is used to specify types of constraints in a declarative way and are also added in the variables. For example, if you want to put a constraint to ensure status can’t be greater than 4, you can put personalstatus: status<5.

Then we have dependency relationship that is denoted by a dashed line in the UML model. When object of one class uses an object of another class in its methods, but referred object is not stored in any variable, it is called dependency.