Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Extending the Standard profile
Extending the Standard profile [message #518111] Wed, 03 March 2010 06:15 Go to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
All,

I am currently working on a custom profile using the MDT and UML2. So far I have been able to successfully define a metamodel and reference the metamodel and associated metaclasses from the profile.

One area where I am a bit confused, is if I create a Stereotype in the profile and an extension to one of the custom metaclasses, I am unable to apply the Stereotype to a Class once the profile is defined and then applied to a Class diagram.

Is it possible to define an inheritance hierarchy between metaclasses (i.e. custom metaclass A inherits from uml::Class)?

That said, I may be headed down the wrong path - what I truly need is a way to apply a metamodel construct to a Stereotype which extends uml::Class - if there is another way to do this, any pointers would be helpful!

TIA
Re: Extending the Standard profile [message #518196 is a reply to message #518111] Wed, 03 March 2010 13:06 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
...................................................

[Updated on: Wed, 10 March 2010 13:59]

Report message to a moderator

Re: Extending the Standard profile [message #518238 is a reply to message #518196] Wed, 03 March 2010 15:14 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Hello Vlad,

I appreciate the pointer to a demo, however this does not quite cover my use case.

I have a metamodel which defines a number of metaclasses. In my profile, I need to apply these metamodel constructs while extending the uml::Class metaclass for a given Stereotype.

Regards,

Steve
Re: Extending the Standard profile [message #518281 is a reply to message #518238] Wed, 03 March 2010 16:39 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
............................................................ ...............

[Updated on: Wed, 10 March 2010 13:59]

Report message to a moderator

Re: Extending the Standard profile [message #518302 is a reply to message #518281] Wed, 03 March 2010 17:30 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
I'm not quite sure I'm getting my question across.

I am working with a MOF metamodel which is referenced by my profile. If I create an extension between a Stereotype and one of my metaclasses, I am unable to apply the Stereotype in a class diagram to a class.

I have tried both the heavyweight and middleweight approaches of defining a generalization between my metaclass and uml::Class however I have not had much luck.

In your diagrams, you are creating a extension between uml::Class and your Stereotype - this is too simple for my needs (I believe this is the Lightweight approach). In my situation, I have an additional metaclass between the Stereotype and uml::Class.

It might help to represent this graphically; in your demo/suggestion above you have the following extension:

uml::Class <- myWebservice

For my particular need, I have defined:

uml::Class <- myMetaclass <- myWebservice

HTH,

Steve
Re: Extending the Standard profile [message #518309 is a reply to message #518111] Wed, 03 March 2010 12:52 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 03.03.2010 07:15, schrieb Steven Stallion:

> One area where I am a bit confused, is if I create a Stereotype in the
> profile and an extension to one of the custom metaclasses, I am unable
> to apply the Stereotype to a Class once the profile is defined and then
> applied to a Class diagram.

I do not quite get your scenario. So first you provide your own
metamodel - understood. Now you want to define a profile for these
metaclasses? Wouldn't it be a lot easier to define this metamodel
according to your needs from the beginning?

In general, do you not use the UML2 metamodel at all, or is there
another reason why you cannot simply stick to profiles?

> Is it possible to define an inheritance hierarchy between metaclasses
> (i.e. custom metaclass A inherits from uml::Class)?

Not in a profile. Stereotypes are the way to go here.

You can of course define your own metamodel library and reference UML
metaclasses therein - but in contrast to profiles, tool-support will be
quite close to non-existent when it comes to instantiate this metamodel.
UML tools are just not meant to be used completely without UML :)

> That said, I may be headed down the wrong path - what I truly need is a
> way to apply a metamodel construct to a Stereotype which extends
> uml::Class - if there is another way to do this, any pointers would be
> helpful!

What do you mean by "apply a metamodel construct"? Examples?

Best regards,
Erhard
Re: Extending the Standard profile [message #518352 is a reply to message #518309] Wed, 03 March 2010 20:58 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
> I do not quite get your scenario. So first you provide your own
> metamodel - understood. Now you want to define a profile for these
> metaclasses? Wouldn't it be a lot easier to define this metamodel
> according to your needs from the beginning?
>
> In general, do you not use the UML2 metamodel at all, or is there
> another reason why you cannot simply stick to profiles?

I'm implementing an OMG specification in process. The spec calls for a metamodel and a profile. Unfortunately the spec is a little scant on details, particularly with how the metamodel is "glued" to the profile so I'm left to my own devices at the moment.

> Not in a profile. Stereotypes are the way to go here.

Right. In this case, I have a Stereotype which extends the uml::Class metaclass. In the documentation it states that a secondary "metaclass construct" should be applied to the Stereotype. I'm taking this to mean that the Stereo type should extend the secondary metaclass which in turn extends the uml::Class metaclass.

> You can of course define your own metamodel library and reference UML
> metaclasses therein - but in contrast to profiles, tool-support will be
> quite close to non-existent when it comes to instantiate this metamodel.
> UML tools are just not meant to be used completely without UML Smile

Right. The end goal here is to produce a compliant profile which can then be used with the graphical tools Wink

> What do you mean by "apply a metamodel construct"? Examples?

See above; this is the exact wording in the specification (which is not public yet) - the term confused me a bit, I was hoping someone could shed some light on it.

Cheers,

Steve
Re: Extending the Standard profile [message #518359 is a reply to message #518309] Wed, 03 March 2010 21:13 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
(Reposting as the original seems to have gotten lost...)

> I do not quite get your scenario. So first you provide your own
> metamodel - understood. Now you want to define a profile for these
> metaclasses? Wouldn't it be a lot easier to define this metamodel
> according to your needs from the beginning?
>
> In general, do you not use the UML2 metamodel at all, or is there
> another reason why you cannot simply stick to profiles?

I'm implementing an OMG specification in process. The spec calls for a metamodel and a profile. Unfortunately the spec is a little scant on details, particularly with how the metamodel is "glued" to the profile so I'm left to my own devices at the moment.

> Not in a profile. Stereotypes are the way to go here.

Right. In this case, I have a Stereotype which extends the uml::Class metaclass. In the documentation it states that a secondary "metaclass construct" should be applied to the Stereotype. I'm taking this to mean that the Stereo type should extend the secondary metaclass which in turn extends the uml::Class metaclass.

> You can of course define your own metamodel library and reference UML
> metaclasses therein - but in contrast to profiles, tool-support will be
> quite close to non-existent when it comes to instantiate this metamodel.
> UML tools are just not meant to be used completely without UML Smile

Right. The end goal here is to produce a compliant profile which can then be used with the graphical tools Wink

> What do you mean by "apply a metamodel construct"? Examples?

See above; this is the exact wording in the specification (which is not public yet) - the term confused me a bit, I was hoping someone could shed some light on it.

Cheers,

Steve
Re: Extending the Standard profile [message #518472 is a reply to message #518352] Thu, 04 March 2010 04:00 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 03.03.2010 21:58, schrieb Steven Stallion:

> I'm implementing an OMG specification in process. The spec calls for a
> metamodel and a profile. Unfortunately the spec is a little scant on
> details, particularly with how the metamodel is "glued" to the profile
> so I'm left to my own devices at the moment.

Phew, honestly I'd rather advice to leave the implementation work to the
spec authors, as they probably know best :) Or they change their spec if
it turns out not to fit into the UML world properly.

>> Not in a profile. Stereotypes are the way to go here.
>
> Right. In this case, I have a Stereotype which extends the uml::Class
> metaclass. In the documentation it states that a secondary "metaclass
> construct" should be applied to the Stereotype. I'm taking this to mean
> that the Stereo type should extend the secondary metaclass which in turn
> extends the uml::Class metaclass.

Doubtful, and very informal - I wonder why they did not put up a profile
diagram instead. I don't think there are good reasons why one would
first extend UML::Class by means of generalization and then again extend
it by a stereotype. There's nothing you couldn't put into the stereotype
directly that you can model in the new metaclass.

What I can imagine is that the stereotype is supposed to have a
composite association to another metaclass (which in turn does not need
to extend anything) - it's the only way I'm aware of to model value
tuples as a stereotype attribute. But that's just guessing.

>> What do you mean by "apply a metamodel construct"? Examples?
>
> See above; this is the exact wording in the specification (which is not
> public yet) - the term confused me a bit, I was hoping someone could
> shed some light on it.

In the UML spec, 'apply' only shows up in the context of profiles. A
profile is not a model (formally) - thats where they lost me.

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #518764 is a reply to message #518472] Thu, 04 March 2010 22:49 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
> Doubtful, and very informal - I wonder why they did not put up a profile
> diagram instead. I don't think there are good reasons why one would
> first extend UML::Class by means of generalization and then again extend
> it by a stereotype. There's nothing you couldn't put into the stereotype
> directly that you can model in the new metaclass.

I'm wondering that myself. There are some pretty complex relationships in this particular domain, so I'm guessing they were trying to save a few trees.

> What I can imagine is that the stereotype is supposed to have a
> composite association to another metaclass (which in turn does not need
> to extend anything) - it's the only way I'm aware of to model value
> tuples as a stereotype attribute. But that's just guessing.

This sounds interesting, and may very well have been the intent of the authors - could you describe this in a little more detail? It sounds like you are saying that I can have a Stereotype extend uml::Class, and then define a composite association between the Stereotype and the Metaclass?

Essentially, I'm trying to capture a number of properties defined in these Metaclasses and have them be accessible from the Stereotype.

Thanks again for the help!

Steve
Re: Extending the Standard profile [message #518918 is a reply to message #518764] Fri, 05 March 2010 12:49 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 04.03.2010 23:49, schrieb Steven Stallion:

> This sounds interesting, and may very well have been the intent of the
> authors - could you describe this in a little more detail? It sounds
> like you are saying that I can have a Stereotype extend uml::Class, and
> then define a composite association between the Stereotype and the
> Metaclass?

This metaclass, or any other one - the target metaclass so to say gets a
new "purpose". E.g., Property does not only represent class attributes,
but also association roles. Class is not only used to represent "usual"
classes, but also for template instantiation. Likewise, you can use
metaclasses for your own purpose in a stereotype. Plus, you can add your
own (meta-)classes to the profile.

I tried to illustrate this in a small example:

http://weinell.de/bin/profile-sh1.png

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #518944 is a reply to message #518918] Fri, 05 March 2010 14:23 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
............................................................ .....................

[Updated on: Wed, 10 March 2010 13:57]

Report message to a moderator

Re: Extending the Standard profile [message #519040 is a reply to message #518944] Fri, 05 March 2010 19:47 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Thanks All.

I think I'm beginning to understand a little better the relationship between the profile and the metamodel. That said, I think there is something fundamental I must be missing here.

Let me try and rephrase my question in a different way...

Essentially I need to be able to define an additional set of tagged values for a given Stereotype. The specification dictates this comes in the form of a Class defined in a UML metamodel.

The profile is all that really matters here, however the metamodel is quite complex, so it would not be an easy effort to collapse all of these attributes and define them directly in the profile. In addition there are a number of inherited constraints which I would prefer not to redefine for every Stereotype.

Ed, the image you posted earlier looks fairly close to what I want, however I'm not quite sure how to translate that into the EMF editor for the profile. Is there any chance you could elaborate on this a little more? Is this simply a composite association to a Metaclass or a packaged Class within the metamodel?

I apologize in advance - I've been a long-time user of UML, however this is my first exposure to the MOF and DSL modeling.

Regards,

Steve
Re: Extending the Standard profile [message #519041 is a reply to message #519040] Fri, 05 March 2010 20:04 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 844
Registered: July 2009
Senior Member
Hi, Steven,

Yes, a Stereotype can simply define associations to to existing
metaclasses of the metamodel (in your case, UML) that it references.
These can be composite (the stereotype instance contains a UML sub-tree)
or not.

A Profile can also define Classes. These behave, effectively, like
metaclasses. You can use them to define structure in a Stereotype that
can't be expressed using metaclasses from the referenced metamodel.
However, you have to be sure that you define at least one composition
association to own any given class, because otherwise they won't persist
nicely. Instances of profile classes can be owned by stereotypes or
other profile classes.

I don't think that a profile class is permitted to specialize a
metaclass from the referenced metamodel, but I could be wrong about
that. I can certainly imagine that it would introduce tricky problems
of element substitutability ...

HTH,

Christian


On 05/03/10 02:47 PM, Steven Stallion wrote:
> Thanks All.
>
> I think I'm beginning to understand a little better the relationship
> between the profile and the metamodel. That said, I think there is
> something fundamental I must be missing here.
>
> Let me try and rephrase my question in a different way...
>
> Essentially I need to be able to define an additional set of tagged
> values for a given Stereotype. The specification dictates this comes in
> the form of a Class defined in a UML metamodel.
>
> The profile is all that really matters here, however the metamodel is
> quite complex, so it would not be an easy effort to collapse all of
> these attributes and define them directly in the profile. In addition
> there are a number of inherited constraints which I would prefer not to
> redefine for every Stereotype.
>
> Ed, the image you posted earlier looks fairly close to what I want,
> however I'm not quite sure how to translate that into the EMF editor for
> the profile. Is there any chance you could elaborate on this a little
> more? Is this simply a composite association to a Metaclass or a
> packaged Class within the metamodel?
>
> I apologize in advance - I've been a long-time user of UML, however this
> is my first exposure to the MOF and DSL modeling.
>
> Regards,
>
> Steve
Re: Extending the Standard profile [message #519053 is a reply to message #519041] Fri, 05 March 2010 22:18 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Thanks Christian.

Based on your feedback, I've tried updating my profile, however I'm still not seeing the results I want.

Lets say I have Metaclass A which contains two properties, "two", and "three". In my profile I have a single Stereotype B, with a property of "one". What I would like to see is all three tagged values be available, that is "one", "two", and "three" (this is the behavior the specification mandates).

If I create a composite association between A and B, in the graphical editor, I am not able to see any tagged values related to A once the profile is defined, and applied to a class diagram.

Ideas?

Steve
Re: Extending the Standard profile [message #519058 is a reply to message #519053] Fri, 05 March 2010 22:35 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 844
Registered: July 2009
Senior Member
Hi, Steve,

Is your stereotype B a metaclass extension of A? A's properties are not
tagged values; they are metamodel attributes.

For the UML profile, all three of these values are accessible, but they
are owned by different objects. Given

<<b>> a : A

(an "A" with the "B" stereotype applied) you are dealing with two
different objects: a, which has the "two" and "three" properties, and
b, which as the "one" property. The metaclass extension is an
association relationship between b and a. So, from b you can get a's
A::two and A::three by navigating over b's B::base_A property (one end
of the extension association). In OCL, you would actually do this as:

b.base_A.two

for example. To go the other way, in OCL (because OCL is able to
navigate the directed association in reverse)

a.extension_B.one

The mapping of the UML profile to a metamodel (or, probably more
naturally, the metamodel from which the profile was mapped) can combine
the concepts of B and A by simply defining a generalization relationship
from B to A:

B ---|> A

In this case, you can have an element

b : B

that define all three properties (two inherited), so that in OCL you can do

b.one
b.two

A profile will never be able to modify the metaclasses that it
references, so there will always need to be some mapping from property
access in the "metamodel view" of your spec to the "profile view."
Remembering that the semantics of metaclass extension (by stereotypes)
is really just the same as association should help to keep these
mappings straight.

(Forgive the introduction of OCL into the conversation. I just find it
convenient for concrete illustration.)

HTH,

Christian


On 05/03/10 05:18 PM, Steven Stallion wrote:
> Thanks Christian.
>
> Based on your feedback, I've tried updating my profile, however I'm
> still not seeing the results I want.
>
> Lets say I have Metaclass A which contains two properties, "two", and
> "three". In my profile I have a single Stereotype B, with a property of
> "one". What I would like to see is all three tagged values be available,
> that is "one", "two", and "three" (this is the behavior the
> specification mandates).
>
> If I create a composite association between A and B, in the graphical
> editor, I am not able to see any tagged values related to A once the
> profile is defined, and applied to a class diagram.
>
> Ideas?
>
> Steve
Re: Extending the Standard profile [message #519059 is a reply to message #519058] Fri, 05 March 2010 23:13 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Christian,

> Is your stereotype B a metaclass extension of A? A's properties are not
> tagged values; they are metamodel attributes.

To be honest, I don't know. The specification seems to be written such that the profile is derived from the metamodel. A is a metaclass, however there does not seem to be a formal association between it and B.

As an example, A is defined as a Class within the Metamodel which may contain any number of associations, generalizations, etc (none of which link back to the UML metamodel).

The profile defines a Stereotype B which extends uml::Class, however there is a table which defines A as B's "metamodel construct".

I think this is where I am getting confused. What is the relationship between a metamodel and a profile? This particular specification has quite a bit defined in the metamodel, and very little in the profile; what purpose could this serve?

TA,

Steve
Re: Extending the Standard profile [message #519113 is a reply to message #519059] Sat, 06 March 2010 12:12 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Hi Steven,

Steven Stallion wrote:

> As an example, A is defined as a Class within the Metamodel which may
> contain any number of associations, generalizations, etc (none of which
> link back to the UML metamodel).

sounds like the 'Tuple' class in the example I posted above - It is defined
in the given profile without extending any metaclass. As Steven pointed out,
such classes shoud be containment-referenced from some stereotype for
technical purposes. Besides that, the may comprise arbitrary attributes and
associations to other classes. Imported metaclasses cannot be modified,
hence associations towards UML metaclasses may only be navigable in this
direction.

> The profile defines a Stereotype B which extends uml::Class, however there
> is a table which defines A as B's "metamodel construct".

I don't think this term is 'officially defined' - so my best guess is indeed
that B has some composition to A.

> I think this is where I am getting confused. What is the relationship
> between a metamodel and a profile? This particular specification has quite
> a bit defined in the metamodel, and very little in the profile; what
> purpose could this serve?

It is quite natural if large fragments of the DSL do not map to any UML
construct - so why extend any UML metaclass?

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #519118 is a reply to message #519058] Sat, 06 March 2010 17:52 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Hello Christian,

Christian W. Damus wrote:

> The mapping of the UML profile to a metamodel (or, probably more
> naturally, the metamodel from which the profile was mapped) can combine
> the concepts of B and A by simply defining a generalization relationship
> from B to A:
>
> B ---|> A

Tools like M2T Xpand treat stereotypes quite this way - metaclasses are
'assignable from' stereotypes (meaning we can typecast from A to B, given
that we have an instance object b). Plus, you can access attributes in a
uniformal way, as you outlined below:

> b.one
> b.two

Surely the 'formal' approach using base_ associations can avoid possible
name clashes, but it makes such OCL documents a nightmare to read.

> A profile will never be able to modify the metaclasses that it
> references, so there will always need to be some mapping from property
> access in the "metamodel view" of your spec to the "profile view."
> Remembering that the semantics of metaclass extension (by stereotypes)
> is really just the same as association should help to keep these
> mappings straight.

In my opinion, thinking of stereotypes as subclasses of extended metaclasses
is a lot closer to the intended meaning of such constructs - albeit not on
a(OMG-compliant) technical level. Why else would I write a marker <<Entity>>
to a class if not to express that this element IS not a regular class, but
an entity (whatever this means in my context).

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #519395 is a reply to message #519118] Mon, 08 March 2010 17:32 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
All,

Thanks for the information - I think I finally have enough background to continue. Thanks again!

Steve
Re: Extending the Standard profile [message #628293 is a reply to message #518281] Wed, 03 March 2010 17:30 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
I'm not quite sure I'm getting my question across.

I am working with a MOF metamodel which is referenced by my profile. If I create an extension between a Stereotype and one of my metaclasses, I am unable to apply the Stereotype in a class diagram to a class.

I have tried both the heavyweight and middleweight approaches of defining a generalization between my metaclass and uml::Class however I have not had much luck.

In your diagrams, you are creating a extension between uml::Class and your Stereotype - this is too simple for my needs (I believe this is the Lightweight approach). In my situation, I have an additional metaclass between the Stereotype and uml::Class.

It might help to represent this graphically; in your demo/suggestion above you have the following extension:

uml::Class <- myWebservice

For my particular need, I have defined:

uml::Class <- myMetaclass <- myWebservice

HTH,

Steve
Re: Extending the Standard profile [message #628298 is a reply to message #518352] Thu, 04 March 2010 08:45 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 03.03.2010 21:58, schrieb Steven Stallion:

> I'm implementing an OMG specification in process. The spec calls for a
> metamodel and a profile. Unfortunately the spec is a little scant on
> details, particularly with how the metamodel is "glued" to the profile
> so I'm left to my own devices at the moment.

Phew, honestly I'd rather advice to leave the implementation work to the
spec authors, as they probably know best :) Or they change their spec if
it turns out not to fit into the UML world properly.

>> Not in a profile. Stereotypes are the way to go here.
>
> Right. In this case, I have a Stereotype which extends the uml::Class
> metaclass. In the documentation it states that a secondary "metaclass
> construct" should be applied to the Stereotype. I'm taking this to mean
> that the Stereo type should extend the secondary metaclass which in turn
> extends the uml::Class metaclass.

Doubtful, and very informal - I wonder why they did not put up a profile
diagram instead. I don't think there are good reasons why one would
first extend UML::Class by means of generalization and then again extend
it by a stereotype. There's nothing you couldn't put into the stereotype
directly that you can model in the new metaclass.

What I can imagine is that the stereotype is supposed to have a
composite association to another metaclass (which in turn does not need
to extend anything) - it's the only way I'm aware of to model value
tuples as a stereotype attribute. But that's just guessing.

>> What do you mean by "apply a metamodel construct"? Examples?
>
> See above; this is the exact wording in the specification (which is not
> public yet) - the term confused me a bit, I was hoping someone could
> shed some light on it.

In the UML spec, 'apply' only shows up in the context of profiles. A
profile is not a model (formally) - thats where they lost me.

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #628301 is a reply to message #628298] Thu, 04 March 2010 22:49 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
> Doubtful, and very informal - I wonder why they did not put up a profile
> diagram instead. I don't think there are good reasons why one would
> first extend UML::Class by means of generalization and then again extend
> it by a stereotype. There's nothing you couldn't put into the stereotype
> directly that you can model in the new metaclass.

I'm wondering that myself. There are some pretty complex relationships in this particular domain, so I'm guessing they were trying to save a few trees.

> What I can imagine is that the stereotype is supposed to have a
> composite association to another metaclass (which in turn does not need
> to extend anything) - it's the only way I'm aware of to model value
> tuples as a stereotype attribute. But that's just guessing.

This sounds interesting, and may very well have been the intent of the authors - could you describe this in a little more detail? It sounds like you are saying that I can have a Stereotype extend uml::Class, and then define a composite association between the Stereotype and the Metaclass?

Essentially, I'm trying to capture a number of properties defined in these Metaclasses and have them be accessible from the Stereotype.

Thanks again for the help!

Steve
Re: Extending the Standard profile [message #628302 is a reply to message #628301] Fri, 05 March 2010 12:49 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 04.03.2010 23:49, schrieb Steven Stallion:

> This sounds interesting, and may very well have been the intent of the
> authors - could you describe this in a little more detail? It sounds
> like you are saying that I can have a Stereotype extend uml::Class, and
> then define a composite association between the Stereotype and the
> Metaclass?

This metaclass, or any other one - the target metaclass so to say gets a
new "purpose". E.g., Property does not only represent class attributes,
but also association roles. Class is not only used to represent "usual"
classes, but also for template instantiation. Likewise, you can use
metaclasses for your own purpose in a stereotype. Plus, you can add your
own (meta-)classes to the profile.

I tried to illustrate this in a small example:

http://weinell.de/bin/profile-sh1.png

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #628303 is a reply to message #518918] Fri, 05 March 2010 14:23 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
Picture including Diagram Profile Editor, UML Model Editor, Property view and the saved metamodel xmi of the profile: http://www.download-omondo.com/profile_backup.png

hope this help and good luck for your project.
Re: Extending the Standard profile [message #628304 is a reply to message #628303] Fri, 05 March 2010 19:47 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Thanks All.

I think I'm beginning to understand a little better the relationship between the profile and the metamodel. That said, I think there is something fundamental I must be missing here.

Let me try and rephrase my question in a different way...

Essentially I need to be able to define an additional set of tagged values for a given Stereotype. The specification dictates this comes in the form of a Class defined in a UML metamodel.

The profile is all that really matters here, however the metamodel is quite complex, so it would not be an easy effort to collapse all of these attributes and define them directly in the profile. In addition there are a number of inherited constraints which I would prefer not to redefine for every Stereotype.

Ed, the image you posted earlier looks fairly close to what I want, however I'm not quite sure how to translate that into the EMF editor for the profile. Is there any chance you could elaborate on this a little more? Is this simply a composite association to a Metaclass or a packaged Class within the metamodel?

I apologize in advance - I've been a long-time user of UML, however this is my first exposure to the MOF and DSL modeling.

Regards,

Steve
Re: Extending the Standard profile [message #628305 is a reply to message #519040] Fri, 05 March 2010 20:04 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 844
Registered: July 2009
Senior Member
Hi, Steven,

Yes, a Stereotype can simply define associations to to existing
metaclasses of the metamodel (in your case, UML) that it references.
These can be composite (the stereotype instance contains a UML sub-tree)
or not.

A Profile can also define Classes. These behave, effectively, like
metaclasses. You can use them to define structure in a Stereotype that
can't be expressed using metaclasses from the referenced metamodel.
However, you have to be sure that you define at least one composition
association to own any given class, because otherwise they won't persist
nicely. Instances of profile classes can be owned by stereotypes or
other profile classes.

I don't think that a profile class is permitted to specialize a
metaclass from the referenced metamodel, but I could be wrong about
that. I can certainly imagine that it would introduce tricky problems
of element substitutability ...

HTH,

Christian


On 05/03/10 02:47 PM, Steven Stallion wrote:
> Thanks All.
>
> I think I'm beginning to understand a little better the relationship
> between the profile and the metamodel. That said, I think there is
> something fundamental I must be missing here.
>
> Let me try and rephrase my question in a different way...
>
> Essentially I need to be able to define an additional set of tagged
> values for a given Stereotype. The specification dictates this comes in
> the form of a Class defined in a UML metamodel.
>
> The profile is all that really matters here, however the metamodel is
> quite complex, so it would not be an easy effort to collapse all of
> these attributes and define them directly in the profile. In addition
> there are a number of inherited constraints which I would prefer not to
> redefine for every Stereotype.
>
> Ed, the image you posted earlier looks fairly close to what I want,
> however I'm not quite sure how to translate that into the EMF editor for
> the profile. Is there any chance you could elaborate on this a little
> more? Is this simply a composite association to a Metaclass or a
> packaged Class within the metamodel?
>
> I apologize in advance - I've been a long-time user of UML, however this
> is my first exposure to the MOF and DSL modeling.
>
> Regards,
>
> Steve
Re: Extending the Standard profile [message #628306 is a reply to message #519041] Fri, 05 March 2010 22:18 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Thanks Christian.

Based on your feedback, I've tried updating my profile, however I'm still not seeing the results I want.

Lets say I have Metaclass A which contains two properties, "two", and "three". In my profile I have a single Stereotype B, with a property of "one". What I would like to see is all three tagged values be available, that is "one", "two", and "three" (this is the behavior the specification mandates).

If I create a composite association between A and B, in the graphical editor, I am not able to see any tagged values related to A once the profile is defined, and applied to a class diagram.

Ideas?

Steve
Re: Extending the Standard profile [message #628307 is a reply to message #628306] Fri, 05 March 2010 22:35 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 844
Registered: July 2009
Senior Member
Hi, Steve,

Is your stereotype B a metaclass extension of A? A's properties are not
tagged values; they are metamodel attributes.

For the UML profile, all three of these values are accessible, but they
are owned by different objects. Given

<<b>> a : A

(an "A" with the "B" stereotype applied) you are dealing with two
different objects: a, which has the "two" and "three" properties, and
b, which as the "one" property. The metaclass extension is an
association relationship between b and a. So, from b you can get a's
A::two and A::three by navigating over b's B::base_A property (one end
of the extension association). In OCL, you would actually do this as:

b.base_A.two

for example. To go the other way, in OCL (because OCL is able to
navigate the directed association in reverse)

a.extension_B.one

The mapping of the UML profile to a metamodel (or, probably more
naturally, the metamodel from which the profile was mapped) can combine
the concepts of B and A by simply defining a generalization relationship
from B to A:

B ---|> A

In this case, you can have an element

b : B

that define all three properties (two inherited), so that in OCL you can do

b.one
b.two

A profile will never be able to modify the metaclasses that it
references, so there will always need to be some mapping from property
access in the "metamodel view" of your spec to the "profile view."
Remembering that the semantics of metaclass extension (by stereotypes)
is really just the same as association should help to keep these
mappings straight.

(Forgive the introduction of OCL into the conversation. I just find it
convenient for concrete illustration.)

HTH,

Christian


On 05/03/10 05:18 PM, Steven Stallion wrote:
> Thanks Christian.
>
> Based on your feedback, I've tried updating my profile, however I'm
> still not seeing the results I want.
>
> Lets say I have Metaclass A which contains two properties, "two", and
> "three". In my profile I have a single Stereotype B, with a property of
> "one". What I would like to see is all three tagged values be available,
> that is "one", "two", and "three" (this is the behavior the
> specification mandates).
>
> If I create a composite association between A and B, in the graphical
> editor, I am not able to see any tagged values related to A once the
> profile is defined, and applied to a class diagram.
>
> Ideas?
>
> Steve
Re: Extending the Standard profile [message #628308 is a reply to message #519058] Fri, 05 March 2010 23:13 Go to previous messageGo to next message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
Christian,

> Is your stereotype B a metaclass extension of A? A's properties are not
> tagged values; they are metamodel attributes.

To be honest, I don't know. The specification seems to be written such that the profile is derived from the metamodel. A is a metaclass, however there does not seem to be a formal association between it and B.

As an example, A is defined as a Class within the Metamodel which may contain any number of associations, generalizations, etc (none of which link back to the UML metamodel).

The profile defines a Stereotype B which extends uml::Class, however there is a table which defines A as B's "metamodel construct".

I think this is where I am getting confused. What is the relationship between a metamodel and a profile? This particular specification has quite a bit defined in the metamodel, and very little in the profile; what purpose could this serve?

TA,

Steve
Re: Extending the Standard profile [message #628309 is a reply to message #628308] Sat, 06 March 2010 16:59 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Hi Steven,

Steven Stallion wrote:

> As an example, A is defined as a Class within the Metamodel which may
> contain any number of associations, generalizations, etc (none of which
> link back to the UML metamodel).

sounds like the 'Tuple' class in the example I posted above - It is defined
in the given profile without extending any metaclass. As Steven pointed out,
such classes shoud be containment-referenced from some stereotype for
technical purposes. Besides that, the may comprise arbitrary attributes and
associations to other classes. Imported metaclasses cannot be modified,
hence associations towards UML metaclasses may only be navigable in this
direction.

> The profile defines a Stereotype B which extends uml::Class, however there
> is a table which defines A as B's "metamodel construct".

I don't think this term is 'officially defined' - so my best guess is indeed
that B has some composition to A.

> I think this is where I am getting confused. What is the relationship
> between a metamodel and a profile? This particular specification has quite
> a bit defined in the metamodel, and very little in the profile; what
> purpose could this serve?

It is quite natural if large fragments of the DSL do not map to any UML
construct - so why extend any UML metaclass?

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #628310 is a reply to message #519058] Sat, 06 March 2010 17:52 Go to previous messageGo to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Hello Christian,

Christian W. Damus wrote:

> The mapping of the UML profile to a metamodel (or, probably more
> naturally, the metamodel from which the profile was mapped) can combine
> the concepts of B and A by simply defining a generalization relationship
> from B to A:
>
> B ---|> A

Tools like M2T Xpand treat stereotypes quite this way - metaclasses are
'assignable from' stereotypes (meaning we can typecast from A to B, given
that we have an instance object b). Plus, you can access attributes in a
uniformal way, as you outlined below:

> b.one
> b.two

Surely the 'formal' approach using base_ associations can avoid possible
name clashes, but it makes such OCL documents a nightmare to read.

> A profile will never be able to modify the metaclasses that it
> references, so there will always need to be some mapping from property
> access in the "metamodel view" of your spec to the "profile view."
> Remembering that the semantics of metaclass extension (by stereotypes)
> is really just the same as association should help to keep these
> mappings straight.

In my opinion, thinking of stereotypes as subclasses of extended metaclasses
is a lot closer to the intended meaning of such constructs - albeit not on
a(OMG-compliant) technical level. Why else would I write a marker <<Entity>>
to a class if not to express that this element IS not a regular class, but
an entity (whatever this means in my context).

Best regards,
Erhard Weinell
Re: Extending the Standard profile [message #628321 is a reply to message #519118] Mon, 08 March 2010 17:32 Go to previous message
Steven Stallion is currently offline Steven StallionFriend
Messages: 21
Registered: March 2010
Junior Member
All,

Thanks for the information - I think I finally have enough background to continue. Thanks again!

Steve
Previous Topic:UML Action Language (UAL) in Eclipse?
Next Topic:How to use existing java classes as Types in uml
Goto Forum:
  


Current Time: Thu Dec 18 11:41:02 GMT 2014

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

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