Book a Demo

Author Topic: How to: OR constraints on associations  (Read 4021 times)

Bill Egge

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
How to: OR constraints on associations
« on: July 07, 2005, 04:22:54 pm »
How do I add an OR constraint on an association?

For example if I have a class called HighSchoolStudent and then 2 other classes named Acedemic and Commercial which have an association of "chooses" with the HighSchoolStudent but with an OR constraint.

How would I show that?  In my UML book it shows a dotted line connecting the 2 association lines with {OR} in the middle, but in EA I only found how to add a constraint that looks like a note by selecting "Attach Note or constraint" from the popup menu on one of the associations.  Is that the only way to do it?




Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to: OR constraints on associations
« Reply #1 on: July 07, 2005, 04:46:06 pm »
Quote
How do I add an OR constraint on an association?

For example if I have a class called HighSchoolStudent and then 2 other classes named Acedemic and Commercial which have an association of "chooses" with the HighSchoolStudent but with an OR constraint.

How would I show that?  In my UML book it shows a dotted line connecting the 2 association lines with {OR} in the middle, but in EA I only found how to add a constraint that looks like a note by selecting "Attach Note or constraint" from the popup menu on one of the associations.  Is that the only way to do it?
Bill,

That's the only way to do it I've found.  However, this is not such a bad thing.  If you had more than two Associations to constrain, you'd still need a common node!

Also, you can adjust the size of the note to be as small as you like, and create a distinguishing style that emphasises the XOR (exclusive OR) condition you are denoting.  I just make the note text="XOR", adjust the size and apply the saved style.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

pebran

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: How to: OR constraints on associations
« Reply #2 on: July 08, 2005, 03:42:49 am »
Hi Bill

It’s easy enough but you have to do it at the time you create the constraint for the first association. That is when you get the dialog ‘Link Relations’ (where you choose the ‘Link Type’) you must check the box at the other association(s) too.

So if you chose the HighSchoolStudent---Academic association as your start you would now have to find the HighSchoolStudent---Commercial association on the list and check that one too.

Be aware that there apparently is no way to add an association at a later time. You have to do this all in one step. Took me some time to figure out

Is this what you meant to do?

Regards,
Peter

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to: OR constraints on associations
« Reply #3 on: July 08, 2005, 04:44:24 am »
Quote
[size=13][SNIP][/size]
Be aware that there apparently is no way to add an association at a later time. You have to do this all in one step. Took me some time to figure out
[size=13][SNIP][/size]
Actually, Bill (and Peter), it IS possible... But you have to accidentally trip over it - like I did! ;)

Select the Constraint shape, Right-Click, Advanced Settings|Set Attached Links...

EA's unique user interface strikes again...   ::)

Paolo
« Last Edit: July 08, 2005, 04:45:28 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!