1. Trang chủ
  2. » Công Nghệ Thông Tin

PATTERNS OF DATA MODELING- P39 doc

5 237 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 144,24 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

entityTypeID entityTypeName AK1.1 EntityType entityID logicalIdentifier AK1.1 Entity attributeID dataType Attribute maxLength minMultiplicity maxMultiplicity entityTypeID FK AK1.1, AK2.1

Trang 1

13.4.2 Cut Metadata

A simplification is to forego metadata This is essentially what the UML does with tagged values Figure 13.12 and Figure 13.13 show the corresponding revision In essence the model stores values without metadata The advantage of omitting metadata is simplicity The down-side is that the values are less structured, less controlled, and more vulnerable to errors This approach can be useful for a small amount of miscellaneous data, but is not suitable for large quantities.

Figure 13.11 Softcoded values—add value metadata: IDEF1X model

entityTypeID

entityTypeName (AK1.1)

EntityType

entityID

logicalIdentifier (AK1.1)

Entity

attributeID dataType

Attribute

maxLength minMultiplicity maxMultiplicity entityTypeID (FK) (AK1.1, AK2.1) attributeName (AK1.2)

sequenceNumber (AK2.2)

valueString valueDateTime

SoftcodedValue

valueID

dateOfEntry entityID (FK)

valueInteger valueDecimal

enumValueID valueInteger

EnumValue

valueDecimal valueString valueDateTime attributeID (FK) (AK1.1) sequenceNumber (AK1.2)

entityTypeID (FK)

attributeID (FK) dataSourceID

dataSourceName (AK1.1)

DataSource

overrideUOMID (FK) dataSourceID (FK)

unitOfMeasureID unitOfMeasName (AK1.1)

UnitOfMeasure

defaultUnitOfMeasureID (FK)

Figure 13.12 Softcoded values—cut metadata: UML model

*

valueInteger valueDecimal valueString valueDateTime attributeName

Entity

<logicalIdentifier>

Trang 2

13.4.3 Store All SoftcodedValues as Strings

Figure 13.14 and Figure 13.15 show the option of storing all values as strings and converting them to the appropriate data type upon access This simplifies the model at the cost of type conversions Type conversions complicate programming and can introduce round-off errors.

13.4.4 Subtype by Data Type

An implementation can subtype SoftcodedValue, Attribute, and EnumValue according to the dataType (Figure 13.16, Figure 13.17) Note that the model’s structure does not enforce that

SoftcodedValue and Attribute subtypes must correspond For example, ValueInteger should only be associated with AttributeInteger Programming code must enforce this intent.

13.4.5 Require All Attributes to be Enumerated

Another possibility is to require that all softcoded values be enumerated (Figure 13.18, Fig-ure 13.19) Enumerations control data entry so there should be approval for new EnumVal-ues The resulting database has clean data since users can not introduce variations such as

alternate spellings, abbreviations, and upper/lower case combinations for the same thing.

Figure 13.13 Softcoded values—cut metadata: IDEF1X model

entityID logicalIdentifier (AK1.1)

Entity

valueString valueDateTime

SoftcodedValue

valueID

attributeName entityID (FK)

valueInteger valueDecimal

attributeName

*

1

1 0 1

*

1

Attribute

dataType maxLength minMultiplicity maxMultiplicity

{ordered}

*

1

{ordered}

EnumValue

valueString

SoftcodedValue

valueString

Figure 13.14 Softcoded values—store all values as strings: UML model

Entity

<logicalIdentifier>

EntityType

name {unique}

Trang 3

Figure 13.15 Softcoded values—store all values as strings: IDEF1X model

entityTypeID

entityTypeName (AK1.1)

EntityType

entityID

logicalIdentifier (AK1.1)

Entity

attributeID dataType

Attribute

maxLength minMultiplicity maxMultiplicity entityTypeID (FK) (AK1.1, AK2.1) attributeName (AK1.2)

