Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER...

41
Conceptual Design Conceptual Design Modeling the rules of Modeling the rules of organization organization Building ER model Building ER model

Transcript of Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER...

Page 1: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Conceptual DesignConceptual Design

Modeling the rules of organizationModeling the rules of organization Building ER modelBuilding ER model

Page 2: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Penyewaan BukuPenyewaan BukuBusiness RulesBusiness Rules1.1. Seorang ANGGOTA boleh meminjam Seorang ANGGOTA boleh meminjam

lebih dari satu BUKUlebih dari satu BUKU2.2. Satu jenis BUKU memiliki lebih dari Satu jenis BUKU memiliki lebih dari

satu salinansatu salinan3.3. Beberapa ANGGOTA boleh meminjam Beberapa ANGGOTA boleh meminjam

satu atau lebih jenis BUKU yang satu atau lebih jenis BUKU yang samasama

4.4. Untuk setiap PEMINJAMAN harus Untuk setiap PEMINJAMAN harus dikembalikan tepat pada waktunya, dikembalikan tepat pada waktunya, jika tidak akan dikenakan dendajika tidak akan dikenakan denda

Page 3: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

ER Model ER Model Penyewaan BukuPenyewaan Buku

ANGGOTA

Id_Anggota

BUKU

Id_Buku

Jumlah_Salinan

PEMINJAMAN

Id_Peminjaman

Id_Buku

Id_Anggota

Tgl_Pinjam

Tgl_HrsKembali

Tgl_Kembali

Denda

has has

Page 4: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Tempat KursusTempat KursusBusiness RulesBusiness Rules1.1. Seorang SISWA boleh mengambil Seorang SISWA boleh mengambil

satu atau lebih KELASsatu atau lebih KELAS2.2. Satu KELAS terdiri dari satu atau Satu KELAS terdiri dari satu atau

banyak SISWAbanyak SISWA3.3. Satu GURU boleh mengajar di Satu GURU boleh mengajar di

satu atau banyak KELASsatu atau banyak KELAS4.4. Satu RUANGAN dapat digunakan Satu RUANGAN dapat digunakan

oleh satu atau banyak KELASoleh satu atau banyak KELAS

Page 5: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

ER Model Tempat ER Model Tempat KursusKursus

SISWA

Id_Siswa

GURU

Id_GURU

KELAS

Id_Kelas

has has

RUANGAN

Id_Ruangan

has

Page 6: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

A hospital in-patient systemA hospital in-patient systemBusiness RulesBusiness Rules

A A hospitalhospital is organised into a number of is organised into a number of wardswards.. Each Each wardward has a has a ward numberward number and a and a namename recorded, along recorded, along

with a number of beds in that ward.with a number of beds in that ward. Each Each wardward is staffed by is staffed by nursesnurses.. NursesNurses have their have their staff numberstaff number and and namename recorded, and are recorded, and are

assigned to a single ward.assigned to a single ward. Each Each patientpatient in the hospital has a in the hospital has a patient identification patient identification

numbernumber, and their , and their namename, , addressaddress and and date of birthdate of birth are are recorded.recorded.

Each Each patientpatient is under the care of a single is under the care of a single consultantconsultant and is and is assigned to a single assigned to a single wardward..

Each Each consultantconsultant is responsible for a number of is responsible for a number of patientspatients.. ConsultantsConsultants have their have their staff numberstaff number, , namename and and specialismspecialism

recorded.recorded.

Page 7: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Exercise on In-patient systemExercise on In-patient system

1.1. State 4 entities for the system giving a suitable State 4 entities for the system giving a suitable identifier for each entity. identifier for each entity. ward, nurse, patient, ward, nurse, patient, consultantconsultant

2.2. Draw an entity-relationship diagram to show the Draw an entity-relationship diagram to show the relationships between the entities.relationships between the entities.

Page 8: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Hospital In-Patient’s Hospital In-Patient’s ER ModelER Model

WARD

Ward_Id

NumberOfBeds

PATIENT

Patient_Id

Patient_Name

Patient_Address

Patient_DoB

NURSE

Staff_No

Nurse_Name

Staffed by

CONSULTANT

Staff_No

Consultant_Name

Consultant_Spc

has

has

Page 9: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

99

The Enhanced E-R The Enhanced E-R Model andModel andBusiness RulesBusiness RulesModern Database Modern Database

ManagementManagement

66thth Edition EditionJeffrey A. Hoffer, Mary B. Prescott, Jeffrey A. Hoffer, Mary B. Prescott,

Fred R. McFaddenFred R. McFadden

Page 10: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1010

Supertypes and Supertypes and SubtypesSubtypes Subtype:Subtype: A subgrouping of the entities in an A subgrouping of the entities in an

