Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » [Fixed]Does meaning of "supertype" includes realized interfaces ?("supertype" is often used in the UML specification but not detailed)
[Fixed]Does meaning of "supertype" includes realized interfaces ? [message #511332] Mon, 01 February 2010 10:09 Go to next message
Vincent   is currently offline Vincent Friend
Messages: 35
Registered: December 2009
Member
Hello everyone.
The "supertype" term often appears in the UML specification but I can't find a place where it is clearly defined.
The example by which I am concerned is in page 389 of UML Superstructure Specification v2.2 (constraint 2 of Package BasicActivities, about object flows) :

Object nodes connected by an object flow, (...), must have compatible types. In
particular, the downstream object node type must be the same or a supertype of the upstream object node type.


I was trying to know how to determine whether a type is supertype of another, to check the model validity.

My first idea was to use method org.eclipse.uml2.uml.Type.conformsTo(Type) to check whether the child type conforms to its supertype.

But this method checks only with generalizations, which means when ClassA implements InterfaceB, ClassA.conformsTo(InterfaceB) returns false (which by the way is in accordance with the specification).

So, should "supertypes" include generalizations and implemented interfaces (known from a BehavioredClassifier) ? Or am I missing an important semantic point?
Are there other relationships that I am forgetting which make a type "supertype" of another one ?

Thanks in advance for your answers.

[Updated on: Mon, 01 February 2010 15:53]

Report message to a moderator

Re: Does meaning of "supertype" includes realized interfaces ? [message #511406 is a reply to message #511332] Mon, 01 February 2010 09:50 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

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

Hi, Vincent,

Interfaces in UML are not supertypes of the classifiers that
realize/implement them, but only of other interfaces through
generalization. The Generalization relationship is the only one that
defines type conformance. This is very different from interfaces in
Java.

Your concrete UML class that realizes an interface must re-declare all
of the features defined by the interface, though UML allows for some
variability (presumably specific to implementation language mappings) in
how that may be done. For example, a Paintable interface with a
"color : Color" attribute could be realized by a class that manifests
this attribute as a pair of "getColor() : Color" and "setColor(Color)"
operations.

Oddly, an InstanceSpecification can be directly classified by an
interface, presumably as a partial description of an object of some
unspecified class that might implement that interface. But then, that
would seem to imply that there *should* be generalization semantics in
the implementation of interfaces. It seems inconsistent to me ... I
appreciate why the UML deliberately separates interface-as-contract from
taxonomy, but it has awkward consequences.

HTH,

Christian


On Mon, 2010-02-01 at 05:09 -0500, Vincent H wrote:

> Hello everyone.
> The "supertype" term often appears in the UML specification but I can't find a place where it is clearly defined.
> The example by which I am concerned is in page 389 of UML Superstructure Specification v2.2 (constraint 2 of Package BasicActivities, about object flows) :
>
> Object nodes connected by an object flow, (...), must have compatible types. In
> particular, the downstream object node type must be the same or a supertype of the upstream object node type.
>
> I was trying to know how to determine whether a type is supertype of another, to check the model validity.
>
> My first idea was to use method org.eclipse.uml2.uml.Type.conformsTo(Type) to check whether the child type conforms to its supertype.
>
> But this method checks only with generalizations, which means when ClassA implements InterfaceB, ClassA.conformsTo(InterfaceB) returns false (which by the way is in accordance with the specification).
>
> So, should "supertypes" include generalizations and implemented interfaces (known from a BehavioredClassifier) ? Or am I missing an important semantic point?
> Are there other relationships that I am forgetting which make a type "supertype" of another one ?
>
> Thanks in advance for your answers.

--=-wFZ9q4QoDY5CD4NAgVEc
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.24.1.1">
</HEAD>
<BODY>
Hi, Vincent,<BR>
<BR>
Interfaces in UML are not supertypes of the classifiers that realize/implement them, but only of other interfaces through generalization.&nbsp; The Generalization relationship is the only one that defines type conformance.&nbsp; This is very different from interfaces in Java.<BR>
<BR>
Your concrete UML class that realizes an interface must re-declare all of the features defined by the interface, though UML allows for some variability (presumably specific to implementation language mappings) in how that may be done.&nbsp; For example, a Paintable interface with a &quot;color : Color&quot; attribute could be realized by a class that manifests this attribute as a pair of &quot;getColor() : Color&quot; and &quot;setColor(Color)&quot; operations.<BR>
<BR>
Oddly, an InstanceSpecification can be directly classified by an interface, presumably as a partial description of an object of some unspecified class that might implement that interface.&nbsp; But then, that would seem to imply that there *should* be generalization semantics in the implementation of interfaces.&nbsp; It seems inconsistent to me ... I appreciate why the UML deliberately separates interface-as-contract from taxonomy, but it has awkward consequences.<BR>
<BR>
HTH,<BR>
<BR>
Christian<BR>
<BR>
<BR>
On Mon, 2010-02-01 at 05:09 -0500, Vincent H wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hello everyone.
The &quot;supertype&quot; term often appears in the UML specification but I can't find a place where it is clearly defined.
The example by which I am concerned is in page 389 of UML Superstructure Specification v2.2 (constraint 2 of Package BasicActivities, about object flows) :

Object nodes connected by an object flow, (...), must have compatible types. In
particular, the downstream object node type must be the same or a supertype of the upstream object node type.

I was trying to know how to determine whether a type is supertype of another, to check the model validity.

My first idea was to use method org.eclipse.uml2.uml.Type.conformsTo(Type) to check whether the child type conforms to its supertype.

But this method checks only with generalizations, which means when ClassA implements InterfaceB, ClassA.conformsTo(InterfaceB) returns false (which by the way is in accordance with the specification).

So, should &quot;supertypes&quot; include generalizations and implemented interfaces (known from a BehavioredClassifier) ? Or am I missing an important semantic point?
Are there other relationships that I am forgetting which make a type &quot;supertype&quot; of another one ?

Thanks in advance for your answers.
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-wFZ9q4QoDY5CD4NAgVEc--
Re: Does meaning of "supertype" includes realized interfaces ? [message #511442 is a reply to message #511406] Mon, 01 February 2010 15:52 Go to previous message
Vincent   is currently offline Vincent Friend
Messages: 35
Registered: December 2009
Member
Thank you very much.
Your answer clarifies everything.
Previous Topic:[Announce] MDT UML2 3.1.0M5 is available
Next Topic:Does meaning of "supertype" includes realized interfaces ?
Goto Forum:
  


Current Time: Fri Apr 26 20:47:37 GMT 2024

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

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

Back to the top