RE: A question about association specialization!



RE: A question about association specialization!

From: Waldin, Earl <Earl.Waldin_at_paranor.ch>
Date: Fri, 1 Jun 2007 19:11:32 +0200
Message-ID: <1DE41A26EA92CA4FB831A9449AB0841E5DC30D@srv-par2.paranor.ch>
Hi
 
Here is a brief, and certainly not complete, stab at it. UML metaclass
names are initial capped.
 
First of all, an association in the context you are talking about here
is really a Property. A Property can play the role of either an
attribute or an association end. So, in the discussion below I will talk
about properties, and everything I say applies to both attributes and
association ends. One small note, those familiar with UML 2.x know that
a Property can be owned by either a Class or an Association. A
Property's owner in this case doesn't really make a difference, so don't
worry about it. Think "attribute or association end" and you'll be
alright.
 
Here are two facts:

1.	A Feature is a RedefineableElement. This means that any feature,
such as a Property, Operation, or Reception (among others) can be
redefined.
2.	Only a Property can be subsetted.

This means that only properties can be subsetted and/or redefined. So
the first difference between subsets and redefines is that more kinds of
things can be redefined than subsetted.
 
Subsetting is more or less what you think it is. If propery b subsets
property a, then the set of items referred to by b is a subset of those
referred to by a. For example, if class A has a property propA, class B
a property propB, B inherits from A, propB subsets propA, variable a is
bound to an instance of class A and variable b to an instance of class B
then, in OCL, 
 
   a.propA -> includesAll(b.propB).      (I hope I didn't get it
backwards! But you get the idea).
 
Here are some other points about subsetting:

1.	A subsetting property may not have the same name as the
subsetted property. 

2.	Both the subsetting and subsetted property are visible in the
context of the subsetting class. E.g., given the example above, both
b.propB and b.propA are valid expressions. 

3.	The subsetting and subsetted properties may be owned by the same
class.

In contrast, a redefinition gives a new name for an inherited feature
within the namespace of the class that redefines that feature. Take the
example above except that propB now renames propA. Here is the contrast:

1.	A redefining element may have any name, including the same name
as the redefined property.
2.	A redefined property is no longer "visible" in the redefining
class.  For example, b.propB is a valid expression whereas b.propA is
not. You should be able to get to propA by upcasting b, e.g.,
b.oclAsType(A).propA.
3.	You can only redefine a property defined in an ancestor. (i.e.,
you cannot redefine a property owned by the same class).

Semantically speaking, redefinition is more like equality. Assuming you
can upcast,
 
     b.propB = b.oclAsType(A).propA.
 
Note that with both subsetting and redefinition, the
subsetting/redefining property can have a different type as long as that
type conforms to that of the subsetted/redefined property. This allows
one to narrow the type of a property in a subclass. An example would be
property superType of Class which redefines property general of
Classifier. Subsetting is often used in combination with an association
end that is a derived union. In this case the subsetted association is
like an abstract association and the subsetting association is a
specialization.
 
Hope this helps
 
    -Earl Waldin
----------------------------------------------------------------------
Earl Waldin                             tel: +41 31 828 9222
Paranor AG                              fax: +41 31 828 9299
Juraweg 14                              email: earl.waldin at paranor.ch
CH-3046 Wahlendorf
Switzerland
----------------------------------------------------------------------


-----Original Message-----
From: puml-list-request@cs.york.ac.uk
[mailto:puml-list-request@cs.york.ac.uk] On Behalf Of Milan Milanovic
Sent: Thursday, 31 May, 2007 12:48
To: puml-list@cs.york.ac.uk
Subject: A question about association specialization!


Hi all,
 
can anyone give a little better explanation of the association
specialization than
it is given in UML Superstructure document? I see that there are two
types of 
this specialization: subsets and redefines, but I'm not sure of its
meaning and their
connection to the classes inheritance which they connects.

_____________________________
Best regards, Milan Milanovic
M.Sc. candidate 
 
GOOD OLD AI Laboratory
Faculty of Organizational Sciences
Department of Information Systems and Technologies
University of Belgrade

  _____  

Park yourself in front of a world of choices in alternative vehicles.
Visit
<http://us.rd.yahoo.com/evt=48246/*http://autos.yahoo.com/green_center/;
_ylc=X3oDMTE5cDF2bXZzBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDZ3JlZW4tY2V
udGVy> the Yahoo! Auto Green Center.
Received on Fri 01 Jun 2007 - 18:11:39 BST