Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Ternary Association
Ternary Association [message #1220102] Mon, 09 December 2013 16:53 Go to next message
John Guerson is currently offline John GuersonFriend
Messages: 51
Registered: August 2011
Member
Hi,

It might be a silly question but I still didn't find the answer anywhere. As far as I studied, there is really few documentations about n-ary assocations that has clear explanations about it. So,

Given a ternary association such as for instance:

Student 1 --< >-- 1..* Enrollment
|
1..*
Time

1. What would be the result of a navigation such as: "context Student self.enrollment"? Is the set o tuples{Enrollment,Time} or the set of enrollments?

2. If I wanted to know the set of Enrollments in a certain Time instance, what would be the concrete syntax for that in OCL? Perhaps like "self.enrollments[t]" (t being a Time instance) or there's none CS defined for that sort of selection?

3. Finally, regarding the implementation in Eclipse, I read in a topic that all the ends (properties) must be owned by the assocation and one of them must not be navigable. But creating such association in UML, the Complete OCL editor was unable to find that ends (the editor always search for ends owned by the context class). I can provide a UML model if necessary together with my constraints file, but I just wanted to know if I missing something here.

Thanks in advance for anyone that may help me.
John






Re: Ternary Association [message #1220106 is a reply to message #1220102] Mon, 09 December 2013 18:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4155
Registered: July 2009
Senior Member
Hi

It is only recently that the asymmetry of ternary associations was
explained to me so that they now make sense, but I haven't yet got round
to exploiting this to produce useable code.

On 09/12/2013 16:53, John Guerson wrote:
> Hi,
>
> It might be a silly question but I still didn't find the answer
> anywhere. As far as I studied, there is really few documentations
> about n-ary assocations that has clear explanations about it. So,
> Given a ternary association such as for instance:
>
> Student 1 --< >-- 1..* Enrollment
> |
> 1..*
> Time
>
The asymmetry means that you may only navigate from unit multiplicities.
Thus in your example:

Student::enrollment and Student::Time and their opposites are sensible.
Time::entollment and its opposite is meaningless.
> 1. What would be the result of a navigation such as: "context Student
> self.enrollment"? Is the set o tuples{Enrollment,Time} or the set of
> enrollments?
>
Collection(Enrollment)[1..*]
> 2. If I wanted to know the set of Enrollments in a certain Time
> instance, what would be the concrete syntax for that in OCL? Perhaps
> like "self.enrollments[t]" (t being a Time instance) or there's none
> CS defined for that sort of selection?
>
I would expect something like the following that first navigates to the
AssociationClass instances

aStudent.EnrollmentRecord->select(Time = t).Enrollment

> 3. Finally, regarding the implementation in Eclipse, I read in a topic
> that all the ends (properties) must be owned by the assocation and one
> of them must not be navigable. But creating such association in UML,
> the Complete OCL editor was unable to find that ends (the editor
> always search for ends owned by the context class). I can provide a
> UML model if necessary together with my constraints file, but I just
> wanted to know if I missing something here.
>
The must not be navigable is the meaningless Time-Enrollment relationship.
I'm afraid that the Xtext grammar behind the CompleteOCL editor is very
very suspect where associations are actually required.

Regards

Ed Willink
Re: Ternary Association [message #1220586 is a reply to message #1220106] Thu, 12 December 2013 15:55 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4155
Registered: July 2009
Senior Member
Hi

On 09/12/2013 18:24, Ed Willink wrote:
> I'm afraid that the Xtext grammar behind the CompleteOCL editor is
> very very suspect where associations are actually required.
I just took a look at implementing this and in principle it should be
quite easy, but...

When I tried before I was unable to find any tool that allowed me draw a
useful AssociationClass.

I've just tried again with Papyrus and while it now has some tempting
looking palette widgets they don't seem to actually allow anything
useful to be drawn.

Can you provide a valid MDT/UML2 model with an AssiociationClass and/or
qualified association? What tool created them?

Regards

Ed Willink
Previous Topic:bag->asSet() operation bug
Next Topic:Checking if the ecore model is valid in code
Goto Forum:
  


Current Time: Sat Nov 29 02:47:22 GMT 2014

Powered by FUDForum. Page generated in 0.02113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software