Tải bản đầy đủ (.pdf) (5 trang)

PATTERNS OF DATA MODELING- P32 pps

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (145.16 KB, 5 trang )

10.17 Product 139
tended). In reality, at most one Person can hold a Position at a time and application code must
enforce this constraint.
The model does not require that the position structure be a hierarchy, although that is the
usual case. The model instead supports matrix management (a Position may report to multi-
ple parent Positions).
10.17 Product
A Product is the packaging of a physical item for a particular marketplace (Figure 10.33,
Figure 10.34). For example, a bank can have a checking account service and tailor the service
into products for various markets. One product might be an interest-bearing checking ac-
count. Another might couple a checking account with discounts for various businesses. A
third product might have low fees for students. A product can consist of multiple items.
Figure 10.31 Archetype Position: UML model. A Position is a job held
by someone in an organization.
effectiveDate
expirationDate
MgmtHierarchy
PositionLink
effectiveDate
expirationDate
Position
title
effectiveDate
expirationDate
Assignment
effectiveDate
*
11
*
0 1
Organization


Person
**
1
1
parent child
expirationDate
1
*
1
root
{At most one Person can
hold a Position at a time.}
Figure 10.32 Archetype Position: IDEF1X model.
positionID
Position
title
effectiveDate
expirationDate
personID
Person
. . .
assignmentID
Assignment
effectiveDate
expirationDate
positionID (FK)
personID (FK)
positionLinkID
PositionLink
effectiveDate

expirationDate
parentPositionID (FK)
childPositionID (FK)
mgmtHierarchyID
MgmtHierarchy
effectiveDate
expirationDate
rootPositionID (FK) (AK1.1)
organizationID (FK)
organizationID
Organization
. . .
140 Chapter 10 / Archetypes
10.18 Role
A Role is a function played by someone or something (Figure 10.35, Figure 10.36). Each
Role corresponds to one Entity and can also have a Relationship. Similarly, each RoleType
corresponds to one EntityType and can also have a RelationshipType.
This archetype is an excerpt from a metamodel but the notion of a role often arises for
application models. Sometimes it is helpful to have explicit role tables as the Actor and Ad-
dress archetypes illustrate.
Note that the role archetype has two homomorphisms.
• EntityType to Entity corresponds to RoleType to Role.
• RelationshipType to Relationship corresponds to RoleType to Role.
Figure 10.33 Archetype Product: UML model. A Product is the packaging
of a physical item for a particular marketplace.
*
Product
name
*
1

marketingData
PhysicalItem Vendor
*
Figure 10.34 Archetype Product: IDEF1X model.
physicalItemID
PhysicalItem
. . .
vendorID
Vendor
. . .
productID
Product
productName
marketingData
vendorID (FK)
PhysItem_Product
physicalItemID (FK)
productID (FK)
Figure 10.35 Archetype Role: UML model. A Role is a function played
by someone or something.
Entity Relationship
RoleType
name
Role
1
1
*
*
*
1

0 1
*
1 0 1
**
*
1
EntityType
name
RelationshipType
name
10.19 Transaction 141
10.19 Transaction
A Transaction is an exchange that must be completed in its entirety or not at all (Figure
10.37, Figure 10.38). There are two major usages — in finance and in computing.
Figure 10.36 Archetype Role: IDEF1X model.
entityTypeID
EntityType
entityTypeName (AK1.1)
roleTypeID
RoleType
roleTypeName
entityTypeID (FK)
relationshipTypeID (FK)
relationshipTypeID
RelationshipType
relationshipTypeName
entityID
Entity
entityTypeID (FK)
roleID

Role
roleTypeID (FK)
entityID (FK)
relationshipID (FK)
relationshipID
Relationship
relationshipTypeID (FK)
*
1
Figure 10.37 Archetype Transaction: UML model. A Transaction is an
exchange that must be completed in its entirety or not at all.
Transaction
datetime
priority
TransactionType
name {unique}
TransactionElement
name
outcome
*
1
Figure 10.38 Archetype Transaction: IDEF1X model.
transactionID
Transaction
datetime
priority
outcome
transactionTypeID (FK)
transactionTypeID
TransactionType

transactionTypeName (AK1.1)
transactionElementID
TransactionElement
transactionElementName
transactionID (FK)
142 Chapter 10 / Archetypes
A financial transaction is an exchange of assets (information, goods, services, money)
between two parties. For example, a stock holding might be sold on a stock exchange. A
company may split its stock awarding additional shares to the owner as well as money in lieu
of partial shares.
A computing transaction (often involving a database) is a group of commands that is
treated as a unit of work. All commands must be completed before the transaction is success-
ful. Partial work is not permitted; if the transaction cannot be completed all work is undone.
Each Transaction has a TransactionType that determines the precise processing. A trans-
action outcome is committed or rolled back. The TransactionElements are either the details
of a financial transaction or the constituent commands for a computing transaction.
10.20 Vendor
A Vendor is someone involved in the sale of products (Figure 10.39, Figure 10.40). Vendor
reifies the vendor role for a TangibleActor (usually an organization, see Section 10.2). Ven-
dors often have special data to collect, such as supply data, credit information, and order lead
time. You could use softcoding (see Chapter 13) to capture vendor data, but an alternative is
to define a distinct entity type as shown here.
10.21 Chapter Summary
Archetypes are abstractions that often occur and transcend individual applications. You
should keep them in mind as you construct models. Table 10.1 summarizes the archetypes.
0 1
Vendor
supplyData
1
creditInformation

orderLeadTime
Figure 10.39 Archetype Vendor: UML model. A Vendor is someone
involved in the sale of products.
TangibleActor
Figure 10.40 Archetype Vendor: IDEF1X model.
vendorID
Vendor
supplyData
creditInformation
orderLeadTime
tangibleActorID (FK) (AK1.1)
tangibleActorID
TangibleActor
. . .
10.21 Chapter Summary 143
Archetype Definition Sample applications Related terms
Account
a label for recording,
reporting, and manag-
ing a quantity of some-
thing
• accounting
• business
• computing
• financial
•travel
• account payable
• account receivable
• credit card account
• email account

• expense account
• frequent flyer account
• general ledger account
Actor
someone or something
that is notable in terms
of data or relationships
widespread use across
applications
• customer
• organization
•party
•person
• vendor
Address
a means for communi-
cating with an actor
Asset
something of value • business
• financial
• security
Contract
an agreement for the
supply of products
• business
• financial
• agreement
• purchase order
• sales order
Course

a series of lessons
about a subject
• education
Customer
someone involved in
the purchase of prod-
ucts
CRM (customer rela-
tionship management)
Document
a physical or elec-
tronic representation of
a body of information
Event
an occurrence at some
point in time
Flight
the travel by an air-
plane between airports
• aviation
• shipping
•trucking
•route
Item
a part or a service • commerce
• manufacturing
•part
• product
• service
Table 10.1 Summary of Archetypes

Note: Keep them in mind as you construct models. The use of an archetype
can lead to a breakthrough.

×