Object Data Model · CSIT115 Data Management and Security Object Data Model Dr Janusz R. Getta...

45
CSIT115 Data Management and Security Object Data Model Dr Janusz R. Getta School of Computing and Information Technology - University of Wollongong Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1 1 of 45 21/11/20, 10:49 pm

Transcript of Object Data Model · CSIT115 Data Management and Security Object Data Model Dr Janusz R. Getta...

  •   CSIT115 Data Management and Security

    Object Data ModelDr Janusz R. Getta

    School of Computing and Information Technology -University of Wollongong

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    1 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 2/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    2 of 45 21/11/20, 10:49 pm

  • Graphical Notations for Conceptual Modeling

    Entity-Relationship (ER) diagrams (1976)

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 3/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    3 of 45 21/11/20, 10:49 pm

  • Graphical Notations for Conceptual Modeling

    Object Modelling Technique (OMT) diagrams (1991)

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 4/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    4 of 45 21/11/20, 10:49 pm

  • Graphical Notations for Conceptual Modeling

    (Simplified) Unified Modelling Language (UML) Object Class diagrams(1994)

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 5/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    5 of 45 21/11/20, 10:49 pm

  • Graphical Notations for Conceptual Modeling

    Object Role Modeling (ORM) diagrams

    ... and many, many, ... other graphical notations

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 6/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    6 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 7/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    7 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    A database suppose to contain information about people

    A rectangular box with a header and a name of class (PERSON) inside aheader represents a (simplified) class of objects

    A person is described by a social security number, name, date of birthand address

    The names of attributes are listed within a rectangular box one name ofattribute per row

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 8/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    8 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    A person has from one to five email addreses and zero or more phonenumbers

    Multiplicity of attribute like [1..5] (from one to five), zero or more ([*]or [0..*]), one or more ([1..*]), optional (zero or one, [0..1]), from"m" to "n" ([m..n]) follows a name of attribute

    Default multiplicity is "one" ([1])

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 9/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    9 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    A person is described by an optional country of origin and age (/ in frontof attribute name age denotes a derived attribute)

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 10/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    10 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    A person is identified by a social security number and independently bya triple (name, date of birth, address)

    A tag IDx following a name of attribute means, that an attribute is anidentifier

    If the same tag (e.g. ID2) follows the names of several attributes then itmeans that an identifier consists of several attributes

    If an identifier consists of several attributes then it means, that eachobject in a class is identified by a tuple of values of the attributes

    An identifier which consists of several attributes is called as a compositeidentifer

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 11/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    11 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    A vehicle is described by a registration number, manufacturer, model,year when manufactured and optional fuel consumption

    Each vehicle has a different registration number

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 12/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    12 of 45 21/11/20, 10:49 pm

  • (Simplified) Class of Objects

    Summary

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 13/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    13 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 14/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    14 of 45 21/11/20, 10:49 pm

  • Association

    A person owns a vehicle

    A solid line that connects two classes represents an association

    A name above a line is an association name

    An association name if followed (preceeded or located above or below)by a small solid triangle, that represents a direction of interpretation ofan association

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 15/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    15 of 45 21/11/20, 10:49 pm

  • Association

    A vehicle has an owner

    Locations of classes and associations in a diagram are immaterial

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 16/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    16 of 45 21/11/20, 10:49 pm

  • Association

    A person owns zero or more vehicles

    A vehicle has one owner

    Multiplicities of association are located at both ends of a line thatrepresents an association

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 17/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    17 of 45 21/11/20, 10:49 pm

  • Association

    One-to-one associationA department has a manager

    A department has exactly one manager

    A person who is a manager manages exactly one department

    -

    -

    -

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 18/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    18 of 45 21/11/20, 10:49 pm

  • Association

    One-to-many associationA company employs an employee

    A company employes many employees

    An employee works for none or one company

    It is possible that a company has no (zero) employees

    -

    -

    -

    -

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 19/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    19 of 45 21/11/20, 10:49 pm

  • Association

    Many-to-many associationA supplier supplies a part

    A supplier supplies zero or more parts

    A part is supplied by zero or more suppliers

    -

    -

    -

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 20/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    20 of 45 21/11/20, 10:49 pm

  • Association

    Summary

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 21/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    21 of 45 21/11/20, 10:49 pm

  • Association

    More examples:

    A team consists of 22 players

    A player belongs to only one team

    A game is played by 11players plus maximum 3 substitutes

    A player participates in zero or more games

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 22/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    22 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 23/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    23 of 45 21/11/20, 10:49 pm

  • Link Attribute

    A link attribute is an attribute that describes an association

    A student enrols a subject

    An enrolment is performed on a given day, it means, that an enrolmentis described by an enrolment date

    A link attribute is graphically represented by a "class-like" rectangularbox without a name of class in a header

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 24/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    24 of 45 21/11/20, 10:49 pm

  • Link Attribute

    Why an atribute enrolment-date must be a represented by a linkattribute ?

    For example, what about an attribute enrolment-date describing aclass STUDENT ?

    Such design is incorrect because information about which subject hasbeen enrolled by a student and on what date is missing

    A student is associated with a set of enrolment-dates, however ...

    ... there is no link between the values of an attribute enrolment-dateand the objects in a class SUBJECT

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 25/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    25 of 45 21/11/20, 10:49 pm

  • Link Attribute

    So what about another option where an atribute enrolment-datedescribes a class SUBJECT ?

    Such design is also incorrect because information about who enrolled ina subject and on what date is missing again

    A subject is associated with a set of enrolment-dates, however ...

    ... there is no link between the values of an attribute enrolment-dateand the objects in a class STUDENT

    Therefore, the only option for an attribute enrolment-date is to be alink attribute that describes an asociation between a class STUDENT anda class SUBJECT

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 26/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    26 of 45 21/11/20, 10:49 pm

  • Link Attribute

    If an attribute enrolment-date describes an association Enrolsbetween the classes STUDENT and SUBJECT then its values are likelabels attached to attached to the links between the objects from theclasses STUDENT and SUBJECT

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 27/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    27 of 45 21/11/20, 10:49 pm

  • Link Attribute

    Another example of link attribute

    A supplier supplies a part

    A shipment of a part is performed on a given day, it means, that ashipment is described by an attribute shipment date

    A shipment contains a given number of parts and it means, that ashipment is also described by an attribute quantity

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 28/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    28 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 29/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    29 of 45 21/11/20, 10:49 pm

  • Association Class

    An association class is a class that represents an association

    A student enrols in a subject

    An enrolment is performed on a given day, it means, that an enrolmentis described by an attribute enrolment-date

    An association class ENROLMENT is graphically represented in the sameway as a class of objects

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 30/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    30 of 45 21/11/20, 10:49 pm

  • Association Class

    What about an identifier of an association class ?

    An association class may have its own identifiers, for exampleenrolment-number in a class ENROLMENT

    An association class that represents many-to-many association has adefault identifier that consists of identifiers of the classes from bothsides of association, for example a pair (snumber, code) in a classENROLMENT

    There is no need to include a default identifier into a description of aclass of objects

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 31/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    31 of 45 21/11/20, 10:49 pm

  • Association Class

    Another example of association class

    A supplier supplies a part

    A shipment of a part is performed on a given day, it means, that ashipment is described by an attribute shipment-date

    A shipment contains a given number of parts, it means, that a shipmentis also described by an attribute quantity

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 32/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    32 of 45 21/11/20, 10:49 pm

  • Association Class

    What can we use association classes for ?

    A shipment is delivered to a customer

    An association Delivered-to connects the classes SHIPMENT andCUSTOMER

    In a general case, it is possible to create associations betweenassociation classes and other classes of objects and between associationclasses and association classes

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 33/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    33 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 34/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    34 of 45 21/11/20, 10:49 pm

  • Qualification

    A building at a university campus is described by a unique number,optional name and the total number of floors

    A room is described by a number and area

    A building consists of rooms

    What is an identifier of a class ROOM ?

    Identifier of a class ROOM is a composite identifier and it consists of theattributes bnumber from a class BUILDING and rnumber from a classROOM

    How do we represent composite identifiers that consist of attributesfrom more than one class ?

    We use a qualification !

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 35/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    35 of 45 21/11/20, 10:49 pm

  • Qualification

    A building at a university campus is described by a unique number,optional name and the total number of floors. A room is described by anumber and area. A building consists of rooms

    A qualification is represented by a rectangle with one or more attributenames

    In the example above a qualification means that in a given building thereis at most one room with a given number

    It also means that an attribute rnumber is a local identifier in a classROOM, i.e. all rooms in a given building have different numbers

    A pair of attributes (bnumber, rnumber) is a default identifier of aclass ROOM

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 36/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    36 of 45 21/11/20, 10:49 pm

  • Qualification

    More examples:

    A bank account is located at a bank

    A campus consists of buildings and buildings consist of rooms

    A company is listed at stock exchange

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 37/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    37 of 45 21/11/20, 10:49 pm

  • Qualification

    Sometimes qualification is needed for many-to-many associations

    For example, if we consider a pessimistic view of students who enrol insubjects then sometimes a student must enrol in the same subject morethan one time (well, ... you know when it happens and why it is a"pessimistic" view of reality)

    Some time ago we created the following design

    But, ... if enrolment is repeated several times then a pair of attributes(snumber, code) is no longer an identifier of a class ENROLMENT !

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 38/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    38 of 45 21/11/20, 10:49 pm

  • Qualification

    If enrolment is repeated several times then an identifier of a classENROLMENT is a triple (snumber, code, enrolment-date)

    How is this represented graphically ?

    It is represented by a qualification of the middle part of the associationEnrols

    Qualification of the middle part of many-to-many association means,that an identifier of association class consists of an identifier of a classon the left hand side of association, identifier of a class on the right handside of association, and qualification attribute(s)

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 39/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    39 of 45 21/11/20, 10:49 pm

  • Qualification

    A qualification of the middle part of many-to-many-association isequivalent to the following two single-side qualifications of one-to-manyassociation and many-to-one association

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 40/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    40 of 45 21/11/20, 10:49 pm

  • Object Data ModelOutline

    Graphical Notations for Conceptual Modeling

    (Simplified) Class of Objects

    Association

    Link Attribute

    Association Class

    Qualification

    Generalization

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 41/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    41 of 45 21/11/20, 10:49 pm

  • Generalization

    A generalization hierarchy represents Is-a-subset relation between theclasses of objects

    A set of all undergraduate students is a subset of a set of students, itmeans, that an undergraduate student IS-A student

    A set of all postgraduate students is a subset of a set of students, itmeans, that a postgraduate student IS-A student

    A generalization hierarchy is built with arrows pointing from a subclassto a superclass

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 42/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    42 of 45 21/11/20, 10:49 pm

  • Generalization

    Another graphical notation for generalization hierarchy:

    A car IS-A vehicle and a truck IS-A vehicle

    To create a nice effect the arrows can be "joined" into a single arrow

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 43/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    43 of 45 21/11/20, 10:49 pm

  • Entity-Relationship Modeling

    Entity-Relationship Modeling is another graphical conceptual modelingnotation

    It is presented in your texbook

    Graphically it is very similar to Object Data Model

    The following concepts from the notations are equivalent:Class of objects = Entity type

    Object = Entity instance

    Association = Relationship

    Identifier = Primary key or Candidate key

    Qualification = Weak entity type

    -

    -

    -

    -

    -

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 44/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    44 of 45 21/11/20, 10:49 pm

  • References

    C. Coronel, S. Morris, A. Basta, M. Zgola, Data Management and Security,Chapters 2, 3, and 4 Cengage Compose eBook, 2018, eBook: DataManagement and Security, 1st Edition

    T. Connoly, C. Begg, Database Systems, A Practical Approach to Design,Implementation, and Management, Chapter 12 Entity-RelationshipModeling, Chapter 13.1 Specialization/Generalization, Pearson EducationLtd, 2015

    TOP         Created by Janusz R. Getta, CSIT115/CSIT815 Data Management and Security, Summer 2020/2021 45/45

    Object Data Model file:///Users/jrg/115-2020-SUMMER/LECTURES/03objectdatamodel/03objectdatamodel.html#1

    45 of 45 21/11/20, 10:49 pm