Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » validating OCL in UML Profile (with Papyrus)(problem when using Stereotype extending 2 Metaclass)
validating OCL in UML Profile (with Papyrus) [message #1589767] Wed, 28 January 2015 16:46 Go to next message
fadwa tmar is currently offline fadwa tmarFriend
Messages: 2
Registered: January 2015
Junior Member
Hi,
I created a stereotype myStereotype which extend 2 metaclass (metaclass1 and metaclass2).
I create a model with metaclass1 stereotyped 'myStereotype'
However, when validating my model , I get the following error-

Error The required feature 'myprofile::myStereotype::base_metaclass2' of '┬źmyStereotype┬╗<null-Object>' must be set


Can someone help me with this error.

Thanks.
Re: validating OCL in UML Profile (with Papyrus) [message #1589787 is a reply to message #1589767] Wed, 28 January 2015 17:01 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 845
Registered: February 2011
Senior Member
Hi Fadwa,

That's a flaw in the UML Specification, which defines the Extension multiplicity as Metaclass [1] <---- [0..*] Stereotype

This means that a Stereotype must be associated to exactly one base_Element. However, when a Stereotype can extend several metaclasses, you have several extension, each with a multiplicity of 1. But you can apply a Stereotype to only one UML Element, so you can satisfy this constraint for only one of the extensions.

I think there's an issue which has been raised at the OMG for this problem, but it hasn't been solved.

From an implementation point of view, I guess the multiplicity of base_X properties should be set to [0..1] instead of [1] during the Profile Definition, when more than one metaclass is extended by a Stereotype. This could be implemented in the Eclipse/UML2 component

Camille


Camille Letavernier
Re: validating OCL in UML Profile (with Papyrus) [message #1589816 is a reply to message #1589787] Wed, 28 January 2015 17:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5573
Registered: July 2009
Senior Member
Hi Camille

I don't see this in the specification at all.

An Extension may only extend one metaclass, but there may be many
extensions.

Historically Eclipse UMLs has given spurious base_XXX must be srt
diagnostics; perhaps this is a new vatiant.

Papyrus, I think. lacks support for the isRequired=true/false
characteristic of an Extension.

Fig 12.17 seems to advocate [0..1]

Regards

Ed Willink



On 28/01/2015 17:01, Camille Letavernier wrote:
> Hi Fadwa,
>
> That's a flaw in the UML Specification, which defines the Extension
> multiplicity as Metaclass [1] <---- [0..*] Stereotype
>
> This means that a Stereotype must be associated to exactly one
> base_Element. However, when a Stereotype can extend several
> metaclasses, you have several extension, each with a multiplicity of
> 1. But you can apply a Stereotype to only one UML Element, so you can
> satisfy this constraint for only one of the extensions.
>
> I think there's an issue which has been raised at the OMG for this
> problem, but it hasn't been solved.
>
> From an implementation point of view, I guess the multiplicity of
> base_X properties should be set to [0..1] instead of [1] during the
> Profile Definition, when more than one metaclass is extended by a
> Stereotype. This could be implemented in the Eclipse/UML2 component
>
> Camille
Re: validating OCL in UML Profile (with Papyrus) [message #1589830 is a reply to message #1589816] Wed, 28 January 2015 17:31 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 845
Registered: February 2011
Senior Member
Hi Ed,

Quote:
An Extension may only extend one metaclass, but there may be many
extensions.


Exactly; and each of these extension has a [1] multiplicity to the metaclass; but only one of these extension is actually used when applying a stereotype. So one extension fulfils the [1] multiplicity, and all other ones are violated.

The isRequired property is indeed not supported in Papyrus but is a different matter

Camille


Camille Letavernier
Re: validating OCL in UML Profile (with Papyrus) [message #1589868 is a reply to message #1589830] Wed, 28 January 2015 18:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5573
Registered: July 2009
Senior Member
Hi Camille

I think you are confusing metalevels, which is very easy, particularly
when the exposition lacks clear examples.

Extension::metaclass[1] specifies that there is exactly one Stereotype'd
class named as XXX and consequently a base_XXX relationship exists. It
does not specify the multiplicity of base_XXX.

Consider alternatives. Extension::metaclass[0] would require "base_" and
Extension::metaclass[2] would require "base_XXX_XXX"; both of which are
pretty stupid.

Once the extension is drawn the user should specify the multiplicity at
the Stereotype end of the Extension to specify the [1] / [0..1] from
which isRequired is derived.

The multiplicity of base_XXX can be deduced as [1] if there is a single
Extension or as [0..1] Extension if there are multiple. NB this is a
deduction made by downstream tooling, since within a tool such as
Papyrus there is always the freedom to add another diagram that defines
another Extension.

NB also that the multiplicity of extension_YYYY may be more than one
since a base extension will navigate to all derived stereotypes too.

Regards

Ed Willink

On 28/01/2015 17:31, Camille Letavernier wrote:
> Hi Ed,
>
> Quote:
>> An Extension may only extend one metaclass, but there may be many
>> extensions.
>
>
> Exactly; and each of these extension has a [1] multiplicity to the
> metaclass; but only one of these extension is actually used when
> applying a stereotype. So one extension fulfils the [1] multiplicity,
> and all other ones are violated.
>
> The isRequired property is indeed not supported in Papyrus but is a
> different matter
>
> Camille
Re: validating OCL in UML Profile (with Papyrus) [message #1589882 is a reply to message #1589868] Wed, 28 January 2015 18:13 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 845
Registered: February 2011
Senior Member
Quote:
The multiplicity of base_XXX can be deduced as [1] if there is a single
Extension or as [0..1] Extension if there are multiple. NB this is a
deduction made by downstream tooling, since within a tool such as
Papyrus there is always the freedom to add another diagram that defines
another Extension.


Indeed; specifying the 0..1 multiplicity for the base_X properties solves the issue. I was convinced that this would cause a Validation Error in the profile... Maybe the fix you were mentioning, or another similar one? Or I completely invented that validation issue in the profile... Which is possible as well! Smile

Camille


Camille Letavernier
Re: validating OCL in UML Profile (with Papyrus) [message #1591050 is a reply to message #1589882] Thu, 29 January 2015 09:39 Go to previous message
fadwa tmar is currently offline fadwa tmarFriend
Messages: 2
Registered: January 2015
Junior Member
Thank you for your reply,
Previous Topic:ecore to oclinecore conversion, single line comments disappear
Next Topic:Reusing OCL in a profile
Goto Forum:
  


Current Time: Wed Jan 17 03:13:39 GMT 2018

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

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