Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » OCL and UML stereotypes
OCL and UML stereotypes [message #24500] |
Wed, 22 February 2006 10:48  |
Eclipse User |
|
|
|
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 #24700 is a reply to message #24541] |
Thu, 23 February 2006 03:28   |
Eclipse User |
|
|
|
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 07:21   |
Eclipse User |
|
|
|
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 07:44   |
Eclipse User |
|
|
|
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 10:28   |
Eclipse User |
|
|
|
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 15:00  |
Eclipse User |
|
|
|
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 15:32  |
Eclipse User |
|
|
|
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 03:28  |
Eclipse User |
|
|
|
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 07:21  |
Eclipse User |
|
|
|
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 07:44  |
Eclipse User |
|
|
|
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 10:28  |
Eclipse User |
|
|
|
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 15:00  |
Eclipse User |
|
|
|
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
>>
|
|
|
Goto Forum:
Current Time: Wed Mar 12 06:57:56 EDT 2025
Powered by FUDForum. Page generated in 0.32049 seconds
|