Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » OwnedComment vs. annotatedElement
OwnedComment vs. annotatedElement [message #917671] Thu, 20 September 2012 06:08 Go to next message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Hello,

I am wondering, why does an ownedComment have an annotatedElement attribute? Shouldn't be the element that ownes the comment be the element that is annotated?

For example when I want to find out the comments for a certain element, I can use:

element.getOwnedComments()

However, there can be other elements that own comments that annotate my element.

element.getAllAnnotatingElements()

This is what I would need, when using annotatedElement not corresponding to the ownership.

Is there a reason why we have this attribute?

Regards,

Tex
Re: OwnedComment vs. annotatedElement [message #917880 is a reply to message #917671] Thu, 20 September 2012 10:26 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 701
Registered: July 2009
Senior Member
Hi, Tex,

The annotatedElement property is what indicates the elements that the
comment actually pertains to.

Consider a comment that describes some relationship amongst multiple
elements. The comment can only be owned by one element, so a different
property is required to reference the multiple elements that it
annotates.

The owner is almost immaterial; it just provides a place to put the
comment. It makes sense that the comment owner be some context that
the annotated elements are also in, but there's no real need for that.

HTH,

Christian


On 2012-09-20 10:08:42 +0000, Tex Iano said:

> Hello,
>
> I am wondering, why does an ownedComment have an annotatedElement
> attribute? Shouldn't be the element that ownes the comment be the
> element that is annotated?
> For example when I want to find out the comments for a certain element,
> I can use:
>
> element.getOwnedComments()
>
> However, there can be other elements that own comments that annotate my
> element.
> element.getAllAnnotatingElements()
>
> This is what I would need, when using annotatedElement not
> corresponding to the ownership.
>
> Is there a reason why we have this attribute?
>
> Regards,
>
> Tex
Re: OwnedComment vs. annotatedElement [message #918997 is a reply to message #917671] Fri, 21 September 2012 11:26 Go to previous messageGo to next message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Hi,

ok thanks. But there is no method like element.getAllAnnotatingComments? Because then I have to check all comments within my document and whether they contain an annotatedElement-element referencing my investigated element.

Or is there a more effective approach?

Regards,

Tex
Re: OwnedComment vs. annotatedElement [message #918999 is a reply to message #918997] Fri, 21 September 2012 11:27 Go to previous messageGo to next message
Tex Iano is currently offline Tex Iano
Messages: 99
Registered: February 2012
Member
Ah and just another question:

Is it ok to have a package containing all comments within my model and only using the annotatedElement to set the annotatedElement? Or is this a bad style and the comments should directly be the child of the annotated element when possible?

Regards,

Tex
Re: OwnedComment vs. annotatedElement [message #919282 is a reply to message #918997] Fri, 21 September 2012 17:40 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 701
Registered: July 2009
Senior Member
Hi, Tex,

The CacheAdapter that is attached to all UML model elements is an
ECrossReferenceAdapter. You can use the
ECrossReferenceAdapter::getNonNavigableInverseReferences(...) API to
find the Comments that reference an Element via the annotatedElement
reference.

cW

On 2012-09-21 15:26:54 +0000, Tex Iano said:

> Hi,
>
> ok thanks. But there is no method like
> element.getAllAnnotatingComments? Because then I have to check all
> comments within my document and whether they contain an
> annotatedElement-element referencing my investigated element.
>
> Or is there a more effective approach?
>
> Regards,
>
> Tex
Re: OwnedComment vs. annotatedElement [message #919286 is a reply to message #918999] Fri, 21 September 2012 17:46 Go to previous message
Christian W. Damus is currently offline Christian W. Damus
Messages: 701
Registered: July 2009
Senior Member
Hi, Tex,

What constitutes good or bad style, I really can't say. I suppose that
if the comments are simply there to provide annotations for some
particular viewpoint on the model, and aren't relevant to other
viewpoints, then there might be value in keeping them segregated. That
would then work like an optional overlay on the model, rather like
stacking sheets of Mylar on an overhead projector. It could become
rather unwieldy, though, to manage. I expect that most UML tools would
add the owning object to the annotatedElement collection by default, so
that's pretty straight-forward. Maybe the obvious path is best (as it
so often is).

cW


On 2012-09-21 15:27:57 +0000, Tex Iano said:

> Ah and just another question:
>
> Is it ok to have a package containing all comments within my model and
> only using the annotatedElement to set the annotatedElement? Or is this
> a bad style and the comments should directly be the child of the
> annotated element when possible?
>
> Regards,
>
> Tex
Previous Topic:InterfaceRealization in XMI
Next Topic:How to find out that a message is delayed
Goto Forum:
  


Current Time: Wed Apr 23 02:43:34 EDT 2014

Powered by FUDForum. Page generated in 0.04106 seconds