using the Type: MyProfile::MyStereotype [message #476689] |
Sat, 01 December 2007 03:01 |
charfi asma Messages: 78 Registered: July 2009 |
Member |
|
|
Hello,
Is Element.base_Component refer to the metaclass?
for example, I write this constraint (context=Component): self.ownedPort...
when I evaluated it did not find theoperation ownedPort although a component
has ownedPort!
when I write the same constraint (context=MyComponent)
self.base_Component.ownedPort it works perfectly
also, the Type MyProfile::MyStereotype is not recongnized unless I change
context to MyComponent not the metacalss Component.
in which level of modeling we can use the type MyProfile::MyStereotype ? (I
supposed that I have profile with stereotype and I added constraints to the
stereotype to evaluate them on model that apply the profile)
thanks
|
|
|
Re: using the Type: MyProfile::MyStereotype [message #476690 is a reply to message #476689] |
Fri, 30 November 2007 18:20 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, asma,
These questions really are more about OCL than about UML, so I am replying
to the OCL newsgroup as well.
See some replies in-line, below.
HTH,
Christian
charfi asma wrote:
> Hello,
> Is Element.base_Component refer to the metaclass?
Do you mean, MyStereoytype::base_Component? Yes, this is the property of
the stereotype that references the extended metaclass. It is one end of
the Extension.
> for example, I write this constraint (context=Component):
> self.ownedPort... when I evaluated it did not find theoperation ownedPort
> although a component has ownedPort!
Probably you are parsing at M1 level? (using the component in your model as
the context classifier instead of the Component metaclass)
At M1 level, OCL will expect your component in your model to own an
attribute named ownedPort. It is the Component metaclass (which is a
Class) in the UML metamodel that has ownedPort, so you want M2 level.
Use OCLHelper::setInstanceContext(Object) to set an M2 context instead of
OCLHelper::setContext(Classifier) which sets M1 context.
> when I write the same constraint (context=MyComponent)
> self.base_Component.ownedPort it works perfectly
Right, because on the stereotype you use M1 context (which is correct). The
stereotype in your profile has a base_Component property referencing the
Class named "Component" (the UML Component metaclass). From the
perspective of a profile, the UML Metamodel is at the M1 level, whereas
from the perspective of a model, the UML metamodel is at the M2 level.
> also, the Type MyProfile::MyStereotype is not recongnized unless I change
> context to MyComponent not the metacalss Component.
The OCL parser should be able to find the MyProfile namespace in your
resource set if your profile resource is loaded in that resource set. Can
you be more specific about how to reproduce this problem?
> in which level of modeling we can use the type MyProfile::MyStereotype ?
Well, either one, actually. It depends on what you are trying to do,
whether you are modeling (creating an instance of the UML metamodel) or
metamodeling (creating customizations/extensions of the UML metamodel or
even completely new metamodels).
> (I
> supposed that I have profile with stereotype and I added constraints to
> the stereotype to evaluate them on model that apply the profile)
>
> thanks
|
|
|
Re: using the Type: MyProfile::MyStereotype [message #625661 is a reply to message #476689] |
Fri, 30 November 2007 18:20 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, asma,
These questions really are more about OCL than about UML, so I am replying
to the OCL newsgroup as well.
See some replies in-line, below.
HTH,
Christian
charfi asma wrote:
> Hello,
> Is Element.base_Component refer to the metaclass?
Do you mean, MyStereoytype::base_Component? Yes, this is the property of
the stereotype that references the extended metaclass. It is one end of
the Extension.
> for example, I write this constraint (context=Component):
> self.ownedPort... when I evaluated it did not find theoperation ownedPort
> although a component has ownedPort!
Probably you are parsing at M1 level? (using the component in your model as
the context classifier instead of the Component metaclass)
At M1 level, OCL will expect your component in your model to own an
attribute named ownedPort. It is the Component metaclass (which is a
Class) in the UML metamodel that has ownedPort, so you want M2 level.
Use OCLHelper::setInstanceContext(Object) to set an M2 context instead of
OCLHelper::setContext(Classifier) which sets M1 context.
> when I write the same constraint (context=MyComponent)
> self.base_Component.ownedPort it works perfectly
Right, because on the stereotype you use M1 context (which is correct). The
stereotype in your profile has a base_Component property referencing the
Class named "Component" (the UML Component metaclass). From the
perspective of a profile, the UML Metamodel is at the M1 level, whereas
from the perspective of a model, the UML metamodel is at the M2 level.
> also, the Type MyProfile::MyStereotype is not recongnized unless I change
> context to MyComponent not the metacalss Component.
The OCL parser should be able to find the MyProfile namespace in your
resource set if your profile resource is loaded in that resource set. Can
you be more specific about how to reproduce this problem?
> in which level of modeling we can use the type MyProfile::MyStereotype ?
Well, either one, actually. It depends on what you are trying to do,
whether you are modeling (creating an instance of the UML metamodel) or
metamodeling (creating customizations/extensions of the UML metamodel or
even completely new metamodels).
> (I
> supposed that I have profile with stereotype and I added constraints to
> the stereotype to evaluate them on model that apply the profile)
>
> thanks
|
|
|
Powered by
FUDForum. Page generated in 0.03561 seconds