entity type which has attributes that are entity type which has attributes that are distinct from those in other subgroupingsdistinct from those in other subgroupings

Supertype:Supertype: An generic entity type that has An generic entity type that has a relationship with one or more subtypesa relationship with one or more subtypes

Inheritance:Inheritance:– Subtype entities inherit values of all Subtype entities inherit values of all

attributes of the supertypeattributes of the supertype– An instance of a subtype is also an instance An instance of a subtype is also an instance

of the supertypeof the supertype

Page 11: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1111

Figure 4-1Basic notation for

supertype/subtype relationships

Page 12: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1212

Figure 4-2 -- Employee supertype with three subtypes

All employee subtypes will have emp nbr, name, address, and date-hired

Each employee subtype will also have its own attributes

Page 13: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1313

Relationships and Relationships and SubtypesSubtypes Relationships at the Relationships at the supertypesupertype

level indicate that all subtypes level indicate that all subtypes will participate in the relationshipwill participate in the relationship

The instances of a The instances of a subtypesubtype may may participate in a relationship participate in a relationship unique to that subtype. In this unique to that subtype. In this situation, the relationship is situation, the relationship is shown at the subtype levelshown at the subtype level

Page 14: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1414

Figure 4-3 -- Supertype/subtype relationships in a hospital

Both outpatients and resident patients are cared for by a responsible physician

Only resident patients are assigned to a bed

Page 15: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1515

Generalization and Generalization and SpecializationSpecialization Generalization:Generalization: The process of The process of

defining a more general entity type defining a more general entity type from a set of more specialized entity from a set of more specialized entity types. types. BOTTOM-UPBOTTOM-UP

Specialization:Specialization: The process of The process of defining one or more subtypes of the defining one or more subtypes of the supertype, and forming supertype, and forming supertype/subtype relationships. supertype/subtype relationships. TOP-TOP-DOWNDOWN

Page 16: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1616

Figure 4-4 – Example of generalization

(a) Three entity types: CAR, TRUCK, and MOTORCYCLE

All these types of vehicles have common attributes

Page 17: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1717

Figure 4-4(b) – Generalization to VEHICLE supertype

So we put the shared attributes in a supertype

Note: no subtype for motorcycle, since it has no unique attributes

Page 18: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1818

Figure 4-5 – Example of specialization

(a) Entity type PART

Only applies to manufactured

parts

Applies only to purchased parts

Page 19: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

1919

Figure 4-5(b) – Specialization to MANUFACTURED PART and PURCHASED PART

Note: multivalued attribute was replaced by a relationship to another entity

Created 2 subtypes

Page 20: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2020

Constraints in Constraints in Supertype/ Supertype/ Completeness Completeness ConstraintConstraint

Completeness ConstraintsCompleteness Constraints: Whether : Whether an instance of a supertype an instance of a supertype mustmust also be a also be a member of at least one subtypemember of at least one subtype– Total Specialization Rule: Yes (double line)Total Specialization Rule: Yes (double line)– Partial Specialization Rule: No (single line)Partial Specialization Rule: No (single line)

Page 21: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2121

Figure 4-6 – Examples of completeness constraints

(a) Total specialization rule

A patient must be either an outpatient or a resident patient

Page 22: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2222

Figure 4-6(b) – Partial specialization rule

A vehicle could be a car, a truck, or neither

Page 23: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2323

Constraints in Constraints in Supertype/ Supertype/ Disjointness constraintDisjointness constraint Disjointness ConstraintsDisjointness Constraints: :

Whether an instance of a supertype Whether an instance of a supertype may may simultaneouslysimultaneously be a member of be a member of two (or more) subtypes.two (or more) subtypes.– Disjoint Rule: An instance of the supertype Disjoint Rule: An instance of the supertype

can be only ONE of the subtypescan be only ONE of the subtypes– Overlap Rule: An instance of the Overlap Rule: An instance of the

supertype could be more than one of the supertype could be more than one of the subtypessubtypes

Page 24: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2424

(a) Disjoint rule

Figure 4-7 – Examples of disjointness constraints

A patient can either be outpatient or resident, but not both

Page 25: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2525

Figure 4-7(b) Overlap rule

A part may be both purchased and manufactured

Page 26: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2626

Constraints in Constraints in Supertype/ Subtype Supertype/ Subtype DiscriminatorsDiscriminators Subtype DiscriminatorSubtype Discriminator:: An An

attribute of the supertype whose values attribute of the supertype whose values determine the target subtype(s)determine the target subtype(s)– DisjointDisjoint – a – a simplesimple attribute with alternative attribute with alternative

values to indicate the possible subtypesvalues to indicate the possible subtypes– OverlappingOverlapping – a – a compositecomposite attribute whose attribute whose

