Introduction to UML
What is UML
- UML is a graphical language for object oriented modeling
- UML is short for Unified Modeling Language.
- UML is developed by the Object Management Group (www.omg.org)
- UML version 2.4.1 is an internasjonal standard numbered ISO 19505:2012.
The graphical language consists of diagrams with graphical model elements. In addition, a modeling tool will store textual definitions of model elements. If the graphic language is not enough, one may also enter keywords and restrictions in their own precise textual language.
UML has many different kinds of diagrams to describe information, behavior, use cases and components. Geographic information is described mainly with 3 diagram types for static structure:
- Package diagrams shows packages and relationships between them.
- Class diagram shows the classes and associations between them. Class diagram shows the classes' names and attributes.
- Object Diagrams can display real instances that describe the real world.
The diagrams show the different types of model elements graphically.
Model elements in package diagrams
- A UML package is a container for a group of elements, and is represented by a tabbed folder in package diagrams.
- Package dependencies shows that classes in one package need classes from another package. This is illustrated with a dashed arrow, pointing to the package which the other package is depending on.
In the diagram below, the package Lineage information contains classes that need classes from the package Citation and responsible party information. More specific - several classes in Lineage information have attributes with data type CI_Citation, which again is defined in Citation and responsible party information.
Model elements in class diagrams
Classes are represented in diagrams as rectangles with areas for name, attributes and operations. In addition, areas for constraints and tagged values may also be shown.
- Abstract classes have their name written in Italic. Such classes can not be instanciated.
- Attributes are presented with attribute name, data type and mulitplicity - the number of possible occurences - in brackets
- Multiplicity [0..1] means none or one, [0..*] means none to many, etc. No value means exactly one.
Above the name of classes and packages there may be a stereotype name in quotes. Stereotypes are used to extend the basic UML elements and give them different meanings. ISO19103 - Conceptual Schema Language and ISO19109 - Rules for application schemas defines the stereotypes that are to be used for models of geographic information. Stereotype names are not case sensitive, but the style used in ISO19103 and ISO19109 should be used:
- Packages with stereotype "ApplicationSchema" contains feature types. This stereotype is important for realization in GML.
- Classes with stereotype "FeatureType" represent geographic objecttypes. This stereotype is important for realization in GML.
- Classes with stereotype "dataType" are sets of properties without identity. Such classes can not exist as single instances, only as attributes or components in other classes.
- Classes with stereotype "enumeration" are fixed lists of possible values. Attributes that use such lists may only take values from the list.
- Classes with stereotype "CodeList" are extendable lists of possible values.
- Classes with stereotype "interface" are conceptual classes. Such classes can not be used directly in data sets, they must be realized in other classes
- Classes with stereotype "Union" contains a list of types where only one may be used in one instance.
Associations between classes are represented with lines that connect the classes
- Associations may have association names.
- Associations may also have a given direction. This is illustrated with arrows that show the direction the association is navigable.
- Each navigable end shall have a role name and multiplicity (number of possible instances of the connection).
- Associations with an open diamond shows an aggregation, where the class on the diamond side have a collection of individual components from the other end.
- Associations with a filled diamond shows a composition, where the class on the diamond side own the components from the other end.
- Inheritance between classes are represented with lines and an open triangle at the end of the class the inheritance comes from.
Notes are rectangles with one folded corner. They may be used for additional information in free text, and may be connected to model elements with a dashed line.
Model elements in object diagrams
- Objects are represented in diagrams as rectangleswith an area on top for name:class name (underlined), and an area bellow with a list of attribute=value.
- Links between objects illustrate instances of associations.