Two Fields Referencing One Table

T

TJO

How does one go about modeling a table containing two fields each of which
that will contain the ID of the same lookup table?

Thanks
 
J

John Saunders

TJO said:
How does one go about modeling a table containing two fields each of which
that will contain the ID of the same lookup table?

If you're talking about ORM modeling, you don't model fields. You model
objects and roles.

There's nothing preventing a single object from playing multiple roles:

Employee(id) has EmployeeName
Employee is managed by Employee
Employee is the secretary of Employee
 
T

TJO

I have the following rules
Rate has DialRateType
Rate has RedialRateType
Rate has InboundRateType

Each of these rules is basically a foriegn key to a common lookup table
called RateType.
I need help modeling this. I don't see how these three rules will relate to
a common object RateType ???

Thanks
 
S

Scot A. Becker

Hi TJO,

As John mentioned, you can have multiple facts that reference the same
objects; what differs then is the predicate text. For example (objects in
brackets):

[Rate] has dial [Rate Type]
[Rate] has redial [Rate Type]
[Rate] has inbound [Rate Type]

In this manner, the different facts are indicated by the changing predicate.
Upon mapping to a logical model, the predicate is used as part of the column
names yielding names like DialRateType, RedialRateType, and InboundRateType.

Hope that helps,
Scot.
 
T

TJO

This is exactly what i need help with. Thanks.
Can you provide some clarity on how you enter this information in the Fact
Editor? I think you are saying that "has dial", "has redial", "has inbound"
belongs in the Relationship text box?


Scot A. Becker said:
Hi TJO,

As John mentioned, you can have multiple facts that reference the same
objects; what differs then is the predicate text. For example (objects in
brackets):

[Rate] has dial [Rate Type]
[Rate] has redial [Rate Type]
[Rate] has inbound [Rate Type]

In this manner, the different facts are indicated by the changing predicate.
Upon mapping to a logical model, the predicate is used as part of the column
names yielding names like DialRateType, RedialRateType, and InboundRateType.

Hope that helps,
Scot.

TJO said:
I have the following rules
Rate has DialRateType
Rate has RedialRateType
Rate has InboundRateType

Each of these rules is basically a foriegn key to a common lookup table
called RateType.
I need help modeling this. I don't see how these three rules will
relate
to
a common object RateType ???

Thanks
 
T

TJO

I would image the same would hold true if you wish to reuse a common value
type such "Description"
Product has product Description
Catalog has catalog Description


Scot A. Becker said:
Hi TJO,

You are correct. The predicate text (lowercase in the examples below) goes
into the relationship boxes and you select the Rate and Rate Type objects in
the "Object Name" drop downs.

See the attached.

Hope that helps,
Scot.
...............................................
Scot Becker

Orthogonal Software
www.orthogonalsoftware.com

TJO said:
This is exactly what i need help with. Thanks.
Can you provide some clarity on how you enter this information in the Fact
Editor? I think you are saying that "has dial", "has redial", "has inbound"
belongs in the Relationship text box?


Scot A. Becker said:
Hi TJO,

As John mentioned, you can have multiple facts that reference the same
objects; what differs then is the predicate text. For example (objects in
brackets):

[Rate] has dial [Rate Type]
[Rate] has redial [Rate Type]
[Rate] has inbound [Rate Type]

In this manner, the different facts are indicated by the changing predicate.
Upon mapping to a logical model, the predicate is used as part of the column
names yielding names like DialRateType, RedialRateType, and InboundRateType.

Hope that helps,
Scot.

I have the following rules
Rate has DialRateType
Rate has RedialRateType
Rate has InboundRateType

Each of these rules is basically a foriegn key to a common lookup table
called RateType.
I need help modeling this. I don't see how these three rules will relate
to
a common object RateType ???

Thanks

How does one go about modeling a table containing two fields each of
which
that will contain the ID of the same lookup table?

Thanks
 
S

Scot A. Becker

Hi TJO,

Many people do just that, and with lots of more general object types like
ID, Name, etc.

I usually prefer to keep them separate, however, to ease any later model
changes (e.g. one description needs to be longer/shorter than the others).
Also, I like to think of them as distinct object types -- with distinct
domains -- in general. It is a matter of style, I suppose.

For more discussion on this: If you have Terry Halpin's book (any of the
editions), check out CSDP step 3 (check for entity types that should be
combined). This starts on page 93 of his latest. Essentially, you generalize
the object types into one and specialize the predicate text with similar
text as what you removed from the object names.

This idea pops up again as "Predicate Specialization and Generalization" in
the "Schema Transformations" chapter.

Hope that helps,
Scot.
................................................
Scot Becker

Orthogonal Software
www.orthogonalsoftware.com

TJO said:
I would image the same would hold true if you wish to reuse a common value
type such "Description"
Product has product Description
Catalog has catalog Description


Scot A. Becker said:
Hi TJO,

You are correct. The predicate text (lowercase in the examples below) goes
into the relationship boxes and you select the Rate and Rate Type
objects
in
the "Object Name" drop downs.

See the attached.

Hope that helps,
Scot.
...............................................
Scot Becker

Orthogonal Software
www.orthogonalsoftware.com

TJO said:
This is exactly what i need help with. Thanks.
Can you provide some clarity on how you enter this information in the Fact
Editor? I think you are saying that "has dial", "has redial", "has inbound"
belongs in the Relationship text box?


Hi TJO,

As John mentioned, you can have multiple facts that reference the same
objects; what differs then is the predicate text. For example
(objects
in
brackets):

[Rate] has dial [Rate Type]
[Rate] has redial [Rate Type]
[Rate] has inbound [Rate Type]

In this manner, the different facts are indicated by the changing
predicate.
Upon mapping to a logical model, the predicate is used as part of the
column
names yielding names like DialRateType, RedialRateType, and
InboundRateType.

Hope that helps,
Scot.

I have the following rules
Rate has DialRateType
Rate has RedialRateType
Rate has InboundRateType

Each of these rules is basically a foriegn key to a common lookup table
called RateType.
I need help modeling this. I don't see how these three rules will
relate
to
a common object RateType ???

Thanks

How does one go about modeling a table containing two fields
each
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top