sequenceNumber (AK2.2)

attributeID (FK)

SoftcodedValue

valueID valueString entityID (FK)

enumValueID valueString

EnumValue

attributeID (FK) (AK1.1) sequenceNumber (AK1.2)

entityTypeID (FK)

1 {ordered}

1 {ordered}

1 {ordered}

Figure 13.16 Softcoded values—subtype by data type: UML model

EnumValInteger

valueInteger

AttributeString

maxLength

AttributeInteger AttributeDateTime AttributeDecimal

EnumValDateTime

valueDateTime

EnumValDecimal

valueDecimal

EnumValString

valueString

1 {ordered}

ValueDecimal

valueDecimal

ValueString

valueString

ValueInteger

valueInteger

ValueDateTime

valueDateTime

attributeName 1 0 1 Attribute

minMultiplicity maxMultiplicity

{ordered}

*

1

*

1

SoftcodedValue

Entity

<logicalIdentifier>

EntityType

name {unique}

Trang 4

Figure 13.17 Softcoded values—subtype by data type: IDEF1X model

attributeDiscrim

AttribString

attribStrID (FK) maxLength

AttribDecimal

attribDecID (FK)

AttribDateTime

attribDatTimID (FK)

AttribInteger

attribIntID (FK)

attributeID

Attribute

minMultiplicity maxMultiplicity attributeDiscrim entityTypeID (FK) (AK1.1, AK2.1) attributeName (AK1.2)

sequenceNumber (AK2.2)

entityTypeID

entityTypeName (AK1.1)

EntityType

enumValDecID

valueDecimal

EnumValDec

attribDecID (FK) (AK1.1)

sequenceNum (AK1.2)

enumValStrID valueString

EnumValStr

attribStrID (FK) (AK1.1) sequenceNum (AK1.2)

enumValIntID valueInteger

EnumValInt

attribIntID (FK) (AK1.1) sequenceNum (AK1.2)

enumValDatTimID valueDateTime

EnumValDatTim

attribDatTimID (FK) (AK1.1) sequenceNum (AK1.2)

valueDiscrim

ValueString

valueStrID (FK) valueString

ValueDecimal

valueDecID (FK)

ValueDateTime

valueDatTimID (FK)

ValueInteger

valueIntID (FK)

attributeID (FK)

SoftcodedValue

valueID valueDiscrim entityID (FK)

entityID

logicalIdentifier (AK1.1)

Entity

entityTypeID (FK)

Trang 5

13.4.6 Enable Time History

The previous softcoded value models have treated data and metadata as invariant An

exten-sion is to let data change over time For example, each SoftcodedValue could have effective

and expiration dates to track its history Then a database can record a SoftcodedValue in ad-vance of when it is needed It can also keep a SoftcodedValue after it becomes obsolete

Sim-ilarly, Attributes and EnumValues could have effective and expiration dates.

attributeName

*

1

1 0 1

*

Attribute

dataType maxLength minMultiplicity maxMultiplicity

{ordered}

*

1 {ordered}

EnumValue

valueInteger valueDecimal valueString valueDateTime

Figure 13.18 Softcoded values—all values are enumerated: UML model

*

Entity

<logicalIdentifier>

EntityType

name {unique}

Figure 13.19 Softcoded values—all values are enumerated: IDEF1X model

entityTypeID

entityTypeName (AK1.1)

EntityType

entityID

logicalIdentifier (AK1.1)

Entity

attributeID dataType

Attribute

maxLength minMultiplicity maxMultiplicity entityTypeID (FK) (AK1.1, AK2.1) attributeName (AK1.2)

sequenceNumber (AK2.2)

enumValueID valueInteger

EnumValue

valueDecimal valueString valueDateTime attributeID (FK) (AK1.1) sequenceNumber (AK1.2) entityTypeID (FK)

Entity_EnumValue

entityID (FK) enumValueID {FK)

Ngày đăng: 05/07/2014, 06:20