The Enhanced Entity- Relationship (EER) Model

Transcription

Chapter 8The EnhancedEntityRelationship(EER) ModelCopyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 8 Outline Subclasses, Superclasses, and Inheritance Specialization and Generalization Constraints and Characteristics ofSpecialization and GeneralizationHierarchies Modeling of UNION Types UsingCategoriesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Chapter 8 Outline (cont’d.) A Sample UNIVERSITY EER Schema,Design Choices, and Formal Definitions Example of Other Notation: RepresentingSpecialization and Generalization in UMLClass Diagrams Data Abstraction, KnowledgeRepresentation, and Ontology ConceptsCopyright 2011 Ramez Elmasri and Shamkant Navathe

The Enhanced EntityRelationship (EER) Model Enhanced ER (EER) model Created to design more accurate databaseschemas Reflect the data properties and constraints moreprecisely More complex requirements than traditionalapplicationsCopyright 2011 Ramez Elmasri and Shamkant Navathe

Subclasses, Superclasses, andInheritance EER model includes all modeling conceptsof the ER model In addition, EER includes: Subclasses and superclassesSpecialization and generalizationCategory or union typeAttribute and relationship inheritanceCopyright 2011 Ramez Elmasri and Shamkant Navathe

Subclasses, Superclasses, andInheritance (cont’d.) Enhanced ER or EER diagrams Diagrammatic technique for displaying theseconcepts in an EER schema Subtype or subclass of an entity type Subgroupings of entities that are meaningfulRepresented explicitly because of theirsignificance to the database applicationCopyright 2011 Ramez Elmasri and Shamkant Navathe

Subclasses, Superclasses, andInheritance (cont’d.) Terms for relationship between asuperclass and any one of its subclasses Superclass/subclassSupertype/subtypeClass/subclass relationship Type inheritance Subclass entity inherits all attributes andrelationships of superclassCopyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Specialization andGeneralization Specialization Process of defining a set of subclasses of anentity typeDefined on the basis of some distinguishingcharacteristic of the entities in the superclass Subclass can define: Specific attributesSpecific relationship typesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Specialization andGeneralization (cont’d.) Certain attributes may apply to some butnot all entities of the superclass Some relationship types may beparticipated in only by members of thesubclassCopyright 2011 Ramez Elmasri and Shamkant Navathe

Generalization Reverse process of abstraction Generalize into a single superclass Original entity types are special subclasses Generalization Process of defining a generalized entity typefrom the given entity typesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Constraints and Characteristicsof Specialization andGeneralization Hierarchies Constraints that apply to a singlespecialization or a single generalization Differences between specialization/generalization lattices and hierarchiesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Constraints on Specializationand Generalization May be several or one subclass Determine entity subtype: Predicate-defined (or condition-defined)subclassesAttribute-defined specializationUser-definedCopyright 2011 Ramez Elmasri and Shamkant Navathe

Constraints on Specializationand Generalization (cont’d.) Disjointness constraint Specifies that the subclasses of thespecialization must be disjoint Completeness (or totalness) constraint May be total or partial Disjointness and completeness constraintsare independentCopyright 2011 Ramez Elmasri and Shamkant Navathe

Specialization andGeneralization Hierarchiesand Lattices Specialization hierarchy Every subclass participates as a subclass inonly one class/subclass relationshipResults in a tree structure or strict hierarchy Specialization lattice Subclass can be a subclass in more than oneclass/subclass relationshipCopyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Specialization andGeneralization Hierarchiesand Lattices (cont’d.) Multiple inheritance Subclass with more than one superclassIf attribute (or relationship) originating in thesame superclass inherited more than once viadifferent paths in lattice Included only once in shared subclass Single inheritance Some models and languages limited to singleinheritanceCopyright 2011 Ramez Elmasri and Shamkant Navathe

Utilizing Specialization andGeneralization in RefiningConceptual Schemas Specialization process Start with entity type then define subclasses bysuccessive specializationTop-down conceptual refinement process Bottom-up conceptual synthesis Involves generalization rather thanspecializationCopyright 2011 Ramez Elmasri and Shamkant Navathe

Modeling of UNION Types UsingCategories Union type or a category Represents a single superclass/subclassrelationship with more than one superclass Subclass represents a collection of objects that isa subset of the UNION of distinct entity types Attribute inheritance works more selectively Category can be total or partial Some modeling methodologies do not haveunion typesCopyright 2011 Ramez Elmasri and Shamkant Navathe

