Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Multiple Inheritance - Some mix-ins not created?
Multiple Inheritance - Some mix-ins not created? [message #553288] Tue, 17 August 2010 01:12 Go to next message
Kirsten M. Z. is currently offline Kirsten M. Z.Friend
Messages: 132
Registered: July 2010
Senior Member
Hi @all,

I have read through several documents and even some old posts on this forum about EMF and multiple inheritance. And, of course, I know the problems of mapping multiple inheritance to technical realization, e.g. Java code.

What I could get from the documents I found (please feel free to add references to more detailed material here), EMF model code generation is doing its best and creates mixins.

However, I wonder why my model code still has some unimplemented code (which means that I don't even get an placeholder). My unqualified assumption is that there is a problem with mixing a special category of references. However, it could be my fault, and my use case simply violates all rules again (*sigh*).

Stuff for reproducing the problem (Topcased 4.0.0 - Eclipse 3.6.0):

Ecore File:
------------

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
nsURI="test" nsPrefix="test">
<eClassifiers xsi:type="ecore:EClass" name="NewClass" eSuperTypes=" platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Mult iplicityElement platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Name dElement "/>
</ecore:EPackage>

GenModel File:
----------------
(default - no modification)

Now generate Model code.

Errors (Java Compiler):
-------------

Description Resource Path Location Type
The type NewClassImpl must implement the inherited abstract method NamedElement.createNameExpression(String, Type) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem
The type NewClassImpl must implement the inherited abstract method NamedElement.getClientDependency(String, boolean, EClass) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem
The type NewClassImpl must implement the inherited abstract method NamedElement.getClientDependency(String) NewClassImpl.java /TestProjekt/src/test/impl line 64 Java Problem


-------------

I would expect that the missing methods are at least generated in a form many others are, e.g.:

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getQualifiedName() {
// TODO: implement this method to return the 'Qualified Name' attribute
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}

Regards,
Kirsten
Re: Multiple Inheritance - Some mix-ins not created? [message #553295 is a reply to message #553288] Tue, 17 August 2010 02:19 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Kirsten,

Comments below.

vultur wrote:
> Hi @all,
>
> I have read through several documents and even some old posts on this
> forum about EMF and multiple inheritance. And, of course, I know the
> problems of mapping multiple inheritance to technical realization,
> e.g. Java code.
>
> What I could get from the documents I found (please feel free to add
> references to more detailed material here), EMF model code generation
> is doing its best and creates mixins.
>
> However, I wonder why my model code still has some unimplemented code
> (which means that I don't even get an placeholder). My unqualified
> assumption is that there is a problem with mixing a special category
> of references. However, it could be my fault, and my use case simply
> violates all rules again (*sigh*).
>
> Stuff for reproducing the problem (Topcased 4.0.0 - Eclipse 3.6.0):
>
> Ecore File:
> ------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="NewClass" eSuperTypes="
> platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Mult
> iplicityElement
> platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Name dElement "/>
> </ecore:EPackage>
>
> GenModel File:
> ----------------
> (default - no modification)
>
> Now generate Model code.
>
> Errors (Java Compiler):
> -------------
>
> Description Resource Path Location Type
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.createNameExpression(String, Type)
> NewClassImpl.java /TestProjekt/src/test/impl line 64 Java
> Problem
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.getClientDependency(String, boolean, EClass)
> NewClassImpl.java /TestProjekt/src/test/impl line 64 Java
> Problem
> The type NewClassImpl must implement the inherited abstract method
> NamedElement.getClientDependency(String) NewClassImpl.java
> /TestProjekt/src/test/impl line 64 Java Problem
>
>
> -------------
>
> I would expect that the missing methods are at least generated in a
> form many others are, e.g.:
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public String getQualifiedName() {
> // TODO: implement this method to return the 'Qualified Name'
> attribute
> // Ensure that you remove @generated or mark it @generated NOT
> throw new UnsupportedOperationException();
> }
UML is generated from an extended GenModel so I think extensions of UML2
need to use that extended GenModel as well. Have a look at UML2's
GenModel. I think you can turn your existing *.genmodel into a UML2 one
just by changing the namespace of the xmlns declaration...
>
> Regards,
> Kirsten


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple Inheritance - Some mix-ins not created? [message #553395 is a reply to message #553295] Tue, 17 August 2010 12:00 Go to previous messageGo to next message
Kirsten M. Z. is currently offline Kirsten M. Z.Friend
Messages: 132
Registered: July 2010
Senior Member
> UML is generated from an extended GenModel so I think extensions of UML2
> need to use that extended GenModel as well. Have a look at UML2's
> GenModel. I think you can turn your existing *.genmodel into a UML2 one
> just by changing the namespace of the xmlns declaration...

I changed the namespace to

xmlns:genmodel="http://www.eclipse.org/uml2/2.2.0/GenModel"

Then I was able to adjust some additional UML2 settings for generation... However, I was not able to generate working code, neither with the simple xmlns change, nor a complete customization of my *.genmodel file (and I checked the original uml.genmodel file for its settings). The more changes I made, the more errors I got. The method "createNameExpression", for example, has never been generated.

In my opinion, only some step-by-step instructions would help me (and possibly some other people) generating their UML extensions. Otherwise, I am like a blind person stumbling in the darkness of hundreds of generation settings.
Re: Multiple Inheritance - Some mix-ins not created? [message #553459 is a reply to message #553395] Tue, 17 August 2010 15:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Kirsten,

I thought the details of how to extend UML2 were document somewhere. If
not, you'll need to ask about it on the UML2 newsgroup.


vultur wrote:
>> UML is generated from an extended GenModel so I think extensions of
>> UML2 need to use that extended GenModel as well. Have a look at
>> UML2's GenModel. I think you can turn your existing *.genmodel into a
>> UML2 one just by changing the namespace of the xmlns declaration...
>
> I changed the namespace to
> xmlns:genmodel="http://www.eclipse.org/uml2/2.2.0/GenModel"
>
> Then I was able to adjust some additional UML2 settings for
> generation... However, I was not able to generate working code,
> neither with the simple xmlns change, nor a complete customization of
> my *.genmodel file (and I checked the original uml.genmodel file for
> its settings). The more changes I made, the more errors I got. The
> method "createNameExpression", for example, has never been generated.
>
> In my opinion, only some step-by-step instructions would help me (and
> possibly some other people) generating their UML extensions.
> Otherwise, I am like a blind person stumbling in the darkness of
> hundreds of generation settings.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple Inheritance - Some mix-ins not created? [message #553523 is a reply to message #553459] Tue, 17 August 2010 19:31 Go to previous messageGo to next message
Kirsten M. Z. is currently offline Kirsten M. Z.Friend
Messages: 132
Registered: July 2010
Senior Member
Ed, thank you very much so far.

If people in another group can help me, is it possible to move this topic?

For anyone's convenience:
There is a good overview on the UML2 project's main page. It even gives details about possibilities for extending UML. As far as I can see from the documents I have read, I am trying to create a middle-weight extension. Unfortunatly, the documents do not provide step-by-step details or real examples for this approach, especially for given tools/editors.

http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Custo mizing_UML2_Which_Technique_is_Right_For_You/article.html
Re: Multiple Inheritance - Some mix-ins not created? [message #553529 is a reply to message #553523] Tue, 17 August 2010 20:05 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Vultur

The UML2 genmodel has many subtle differences from the Ecore one.

I recommend formulating your example as a *.uml file so that you get a
correct genmodel file generated by the UML importer.

If this works compare them to find the difference.

If not file a bug.

Regards

Ed Willink

On 17/08/2010 20:31, vultur wrote:
> Ed, thank you very much so far.
>
> If people in another group can help me, is it possible to move this topic?
>
> For anyone's convenience:
> There is a good overview on the UML2 project's main page. It even gives
> details about possibilities for extending UML. As far as I can see from
> the documents I have read, I am trying to create a middle-weight
> extension. Unfortunatly, the documents do not provide step-by-step
> details or real examples for this approach, especially for given
> tools/editors.
>
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Custo mizing_UML2_Which_Technique_is_Right_For_You/article.html
>
Previous Topic:EMF Model Query and Multithreading
Next Topic:NPE - In EMF 2.5 it works fine, because setting delegates are adding newly in EMP2.6
Goto Forum:
  


Current Time: Fri Apr 26 06:46:09 GMT 2024

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

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

Back to the top