Book a Demo

Author Topic: How to model "IsATypeOf"  (Read 8730 times)

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
How to model "IsATypeOf"
« on: January 13, 2005, 12:51:01 pm »
In the ER Diagramming notation for databases, I can use a connector that says an object is a "Type of" another Object.  For example:  'balls' and 'cylinders' are a type of 'bearing', or, 'employees' and 'customers' are types of 'individuals'.  There is a specification of a data element in the generic object that is used to specify the type of the associated tuple in the "child" table.  Columns applicable to both types are declared in the Parent table.  Columns unique to the typed child table are declared in the child table.  In the physical model, all columns can be declared in one table or in separate tables.

How is all of this modeled in UML?  I've seen something similar in defining actors on a Use Case model, but nothing in the class diagrams

How is the code generation controlled to map into the desired table structure?

Verbal Use Cases aren't worth the paper they are written upon.

thomaskilian

  • Guest
Re: How to model "IsATypeOf"
« Reply #1 on: January 14, 2005, 03:32:52 am »
I guess what you're seeking is the generalization relationship. Draw it from class A to B to tell that A "IsATypeOf" B.

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: How to model "IsATypeOf"
« Reply #2 on: January 15, 2005, 07:17:04 pm »
Well, I started with that thought, but generalizations are a static sort of thing that lead to multiple database tables, one for the parent and one each for each sub-type.

How do I extend this into dynamic generalizations where multiple types occur in one table?  How do I make the UML notation explicit enough that EA's code generator produces DDL that either creates one consolidated, multi-type table; or, several Uni-type tables according to my db design strategy?

Verbal Use Cases aren't worth the paper they are written upon.

thomaskilian

  • Guest
Re: How to model "IsATypeOf"
« Reply #3 on: January 17, 2005, 03:57:18 am »
By using the automation interface and some programming ???

Gary W.

  • EA User
  • **
  • Posts: 139
  • Karma: +0/-0
    • View Profile
Re: How to model "IsATypeOf"
« Reply #4 on: January 17, 2005, 09:53:50 am »
jeshaw2,

You're running into the infamous 'object-relational impedence mismatch' problem.  It sounds like you're used to the Oracle Designer Database Design Transformer, which can create one of four supertype/subtype implementations.

Neithr EA, nor any object-oriented tool, can give you the same fine-grained level of detail.  

You can look at Oracle's 'TopLink' tool for one solution (i.e. stay purely relational but have a mapping framework on top of it).  There are many others, but having EA automatically generate DDL in this way is not really one of them =8^(

gary

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: How to model "IsATypeOf"
« Reply #5 on: January 19, 2005, 09:21:49 pm »
Sounds like its time to come up with a <<IsATypeOF>>  steriotype for the Generalization link?  

Its attributes could control how to generate the DDL without too much trouble I think. (Consolidated or Seperate tables, etc.)
Verbal Use Cases aren't worth the paper they are written upon.

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: How to model "IsATypeOf"
« Reply #6 on: January 20, 2005, 01:40:37 pm »
Good news - The mechanism is the "generalizationSet".  

bad news - See: http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1105989284


bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: How to model "IsATypeOf"
« Reply #7 on: January 24, 2005, 08:26:37 pm »
Well, here is what I'm doing until the beard stroking is accomplished.  Perhaps this will generate some productive discussion.

First, I define two new steriotypes:
"GeneralizationSet" on a base of 'association', and
"typeOf" on a base of 'dependancy'

Second, I draw the generalized table above the IsATypeOf tables.

Third, I put a diagonal, n-ary association between them giving it a name that is also the name of the data element that discriminates between the different types.

Fourth, I draw an nesting line from the diagonal association to the generalized table and steriotype it as <<typeOf>>.  The use of the nesting line communicates that the fields in the 'IsATypeOf' tables actually exist in the 'generalized' table.

Finally, I draw generalization lines from the 'IsATypeOF' tables to the diagonal association and steriotype them as <<GeneralizationSet>>.  This is in deferance to the UML 2.0 specification

This may be a bit kinky and I don't expect EA to generate code from it, but it communicates my design.  If I've done real damage to the notational syntax of UML 2.0, I'm open to good suggestions.

Perhaps I should use the C++ construct of virtual inheritance supported by EA. (See the thread on this in the general discussion forum.)

« Last Edit: January 24, 2005, 08:36:54 pm by jeshaw2 »
Verbal Use Cases aren't worth the paper they are written upon.