A Sample UNIVERSITY EERSchema, Design Choices, andFormal Definitions The UNIVERSITY Database Example UNIVERSITY database Students and their majors Transcripts, and registration University’s course offeringsCopyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Design Choices forSpecialization/Generalization Many specializations and subclasses canbe defined to make the conceptual modelaccurate If subclass has few specific attributes andno specific relationships Can be merged into the superclassCopyright 2011 Ramez Elmasri and Shamkant Navathe

Design Choices forSpecialization/Generalization(cont’d.) If all the subclasses of a specialization/generalization have few specific attributesand no specific relationships Can be merged into the superclassReplace with one or more type attributes thatspecify the subclass or subclasses that eachentity belongs toCopyright 2011 Ramez Elmasri and Shamkant Navathe

Design Choices forSpecialization/Generalization(cont’d.) Union types and categories shouldgenerally be avoided Choice of disjoint/overlapping and total/partial constraints on specialization/generalization Driven by rules in miniworld being modeledCopyright 2011 Ramez Elmasri and Shamkant Navathe

Formal Definitions for the EERModel Concepts Class Set or collection of entitiesIncludes any of the EER schema constructs ofgroup entities Subclass Class whose entities must always be a subsetof the entities in another class Specialization Set of subclasses that have same superclassCopyright 2011 Ramez Elmasri and Shamkant Navathe

Formal Definitions for the EERModel Concepts (cont’d.) Generalization Generalized entity type or superclass Predicate-defined Predicate on the attributes of is used to specifywhich entities in C are members of S User-defined Subclass that is not defined by a predicateCopyright 2011 Ramez Elmasri and Shamkant Navathe

Formal Definitions for the EERModel Concepts (cont’d.) Category Class that is a subset of the union of n definingsuperclasses Relationship type Any class can participate in a relationshipCopyright 2011 Ramez Elmasri and Shamkant Navathe

Example of Other Notation Representing specialization andgeneralization in UML class diagrams Basic notation See Figure 8.10 Base class Root superclass Leaf classes Subclasses (leaf nodes)Copyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Data Abstraction, KnowledgeRepresentation, and OntologyConcepts Goal of knowledge representation (KR)techniques Accurately model some domain of knowledgeCreate an ontology that describes theconcepts of the domain and how theseconcepts are interrelated Goals of KR are similar to those ofsemantic data models Important similarities and differencesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Classification and Instantiation Classification Systematically assigning similar objects/entitiesto object classes/entity types Instantiation Inverse of classificationGeneration and specific examination of distinctobjects of a classCopyright 2011 Ramez Elmasri and Shamkant Navathe

Classification and Instantiation(cont’d.) Exception objects Differ in some respects from other objects ofclass KR schemes allow such class properties One class can be an instance of anotherclass (called a meta-class) Cannot be represented directly in EER modelCopyright 2011 Ramez Elmasri and Shamkant Navathe

Identification Abstraction process Classes and objects are made uniquelyidentifiable by means of some identifier Needed at two levels To distinguish among database objects andclassesTo identify database objects and to relate themto their real-world counterpartsCopyright 2011 Ramez Elmasri and Shamkant Navathe

Specialization andGeneralization Specialization Classify a class of objects into morespecialized subclasses Generalization Generalize several classes into a higher-levelabstract classIncludes the objects in all these classesCopyright 2011 Ramez Elmasri and Shamkant Navathe

Aggregation and Association Aggregation Abstraction concept for building compositeobjects from their component objects Association Associate objects from several independentclasses Main structural distinction When an association instance is deleted Participating objects may continue to existCopyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Copyright 2011 Ramez Elmasri and Shamkant Navathe

Ontologies and the SemanticWeb Documents contain less structure thandatabase information does Semantic Web Allow meaningful information exchange andsearch among machines Ontology Specification of a conceptualization Specification Language and vocabulary terms used tospecify conceptualizationCopyright 2011 Ramez Elmasri and Shamkant Navathe

Summary Enhanced ER or EER model Extensions to ER model that improve itsrepresentational capabilitiesSubclass and its superclassCategory or union type Notation and terminology of UML forrepresenting specialization andgeneralizationCopyright 2011 Ramez Elmasri and Shamkant Navathe

Terms for relationship between a superclass and any one of its subclasses Superclass/subclass Supertype/subtype Class/subclass relationship Type inheritance Subclass entity inherits all attributes and relationships of superclass