• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

n-ary association

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can someone giveme an example for nary association between classes? How do I draw this using UML.
Thanks
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean something like the following:
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is binary association. n-ary meaning more than two classes are involved in the relationship.
Grady Booch UML reference talks about it but it does not give any example though.
[ September 09, 2003: Message edited by: Pradeep Bhat ]
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's still an n-ary association.
A bi-n-ary association.
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right, but I am looking for ternary and above.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is it you would like to do, first.
Perhaps a bi-n-ary association would suffice ?
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I havent used ternary association ,so I wanna to know an example for this one and how to draw UML digaram for this.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing here . On a domain model with n different conceptual classes there can be n (n-1) different associations.
So 3 x 2 = 6 different associations. Quite complex for 3 classes, let alone 100s .Too many associations tend to confuse and add to the visual noise.

ternary associations are about my limit. In fact I can't find the other 3 potential associations. Best stick to associations on a "need to know basis" and leave out the ones that can be derived.
I hope I am reading the n-ary right and not confusing it with multiplicity ( 5..100 ).
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Thomas!
How do I show that the above diagram represents a single association and not 3 associations.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I show that the above diagram represents a single association

You mean a un-ary association .

The students could be divided into project groups. I think that's a u-n-ary association. I thought you were into the n-aries ? When did you move to "common" language ?
Anyway, this is pure guess work. I hope an expert will correct this.
regards
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I am a little slow in thinking today...
Here is a good example for a ternary association: http://ias.uni-klu.ac.at/projects/uml/ECOOP99/sld059.htm
What do you need it for???
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seeing Your first diagram I feel that are are three associations i.e.
1. between school and class
2. between schooland student
3. between student and class
and *not* a single ternary asscoiation.
Is there any notation to indicate that it is a single ternary asscoiation?
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks HS!

What do you need it for???

I wanna to know more.
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gosh! It's worse than I thought.
regards
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You link is great! It solves my query!
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why aren't ternary asociations that common ?
Also the note , that navigation is not shown ?
regards
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to interrupt
I have read the notation representing the ternary asscoiation provided by Ilaj.
I have read it from the database notes,but it does not contain the word "association".
Does ternary relationship is superset of ternary asscoiation?
thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Association is a realtionship.
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep =.=
Association is a realtionship.
Is it more clear that association is a kind of relationship?
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grady Booch states that association is a structural relationship between classes.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by siu chung man:
I have read the notation representing the ternary asscoiation provided by Ilaj.
I have read it from the database notes,but it does not contain the word "association".

Perhaps in your database notes it's an Entity Relationship diagram? They look somewhat similar to class diagrams, if I remember correctly...
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by HS Thomas:
Why aren't ternary asociations that common ?
Also the note , that navigation is not shown ?

First, most languages don't provide direct support for this, so it's kind of an abstract thing to do.
Second, the notation is somewhat ambiguous. What would a navigation on one of the associations ends mean? Can both other classes navigate in that direction, or just one? What about multipicity?
 
HS Thomas
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should ternary associations be avoided then ? As it doesn't seem to translate to code , or needs to be changed severely.
So,if you find yourself drawing (or given) a ternary association , is that a signal to re-model ?
regards
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That slide link looked what I was expecting for ternary relationship. It's probably modeled

but implemented with reference variables
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps in your database notes it's an Entity Relationship diagram? They look somewhat similar to class diagrams, if I remember correctly...
Yes, it is exactly ER diagram
And I find it interesting that it contains Inheritance relationship syntax, and notice that using crow's foot notation. And I notice the assocation syntax is different to those sytax.
Why it is so different?
Is it different in sytax only? But how about the meaning?
thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it different in sytax only? But how about the meaning?

I understnd that the syntaxes may be different but meaning the same.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ER-Diagrams are about relational data and quite different from class diagrams. For example, every entity needs to have attributes identified as primary key, but can't have operations like a class.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True there are no operations. There is no aggregation, inheritance relationship. Only thing is cardinality.
 
Robert Martin
Author
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Hi,
Can someone giveme an example for nary association between classes? How do I draw this using UML.
Thanks

You draw it using a large diamond. The classes surround that large diamond and have associations to and from it. You can put a name in the diamond that represents the name of the relationship. This is very similar to the standard E-R diagram notation.
I almost never use n-ary relationships in class diagrams. When I draw class diagrams I am almost never creating data models. I use class diagrams for object models, and object models are models of behavior, not of data structure. I use N-ary relationships often in ER diagrams when doing data modeling.
An example: Employer, Employee, and Contract represent three data structures that are related to one another via an "Employement" relationship.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob,
Thanks for spending your valuable time at Javaranch.
Does your book talk about ternaray relationships?
 
Kalpesh Soni
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
You link is great! It solves my query!

:roll:
and i could not understand anything from it !
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kalpesh Soni:

:roll:
and i could not understand anything from it !


Looks like you are a big UML expert
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic