Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » add a value to package
add a value to package [message #475891] Fri, 14 September 2007 13:22 Go to next message
Eclipse UserFriend
Originally posted by: nickkirtley.gmail.com

hi,

I want to add an integer value to a package, to work as a kind of layer
number, so that I know which layer the package is in.
I then want to use this information in an ocl query. How can I add an
integer value to a package to do this? If it's even possible. A work
around is also welcome.

regards,

Nick
Re: add a value to package [message #475894 is a reply to message #475891] Fri, 14 September 2007 13:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Nick,

It sounds like you have an application that wants use this number for some
kind of model analysis/transformation. The usual way to do this is to
define a Stereotype, such as "Layer", that extends the Package metaclass
and to define a "level : Integer" or some such property on the stereotype.

An OCL query in the context of the Package metaclass, then, can do something
like:

let layerNum : Integer =
if self.extension_Layer.oclIsUndefined() then 0 else
self.extension_Layer.level endif
in
-- do something with "layerNum" here

Note that this requires the UML environment implementation, not Ecore:
org.eclipse.ocl.uml.UMLEnvironmentFactory.

HTH,

Christian


nick kirtley wrote:

> hi,
>
> I want to add an integer value to a package, to work as a kind of layer
> number, so that I know which layer the package is in.
> I then want to use this information in an ocl query. How can I add an
> integer value to a package to do this? If it's even possible. A work
> around is also welcome.
>
> regards,
>
> Nick
Re: add a value to package [message #475897 is a reply to message #475891] Fri, 14 September 2007 14:15 Go to previous message
Eclipse UserFriend
Originally posted by: nickkirtley.gmail.com

hi,

I think a different approach is need.
What I want is a stereotype that extends package. I want that stereotype
to have a value, ie an integer, and then when I apply the stereotype to
package, I want to add a value to that instance of the stereotype. That
way I can add a layer value.

Question is how can I do this?

Nick
Re: add a value to package [message #624786 is a reply to message #475891] Fri, 14 September 2007 13:51 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Nick,

It sounds like you have an application that wants use this number for some
kind of model analysis/transformation. The usual way to do this is to
define a Stereotype, such as "Layer", that extends the Package metaclass
and to define a "level : Integer" or some such property on the stereotype.

An OCL query in the context of the Package metaclass, then, can do something
like:

let layerNum : Integer =
if self.extension_Layer.oclIsUndefined() then 0 else
self.extension_Layer.level endif
in
-- do something with "layerNum" here

Note that this requires the UML environment implementation, not Ecore:
org.eclipse.ocl.uml.UMLEnvironmentFactory.

HTH,

Christian


nick kirtley wrote:

> hi,
>
> I want to add an integer value to a package, to work as a kind of layer
> number, so that I know which layer the package is in.
> I then want to use this information in an ocl query. How can I add an
> integer value to a package to do this? If it's even possible. A work
> around is also welcome.
>
> regards,
>
> Nick
Re: add a value to package [message #624789 is a reply to message #475891] Fri, 14 September 2007 14:15 Go to previous message
Eclipse UserFriend
Originally posted by: nickkirtley.gmail.com

hi,

I think a different approach is need.
What I want is a stereotype that extends package. I want that stereotype
to have a value, ie an integer, and then when I apply the stereotype to
package, I want to add a value to that instance of the stereotype. That
way I can add a layer value.

Question is how can I do this?

Nick
Previous Topic:add a value to package
Next Topic:EMF validation constraint target for Stereotype changes
Goto Forum:
  


Current Time: Fri Apr 26 16:18:00 GMT 2024

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

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

Back to the top