Class Diagrams Defines Graph Structures 2014 Class Diagrams

  • Slides: 12
Download presentation
Class Diagrams Defines Graph Structures 2014 Class Diagrams Defines Graph Structures, JPN, UIA, page

Class Diagrams Defines Graph Structures 2014 Class Diagrams Defines Graph Structures, JPN, UIA, page 1

Association • Describes a set of links between objects, indicating some sort of connection

Association • Describes a set of links between objects, indicating some sort of connection between objects of the involved classes. • Example: A person may have friends. f 1 p 1: Person * f 2 friendship : friendship p 3: Person : friendship p 2: Person : friendship p 4: Person possible graph structure, i. e. , objects with links page 2

f 1 * Person * f 2 friendship defines an infinite set of graphs

f 1 * Person * f 2 friendship defines an infinite set of graphs where the nodes are called Person and the edges are called friendship end 1 edge * Node * end 2 “ordinary graph” with “ordinary names” What if we need to attach some information to the edges? Class Diagrams Defines Graph Structures, JPN, UIA, page 3

Different Types Associations In UML class diagrams you can distinguish between: – Ordinary Association

Different Types Associations In UML class diagrams you can distinguish between: – Ordinary Association – Aggregation(weak aggregation/ Aggregation Shared Association) – Composition (strong aggregation) Class Diagrams Defines Graph Structures, JPN, UIA, page 4

Aggregation/Composition • Indicates that one object contains objects of a given type, i. e.

Aggregation/Composition • Indicates that one object contains objects of a given type, i. e. , a whole/part relationship. • No cycles are allowed. • A transitive relation. aggregation the whole Company * 1. . * the part Department using aggregation allows a department to be shared among companies Composition aggregation (strong aggregation) Company Must be 1 or 0. . 1 1 1. . * Department No limitations on this multiplicity page 5

Aggregation is a weaker form of aggregation than composition. A part instance might be

Aggregation is a weaker form of aggregation than composition. A part instance might be included in more than one aggregation at a time, which is not allowed for composition. Company 1 1. . * Department a department can only belong to one company at a time * 1. . * Employee an employee can belong to several departments at a time Class Diagrams Defines Graph Structures, JPN, UIA, page 6

 • Composition defines a directed tree and an aggregation defines a directed graph

• Composition defines a directed tree and an aggregation defines a directed graph (without cycles). • Using these properties to define a directed graph and directed tree: Directed. Acyclic. Graph 0. . 1 * Node successor * Directed. Tree * predecessor edge 0. . 1 top. Root 1 root Node child * edge page 7

Directed. Acyclic. Graph 0. . 1 * Node : Directed. Acyclic. Graph : Node

Directed. Acyclic. Graph 0. . 1 * Node : Directed. Acyclic. Graph : Node successor * Do you see errors? : Node * predecessor edge : Node : Node page 8

Directed. Acyclic. Graph 0. . 1 * Node : Directed. Acyclick. Graph : Node

Directed. Acyclic. Graph 0. . 1 * Node : Directed. Acyclick. Graph : Node successor * Do you see errors? : Node * predecessor edge : Node : Node UML Diagrams Part I - September 2011, J. P. N. , page 9

Directed. Tree 0. . 1 top. Root 1 root Node child * : Directed.

Directed. Tree 0. . 1 top. Root 1 root Node child * : Directed. Tree : Node edge Do you see errors? : Node : Node UML Diagrams Part I - September 2011, J. P. N. , page 10

Directed. Tree 0. . 1 top. Root 1 root Node child * : Directed.

Directed. Tree 0. . 1 top. Root 1 root Node child * : Directed. Tree : Node edge Do you see errors? : Node : Node UML Diagrams Part I - September 2011, J. P. N. , page 11

Deletion Characteristics UML 2. 1 specification: “… If a composite is deleted, all of

Deletion Characteristics UML 2. 1 specification: “… If a composite is deleted, all of its parts are normally deleted with it… deleting an element in one part of the graph will also result in the deletion of all elements of the subgraph below that element. ” UML Diagrams 2012, J. P. N. , page