subparts pertain to different subtypes. Each subparts pertain to different subtypes. Each subpart contains a boolean value to indicate subpart contains a boolean value to indicate whether or not the instance belongs to the whether or not the instance belongs to the associated subtypeassociated subtype

Page 27: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2727

Figure 4-8 – Introducing a subtype discriminator (disjoint rule)

A simple attribute with different possible values indicating the subtype

Page 28: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2828

Figure 4-9 – Subtype discriminator (overlap rule)

A composite attribute with sub-attributes indicating “yes” or “no” to determine whether it is of each subtype

Page 29: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

2929

Figure 4-10 – Example of supertype/subtype hierarchy

Page 30: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

PRPR

Kasus Rumah Sakit:Kasus Rumah Sakit:

1.1. Definisikan Business Rules-nya!Definisikan Business Rules-nya!

2.2. Buatlah ER diagram untuk kasus Buatlah ER diagram untuk kasus tersebut dimana didalamnya tersebut dimana didalamnya terdapat completeness terdapat completeness constraints, disjointness constraints, disjointness constraints, subtype constraints, subtype discriminator.discriminator.

Page 31: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

Bersambung minggu depan…….Bersambung minggu depan…….

Page 32: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3232

Entity ClustersEntity Clusters EER diagrams are difficult to read EER diagrams are difficult to read

when there are too many entities and when there are too many entities and relationshipsrelationships

Solution: group entities and Solution: group entities and relationships into relationships into entity clustersentity clusters

Entity clusterEntity cluster: set of one or more : set of one or more entity types and associated entity types and associated relationships grouped into a single relationships grouped into a single abstract entity typeabstract entity type

Page 33: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3333

Figure 4-13(a) – Possible entity clusters

for Pine Valley Furniture

Related groups of entities could become clusters

Page 34: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3434

Figure 4-13(b) – EER diagram of PVF entity clusters

More readable, isn’t it?

Page 35: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3535

Business rulesBusiness rules

Statements that Statements that definedefine or or constrainconstrain some some aspect of the business.aspect of the business.

Constraints can impact:Constraints can impact:– Structure (definition, domain, relationship)Structure (definition, domain, relationship)– Behavior (operational constraints)Behavior (operational constraints)

Classification of business rules:Classification of business rules:– Derivation – rule derived from other knowledgeDerivation – rule derived from other knowledge– Structural assertion – rule expressing static Structural assertion – rule expressing static

structurestructure– Action assertion – rule expressing Action assertion – rule expressing

constraints/control of organizational actionsconstraints/control of organizational actions

Page 36: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3636

Figure 4-15 – EER depiction of

business rules classification

Source: adapted from GUIDE Business Rules Project, 1997.

Page 37: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3737

Action Assertion Action Assertion ClassificationsClassifications ResultResult

– Condition – IF/THEN ruleCondition – IF/THEN rule– Integrity constraint – must always be trueIntegrity constraint – must always be true– Authorization – privilege statementAuthorization – privilege statement

FormForm– Enabler – leads to creation of new objectEnabler – leads to creation of new object– Timer – allows or disallows an actionTimer – allows or disallows an action– Executive – executes one or more actionsExecutive – executes one or more actions

RigorRigor– Controlling – something must or must not Controlling – something must or must not

happenhappen– Influencing – guideline for which a notification Influencing – guideline for which a notification

must occurmust occur

Page 38: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3838

Stating an Action Stating an Action AssertionAssertion

Anchor ObjectAnchor Object – an object on which – an object on which actions are limitedactions are limited

ActionAction – creation, deletion, update, – creation, deletion, update, or reador read

Corresponding ObjectsCorresponding Objects – an object – an object influencing the ability to perform an influencing the ability to perform an action on another business ruleaction on another business rule

Action assertion will identify corresponding objects that Action assertion will identify corresponding objects that constrain the ability to perform actions on anchor objectsconstrain the ability to perform actions on anchor objects

Page 39: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

3939

Figure 4-16 – Data model segment for class scheduling

Page 40: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

4040

Figure 4-17 – Business Rule 1: For a faculty member to be assigned to teach a section of a course, the faculty member must be qualified to teach the course for which that section is scheduled

Action assertion

Anchor object

Corresponding object

Corresponding object

In this case, the action assertion

is a RRestriction

Page 41: Conceptual Design Modeling the rules of organization Modeling the rules of organization Building ER model Building ER model.

4141

Figure 4-18 –Business Rule 2: For a faculty member to be assigned to teach a section of a course, the faculty member must not be assigned to teach a total of more than three course sections

Action assertionAnchor object

Corresponding object

In this case, the action assertion is an

UUpper LIMLIMit