Database Design with Semantic Object Models zMapping 7 types of semantic objects into relations
Simple objects zTransform object into relation zMake ID into key zOther attributes become columns
Composite objects zOne relation for base object yInclude single-valued attributes zOne relation for each (simple or group) multi- valued attribute zKey of child relation is composite: yForeign key of object yLocal key of multi- valued attribute
Separate versus nested groups zIterate composite object procedure zOuter group is base object for inner group
Compound objects zBasically 3 types of binary relationships
Compound objects z1:1 - place key of either table into other table
Compound objects z1:N - place key of parent into child table
Compound objects zN:M - create intersection table with keys of both relations
Hybrid objects zCreate a table for the multi-valued group attribute of the composite object zPlace key of non-composite object into that table SALES-ORDER (SalesOrderNumber, Date, Subtotal, Tax, Total, Phone, SalespersonName) ITEM (ItemNumber, ItemDescription, UnitPrice) LINE-ITEM (SalesOrderNumber, ItemNumber, Quantity, ExtendedPrice)
Hybrid objects zActually, 4 cases of hybrid objects
Hybrid Object Max Cardinality zCase One zITEM in one ORDER and only one LineItem
Hybrid Object Max Cardinality zCase Two zITEM in one or more LineItems within one SALES-ORDER
Hybrid Object Max Cardinality zCase Three zITEM in one LineItem within one SALES- ORDER
Hybrid Object Max Cardinality zCase Four zITEM in one or more LineItems within one SALES-ORDER
Hybrid object common cases zCase 4: O3 is inserted into R-G2 but not as part of its local key zCase 1: like 3 but add O1 to R2 and R2(O1,O2) = R-G1(O1,O2) Case 2: like 4 but add O1 to R3 and R-G2(O1,O3) R3(O1,O3)
Association objects zOne relation for each of the 3 participating objects yEach relation has its own key yAssociation relation has parents’ keys as foreign keys yIf association has no unique ID, use foreign keys zUnlike intersection relations, association tables may have additional attributes
Super/subtype objects zOne table for parent zOne table for each subtype zNormally same key for all zMay add subtype attribute(s) to parent for efficiency yOne label if exclusive yOne Boolean per type, if not exclusive
Archetype/version objects zOne table for archetype zOne table for version zKey of version table contains key of archetype table