|
|
Re: Cannot find operation alloOwnedElements() [message #531842 is a reply to message #531811] |
Thu, 06 May 2010 11:00 |
Shaman_Mahmoudi Messages: 16 Registered: February 2010 |
Junior Member |
|
|
Hi,
Thanks for the reply!
I am not the person who orignally created the UML profile and the applied OCL constraints on it. My colleague is on vacation until sometime next week.
So my knowledge of OCL is almost nonexistant. I just recently (this monday) had my first experience with OCL through the eclipse OCL project and its packages.
I am step debuggin and this is the data I am retrieving:
The OCL expression in question is
self.allOwnedElements()->select(e|e.oclIsTypeOf(Package))->collect(e|e.getAppliedStereotypes())->select(e|e.name='ManagedObject') ->size() > 0
and it is retrieving it properly, I double checked with the constraint written in the uml profile.
If I set the classifier context to the UML Meta Model Stereotype, creating the invariant works fine.
if I set the classifier context to the (on the one where the ocl constraint is actually applied on) stereotype, I get that the operation allownedElements() cannot be found for the type managedObject.
for this constraint
self.namespacePrefix <> "and not self.namespacePrefix.ocllsUndefined()
if I set the classifier context to the stereotype, I can create the invaraint.
The difference between allownedElements() and namespacePrefix that I see is that one is a method, the other is an attribute and namespacePrefix has been defined in our UML profile, however, allownedElements() is a method defined originaly in the UML meta model?
Is it possible to get my stereotype classifier context to be like a superset of the UML meta model stereotype classifier context? That is what I thought it would be automatically.
To get the stereotypes I do this:
element.getAppliedStereotypes()
Maybe it is me who has not understood OCL , and OCL classifier context in particular. So maybe the behaviour is as expected. How can I check what the classifier context should be? And how are the classifier contexts designed/created in the first place? Maybe that is the root of the problem? Right now, for me it is a guessing game. I orignally thought that setting the context classifier to the original stereotype would be sufficient, but it does not seem to be the case here.
Thanks in advance.
[Updated on: Thu, 06 May 2010 11:16] Report message to a moderator
|
|
|
Re: Cannot find operation alloOwnedElements() [message #532019 is a reply to message #531842] |
Thu, 06 May 2010 18:42 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi Shaman
I'm sorry but you cannot expect me to join together hints from your two
emails and telepathically come up with a solution.
If you have a problem, please present it with sufficient context to
allow it to be understood.
You can set breakpoints at for instance
EvaluationVisitorImpl.visitOperationCallExp and watch every operation
happening, but it's not very pleasant. We hope to do better in the next
release.
If you have a test model available, the easiest debugging is to use the
OCL Console to practice steadily more complicated expressions. Otherwise
modify your code to execute steadily more complicated expressions until
inspiration strikes. It is unlikely that a novice, or many experts, will
get a quadruply nested loop spot on first time.
Regards
Ed Willink
On 06/05/2010 12:00, Shaman_Mahmoudi wrote:
> Hi,
>
> Thanks for the reply!
>
> I am not the person who orignally created the UML profile and the
> applied OCL constraints on it. My colleague is on vacation until
> sometime next week.
> So my knowledge of OCL is almost nonexistant. I just recently (this
> monday) had my first experience with OCL through the eclipse OCL project
> and its packages.
>
> I am step debuggin and this is the data I am retrieving:
>
> The OCL expression in question is
>
> self.allOwnedElements()->select(e|e.oclIsTypeOf(Package))->collect(e|e.getAppliedStereotypes())- >select(e|e.name='ManagedObject')
> ->size() > 0
>
>
> and it is retrieving it properly, I double checked with the constraint
> written in the uml profile.
>
> If I set the classifier context to the UML Meta Model Stereotype,
> creating the invariant works fine.
> if I set the classifier context to the stereotype, I get that the
> oepration allownedElements() cannot be found for the type managedObject.
>
> And to get the stereotypes I do this:
>
>
> element.getAppliedStereotypes()
>
>
> Maybe it is me who has not understood OCL , and OCL classifier context
> in particular. So maybe the behaviour is as expected. How can I check
> what the classifier context should be? And how are the classifier
> contexts designed/created in the first place? Maybe that is the root of
> the problem? Right now, for me it is a guessing game. I orignally
> thought that setting the context classifier to the original stereotype
> would be sufficient, but it does not seem to be the case here.
>
> Thanks in advance.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04135 seconds