Author Topic: XOR Disjunction applied to two associations  (Read 1296 times)

YnnamTenob

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
XOR Disjunction applied to two associations
« on: June 24, 2009, 12:36:01 pm »
Hello,

Say I have a concept "Car" which is associated via the binary relation "ownedBy" with the concept "Person" and "Company". In other words ownedBy(Car,Person) and ownedBy(Car,Company). However I want the relation to be exclusive i.e.  

(ownedBy(Car,Person) or ownedBy(Car,Company)) and not(ownedBy(Car,Person) and ownedBy(Car,Company))

In the UML specification you draw a binary relation R1 between Car and Person and R2 between Car and Company. Then you draw a binary relation R3 between R1 and R2 and finally you place and {xor} constrain on the relation R3.

I cannot seem to be able to do this in EA. Is there a way to do this?

Regards,
Manny

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6246
  • Karma: +103/-89
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #1 on: June 24, 2009, 04:43:35 pm »
H Manny,

As far as I know, EA doesn't yet support relationships between relationships, in the manner you suggest.  However, you can come pretty close.

The way I deal with this problem is to create an attached note (as a constraint) to both relations.  This creates a constraint vertex and two notelinks, one to each relation.  You can also stereotype the note and get EA to adorn the constraint so that it stands out.

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

Luis J. Lobo

  • EA User
  • **
  • Posts: 248
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #2 on: June 24, 2009, 06:35:29 pm »
Right click over one of the relations, and select "Attach Note or Constraint". Then, choose the participant relations and note or constraint.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #3 on: June 24, 2009, 10:25:39 pm »
I think Luis has the correct idea.

The way you describe it, this sounds like a constraint. UML provides for constraints of this type. For example, this might be an exclusivity constraint between the connectors, since you cannot have both.

Depending on how you test the validity of the model you might consider the 'standard' UML association constraint of XOR here. Using this constraint you can specify that there cannot be multiple owners, nor could there by cars that had no owner. Of course you'd have to allow for the manufacturer or dealer to 'own' the car before it was first sold. This might be a valid business rule for you scenario.

David
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +0/-0
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #4 on: June 25, 2009, 05:04:20 am »
Nothing to do with the technical problem discussed here (lack of support for relations between connectors), but do you need this at all? I think I would introduce an interface, say "ICarOwner", have Person as well as Company realize it, and define a 0..1/0..* association between ICarOwner and Car. No need for constraints then. And above all, this would be much easier to handle when some time in the the future you decide that their are other entities which can own a car.

Imagine you have to introduce the army or the government or something else which is neither a person nor a company but can own cars. Working with an interface you just need a new class and a new realization connector, but how will you model this with constraints?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #5 on: June 25, 2009, 09:01:28 am »
Frank makes a valid point. Perhaps this is a design issue that could be tackled at a higher level of abstraction. Consider whether either or both of the links are related to an attribute (role or whatever) of some element. Perhaps the association should involve the element or type that the role represents.
No, you can't have it!

Gary W.

  • EA User
  • **
  • Posts: 139
  • Karma: +0/-0
    • View Profile
Re: XOR Disjunction applied to two associations
« Reply #6 on: June 25, 2009, 09:15:33 am »
Well,

Since we're expanding this to other modeling constructs.. how about ownedBy(Car, Party) where Party has sub-classes Person, Company.  In the future, you could expand Party sub-classes to include 'Army', 'Government', etc.

Of course, you could also extend this abstraction to ownedBy(Vehicle,Party) where Car is a type of Vehicle, and where the ownedBy association is an Association Class with attributes such as StartingDate, EndingDate to include the time-varying aspect of the 'ownership' .

But back to the original question.. yes, I have done what Luis suggested, and it looks something like:


My 2 cents  :-[
Gary