UML class diagram: example class Administrativ eUnits: Ov erv iew +/administeredBy «voidable» 0..* +coAdminister «voidable» 0..* «featureType» Administrativ eUnit «featureType» Administrativ eBoundary + + + + country :CountryCode geometry :GM_Curve inspireId :Identifier nationalLevel :AdministrativeHierarchyLevel [1..6] «voidable, lifeCycleInfo» + beginLifespanVersion :DateTime + endLifespanVersion :DateTime [0..1] «voidable» + legalStatus :LegalStatusValue = "agreed" + technicalStatus :TechnicalStatusValue = "edge-matched" «codeList» Administrativ eHierarchyLev el + + + + + + 1stOrder 2ndOrder 3rdOrder 4thOrder 5thOrder 6thOrder +boundary «voidable» 1..* +admUnit «voidable» + + + + + + country :CountryCode geometry :GM_MultiSurface inspireId :Identifier name :GeographicalName [1..*] nationalCode :CharacterString nationalLevel :AdministrativeHierarchyLevel «voidable, lifeCycleInfo» 1..* + beginLifespanVersion :DateTime + endLifespanVersion :DateTime [0..1] «voidable» + nationalLevelName :LocalisedCharacterString [1..*] + residenceOfAuthority :ResidenceOfAuthority [1..*] +lowerLevelUnit «voidable» 0..* constraints {CondominiumsAtCountryLevel} {AdmininstrativeUnitHighestLevel} {AdministrativeUnitLowestLevel} «dataType» ResidenceOfAuthority + name :GeographicalName «voidable» + geometry :GM_Point INSPIRE UML class diagram for administrative units Training: INSPIRE Basics EC JRC +upperLevelUnit «voidable» 0..1 1/15 UML (Unified Modeling Language) Training: INSPIRE Basics EC JRC 2/15 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 Training: INSPIRE Basics EC JRC 3/15 Class visibility class name (convention: UpperCamelCase) Car + seatNumber : Integer + colour : Colour [1..*] attribute name (convention: lowerCamelCase) attribute type multiplicity – [min..max] (default: exactly 1) « A car is characterised by a seat number and one or several colors. » Training: INSPIRE Basics EC JRC 4/15 Inheritage / generalisation • Definition: taxonomic relationship between a more general element and a more specific element. • Representation: ClassA ClassB « A ClassB instance is also a ClassA instance » « ClassB instances share the same characteristics as Class A instances » « ClassB specialises ClassA » « ClassA is more abstract / generalised than ClassB » ... Training: INSPIRE Basics EC JRC 5/15 Inheritage / generalisation Vehicle ownerName : String constructionDate : Date Car Boat draft : Float abstract classes (shown in italics) cannot have instances Bus passengerNb : Integer « Cars, boats, and buses are vehicles » « All vehicles have a construction date » « A bus is a vehicle with a passenger number value » … Training: INSPIRE Basics EC JRC 6/15 Association • Definition: relationship between classes that specifies connections between their instances ClassA roleA a..b AssotiationName roleB c..d ClassB • Example: Company Training: INSPIRE Basics EC JRC employer 1..* Employment employee 0..* Person 7/15 Multiplicity • Examples: Company employed employer Employment 0..* 0..* Person « Companies and persons are linked with an employment relation » « A person can be employed by zero, one or several companies » « A company can employ zero, one or several persons » parent Kinship 2 Individual 0..* child Training: INSPIRE Basics EC JRC « There is a kinship relation between individuals » « All individuals have exactly 2 parents » « Each individual can have no, one or several children » 8/15 Aggregation • Definition: Aggregation relationship between instances of a class and several instances of another class AggregateClass a..b c..d AggregatedClass « A ClassA instance is an aggregate of instances of classB » • Example: Country Region * 1 « A country is an aggregation of regions » Training: INSPIRE Basics EC JRC 9/15 Composition • Definition: Composition relationship between instances of a class and several instances of another classe (they cannot exist independently CompositeClass ComponantClass 1 * « A classA instance is a a composite of instances of classB » • Example: Book Page 1 2..* « A book is composed of pages (at least two) » Training: INSPIRE Basics EC JRC 10/15 Navigability • Definition: Indication, whether instances of one class can see or know about instances of another class to which they are related through an association Company supplier 0..2 user Person * « A Person instance knows the Company instances it is associated with » « A Company instance does not know the Person instances it is associated with » Training: INSPIRE Basics EC JRC 11/15 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 Training: INSPIRE Basics EC JRC 12/15 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 Training: INSPIRE Basics EC JRC {ClassA objects should be like that} 13/15 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 Training: INSPIRE Basics EC JRC 14/15 Exercise: What is represented here? class Administrativ eUnits: Ov erv iew +/administeredBy «voidable» 0..* +coAdminister «voidable» 0..* «featureType» Administrativ eUnit «featureType» Administrativ eBoundary + + + + country :CountryCode geometry :GM_Curve inspireId :Identifier nationalLevel :AdministrativeHierarchyLevel [1..6] «voidable, lifeCycleInfo» + beginLifespanVersion :DateTime + endLifespanVersion :DateTime [0..1] «voidable» + legalStatus :LegalStatusValue = "agreed" + technicalStatus :TechnicalStatusValue = "edge-matched" «codeList» Administrativ eHierarchyLev el + + + + + + 1stOrder 2ndOrder 3rdOrder 4thOrder 5thOrder 6thOrder +boundary «voidable» 1..* +admUnit «voidable» + + + + + + country :CountryCode geometry :GM_MultiSurface inspireId :Identifier name :GeographicalName [1..*] nationalCode :CharacterString nationalLevel :AdministrativeHierarchyLevel «voidable, lifeCycleInfo» 1..* + beginLifespanVersion :DateTime + endLifespanVersion :DateTime [0..1] «voidable» + nationalLevelName :LocalisedCharacterString [1..*] + residenceOfAuthority :ResidenceOfAuthority [1..*] +lowerLevelUnit «voidable» 0..* constraints {CondominiumsAtCountryLevel} {AdmininstrativeUnitHighestLevel} {AdministrativeUnitLowestLevel} «dataType» ResidenceOfAuthority + name :GeographicalName «voidable» + geometry :GM_Point INSPIRE UML class diagram for administrative units Training: INSPIRE Basics EC JRC +upperLevelUnit «voidable» 0..1 15/15