Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » OCL and UML stereotypes
OCL and UML stereotypes [message #24500] Wed, 22 February 2006 15:48 Go to next message
Eclipse UserFriend
Originally posted by: daniel.rohe.stud.tu-ilmenau.de

Is it possible to retrieve the applied stereotype on a model element
with OCL. Something like:

self.appliedStereotypes or self.stereotypes

Kind regards,
Daniel
Re: OCL and UML stereotypes [message #24541 is a reply to message #24500] Wed, 22 February 2006 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

If you are planning to use OCL with the org.eclipse.uml2 meta-model, then
you will have a lot more work to do than just dealing with applied
stereotypes. You will need to provide an implementation of the Environment
(and probably EvaluationEnvironment as well) interface that can
convert/wrap UML classifiers, packages, etc. to the corresponding Ecore
APIs.

Currently, there is no support for the UML metamodel in the OCL project,
only Ecore.

Christian


Daniel Rohe wrote:

> Is it possible to retrieve the applied stereotype on a model element
> with OCL. Something like:
>
> self.appliedStereotypes or self.stereotypes
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #24700 is a reply to message #24541] Thu, 23 February 2006 08:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.rohe.stud.tu-ilmenau.de

Christian W. Damus schrieb:
> Hi, Daniel,
>
> If you are planning to use OCL with the org.eclipse.uml2 meta-model, then
> you will have a lot more work to do than just dealing with applied
> stereotypes. You will need to provide an implementation of the Environment
> (and probably EvaluationEnvironment as well) interface that can
> convert/wrap UML classifiers, packages, etc. to the corresponding Ecore
> APIs.
>
> Currently, there is no support for the UML metamodel in the OCL project,
> only Ecore.
>
> Christian
>
>
> Daniel Rohe wrote:
>
>> Is it possible to retrieve the applied stereotype on a model element
>> with OCL. Something like:
>>
>> self.appliedStereotypes or self.stereotypes
>>
>> Kind regards,
>> Daniel
>

Thanks, currently I only need the static elements of UML (Classifiers,
Components, Packages), no sequence model or use case model. So I will
implement an UMLEnvironment for this.

The environment provides the context for the OCL expression. Are there
any other constraints like there must be one Environment for an EPackage?

Kind regards,
Daniel
Re: OCL and UML stereotypes [message #24906 is a reply to message #24700] Thu, 23 February 2006 12:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

The Environment defines the entire "model" (in the OCL spec, assumed to be
the UML model) that is accessible to OCL expressions. It can include any
number of EPackages. You will see in the EcoreEnvironment, in particular,
that it uses the an EPackage.Registry (by default, the global instance) to
find EPackages.

Your UML environment should make UML Models and Packages available as
EPackages. On tricky point to note is that, because UML allows classifiers
to nest but Ecore does not, you will probably end up mapping UML
classifiers as both EClassifiers *and* EPackages to support qualified-name
traversal.

Cheers,

Christian


Daniel Rohe wrote:

<snip>

> Thanks, currently I only need the static elements of UML (Classifiers,
> Components, Packages), no sequence model or use case model. So I will
> implement an UMLEnvironment for this.
>
> The environment provides the context for the OCL expression. Are there
> any other constraints like there must be one Environment for an EPackage?
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #24922 is a reply to message #24500] Thu, 23 February 2006 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

I realize now, also, that I may have rather missed the point of your
question.

Stereotypes are applied to the elements of a UML model; they effectively
extend the UML *meta* model. Thus, they are only of concern to OCL applied
at the meta-modeling (M2) level.

For OCL applied at the modeling (M1) level, such as you would find in UML
Constraint elements in the model, stereotypes have no effect. So, the
other branch of this thread in which I mentioned the UML environment that
you would have to create to adapt UML elements to Ecore elements only
applies if you want to create OCL constraints in the UML model, itself
(M1).

For M2 usage of OCL, such as for constraining or querying the structure of
the UML model, stereotypes are potentially important. The 2.0 version of
the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
getAppliedStereotypes() method as an EOperation in its Ecore model,
returning stereotype instances as first-class model elements, with EClasses
of their own. So, OCL support for these should be "automagic": simply do

self.getStereotypeApplications()

to get the applied stereotype instances. If you need a particular applied
stereotype instance, then do

self.getStereotypeApplication(aStereotype)

first checking, of course, that

self.isStereotypeApplied(aStereotype)

Note, however, that this requires referencing the stereotype as a
pseudo-metaclass by qualified name
(SomeProfile::SomePackage::SomeStereotype). This gets you back into the
implementation of a UML Environment that adapts Profiles to EPackages and
Stereotypes to EClasses.

HTH,

Christian

Daniel Rohe wrote:

> Is it possible to retrieve the applied stereotype on a model element
> with OCL. Something like:
>
> self.appliedStereotypes or self.stereotypes
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #47619 is a reply to message #24922] Tue, 29 August 2006 14:28 Go to previous messageGo to next message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Ok so my question:
I have a profile, where I have defined some stereotypes, now I want to
get all classes out of a package which have applied this stereotype.
Does anyone have an idea:

I tried this:
(SomeProfile::SomePackage::SomeStereotype)
but it seams not to work in my implementation ????

Christian W. Damus schrieb:
> Hi, Daniel,
>
> I realize now, also, that I may have rather missed the point of your
> question.
>
> Stereotypes are applied to the elements of a UML model; they effectively
> extend the UML *meta* model. Thus, they are only of concern to OCL applied
> at the meta-modeling (M2) level.
>
> For OCL applied at the modeling (M1) level, such as you would find in UML
> Constraint elements in the model, stereotypes have no effect. So, the
> other branch of this thread in which I mentioned the UML environment that
> you would have to create to adapt UML elements to Ecore elements only
> applies if you want to create OCL constraints in the UML model, itself
> (M1).
>
> For M2 usage of OCL, such as for constraining or querying the structure of
> the UML model, stereotypes are potentially important. The 2.0 version of
> the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
> getAppliedStereotypes() method as an EOperation in its Ecore model,
> returning stereotype instances as first-class model elements, with EClasses
> of their own. So, OCL support for these should be "automagic": simply do
>
> self.getStereotypeApplications()
>
> to get the applied stereotype instances. If you need a particular applied
> stereotype instance, then do
>
> self.getStereotypeApplication(aStereotype)
>
> first checking, of course, that
>
> self.isStereotypeApplied(aStereotype)
>
> Note, however, that this requires referencing the stereotype as a
> pseudo-metaclass by qualified name
> (SomeProfile::SomePackage::SomeStereotype). This gets you back into the
> implementation of a UML Environment that adapts Profiles to EPackages and
> Stereotypes to EClasses.
>
> HTH,
>
> Christian
>
> Daniel Rohe wrote:
>
>> Is it possible to retrieve the applied stereotype on a model element
>> with OCL. Something like:
>>
>> self.appliedStereotypes or self.stereotypes
>>
>> Kind regards,
>> Daniel
>
Re: OCL and UML stereotypes [message #48181 is a reply to message #47619] Thu, 31 August 2006 19:00 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

Maybe you can do:

self.getAppliedStereotypes()->exists(s : Stereotype |
s.qualifiedName = 'SomeProfile::SomePackage::SomeStereotype')

Otherwise, out-of-the-box EMFT OCL cannot reference a stereotype as a
classifier because the type system for OCL is Ecore, not UML. One of my
previous replies, below, suggests that you may be able to implement a
custom environment that knows how to adapt UML stereotypes to EClassifiers
and look them up by qualified name. I have not tried that.

HTH,

Christian


Chris Lenz wrote:

> Ok so my question:
> I have a profile, where I have defined some stereotypes, now I want to
> get all classes out of a package which have applied this stereotype.
> Does anyone have an idea:
>
> I tried this:
> (SomeProfile::SomePackage::SomeStereotype)
> but it seams not to work in my implementation ????
>
> Christian W. Damus schrieb:
>> Hi, Daniel,
>>
>> I realize now, also, that I may have rather missed the point of your
>> question.
>>
>> Stereotypes are applied to the elements of a UML model; they effectively
>> extend the UML *meta* model. Thus, they are only of concern to OCL
>> applied at the meta-modeling (M2) level.
>>
>> For OCL applied at the modeling (M1) level, such as you would find in UML
>> Constraint elements in the model, stereotypes have no effect. So, the
>> other branch of this thread in which I mentioned the UML environment that
>> you would have to create to adapt UML elements to Ecore elements only
>> applies if you want to create OCL constraints in the UML model, itself
>> (M1).
>>
>> For M2 usage of OCL, such as for constraining or querying the structure
>> of
>> the UML model, stereotypes are potentially important. The 2.0 version of
>> the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
>> getAppliedStereotypes() method as an EOperation in its Ecore model,
>> returning stereotype instances as first-class model elements, with
>> EClasses
>> of their own. So, OCL support for these should be "automagic": simply
>> do
>>
>> self.getStereotypeApplications()
>>
>> to get the applied stereotype instances. If you need a particular
>> applied stereotype instance, then do
>>
>> self.getStereotypeApplication(aStereotype)
>>
>> first checking, of course, that
>>
>> self.isStereotypeApplied(aStereotype)
>>
>> Note, however, that this requires referencing the stereotype as a
>> pseudo-metaclass by qualified name
>> (SomeProfile::SomePackage::SomeStereotype). This gets you back into the
>> implementation of a UML Environment that adapts Profiles to EPackages and
>> Stereotypes to EClasses.
>>
>> HTH,
>>
>> Christian
>>
>> Daniel Rohe wrote:
>>
>>> Is it possible to retrieve the applied stereotype on a model element
>>> with OCL. Something like:
>>>
>>> self.appliedStereotypes or self.stereotypes
>>>
>>> Kind regards,
>>> Daniel
>>
Re: OCL and UML stereotypes [message #568779 is a reply to message #24500] Wed, 22 February 2006 20:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

If you are planning to use OCL with the org.eclipse.uml2 meta-model, then
you will have a lot more work to do than just dealing with applied
stereotypes. You will need to provide an implementation of the Environment
(and probably EvaluationEnvironment as well) interface that can
convert/wrap UML classifiers, packages, etc. to the corresponding Ecore
APIs.

Currently, there is no support for the UML metamodel in the OCL project,
only Ecore.

Christian


Daniel Rohe wrote:

> Is it possible to retrieve the applied stereotype on a model element
> with OCL. Something like:
>
> self.appliedStereotypes or self.stereotypes
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #568912 is a reply to message #24541] Thu, 23 February 2006 08:28 Go to previous message
Daniel Rohe is currently offline Daniel RoheFriend
Messages: 63
Registered: July 2009
Member
Christian W. Damus schrieb:
> Hi, Daniel,
>
> If you are planning to use OCL with the org.eclipse.uml2 meta-model, then
> you will have a lot more work to do than just dealing with applied
> stereotypes. You will need to provide an implementation of the Environment
> (and probably EvaluationEnvironment as well) interface that can
> convert/wrap UML classifiers, packages, etc. to the corresponding Ecore
> APIs.
>
> Currently, there is no support for the UML metamodel in the OCL project,
> only Ecore.
>
> Christian
>
>
> Daniel Rohe wrote:
>
>> Is it possible to retrieve the applied stereotype on a model element
>> with OCL. Something like:
>>
>> self.appliedStereotypes or self.stereotypes
>>
>> Kind regards,
>> Daniel
>

Thanks, currently I only need the static elements of UML (Classifiers,
Components, Packages), no sequence model or use case model. So I will
implement an UMLEnvironment for this.

The environment provides the context for the OCL expression. Are there
any other constraints like there must be one Environment for an EPackage?

Kind regards,
Daniel
Re: OCL and UML stereotypes [message #569161 is a reply to message #24700] Thu, 23 February 2006 12:21 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

The Environment defines the entire "model" (in the OCL spec, assumed to be
the UML model) that is accessible to OCL expressions. It can include any
number of EPackages. You will see in the EcoreEnvironment, in particular,
that it uses the an EPackage.Registry (by default, the global instance) to
find EPackages.

Your UML environment should make UML Models and Packages available as
EPackages. On tricky point to note is that, because UML allows classifiers
to nest but Ecore does not, you will probably end up mapping UML
classifiers as both EClassifiers *and* EPackages to support qualified-name
traversal.

Cheers,

Christian


Daniel Rohe wrote:

<snip>

> Thanks, currently I only need the static elements of UML (Classifiers,
> Components, Packages), no sequence model or use case model. So I will
> implement an UMLEnvironment for this.
>
> The environment provides the context for the OCL expression. Are there
> any other constraints like there must be one Environment for an EPackage?
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #569193 is a reply to message #24500] Thu, 23 February 2006 12:44 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Daniel,

I realize now, also, that I may have rather missed the point of your
question.

Stereotypes are applied to the elements of a UML model; they effectively
extend the UML *meta* model. Thus, they are only of concern to OCL applied
at the meta-modeling (M2) level.

For OCL applied at the modeling (M1) level, such as you would find in UML
Constraint elements in the model, stereotypes have no effect. So, the
other branch of this thread in which I mentioned the UML environment that
you would have to create to adapt UML elements to Ecore elements only
applies if you want to create OCL constraints in the UML model, itself
(M1).

For M2 usage of OCL, such as for constraining or querying the structure of
the UML model, stereotypes are potentially important. The 2.0 version of
the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
getAppliedStereotypes() method as an EOperation in its Ecore model,
returning stereotype instances as first-class model elements, with EClasses
of their own. So, OCL support for these should be "automagic": simply do

self.getStereotypeApplications()

to get the applied stereotype instances. If you need a particular applied
stereotype instance, then do

self.getStereotypeApplication(aStereotype)

first checking, of course, that

self.isStereotypeApplied(aStereotype)

Note, however, that this requires referencing the stereotype as a
pseudo-metaclass by qualified name
(SomeProfile::SomePackage::SomeStereotype). This gets you back into the
implementation of a UML Environment that adapts Profiles to EPackages and
Stereotypes to EClasses.

HTH,

Christian

Daniel Rohe wrote:

> Is it possible to retrieve the applied stereotype on a model element
> with OCL. Something like:
>
> self.appliedStereotypes or self.stereotypes
>
> Kind regards,
> Daniel
Re: OCL and UML stereotypes [message #586771 is a reply to message #24922] Tue, 29 August 2006 14:28 Go to previous message
Chris Lenz is currently offline Chris LenzFriend
Messages: 214
Registered: July 2009
Senior Member
Ok so my question:
I have a profile, where I have defined some stereotypes, now I want to
get all classes out of a package which have applied this stereotype.
Does anyone have an idea:

I tried this:
(SomeProfile::SomePackage::SomeStereotype)
but it seams not to work in my implementation ????

Christian W. Damus schrieb:
> Hi, Daniel,
>
> I realize now, also, that I may have rather missed the point of your
> question.
>
> Stereotypes are applied to the elements of a UML model; they effectively
> extend the UML *meta* model. Thus, they are only of concern to OCL applied
> at the meta-modeling (M2) level.
>
> For OCL applied at the modeling (M1) level, such as you would find in UML
> Constraint elements in the model, stereotypes have no effect. So, the
> other branch of this thread in which I mentioned the UML environment that
> you would have to create to adapt UML elements to Ecore elements only
> applies if you want to create OCL constraints in the UML model, itself
> (M1).
>
> For M2 usage of OCL, such as for constraining or querying the structure of
> the UML model, stereotypes are potentially important. The 2.0 version of
> the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
> getAppliedStereotypes() method as an EOperation in its Ecore model,
> returning stereotype instances as first-class model elements, with EClasses
> of their own. So, OCL support for these should be "automagic": simply do
>
> self.getStereotypeApplications()
>
> to get the applied stereotype instances. If you need a particular applied
> stereotype instance, then do
>
> self.getStereotypeApplication(aStereotype)
>
> first checking, of course, that
>
> self.isStereotypeApplied(aStereotype)
>
> Note, however, that this requires referencing the stereotype as a
> pseudo-metaclass by qualified name
> (SomeProfile::SomePackage::SomeStereotype). This gets you back into the
> implementation of a UML Environment that adapts Profiles to EPackages and
> Stereotypes to EClasses.
>
> HTH,
>
> Christian
>
> Daniel Rohe wrote:
>
>> Is it possible to retrieve the applied stereotype on a model element
>> with OCL. Something like:
>>
>> self.appliedStereotypes or self.stereotypes
>>
>> Kind regards,
>> Daniel
>
Re: OCL and UML stereotypes [message #587008 is a reply to message #47619] Thu, 31 August 2006 19:00 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

Maybe you can do:

self.getAppliedStereotypes()->exists(s : Stereotype |
s.qualifiedName = 'SomeProfile::SomePackage::SomeStereotype')

Otherwise, out-of-the-box EMFT OCL cannot reference a stereotype as a
classifier because the type system for OCL is Ecore, not UML. One of my
previous replies, below, suggests that you may be able to implement a
custom environment that knows how to adapt UML stereotypes to EClassifiers
and look them up by qualified name. I have not tried that.

HTH,

Christian


Chris Lenz wrote:

> Ok so my question:
> I have a profile, where I have defined some stereotypes, now I want to
> get all classes out of a package which have applied this stereotype.
> Does anyone have an idea:
>
> I tried this:
> (SomeProfile::SomePackage::SomeStereotype)
> but it seams not to work in my implementation ????
>
> Christian W. Damus schrieb:
>> Hi, Daniel,
>>
>> I realize now, also, that I may have rather missed the point of your
>> question.
>>
>> Stereotypes are applied to the elements of a UML model; they effectively
>> extend the UML *meta* model. Thus, they are only of concern to OCL
>> applied at the meta-modeling (M2) level.
>>
>> For OCL applied at the modeling (M1) level, such as you would find in UML
>> Constraint elements in the model, stereotypes have no effect. So, the
>> other branch of this thread in which I mentioned the UML environment that
>> you would have to create to adapt UML elements to Ecore elements only
>> applies if you want to create OCL constraints in the UML model, itself
>> (M1).
>>
>> For M2 usage of OCL, such as for constraining or querying the structure
>> of
>> the UML model, stereotypes are potentially important. The 2.0 version of
>> the org.eclipse.uml2 API (i.e., org.eclipse.uml2.uml) models the
>> getAppliedStereotypes() method as an EOperation in its Ecore model,
>> returning stereotype instances as first-class model elements, with
>> EClasses
>> of their own. So, OCL support for these should be "automagic": simply
>> do
>>
>> self.getStereotypeApplications()
>>
>> to get the applied stereotype instances. If you need a particular
>> applied stereotype instance, then do
>>
>> self.getStereotypeApplication(aStereotype)
>>
>> first checking, of course, that
>>
>> self.isStereotypeApplied(aStereotype)
>>
>> Note, however, that this requires referencing the stereotype as a
>> pseudo-metaclass by qualified name
>> (SomeProfile::SomePackage::SomeStereotype). This gets you back into the
>> implementation of a UML Environment that adapts Profiles to EPackages and
>> Stereotypes to EClasses.
>>
>> HTH,
>>
>> Christian
>>
>> Daniel Rohe wrote:
>>
>>> Is it possible to retrieve the applied stereotype on a model element
>>> with OCL. Something like:
>>>
>>> self.appliedStereotypes or self.stereotypes
>>>
>>> Kind regards,
>>> Daniel
>>
Previous Topic:OCL Console in GMF
Next Topic:how do i get net4j?
Goto Forum:
  


Current Time: Thu Apr 25 04:48:36 GMT 2024

Powered by FUDForum. Page generated in 0.04050 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top