|
Re: OwnedComment vs. annotatedElement [message #917880 is a reply to message #917671] |
Thu, 20 September 2012 14:26 |
|
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 #919282 is a reply to message #918997] |
Fri, 21 September 2012 21:40 |
|
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 21:46 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03878 seconds