Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Should the OCL allInstances() feature apply to stereotypes?
Should the OCL allInstances() feature apply to stereotypes? [message #477610] Wed, 16 July 2008 18:51 Go to next message
Linda Damus is currently offline Linda DamusFriend
Messages: 85
Registered: July 2009
Member
Hi,

Should the OCL allInstances() feature apply to stereotypes?

In other words, if I've created a stereotype 'S' extending Class in
profile 'P', should I be able to write an OCL constraint that uses the
expression:

P::S.allInstances()

and expect it to find all of the Classes in my model to which 'S' has
been applied?

Although the UML v2.1.2 specification talks about instances of an
instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
to me whether or not a Class stereotyped as 'S' should or should not be
considered an instance of 'S'.

Thanks,
Linda
Re: Should the OCL allInstances() feature apply to stereotypes? [message #477611 is a reply to message #477610] Wed, 16 July 2008 19:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-B9rx7rMixmoSavi/KItu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Linda,

>From an OCL (and UML) perspective, Stereotypes are just Classes. The
metaclass extension is an association, and in OCL, is navigated just
like any other association.

The instances of stereotypes are elements associated with the instances
of the extended metaclasses. UML uses a triangular arrow-head for the
metaclass extension to indicate that the intention is to extend the
attributes of a UML element in a way like generalization (which also
uses a triangle), but I think it's clear that extensions do not actually
have generalization semantics. For example, the
Classifier::conformsTo(Type) operation does not consider a metaclass to
conform to an applied stereotype because there is no generalization.

So, allInstances() on a stereotype should only find the stereotype
"applications" and not the UML elements that they extend. However, from
the applications, it's easy enough to navigate to the UML elements via
the base_Xyz extension end property. Try this:

P::S.allInstances().base_Actor

as an example of getting a collection of Actors that have S applied if S
extends the Actor metaclass.

I don't know that this actually works in the MDT OCL implementation ...

HTH,

Christian


On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:

> Hi,
>
> Should the OCL allInstances() feature apply to stereotypes?
>
> In other words, if I've created a stereotype 'S' extending Class in
> profile 'P', should I be able to write an OCL constraint that uses the
> expression:
>
> P::S.allInstances()
>
> and expect it to find all of the Classes in my model to which 'S' has
> been applied?
>
> Although the UML v2.1.2 specification talks about instances of an
> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
> to me whether or not a Class stereotyped as 'S' should or should not be
> considered an instance of 'S'.
>
> Thanks,
> Linda

--=-B9rx7rMixmoSavi/KItu
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Linda,<BR>
<BR>
>From an OCL (and UML) perspective, Stereotypes are just Classes.&nbsp; The metaclass extension is an association, and in OCL, is navigated just like any other association.<BR>
<BR>
The instances of stereotypes are elements associated with the instances of the extended metaclasses.&nbsp; UML uses a triangular arrow-head for the metaclass extension to indicate that the intention is to extend the attributes of a UML element in a way like generalization (which also uses a triangle), but I think it's clear that extensions do not actually have generalization semantics.&nbsp; For example, the Classifier::conformsTo(Type) operation does not consider a metaclass to conform to an applied stereotype because there is no generalization.<BR>
<BR>
So, allInstances() on a stereotype should only find the stereotype &quot;applications&quot; and not the UML elements that they extend.&nbsp; However, from the applications, it's easy enough to navigate to the UML elements via the base_Xyz extension end property.&nbsp; Try this:<BR>
<BR>
&nbsp; P::S.allInstances().base_Actor<BR>
<BR>
as an example of getting a collection of Actors that have S applied if S extends the Actor metaclass.<BR>
<BR>
I don't know that this actually works in the MDT OCL implementation ...<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi,</FONT>

<FONT COLOR="#000000">Should the OCL allInstances() feature apply to stereotypes?</FONT>

<FONT COLOR="#000000">In other words, if I've created a stereotype 'S' extending Class in </FONT>
<FONT COLOR="#000000">profile 'P', should I be able to write an OCL constraint that uses the </FONT>
<FONT COLOR="#000000">expression:</FONT>

<FONT COLOR="#000000">P::S.allInstances()</FONT>

<FONT COLOR="#000000">and expect it to find all of the Classes in my model to which 'S' has </FONT>
<FONT COLOR="#000000">been applied?</FONT>

<FONT COLOR="#000000">Although the UML v2.1.2 specification talks about instances of an </FONT>
<FONT COLOR="#000000">instance &quot;S&quot; of Stereotype (section 18.3.8, semantics), it's not clear </FONT>
<FONT COLOR="#000000">to me whether or not a Class stereotyped as 'S' should or should not be </FONT>
<FONT COLOR="#000000">considered an instance of 'S'.</FONT>

<FONT COLOR="#000000">Thanks,</FONT>
<FONT COLOR="#000000">Linda</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-B9rx7rMixmoSavi/KItu--
Re: Should the OCL allInstances() feature apply to stereotypes? [message #477612 is a reply to message #477611] Wed, 16 July 2008 20:09 Go to previous messageGo to next message
Linda Damus is currently offline Linda DamusFriend
Messages: 85
Registered: July 2009
Member
Thanks for the prompt answer, Christian!

I've tried your suggested:

P::S.allInstances().base_Actor

but it is always empty, even when 'S' is applied to Actors in my model.

I've opened bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148 to request that
allInstances() return instances of stereotype "applications."

In the mean time, a combination of Actor.allInstances() and
getAppliedStereotype('P::S') will do the trick to express the constraint.

Thanks,
Linda


Christian W. Damus wrote:
> Hi, Linda,
>
> >From an OCL (and UML) perspective, Stereotypes are just Classes. The
> metaclass extension is an association, and in OCL, is navigated just
> like any other association.
>
> The instances of stereotypes are elements associated with the instances
> of the extended metaclasses. UML uses a triangular arrow-head for the
> metaclass extension to indicate that the intention is to extend the
> attributes of a UML element in a way like generalization (which also
> uses a triangle), but I think it's clear that extensions do not actually
> have generalization semantics. For example, the
> Classifier::conformsTo(Type) operation does not consider a metaclass to
> conform to an applied stereotype because there is no generalization.
>
> So, allInstances() on a stereotype should only find the stereotype
> "applications" and not the UML elements that they extend. However, from
> the applications, it's easy enough to navigate to the UML elements via
> the base_Xyz extension end property. Try this:
>
> P::S.allInstances().base_Actor
>
> as an example of getting a collection of Actors that have S applied if S
> extends the Actor metaclass.
>
> I don't know that this actually works in the MDT OCL implementation ...
>
> HTH,
>
> Christian
>
>
> On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
>> Hi,
>>
>> Should the OCL allInstances() feature apply to stereotypes?
>>
>> In other words, if I've created a stereotype 'S' extending Class in
>> profile 'P', should I be able to write an OCL constraint that uses the
>> expression:
>>
>> P::S.allInstances()
>>
>> and expect it to find all of the Classes in my model to which 'S' has
>> been applied?
>>
>> Although the UML v2.1.2 specification talks about instances of an
>> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
>> to me whether or not a Class stereotyped as 'S' should or should not be
>> considered an instance of 'S'.
>>
>> Thanks,
>> Linda
Re: Should the OCL allInstances() feature apply to stereotypes? [message #477613 is a reply to message #477612] Wed, 16 July 2008 20:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-S0idtfB5W7lMzty7yaD0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Linda,

You should also be able to do this:

Actor.allInstances()->select(extension_S->notEmpty())

to get all of the Actors that have S applied, in an OCL-standard way
(the getAppliedStereotype(String) operation is not UML-compliant).

Or, if you need the S instances:

Actor.allInstances().extension_S

cW

On Wed, 2008-07-16 at 16:09 -0400, Linda Damus wrote:

> Thanks for the prompt answer, Christian!
>
> I've tried your suggested:
>
> P::S.allInstances().base_Actor
>
> but it is always empty, even when 'S' is applied to Actors in my model.
>
> I've opened bugzilla
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148 to request that
> allInstances() return instances of stereotype "applications."
>
> In the mean time, a combination of Actor.allInstances() and
> getAppliedStereotype('P::S') will do the trick to express the constraint.
>
> Thanks,
> Linda
>
>
> Christian W. Damus wrote:
> > Hi, Linda,
> >
> > >From an OCL (and UML) perspective, Stereotypes are just Classes. The
> > metaclass extension is an association, and in OCL, is navigated just
> > like any other association.
> >
> > The instances of stereotypes are elements associated with the instances
> > of the extended metaclasses. UML uses a triangular arrow-head for the
> > metaclass extension to indicate that the intention is to extend the
> > attributes of a UML element in a way like generalization (which also
> > uses a triangle), but I think it's clear that extensions do not actually
> > have generalization semantics. For example, the
> > Classifier::conformsTo(Type) operation does not consider a metaclass to
> > conform to an applied stereotype because there is no generalization.
> >
> > So, allInstances() on a stereotype should only find the stereotype
> > "applications" and not the UML elements that they extend. However, from
> > the applications, it's easy enough to navigate to the UML elements via
> > the base_Xyz extension end property. Try this:
> >
> > P::S.allInstances().base_Actor
> >
> > as an example of getting a collection of Actors that have S applied if S
> > extends the Actor metaclass.
> >
> > I don't know that this actually works in the MDT OCL implementation ...
> >
> > HTH,
> >
> > Christian
> >
> >
> > On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
> >> Hi,
> >>
> >> Should the OCL allInstances() feature apply to stereotypes?
> >>
> >> In other words, if I've created a stereotype 'S' extending Class in
> >> profile 'P', should I be able to write an OCL constraint that uses the
> >> expression:
> >>
> >> P::S.allInstances()
> >>
> >> and expect it to find all of the Classes in my model to which 'S' has
> >> been applied?
> >>
> >> Although the UML v2.1.2 specification talks about instances of an
> >> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
> >> to me whether or not a Class stereotyped as 'S' should or should not be
> >> considered an instance of 'S'.
> >>
> >> Thanks,
> >> Linda

--=-S0idtfB5W7lMzty7yaD0
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Linda,<BR>
<BR>
You should also be able to do this:<BR>
<BR>
&nbsp; Actor.allInstances()-&gt;select(extension_S-&gt;notE mpty()) <BR>
<BR>
to get all of the Actors that have S applied, in an OCL-standard way (the getAppliedStereotype(String) operation is not UML-compliant).<BR>
<BR>
Or, if you need the S instances:<BR>
<BR>
&nbsp; Actor.allInstances().extension_S<BR>
<BR>
cW<BR>
<BR>
On Wed, 2008-07-16 at 16:09 -0400, Linda Damus wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Thanks for the prompt answer, Christian!</FONT>

<FONT COLOR="#000000">I've tried your suggested:</FONT>

<FONT COLOR="#000000"> P::S.allInstances().base_Actor</FONT>

<FONT COLOR="#000000">but it is always empty, even when 'S' is applied to Actors in my model.</FONT>

<FONT COLOR="#000000">I've opened bugzilla </FONT>
<FONT COLOR="#000000"><A HREF="https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148">https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148</A> to request that </FONT>
<FONT COLOR="#000000">allInstances() return instances of stereotype &quot;applications.&quot;</FONT>

<FONT COLOR="#000000">In the mean time, a combination of Actor.allInstances() and </FONT>
<FONT COLOR="#000000">getAppliedStereotype('P::S') will do the trick to express the constraint.</FONT>

<FONT COLOR="#000000">Thanks,</FONT>
<FONT COLOR="#000000">Linda</FONT>


<FONT COLOR="#000000">Christian W. Damus wrote:</FONT>
<FONT COLOR="#000000">&gt; Hi, Linda,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; &gt;From an OCL (and UML) perspective, Stereotypes are just Classes. The </FONT>
<FONT COLOR="#000000">&gt; metaclass extension is an association, and in OCL, is navigated just </FONT>
<FONT COLOR="#000000">&gt; like any other association.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; The instances of stereotypes are elements associated with the instances </FONT>
<FONT COLOR="#000000">&gt; of the extended metaclasses. UML uses a triangular arrow-head for the </FONT>
<FONT COLOR="#000000">&gt; metaclass extension to indicate that the intention is to extend the </FONT>
<FONT COLOR="#000000">&gt; attributes of a UML element in a way like generalization (which also </FONT>
<FONT COLOR="#000000">&gt; uses a triangle), but I think it's clear that extensions do not actually </FONT>
<FONT COLOR="#000000">&gt; have generalization semantics. For example, the </FONT>
<FONT COLOR="#000000">&gt; Classifier::conformsTo(Type) operation does not consider a metaclass to </FONT>
<FONT COLOR="#000000">&gt; conform to an applied stereotype because there is no generalization.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; So, allInstances() on a stereotype should only find the stereotype </FONT>
<FONT COLOR="#000000">&gt; &quot;applications&quot; and not the UML elements that they extend. However, from </FONT>
<FONT COLOR="#000000">&gt; the applications, it's easy enough to navigate to the UML elements via </FONT>
<FONT COLOR="#000000">&gt; the base_Xyz extension end property. Try this:</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; P::S.allInstances().base_Actor</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; as an example of getting a collection of Actors that have S applied if S </FONT>
<FONT COLOR="#000000">&gt; extends the Actor metaclass.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; I don't know that this actually works in the MDT OCL implementation ...</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; HTH,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Christian</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt; Hi,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Should the OCL allInstances() feature apply to stereotypes?</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; In other words, if I've created a stereotype 'S' extending Class in </FONT>
<FONT COLOR="#000000">&gt;&gt; profile 'P', should I be able to write an OCL constraint that uses the </FONT>
<FONT COLOR="#000000">&gt;&gt; expression:</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; P::S.allInstances()</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; and expect it to find all of the Classes in my model to which 'S' has </FONT>
<FONT COLOR="#000000">&gt;&gt; been applied?</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Although the UML v2.1.2 specification talks about instances of an </FONT>
<FONT COLOR="#000000">&gt;&gt; instance &quot;S&quot; of Stereotype (section 18.3.8, semantics), it's not clear </FONT>
<FONT COLOR="#000000">&gt;&gt; to me whether or not a Class stereotyped as 'S' should or should not be </FONT>
<FONT COLOR="#000000">&gt;&gt; considered an instance of 'S'.</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Thanks,</FONT>
<FONT COLOR="#000000">&gt;&gt; Linda</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-S0idtfB5W7lMzty7yaD0--
Re: Should the OCL allInstances() feature apply to stereotypes? [message #626801 is a reply to message #477610] Wed, 16 July 2008 19:18 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-B9rx7rMixmoSavi/KItu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Linda,

>From an OCL (and UML) perspective, Stereotypes are just Classes. The
metaclass extension is an association, and in OCL, is navigated just
like any other association.

The instances of stereotypes are elements associated with the instances
of the extended metaclasses. UML uses a triangular arrow-head for the
metaclass extension to indicate that the intention is to extend the
attributes of a UML element in a way like generalization (which also
uses a triangle), but I think it's clear that extensions do not actually
have generalization semantics. For example, the
Classifier::conformsTo(Type) operation does not consider a metaclass to
conform to an applied stereotype because there is no generalization.

So, allInstances() on a stereotype should only find the stereotype
"applications" and not the UML elements that they extend. However, from
the applications, it's easy enough to navigate to the UML elements via
the base_Xyz extension end property. Try this:

P::S.allInstances().base_Actor

as an example of getting a collection of Actors that have S applied if S
extends the Actor metaclass.

I don't know that this actually works in the MDT OCL implementation ...

HTH,

Christian


On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:

> Hi,
>
> Should the OCL allInstances() feature apply to stereotypes?
>
> In other words, if I've created a stereotype 'S' extending Class in
> profile 'P', should I be able to write an OCL constraint that uses the
> expression:
>
> P::S.allInstances()
>
> and expect it to find all of the Classes in my model to which 'S' has
> been applied?
>
> Although the UML v2.1.2 specification talks about instances of an
> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
> to me whether or not a Class stereotyped as 'S' should or should not be
> considered an instance of 'S'.
>
> Thanks,
> Linda

--=-B9rx7rMixmoSavi/KItu
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Linda,<BR>
<BR>
>From an OCL (and UML) perspective, Stereotypes are just Classes.&nbsp; The metaclass extension is an association, and in OCL, is navigated just like any other association.<BR>
<BR>
The instances of stereotypes are elements associated with the instances of the extended metaclasses.&nbsp; UML uses a triangular arrow-head for the metaclass extension to indicate that the intention is to extend the attributes of a UML element in a way like generalization (which also uses a triangle), but I think it's clear that extensions do not actually have generalization semantics.&nbsp; For example, the Classifier::conformsTo(Type) operation does not consider a metaclass to conform to an applied stereotype because there is no generalization.<BR>
<BR>
So, allInstances() on a stereotype should only find the stereotype &quot;applications&quot; and not the UML elements that they extend.&nbsp; However, from the applications, it's easy enough to navigate to the UML elements via the base_Xyz extension end property.&nbsp; Try this:<BR>
<BR>
&nbsp; P::S.allInstances().base_Actor<BR>
<BR>
as an example of getting a collection of Actors that have S applied if S extends the Actor metaclass.<BR>
<BR>
I don't know that this actually works in the MDT OCL implementation ...<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Hi,</FONT>

<FONT COLOR="#000000">Should the OCL allInstances() feature apply to stereotypes?</FONT>

<FONT COLOR="#000000">In other words, if I've created a stereotype 'S' extending Class in </FONT>
<FONT COLOR="#000000">profile 'P', should I be able to write an OCL constraint that uses the </FONT>
<FONT COLOR="#000000">expression:</FONT>

<FONT COLOR="#000000">P::S.allInstances()</FONT>

<FONT COLOR="#000000">and expect it to find all of the Classes in my model to which 'S' has </FONT>
<FONT COLOR="#000000">been applied?</FONT>

<FONT COLOR="#000000">Although the UML v2.1.2 specification talks about instances of an </FONT>
<FONT COLOR="#000000">instance &quot;S&quot; of Stereotype (section 18.3.8, semantics), it's not clear </FONT>
<FONT COLOR="#000000">to me whether or not a Class stereotyped as 'S' should or should not be </FONT>
<FONT COLOR="#000000">considered an instance of 'S'.</FONT>

<FONT COLOR="#000000">Thanks,</FONT>
<FONT COLOR="#000000">Linda</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-B9rx7rMixmoSavi/KItu--
Re: Should the OCL allInstances() feature apply to stereotypes? [message #626802 is a reply to message #477611] Wed, 16 July 2008 20:09 Go to previous message
Linda Damus is currently offline Linda DamusFriend
Messages: 85
Registered: July 2009
Member
Thanks for the prompt answer, Christian!

I've tried your suggested:

P::S.allInstances().base_Actor

but it is always empty, even when 'S' is applied to Actors in my model.

I've opened bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148 to request that
allInstances() return instances of stereotype "applications."

In the mean time, a combination of Actor.allInstances() and
getAppliedStereotype('P::S') will do the trick to express the constraint.

Thanks,
Linda


Christian W. Damus wrote:
> Hi, Linda,
>
> >From an OCL (and UML) perspective, Stereotypes are just Classes. The
> metaclass extension is an association, and in OCL, is navigated just
> like any other association.
>
> The instances of stereotypes are elements associated with the instances
> of the extended metaclasses. UML uses a triangular arrow-head for the
> metaclass extension to indicate that the intention is to extend the
> attributes of a UML element in a way like generalization (which also
> uses a triangle), but I think it's clear that extensions do not actually
> have generalization semantics. For example, the
> Classifier::conformsTo(Type) operation does not consider a metaclass to
> conform to an applied stereotype because there is no generalization.
>
> So, allInstances() on a stereotype should only find the stereotype
> "applications" and not the UML elements that they extend. However, from
> the applications, it's easy enough to navigate to the UML elements via
> the base_Xyz extension end property. Try this:
>
> P::S.allInstances().base_Actor
>
> as an example of getting a collection of Actors that have S applied if S
> extends the Actor metaclass.
>
> I don't know that this actually works in the MDT OCL implementation ...
>
> HTH,
>
> Christian
>
>
> On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
>> Hi,
>>
>> Should the OCL allInstances() feature apply to stereotypes?
>>
>> In other words, if I've created a stereotype 'S' extending Class in
>> profile 'P', should I be able to write an OCL constraint that uses the
>> expression:
>>
>> P::S.allInstances()
>>
>> and expect it to find all of the Classes in my model to which 'S' has
>> been applied?
>>
>> Although the UML v2.1.2 specification talks about instances of an
>> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
>> to me whether or not a Class stereotyped as 'S' should or should not be
>> considered an instance of 'S'.
>>
>> Thanks,
>> Linda
Re: Should the OCL allInstances() feature apply to stereotypes? [message #626803 is a reply to message #477612] Wed, 16 July 2008 20:32 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.zeligsoft.com

--=-S0idtfB5W7lMzty7yaD0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi, Linda,

You should also be able to do this:

Actor.allInstances()->select(extension_S->notEmpty())

to get all of the Actors that have S applied, in an OCL-standard way
(the getAppliedStereotype(String) operation is not UML-compliant).

Or, if you need the S instances:

Actor.allInstances().extension_S

cW

On Wed, 2008-07-16 at 16:09 -0400, Linda Damus wrote:

> Thanks for the prompt answer, Christian!
>
> I've tried your suggested:
>
> P::S.allInstances().base_Actor
>
> but it is always empty, even when 'S' is applied to Actors in my model.
>
> I've opened bugzilla
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148 to request that
> allInstances() return instances of stereotype "applications."
>
> In the mean time, a combination of Actor.allInstances() and
> getAppliedStereotype('P::S') will do the trick to express the constraint.
>
> Thanks,
> Linda
>
>
> Christian W. Damus wrote:
> > Hi, Linda,
> >
> > >From an OCL (and UML) perspective, Stereotypes are just Classes. The
> > metaclass extension is an association, and in OCL, is navigated just
> > like any other association.
> >
> > The instances of stereotypes are elements associated with the instances
> > of the extended metaclasses. UML uses a triangular arrow-head for the
> > metaclass extension to indicate that the intention is to extend the
> > attributes of a UML element in a way like generalization (which also
> > uses a triangle), but I think it's clear that extensions do not actually
> > have generalization semantics. For example, the
> > Classifier::conformsTo(Type) operation does not consider a metaclass to
> > conform to an applied stereotype because there is no generalization.
> >
> > So, allInstances() on a stereotype should only find the stereotype
> > "applications" and not the UML elements that they extend. However, from
> > the applications, it's easy enough to navigate to the UML elements via
> > the base_Xyz extension end property. Try this:
> >
> > P::S.allInstances().base_Actor
> >
> > as an example of getting a collection of Actors that have S applied if S
> > extends the Actor metaclass.
> >
> > I don't know that this actually works in the MDT OCL implementation ...
> >
> > HTH,
> >
> > Christian
> >
> >
> > On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:
> >> Hi,
> >>
> >> Should the OCL allInstances() feature apply to stereotypes?
> >>
> >> In other words, if I've created a stereotype 'S' extending Class in
> >> profile 'P', should I be able to write an OCL constraint that uses the
> >> expression:
> >>
> >> P::S.allInstances()
> >>
> >> and expect it to find all of the Classes in my model to which 'S' has
> >> been applied?
> >>
> >> Although the UML v2.1.2 specification talks about instances of an
> >> instance "S" of Stereotype (section 18.3.8, semantics), it's not clear
> >> to me whether or not a Class stereotyped as 'S' should or should not be
> >> considered an instance of 'S'.
> >>
> >> Thanks,
> >> Linda

--=-S0idtfB5W7lMzty7yaD0
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Linda,<BR>
<BR>
You should also be able to do this:<BR>
<BR>
&nbsp; Actor.allInstances()-&gt;select(extension_S-&gt;notE mpty()) <BR>
<BR>
to get all of the Actors that have S applied, in an OCL-standard way (the getAppliedStereotype(String) operation is not UML-compliant).<BR>
<BR>
Or, if you need the S instances:<BR>
<BR>
&nbsp; Actor.allInstances().extension_S<BR>
<BR>
cW<BR>
<BR>
On Wed, 2008-07-16 at 16:09 -0400, Linda Damus wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Thanks for the prompt answer, Christian!</FONT>

<FONT COLOR="#000000">I've tried your suggested:</FONT>

<FONT COLOR="#000000"> P::S.allInstances().base_Actor</FONT>

<FONT COLOR="#000000">but it is always empty, even when 'S' is applied to Actors in my model.</FONT>

<FONT COLOR="#000000">I've opened bugzilla </FONT>
<FONT COLOR="#000000"><A HREF="https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148">https://bugs.eclipse.org/bugs/show_bug.cgi?id=241148</A> to request that </FONT>
<FONT COLOR="#000000">allInstances() return instances of stereotype &quot;applications.&quot;</FONT>

<FONT COLOR="#000000">In the mean time, a combination of Actor.allInstances() and </FONT>
<FONT COLOR="#000000">getAppliedStereotype('P::S') will do the trick to express the constraint.</FONT>

<FONT COLOR="#000000">Thanks,</FONT>
<FONT COLOR="#000000">Linda</FONT>


<FONT COLOR="#000000">Christian W. Damus wrote:</FONT>
<FONT COLOR="#000000">&gt; Hi, Linda,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; &gt;From an OCL (and UML) perspective, Stereotypes are just Classes. The </FONT>
<FONT COLOR="#000000">&gt; metaclass extension is an association, and in OCL, is navigated just </FONT>
<FONT COLOR="#000000">&gt; like any other association.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; The instances of stereotypes are elements associated with the instances </FONT>
<FONT COLOR="#000000">&gt; of the extended metaclasses. UML uses a triangular arrow-head for the </FONT>
<FONT COLOR="#000000">&gt; metaclass extension to indicate that the intention is to extend the </FONT>
<FONT COLOR="#000000">&gt; attributes of a UML element in a way like generalization (which also </FONT>
<FONT COLOR="#000000">&gt; uses a triangle), but I think it's clear that extensions do not actually </FONT>
<FONT COLOR="#000000">&gt; have generalization semantics. For example, the </FONT>
<FONT COLOR="#000000">&gt; Classifier::conformsTo(Type) operation does not consider a metaclass to </FONT>
<FONT COLOR="#000000">&gt; conform to an applied stereotype because there is no generalization.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; So, allInstances() on a stereotype should only find the stereotype </FONT>
<FONT COLOR="#000000">&gt; &quot;applications&quot; and not the UML elements that they extend. However, from </FONT>
<FONT COLOR="#000000">&gt; the applications, it's easy enough to navigate to the UML elements via </FONT>
<FONT COLOR="#000000">&gt; the base_Xyz extension end property. Try this:</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; P::S.allInstances().base_Actor</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; as an example of getting a collection of Actors that have S applied if S </FONT>
<FONT COLOR="#000000">&gt; extends the Actor metaclass.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; I don't know that this actually works in the MDT OCL implementation ...</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; HTH,</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Christian</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; On Wed, 2008-07-16 at 14:51 -0400, Linda Damus wrote:</FONT>
<FONT COLOR="#000000">&gt;&gt; Hi,</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Should the OCL allInstances() feature apply to stereotypes?</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; In other words, if I've created a stereotype 'S' extending Class in </FONT>
<FONT COLOR="#000000">&gt;&gt; profile 'P', should I be able to write an OCL constraint that uses the </FONT>
<FONT COLOR="#000000">&gt;&gt; expression:</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; P::S.allInstances()</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; and expect it to find all of the Classes in my model to which 'S' has </FONT>
<FONT COLOR="#000000">&gt;&gt; been applied?</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Although the UML v2.1.2 specification talks about instances of an </FONT>
<FONT COLOR="#000000">&gt;&gt; instance &quot;S&quot; of Stereotype (section 18.3.8, semantics), it's not clear </FONT>
<FONT COLOR="#000000">&gt;&gt; to me whether or not a Class stereotyped as 'S' should or should not be </FONT>
<FONT COLOR="#000000">&gt;&gt; considered an instance of 'S'.</FONT>
<FONT COLOR="#000000">&gt;&gt;</FONT>
<FONT COLOR="#000000">&gt;&gt; Thanks,</FONT>
<FONT COLOR="#000000">&gt;&gt; Linda</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-S0idtfB5W7lMzty7yaD0--
Previous Topic:Should the OCL allInstances() feature apply to stereotypes?
Next Topic:How to make a Class and an Interface read-only?
Goto Forum:
  


Current Time: Fri Apr 19 13:52:59 GMT 2024

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

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

Back to the top