Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » UML and multiple/diamond inheritance
UML and multiple/diamond inheritance [message #475206] Thu, 23 August 2007 15:05 Go to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
Hi newsgroup,

I'm working on a heavyweight extension of the UML metamodel.

So my problem is that I have the case in which two classes
called A and B inherit from uml::Class, and another class X is
inheriting from A and B. (Aka. diamond inheritance)

What happens in X, if a feature of uml::Class is redefined (and renamed)
only in A, but not in B? Are both features available?
( I'd like to have only the redefined one to be there in X! ;) )

Besides, is there a problem, if A as well as B contain features with
the same name and type?

Kind regards, Andreas
Re: UML and multiple/diamond inheritance [message #475220 is a reply to message #475206] Fri, 24 August 2007 15:13 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Andreas,

I think that whether both features are available in X would depend on the
properties of the features involved. If you look at
SequenceNode:executableNode redefining StructuredActivityNode:node. Both
are containment features and one redefines the other and both
executableNode and node are available in the specializing SequenceNode.

You can deal with features of identical name and type with the various
options you can pass to the merge process.
You might want to check out UMLUtil.isRedefinitionValid and experiment with
the "Different Property Uniqueness" and "Invalid Redefinitions" options.

I will try to document these options in more detail at some later point.

I hope this helps in some way :). Kenn would be able to produce a more
coherent response since he knows such details intimately.

- James.


"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
>
> I'm working on a heavyweight extension of the UML metamodel.
>
> So my problem is that I have the case in which two classes
> called A and B inherit from uml::Class, and another class X is
> inheriting from A and B. (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available?
> ( I'd like to have only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with
> the same name and type?
>
> Kind regards, Andreas
>
>
Re: UML and multiple/diamond inheritance [message #475265 is a reply to message #475206] Tue, 28 August 2007 23:12 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Andreas,

I would expect that only the redefinition of the feature (from A) is
"available" in X. If both A and B contain features with the same name/type,
I'd say that yes, you have a problem - this situation is best avoided in
general. In practice, this can perhaps be addressed by defining a new
feature (again with the same name and type) that redefines both of the
inherited features. Otherwise, the UML2 code generator will rename one of
the inherited features to make it distinct.

Note that mapping redefinitions to an implementation in a language like Java
isn't trivial; in the UML2 code generator, we've tried to support some of
the common scenarios (e.g. those found in UML itself), but I'm sure some
scenarios aren't being handled properly. If you run into problems, let us
know!

Kenn

"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
> I'm working on a heavyweight extension of the UML metamodel.
> So my problem is that I have the case in which two classes called A and B
> inherit from uml::Class, and another class X is inheriting from A and B.
> (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available? ( I'd like to have
> only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with the
> same name and type?
>
> Kind regards, Andreas
>
>
Re: UML and multiple/diamond inheritance [message #624526 is a reply to message #475206] Fri, 24 August 2007 15:13 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Andreas,

I think that whether both features are available in X would depend on the
properties of the features involved. If you look at
SequenceNode:executableNode redefining StructuredActivityNode:node. Both
are containment features and one redefines the other and both
executableNode and node are available in the specializing SequenceNode.

You can deal with features of identical name and type with the various
options you can pass to the merge process.
You might want to check out UMLUtil.isRedefinitionValid and experiment with
the "Different Property Uniqueness" and "Invalid Redefinitions" options.

I will try to document these options in more detail at some later point.

I hope this helps in some way :). Kenn would be able to produce a more
coherent response since he knows such details intimately.

- James.


"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
>
> I'm working on a heavyweight extension of the UML metamodel.
>
> So my problem is that I have the case in which two classes
> called A and B inherit from uml::Class, and another class X is
> inheriting from A and B. (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available?
> ( I'd like to have only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with
> the same name and type?
>
> Kind regards, Andreas
>
>
Re: UML and multiple/diamond inheritance [message #624555 is a reply to message #475206] Tue, 28 August 2007 23:12 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Andreas,

I would expect that only the redefinition of the feature (from A) is
"available" in X. If both A and B contain features with the same name/type,
I'd say that yes, you have a problem - this situation is best avoided in
general. In practice, this can perhaps be addressed by defining a new
feature (again with the same name and type) that redefines both of the
inherited features. Otherwise, the UML2 code generator will rename one of
the inherited features to make it distinct.

Note that mapping redefinitions to an implementation in a language like Java
isn't trivial; in the UML2 code generator, we've tried to support some of
the common scenarios (e.g. those found in UML itself), but I'm sure some
scenarios aren't being handled properly. If you run into problems, let us
know!

Kenn

"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
> I'm working on a heavyweight extension of the UML metamodel.
> So my problem is that I have the case in which two classes called A and B
> inherit from uml::Class, and another class X is inheriting from A and B.
> (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available? ( I'd like to have
> only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with the
> same name and type?
>
> Kind regards, Andreas
>
>
Previous Topic:Re: errors while metamodeling
Next Topic:Re: errors while metamodeling
Goto Forum:
  


Current Time: Sat Apr 27 03:40:32 GMT 2024

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

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

Back to the top