class diagram notation for object database modeling
- Hi All,
I am a newbie OO designer. I use an object database, db4o ( http://www.db4o.com ) for a project. I am having problem to document my object schema design. Is there any standard notation in UML class diagram to define constraints like these:
- unique constraint value of a member field. For example: "an ISBN is unique value for Book class"
- referential integrity between class, Cascade Delete. For example: There is 2 category class, fiction and non-fiction Book. If i delete fiction class, all books belong to that category will be deleted too.
- inverse relationship, bi-directional
--- On Thu, 4/2/09, Muntasir Rahman <muntasir.rahman@...> wrote:
> - 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
> - referential integrity between class, Cascade Delete. For
> example: There is 2 category class, fiction and non-fiction
> Book. If i delete fiction class, all books belong to that
> category will be deleted too.
> - inverse relationship, bi-directional
Scott W. Ambler
Chief Methodologist/Agile, IBM Rational
Agile at Scale: http://www.ibm.com/developerworks/blogs/page/ambler
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/
- Hi all,
--- In agileDatabases@yahoogroups.com, Scott Ambler <scottwambler@...> wrote:
> --- On Thu, 4/2/09, Muntasir Rahman <muntasir.rahman@...> wrote:
> > - 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
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?
and thanks in advance for your input,
Pieter Van Gorp