# Friday, January 02, 2009

A central theme in my current work is the idea of a universal data model. Research in this direction led to noted author and consultant Len Silverston and his work on the subject which led to licensing ER/Studio and Len's models from Embarcadero. Soon after that, we invited Len to our offices to help us better understand his approach to data models and the process of data modeling. It was an informative and very productive three days. I wholeheartedly recommend his books and his consulting services to you. (See www.univdata.com.)

One of the most difficult concepts to grasp, for me at least, in the realm of data modeling is the transition from logical data model to physical database schema. When I look at boxes and lines with crow's feet connectors, I think of physical database tables. So looking at a logical model like this one makes me think of twelve tables.

model1  

The model depicted above (created using ER/Studio) is a simplification of Len's party role logical model that he talks about in his book Data Model Resource Book Volume 1. I've marked the entities that are "logical" and not physical in nature with a yellow background. ER/Studio allows me to mark these entities in the model as "logical" so that they will not be generated in the physical model that the modeling tool will create for you. The only problem is the PARTY ROLE TYPE entity, if marked as "logical," does not get generated and the relationship and foreign key does not get created in the PARTY ROLE table in the physical model.

When you add attributes such as those that PERSON and ORGANIZATION have that are unique to a sub-type, you have to push them to the physical model. Where the sub-type has no unique attributes but can be represented by a unique value record in the super-type entity/table, that entity can remain "logical only."

So now I modify the model and remove PARTY ROLE TYPE and create a relationship between ROLE TYPE and PARTY ROLE and then generate a physical model and this is what I get:

model2  

From the physical model I can generate a database script and create a database. Perhaps it is not practical to generate the physical model from the logical model in all cases, but where it can be done in order to avoid maintaining two separate models and risk synchronization issues, I would encourage it.

I'm looking forward to getting Len's next book that focuses on patterns in data modeling which ships next week. Amazon already has my order.

posted on Friday, January 02, 2009 4:31:33 PM (Mountain Standard Time, UTC-07:00)  #    Comments [2]
Related posts:
Party Role and Party Type in Data Model
Saturday, January 03, 2009 10:56:24 AM (Mountain Standard Time, UTC-07:00)
Tyler
Happy New Year!

I am a middle level developer of Web Apps in ASP.Net C#.

I just stumbled (Googled) across your entry on 2nd Jan about Len Silverston’s Party Role Model. I have used a database (designed by others) that is similar to this, except that the Person and Organisation table (or their equivalent) were child categories of the Party Role table rather than the Party table. This has never sat well for me and I am now designing my own database for a local tennis club that has various parties (people, families, teams, other clubs) and roles (playing member, non-playing member, committee member etc). Your blog has persuaded me of two things. That I should have the courage of my convictions and categorise the party side of the database, keeping the party roles to themselves, and secondly, to go and buy one, or more, of Len’s books. Thank you.

Also, I read your entry on the Mac vs PC marketing spend. I am a Mac and a PC. My Mac is primarily my ‘home’ machine: photos, browsing, letter writing, designing leaflets, music , email. My PC (laptop with 18.4” display that makes it a pleasant tool to use) is for developing and business. I find this way I don’t get to frustrated with either Mr Jobs or Mr Gates!

Thanks for the blog.

Peter
Peter
Tuesday, January 13, 2009 8:32:20 AM (Mountain Standard Time, UTC-07:00)
You may want to consider having the "Party Role Type" entity become the physical table, rather than the "Role Type". This would be done by rolling down the attribute (description) from "Role Type" to "Party Role Type".

This would setup the physical model to separate out the role type values for their logical purpose, when additional subtypes are added. For example, if you added a subtype of "Order Role Type" and carried that data in "Role Type" table along with the data for "Party Role Type" the physical model would allow a role type intended for party to be used within order.

The downside to this is that each role type subtype will become an additional table, with a small amount of date. which could be a good trade off for having the DB keep the data integrity.

Another method is to add a column on the physical side to indicate which subtype the role is used with, then build a more complex check within the DB.
Kevin Arnold
Comments are closed.