650 likes | 1.76k Views
UML class diagram : example. INSPIRE UML class diagram for administrative units. UML ( Unified Modeling L anguage ). Class. Definition: description of a set of objects that share the same attributes, operations, relationships, and semantics.
E N D
UML class diagram: example INSPIRE UML class diagramfor administrative units
Class • Definition: description of a set of objects that share the same attributes, operations, relationships, and semantics. • Objects are also called «instances» of the class
Class class name (convention: UpperCamelCase) Car attribute type visibility + seatNumber : Integer + colour: Colour[1..*] multiplicity –[min..max] (default: exactly 1) attribute name (convention: lowerCamelCase) « A car ischaracterised by a seatnumber and one or severalcolors. »
Inheritage / generalisation • Definition: taxonomic relationship between a more general element and a more specific element. • Representation: ClassA ClassB « A ClassBinstance isalso a ClassAinstance » « ClassBinstances share the samecharacteristics as Class A instances » « ClassBspecialisesClassA » « ClassAis more abstract / generalisedthanClassB » ...
Inheritage / generalisation abstract classes(shown in italics) cannot have instances Vehicle ownerName : String constructionDate : Date Bus Car Boat passengerNb : Integer draft : Float « Cars, boats, and buses are vehicles » « All vehicleshave a construction date » « A bus is a vehiclewith a passengernumber value » …
Association • Definition: relationshipbetween classes thatspecifies connections betweentheirinstances • Example: roleB AssotiationName roleA ClassA ClassB c..d a..b employee Employment employer Company Person 0..* 1..*
Multiplicity • Examples: employed employer Company Person Employment 0..* 0..* « Companies and persons are linkedwith an employment relation » « A personcanbeemployed by zero, one or severalcompanies » « A companycanemployzero, one or severalpersons » parent Kinship 2 « There is a kinship relation betweenindividuals » « All individuals have exactly 2 parents » « Eachindividualcan have no, one or severalchildren » 0..* Individual child
Aggregation • Definition: Aggregationrelationshipbetween instances of a class and several instances of anotherclass • Example: AggregateClass AggregatedClass c..d a..b « A ClassAinstance isan aggregate of instances of classB » Country Region * 1 « A country is an aggregation of regions »
Composition • Definition: Composition relationshipbetween instances of a class and several instances of another classe (theycannotexistindependently • Example: CompositeClass ComponantClass * 1 « A classA instance is a a composite of instances of classB » Book Page 2..* 1 « A book iscomposed of pages (at least two) »
Navigability • Definition: Indication, whether instances of one class cansee or know about instances of another class to whichthey are relatedthrough an association supplier user Company Person * 0..2 « A Person instance knows the Companyinstances itisassociatedwith » « A Company instance does not know the Person instances itisassociatedwith »
Note • Definition: Comment or a constraint attached to a diagram element. • Usually linked to the element it is related to (with dashed line) • In natural language ClassA Comment on classA
Constraint • Definition: condition or restriction to satisfy. • Can be represented in {…} or in a note • In natural language, or OCL (when possible) ClassA ClassA objects should be like this {ClassAobjectsshould belikethat}
Stereotype • Definition: Stereotypes extend the semantics, but not the structure of pre-existing UML elements (classes, attributes, operations, associations, roles, packages) • UML representation: << stereotypeName>> ClassName << stereotypeName>> + attributeName : DataType
Exercise: Whatisrepresentedhere? INSPIRE UML class diagramfor administrative units