• Like
  • Save
Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to Databases (1007156ANR)
Upcoming SlideShare
Loading in...5
×
 

Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to Databases (1007156ANR)

on

  • 6,632 views

This lecture is part of an Introduction to Databases course given at the Vrije Universiteit Brussel.

This lecture is part of an Introduction to Databases course given at the Vrije Universiteit Brussel.

Statistics

Views

Total Views
6,632
Views on SlideShare
6,588
Embed Views
44

Actions

Likes
1
Downloads
210
Comments
0

5 Embeds 44

http://www.slideshare.net 19
http://wise.vub.ac.be 16
http://www.inf.ethz.ch 4
http://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-sites-opensocial.googleusercontent.com 4
http://jujo00obo2o234ungd3t8qjfcjrs3o6k-a-si 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to Databases (1007156ANR) Extended ER Model and other Modelling Languages - Lecture 2 - Introduction to Databases (1007156ANR) Presentation Transcript

    • Introduction to Databases Extended ER Model and other Modelling Languages Prof. Beat Signer Department of Computer Science Vrije Universiteit Brussel http://www.beatsigner.com 2 December 2005
    • Extended Entity-Relationship (EER) Model  Over the years the ER model has been extended with additional concepts to increase its expressiveness    specialisation and generalisation (ISA relationship) ISA constraints aggregation February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 2
    • Specialisation and Generalisation ISA  An entitiy set can be further subgrouped or specialised into distinctive entity sets   an entity subset may for example have additional attributes top-down approach  Parts of multiple entity sets may be generalised in a higher level entity set  bottom-up approach  Specialisations as well as generalisations are represented by the same ISA relationship construct represented by a triangle in the EER model  A ISA B implies that every A entity is also a B entity  generalisation can be seen as the inversion of specialisation  February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 3
    • ISA Relationship ISA id name 0..1 Persons LivesAt 0..* address ISA studentID Students Locations Teachers teaching hours ISA research topic February 21, 2014 PhD Students Professors #projects Beat Signer - Department of Computer Science - bsigner@vub.ac.be 4
    • ISA Relationship ... ISA  The attributes of a higher level entity set (superclass) are inherited by the lower level entity set (subclass) via the ISA relationship  e.g. students inherit the id attribute from persons  A subclass also inherits any relationship participation from its superclass  e.g. students, teachers etc. can participate in the LivesAt relationship February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 5
    • ISA Constraints ISA  To model an application domain more precisely, specific constraints can be defined over an ISA relationship  Membership constraints   a condition-defined membership constraint assigns an entity to a specific subclass based on one or more attribute values a user-defined membership constraint can be used to manually assign entities to a specific subclass (manual classification)  Disjointness constraints  an overlapping constraint over subclasses specifies that an entity may belong to multiple subclasses - e.g. a person may be a teacher as well as a student - by default, subclasses participate in an overlapping constraint February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 6
    • ISA Constraints ... ISA  Disjointness constraints ...  a disjoint constraint specifies that an entity can only belong to exactly one subclass - e.g. a teacher can be either a PhD student or a professor (but not both) - expressed by writing the word disjoint next to the triangle  Completeness constraints  a partial specialisation (generalisation) constraint specifies that some superclass entities may not belong to any subclass - default completeness constraint  a total specialisation (generalisation) constraint defines that each superclass entity must belong to a subclass - e.g. each teacher must belong to the PhD Students or Professors subclass (or to both of them) - represented by a double line connection to the triangle (like total participation) February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 7
    • ISA Constraints ... ISA name ISA id Adults birthdate 0..1 Persons LivesAt 0..* birthdate < 23.02.1996 address ISA studentID Students Teachers ISA research topic Locations PhD Students teaching hours disjoint Professors #projects disjointness and completeness constraints are independent of each other February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 8
    • Aggregation  A limitation of the ER model is that relationships cannot be modelled over other relationship sets  What if we would like to introduce a manager for each (employee, company, duration) combination? from to Durations Employees id February 21, 2014 Companies WorksFor name name address Beat Signer - Department of Computer Science - bsigner@vub.ac.be 9
    • Aggregation ...  We cannot just create a 4-ary relationship WorksFor  not all combinations have a manager  Introduce a new 4-ary Manages relationship  from Durations Employees id problem: we introduce some redundancy! Companies WorksFor name name address Manages - (employee, company, duration) are replicated in (manager, employee, company, duration) February 21, 2014 to Managers Beat Signer - Department of Computer Science - bsigner@vub.ac.be 10
    • Aggregation ... from to Durations Employees id name  An aggregation treats the relationship as a higher level entity  Companies WorksFor name address Manages Managers can be used in another relationship February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 11
    • Part-Of Hierarchies Cars 3..4 1..1 CPartOf TPartOf 1..1 1..1 Chassis Tires PartOf subpart superpart 0..1 Products 0..* general Part-Of PartOf PartOf particular product February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 12
    • ER Design Issues  When do we model something as an attribute and when as an entity set?  there is no general answer and the choice depends on the specific application domain to be modelled  When do we model something as a relationship set and when as an entity set?  a relationship set often corresponds to an action between entities  In general we should try to avoid higher level n-ary relationship sets  3-ary relationship sets should be the maximum and even these should be used carefully February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 13
    • Attribute or Entity?  Should the address in the example be modelled as an attribute or as a separate entity?  This depends on the intended use of the address  if we need an address for different entities (e.g. not just for employees) it is better to model the address as separate entity phone age #offices birthday Employees id name 0..1 0..* Offices address street February 21, 2014 LocatedAt city Beat Signer - Department of Computer Science - bsigner@vub.ac.be 14
    • Attribute or Entity?  Should the duration be modelled as a from and to attribute or as a separate entity?  Depends again on the use  if we foresee that the same duration period is used by other entity sets, it should be modelled as a separate entity from to Durations Employees id February 21, 2014 Companies WorksFor name name address Beat Signer - Department of Computer Science - bsigner@vub.ac.be 15
    • N-ary or Binary Relationships?  Basically any n-ary relationship can be replaced by a number of binary relationship sets "real" 3-ary relationships should not be replaced  - e.g. WorksFor presented earlier  the Parents relationship is a example of a non-real 3-ary relationship - have to use null values if there is either no father or mother - better to model it as two separate binary relationships father Persons child mother father Parents HasFather child Persons child HasMother mother February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 16
    • ER Design Principles  Make sure that you pay attention to all the entities, their relationships and any other constraints mentioned in the description (requirements) of a specific application domain  e.g. show cardinality constraints for all relationships  Avoid redundancy!  The resulting conceptual model should be as simple as possible, but not simpler  introduce only necessary entities and relationships  Some constraints (e.g. functional dependencies) cannot be expressed in the ER model February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 17
    • ER Design Principles ...  In two weeks we will see how the conceptual ER model can be mapped to a logical database schema (e.g. relational database schema)  The resulting relational schema can be further analysed by using functional dependencies and normalisation February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 18
    • ER Summary  Entities and attributes  Relationships       cardinality constraints participation constraints Keys Weak entities ISA hierarchies Aggregation February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 19
    • Classification and Typing  Aristotle (384 BC-322 BC) introduced a biological classification (ontology)     artificial classification system organisms with the two subclasses plants and animals animals further subclassified into animals with blood and animals without blood animals also classified into walking animals, flying animals and swimming animals (habitat) Aristotle  Characteristics (problems) of Aristotle's classification   based on behaviour and not on similarities (non-evolutionary) animals can belong to multiple classes - e.g. a duck belongs to the walking animals as well as swimming animals class February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 20
    • Classification and Typing ...  Bertrand Russell defined the type of a given predicate P as the entity set spanned by P  intensional notion of type  The notion of type for classifying entities based on a set of conditions was questionned by Wittgenstein  Bertrand Russell Ludwig Wittgenstein there exists no precise definition (type) for some general concepts - e.g. no definition for the general concept of a game  We can have a definitional (e.g. intensional) or prototypical definition of a type February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 21
    • OM Model  Data model that integrates concepts from the entity-relationship and object-oriented data models  based on objects, collections and associations (binary collections) - supports associations over associations  different types of collections Moira C. Norrie - sets, bags, rankings and sequences  Separates typing and classification (role modelling)  Operational part (algebra) over objects and collections  A family of object database platforms have been realised based on the OM model (e.g. OMS Java) February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 22
    • OM Typing and Classification Classification Entities Roles Employees employee Semantic Grouping Designers designer p1 represented by subtype Typing Females p2 { p1,p2 } p1,p2,p3,p4 } subcollection Collections Objects February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 23
    • OM Example (RSL Link Model) February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 24
    • The Unified Modelling Language (UML)  UML is a standard developed by the Object Management Group (OMG)   used to specify the components of a software system James Rumbaugh Grady Booch Ivar Jacobson based on earlier work including the object-modelling technique (OMT) by Rumbaugh et al., the Booch method by Booch and objectoriented software engineering (OOSE) by Jacobson  UML supports different types of diagrams  class diagrams, use case diagrams, package diagrams,... February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 25
    • UML Class Diagrams  A UML class diagram is similar to an ER model  A UML class is "like" an ER entity set  contains attributes as well as methods phone birthday Employees id name ER entity set February 21, 2014 employee age address id name birthday phone address age() UML class Beat Signer - Department of Computer Science - bsigner@vub.ac.be 26
    • UML Class Diagrams ...  UML relationship class with attributes can be used like an ER aggregation in other UML relationships  e.g. locatedAt in the example  Note that the position of the cardinality constraints are switched in UML Employees employee 0..1 LocatedAt office 0..* Offices employee employee locatedAt office 0..1 0..* office locatedAt years years Employees employee LocatedAt ER relationships February 21, 2014 office Offices employee employee office office UML relationships Beat Signer - Department of Computer Science - bsigner@vub.ac.be 27
    • UML Class Diagrams ... Teachers teacher ISA PhD Students overlapping Professors Teachers ISA phdStudent professor teacher disjoint disjoint PhD Students Professors ER specialisation February 21, 2014 phdStudent professor UML specialisation Beat Signer - Department of Computer Science - bsigner@vub.ac.be 28
    • Modelling Exercises  Model the RSL link model in ER  Define an ER model for the following application  You are going to develop a database for the Chamber of Commerce and Industry of Brussels (CVO) to manage information about language courses in Dutch, Spanish, French and Italian. The database should store information about the teachers and students as well as the individual language courses. A semester lasts for 13 weeks. Regular courses are scheduled for two sessions (each 3 hours) per week; advanced courses for three sessions (each 4 hours) per week. Each course has a difficulty level (module) of 1, 2 or 3 and costs a certain amount of money. A teacher may not give more than 4 courses and not teach in more than 2 languages. Each student has to do a final exam and will get a grade for the exam. February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 29
    • Homework  Study the following chapter of the Database System Concepts book  chapter 7 - sections 7.8-7.10 - Extended ER Model (EER) - Unified Modelling Language (UML) February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 30
    • Exercise 2  Entity-Relationship (ER) model  Extended Entity-Relationship (EER) model February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 31
    • References  A. Silberschatz, H. Korth and S. Sudarshan, Database System Concepts (Sixth Edition), McGraw-Hill, 2010  M.C. Norrie, An Extended Entity-Relationship Approach to Data Management in Object-Oriented Systems, Proceedings of ER ’93, 12th International Conference on Conceptual Modeling, Arlington, USA, December 1993  B. Signer and M.C. Norrie, As We May Link: A General Metamodel for Hypermedia Systems, Proceedings of ER 2007, 26th International Conference on Conceptual Modeling, Auckland, New Zealand, November 2007 February 21, 2014 Beat Signer - Department of Computer Science - bsigner@vub.ac.be 32
    • Next Lecture Relational Model and Relational Algebra 2 December 2005