Re: Representing Key Constraints in UML based Conceptual Data Models



Re: Representing Key Constraints in UML based Conceptual Data Models

From: Pieter Van Gorp <pieter_at_pietervangorp.com>
Date: Thu, 30 Apr 2009 17:45:43 +0200
Message-ID: <15af5f050904300845v4d24103dwece6237a3747e1a1@mail.gmail.com>
Hi Daniel, hi all,

On Thu, Apr 30, 2009 at 2:49 PM, Daniel Jackson <dnj@mit.edu> wrote:
> Can you post your question? I clicked on your link but messages are only
> visible to group members and it's too much hassle to sign up.
Sorry to have overlooked that.  Indeed it would be too much hassle so
here's a copy of the thread.

MESSAGE HISTORY:
--- In agileDatabases@yahoogroups.com, Scott Ambler <scottwambler@...> wrote:
> --- On Thu, 4/2/09, Muntasir Rahman <muntasir.rahman@...> wrote:
> <snip>
> > - unique constraint value of a member field. For example:
> > "an ISBN is unique value for Book class"
> Easist thing is to use a note, see http://www.agilemodeling.com/style/note.htm for examples.
> You could also use OCL, but few people actually know it.
> If ISBN is some form of key, see
http://www.agiledata.org/essays/umlDataModelingProfile.html#Keys

MY REPLY/QUESTION:
--- In agileDatabases@yahoogroups.com, "pietervangorp" <pieter@...>
wrote on Tue Apr 14, 2009 6:31 pm:
I am currently documenting an operational database and I am confronted with a
key-related modeling problem as well. On
http://is.tm.tue.nl/staff/pvgorp/fora/key-issue1.png you find a fragment where I
apply <<K>> to denote natural keys of the tables underlying particular classes
(User and Host). The diagram is at the level of *logical* data modeling.
Therefore, I have not mapped the three associations to attributes (that would
correspond directly to table columns).

The problem I am faced with now, is that
http://www.agiledata.org/essays/umlDataModelingProfile.html#Keys (or any other
data modeling source I am aware of) does not provide a means to model the
InternetAccess(user,host) key from the underlying database. On
http://is.tm.tue.nl/staff/pvgorp/fora/key-issue1.png I show two OCL constraints
that do formalize the intended constraint but I am looking for a more readable
modeling style. I do not consider the OCL readable, because:
1) database administrators may not know the OCL (see comment from Scott),
2) I need to specify the constraint from two sides explicitly.

I think (2) is a bigger problem than (1) because the OCL example is based on
straightforward logics and may be comprehensible even to people that are
unfamiliar with the language. No matter what, I think the OCL application shown
in the example is bad style.

I have some old, rough experience on
http://is.tm.tue.nl/staff/pvgorp/research/datamodelingprofile/HR-example.png but
at the time (2003?) I did not consider the need to include (to-one) association
ends in key definitions either...

As potential solutions, I am thinking of
http://is.tm.tue.nl/staff/pvgorp/fora/key-issue2a.png and
http://is.tm.tue.nl/staff/pvgorp/fora/key-issue2b.png. Both approaches raise
new issues from a tooling perspective (it is impossible to use AssociationEnd as
types in in TagDefinitions) but currently I am primarily interested in:

1) have others ever wanted to include association ends in natural key
definitions?
2) what (informal) syntax have others applied?

Kind regards,
and thanks in advance for your input,
Pieter Van Gorp
Received on Thu 30 Apr 2009 - 16:45:49 BST