Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsn-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760360/#msg_760360
how can i programmatically create n-ary association? or is that impossible?
normally, i create associations using createAssociation method of
org.eclipse.uml2.uml.Class
class1.createAssociation(..., class2, ...);
it would be nice, if i could create empty association, for example
assoc = model.createAssociation(name);
and then add several association ends to it
assoc.addMemberEnd(assocEnd);
thanks in advance]]>2011-12-02T07:07:17-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760390/#msg_760390
Have you used the debugger to see what's happening under the covers. In
the end, the factory methods on UML2Factory are used to create empty new
things and then they're populated. Methods like createAssociation are
just convenience methods...
On 02/12/2011 8:07 AM, Emil Huseynli wrote:
> Hello,
>
> how can i programmatically create n-ary association? or is that
> impossible?
>
> normally, i create associations using createAssociation method of
> org.eclipse.uml2.uml.Class
>
> class1.createAssociation(..., class2, ...);
>
> it would be nice, if i could create empty association, for example
>
> assoc = model.createAssociation(name);
>
> and then add several association ends to it
>
> assoc.addMemberEnd(assocEnd);
>
> thanks in advance]]>Ed Merks2011-12-02T09:16:35-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760401/#msg_760401
On 02.12.2011 10:16, Ed Merks wrote:
> Emil,
>
> Have you used the debugger to see what's happening under the covers. In
> the end, the factory methods on UML2Factory are used to create empty new
> things and then they're populated. Methods like createAssociation are
> just convenience methods...
>
> On 02/12/2011 8:07 AM, Emil Huseynli wrote:
>> Hello,
>>
>> how can i programmatically create n-ary association? or is that
>> impossible?
>>
>> normally, i create associations using createAssociation method of
>> org.eclipse.uml2.uml.Class
>>
>> class1.createAssociation(..., class2, ...);
>>
>> it would be nice, if i could create empty association, for example
>>
>> assoc = model.createAssociation(name);
>>
>> and then add several association ends to it
>>
>> assoc.addMemberEnd(assocEnd);
>>
>> thanks in advance]]>2011-12-02T09:56:37-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760410/#msg_760410
On 02.12.2011 10:16, Ed Merks wrote:
> Emil,
>
> Have you used the debugger to see what's happening under the covers. In
> the end, the factory methods on UML2Factory are used to create empty new
> things and then they're populated. Methods like createAssociation are
> just convenience methods...
>
> On 02/12/2011 8:07 AM, Emil Huseynli wrote:
>> Hello,
>>
>> how can i programmatically create n-ary association? or is that
>> impossible?
>>
>> normally, i create associations using createAssociation method of
>> org.eclipse.uml2.uml.Class
>>
>> class1.createAssociation(..., class2, ...);
>>
>> it would be nice, if i could create empty association, for example
>>
>> assoc = model.createAssociation(name);
>>
>> and then add several association ends to it
>>
>> assoc.addMemberEnd(assocEnd);
>>
>> thanks in advance]]>2011-12-02T10:11:15-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760412/#msg_760412
I'm really not sure. Did you look at what's happening under the covers
for the bidirectional case? Does the Association API appear to allow
more than two ends? Have you consulted the UML specification or some
other source of information for the answer?
On 02/12/2011 11:11 AM, Emil Huseynli wrote:
> i.e. it's theoretically possible to create n-ary associations?
>
> On 02.12.2011 10:16, Ed Merks wrote:
>> Emil,
>>
>> Have you used the debugger to see what's happening under the covers. In
>> the end, the factory methods on UML2Factory are used to create empty new
>> things and then they're populated. Methods like createAssociation are
>> just convenience methods...
>>
>> On 02/12/2011 8:07 AM, Emil Huseynli wrote:
>>> Hello,
>>>
>>> how can i programmatically create n-ary association? or is that
>>> impossible?
>>>
>>> normally, i create associations using createAssociation method of
>>> org.eclipse.uml2.uml.Class
>>>
>>> class1.createAssociation(..., class2, ...);
>>>
>>> it would be nice, if i could create empty association, for example
>>>
>>> assoc = model.createAssociation(name);
>>>
>>> and then add several association ends to it
>>>
>>> assoc.addMemberEnd(assocEnd);
>>>
>>> thanks in advance
>]]>Ed Merks2011-12-02T10:14:40-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760416/#msg_760416
On 02.12.2011 11:14, Ed Merks wrote:
> Emil,
>
> I'm really not sure. Did you look at what's happening under the covers
> for the bidirectional case? Does the Association API appear to allow
> more than two ends? Have you consulted the UML specification or some
> other source of information for the answer?
>
>
>
> On 02/12/2011 11:11 AM, Emil Huseynli wrote:
>> i.e. it's theoretically possible to create n-ary associations?
>>
>> On 02.12.2011 10:16, Ed Merks wrote:
>>> Emil,
>>>
>>> Have you used the debugger to see what's happening under the covers. In
>>> the end, the factory methods on UML2Factory are used to create empty new
>>> things and then they're populated. Methods like createAssociation are
>>> just convenience methods...
>>>
>>> On 02/12/2011 8:07 AM, Emil Huseynli wrote:
>>>> Hello,
>>>>
>>>> how can i programmatically create n-ary association? or is that
>>>> impossible?
>>>>
>>>> normally, i create associations using createAssociation method of
>>>> org.eclipse.uml2.uml.Class
>>>>
>>>> class1.createAssociation(..., class2, ...);
>>>>
>>>> it would be nice, if i could create empty association, for example
>>>>
>>>> assoc = model.createAssociation(name);
>>>>
>>>> and then add several association ends to it
>>>>
>>>> assoc.addMemberEnd(assocEnd);
>>>>
>>>> thanks in advance
>>]]>2011-12-02T10:18:40-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760472/#msg_760472
About a year ago, I succeeded in creating N-ary associations in Papyrus,
although at that time the ergonomics was klunky so I raised a Bugzilla.
I think you need an AssociationClass to orchestrate the multiple 1:1
'sub-associations'.
That would rather confirm that UML2's implementation of the UML model is
accurate. The new UML 2.4.1 version of MDT/UML2 should be even more
accurate since the UML meta-model is directly generated from the OMG
specification meta-model.
Regards
Ed Willink
On 02/12/2011 10:11, Emil Huseynli wrote:
> i.e. it's theoretically possible to create n-ary associations?
>
> On 02.12.2011 10:16, Ed Merks wrote:
>> Emil,
>>
>> Have you used the debugger to see what's happening under the covers. In
>> the end, the factory methods on UML2Factory are used to create empty new
>> things and then they're populated. Methods like createAssociation are
>> just convenience methods...
>>
>> On 02/12/2011 8:07 AM, Emil Huseynli wrote:
>>> Hello,
>>>
>>> how can i programmatically create n-ary association? or is that
>>> impossible?
>>>
>>> normally, i create associations using createAssociation method of
>>> org.eclipse.uml2.uml.Class
>>>
>>> class1.createAssociation(..., class2, ...);
>>>
>>> it would be nice, if i could create empty association, for example
>>>
>>> assoc = model.createAssociation(name);
>>>
>>> and then add several association ends to it
>>>
>>> assoc.addMemberEnd(assocEnd);
>>>
>>> thanks in advance
>]]>Ed Willink2011-12-02T13:53:55-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760532/#msg_760532
For an example of how to create an n-ary Association, see my reply to Emil's
other question below.
On 02.12.2011 14:53, Ed Willink wrote:
> I think you need an AssociationClass to orchestrate the multiple 1:1
> 'sub-associations'.
This is a common misconception about n-ary associations in the UML. There
really are no "multiple 1:1 sub-associations" in an n-ary association.
This is due to the tuple semantics of associations in the UML. An "instance"
of an association (which usually doesn't explicitly exist in most
implementations of binary associations) is a tuple of all its ends (i.e. a
3-tuple for a ternary assoc etc...). And in terms of navigability, you can't
just navigate from one end of a ternary association to one other end (in
fact a single end's multiplicity isn't even well-defined with respect to
just a single other end). Instead, for an n-ary assoc, you always need (n-1)
ends in order to navigate to the remaining end (i.e. a 2-tuple of end values
to navigate to the remaining end for a ternary assoc).
Best regards,
Carsten]]>Carsten Reckord2011-12-02T17:45:15-00:00Re: n-ary association
https://www.eclipse.org/forums/index.php/mv/msg/263125/760578/#msg_760578
You seem very well-informed. In what context, with what tools, have you
been using/considering n-ary associations.
My interest arose from trying to make sense of the OCL syntax for binary
and see whether an alignment with UML was possible for n-ary associations.
As you say, an n-ary association instance requires a tuple, which a
practical OCL run-time could realise via an implicit AssociationClass,
so that navigation can proceed in three stages
a) from a first source to all tuples
b) filtering of all tuples to one/some by selection with respect to
second/third/fourth sources
c) navigation from tuple(s) to target(s)
This made me think that UML::Association and UML::AssociationClass are
merged when deriving an OCL::Association, which at least solves the
modelling, leaving only the concrete syntax to align.
Regards
Ed Willink
On 02/12/2011 17:45, Carsten Reckord wrote:
> Hi Ed, Emil,
>
> For an example of how to create an n-ary Association, see my reply to Emil's
> other question below.
>
> On 02.12.2011 14:53, Ed Willink wrote:
>> I think you need an AssociationClass to orchestrate the multiple 1:1
>> 'sub-associations'.
> This is a common misconception about n-ary associations in the UML. There
> really are no "multiple 1:1 sub-associations" in an n-ary association.
>
> This is due to the tuple semantics of associations in the UML. An "instance"
> of an association (which usually doesn't explicitly exist in most
> implementations of binary associations) is a tuple of all its ends (i.e. a
> 3-tuple for a ternary assoc etc...). And in terms of navigability, you can't
> just navigate from one end of a ternary association to one other end (in
> fact a single end's multiplicity isn't even well-defined with respect to
> just a single other end). Instead, for an n-ary assoc, you always need (n-1)
> ends in order to navigate to the remaining end (i.e. a 2-tuple of end values
> to navigate to the remaining end for a ternary assoc).
>
>
> Best regards,
> Carsten]]>Ed Willink2011-12-03T05:44:12-00:00