Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA2 » Importing Ecore metamodel into Modelspace with VIATRA2 R3.1
Importing Ecore metamodel into Modelspace with VIATRA2 R3.1 [message #645078] Wed, 15 December 2010 14:15 Go to next message
Tassilo Horn is currently offline Tassilo HornFriend
Messages: 93
Registered: July 2009
Member
Hi all,

I want to do my first VIATRA2 transformation, but I am unable to get my
models imported. I have a source and a target metamodel as Ecore
models, and an EMF model conforming to the source metamodel.

So I've created a new project including a new model space (New > VIATRA2
VPM Model Space). In the wizard, I have included VDM Core and UML, but
I don't know if that's needed.

So what now? How do I import the metamodels from the Ecore files?

The getting started guide

http://wiki.eclipse.org/VIATRA2/GettingStarted/Using_Transfo rmations

only tells me how to import models and mentions the requirement that the
metamodel has to be present in the importing model space. This
requirement is not met for me, and I can neither drag & drop the
metamodel nor a model into my fresh modelspace (or at least, that
doesn't change and I don't get any messages in the VIATRA2 Console).

Maybe that's related: In Preferences > VIATRA2 > UML2 Importer, the
"Ignore specified profiles" option is activated and ecore and Ecore are
in the ignore list. But I don't get any different behavior when
deactivating the option.

Thanks a lot for any hints!
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Importing Ecore metamodel into Modelspace with VIATRA2 R3.1 [message #645142 is a reply to message #645078] Wed, 15 December 2010 16:54 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 222
Registered: July 2009
Senior Member
If I understand your issue correctly, you are trying to load an existing EMF model (but not a UML model) to the model space.

Currently, there are no ecore importers in the release (only the UML importer that you have seen).

Such an importer can be downloaded from our external source repository. Use the following project:

https://svn.inf.mit.bme.hu/viatra/viatra_extra/R3/mit.bme.hu /trunk/ViatraEMF/code/hu.optxware.emf2viatra.core/

After this project is included, ecore metamodels can be imported using drag'n'drop, while the instance models (resources) can be loaded using the right click menu.

I hope, this helps, otherwise feel free to ask for further details.

Zoltán Ujhelyi
Re: Importing Ecore metamodel into Modelspace with VIATRA2 R3.1 [message #645235 is a reply to message #645142] Thu, 16 December 2010 07:59 Go to previous messageGo to next message
Tassilo Horn is currently offline Tassilo HornFriend
Messages: 93
Registered: July 2009
Member
Zoltán Ujhelyi <ujhelyiz@mit.bme.hu> writes:

Hi Zoltán,

> If I understand your issue correctly, you are trying to load an
> existing EMF model (but not a UML model) to the model space.

Exactly.

> Such an importer can be downloaded from our external source
> repository. Use the following project:
>
> https://svn.inf.mit.bme.hu/viatra/viatra_extra/R3/mit.bme.hu /trunk/ViatraEMF/code/hu.optxware.emf2viatra.core/
>
> After this project is included, ecore metamodels can be imported using
> drag'n'drop, while the instance models (resources) can be loaded using
> the right click menu.

I've checked that out and imported it into my Eclipse workspace. Then I
did "Run as > Eclipse Application" on that project, and a new Eclipse
instance was started.

In that, I've imported my VIATRA2 project and the two other projects
containing the Ecore metamodels and EMF instances. Dragging and
dropping an Ecore metamodel into my model space produces this error
message in the VIATRA2 Console:

[fatal] Error executing task 'Drag-and-drop operation'
(java.lang.reflect.InvocationTargetException) [null]

In the other eclipse instance, I have a full backtrace in Console:

--8<---------------cut here---------------start------------->8---
!ENTRY VIATRA2 4 1 2010-12-16 08:53:36.182
!MESSAGE Error executing task 'Drag-and-drop operation' (java.lang.reflect.InvocationTargetException) [null]
[fatal] Error executing task 'Drag-and-drop operation' (java.lang.reflect.InvocationTargetException) [null]
java.lang.reflect.InvocationTargetException
at org.eclipse.viatra2.frameworkgui.views.FrameworkDropTargetAd apter$5.run(FrameworkDropTargetAdapter.java:201)
at org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:121)
Caused by: org.eclipse.viatra2.framework.FrameworkException: Native import ended with error
at org.eclipse.viatra2.framework.Framework.nativeImport(Framewo rk.java:557)
at org.eclipse.viatra2.frameworkgui.views.FrameworkDropTargetAd apter$5.run(FrameworkDropTargetAdapter.java:192)
... 1 more
Caused by: org.eclipse.viatra2.errors.VPMRuntimeException: Error encountered while importing ECore
at hu.optxware.emf2viatra.core.importer.EcoreImporter.processFi le(EcoreImporter.java:107)
at org.eclipse.viatra2.framework.Framework.nativeImport(Framewo rk.java:555)
... 2 more
Caused by: java.lang.NullPointerException
at hu.optxware.emf2viatra.core.managers.EMF2ViatraSynchronizer. getIEntityForEPackage(EMF2ViatraSynchronizer.java:168)
at hu.optxware.emf2viatra.core.managers.EMF2ViatraSynchronizer. getIEntityForEClass(EMF2ViatraSynchronizer.java:127)
at hu.optxware.emf2viatra.core.importer.EcoreImporter.processSu perTypes(EcoreImporter.java:216)
at hu.optxware.emf2viatra.core.importer.EcoreImporter.processFi le(EcoreImporter.java:92)
... 3 more
--8<---------------cut here---------------end--------------->8---

Any idea what's the problem?

As another solution: it's not too hard for me to recreate my metamodels
(and some test instances) as plain UML models using IBM RSA 7.5. Do I
simply need to create a Class Diagram for the metamodel, and a
corresponding Object Diagram for the instance, and then export those to
XMI?

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Importing Ecore metamodel into Modelspace with VIATRA2 R3.1 [message #645245 is a reply to message #645235] Thu, 16 December 2010 08:49 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 222
Registered: July 2009
Senior Member
Can you somehow send me the ecore and instance models to make some more detailed tests? Sadly, this stack trace only contains information that the importer plug-in run into a nullpointer exception, but it is hard to understand why.

--

About the other solution, the UML importer uses a specific ecore importer (for technical reasons about the implementation of the UML model in Eclipse). In other words, the metamodel can be prepopulated into the VPM (when you check the UML model import in the New VPM wizard).

So I don't think, this approach would be useful for you, as in this case you cannot create both your metamodels and models in a simple way.

Zoltán Ujhelyi
Importing UML2 Metamodel & Model from IBM RSA (was: Importing Ecore metamodel into Modelspace wi [message #645246 is a reply to message #645235] Thu, 16 December 2010 09:03 Go to previous messageGo to next message
Tassilo Horn is currently offline Tassilo HornFriend
Messages: 93
Registered: July 2009
Member
Tassilo Horn <horn@uni-koblenz.de> writes:

Hi again,

> As another solution: it's not too hard for me to recreate my
> metamodels (and some test instances) as plain UML models using IBM RSA
> 7.5. Do I simply need to create a Class Diagram for the metamodel,
> and a corresponding Object Diagram for the instance, and then export
> those to XMI?

Now I've done that and exported my metamodel defined by a class diagram
and my instance defined as object diagram to an UML2.1 model. When I
create a new empty model space and drag & drop (or use the context menu
in the model space view), I get an error that uml.metamodel.uml.Integer
is missing.

So I created another model space that includes VTM Core and UML, and did
the same again. Now the import only issued some warnings, but the
problem is that both the imported classes as well as the imported
instances are placed into the model part of the existing UML metamodel.
For example, my UML class diagram defines a class Member. That shows up
as uml.models.MyProject_uml.mypackage.Member with type
uml.metamodel.uml.Class, and no instances.

But of course, my object diagram has an instance of class Member. That
shows up as uml.models.MyProject_uml.mypackage.Chris, with type
uml.metamodel.uml.InstanceSpecification, but no relation to my Member
class at all.

I had expected that the class diagram is a new metamodel, and my object
diagram is an instance thereof.

So it seems to me that in order to do transformations from instances of
custom metamodels, I have to recreate them using the model space editor.
Is that correct?

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: Importing UML2 Metamodel & Model from IBM RSA (was: Importing Ecore metamodel into Modelspac [message #645301 is a reply to message #645246] Thu, 16 December 2010 14:23 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 222
Registered: July 2009
Senior Member
I tested your ecore models, and realized, I forgot to tell the important part of using the EMF importer: you have to have an Ecore meta-metamodel present in the VPM model space in order to import an ecore model (metamodel).

The simplest way to achieve this is the use of the New VPM model space wizard (after the ecore importer is installed) - on the last page you can now select the VIATRA2 nEMF Integration option, that creates the specified metamodel.

This way the importer managed to run in my instance.

---

About the UML approach: unfortunately, VIATRA does not know about the semantics of UML models, so class and object diagrams are not used as two meta-levels, instead they are both instances of the same UML metamodel. As you noted, this is not the behaviour you are looking for.

Instead I suggest giving another try to the ecore importer as described above.

And sorry about forgetting this part.
Zoltán Ujhelyi
Re: Importing UML2 Metamodel & Model from IBM RSA (was: Importing Ecore metamodel into Modelspac [message #645308 is a reply to message #645301] Thu, 16 December 2010 14:30 Go to previous message
Tassilo Horn is currently offline Tassilo HornFriend
Messages: 93
Registered: July 2009
Member
Zoltán Ujhelyi <ujhelyiz@mit.bme.hu> writes:

Hi Zoltán,

> I tested your ecore models, and realized, I forgot to tell the
> important part of using the EMF importer: you have to have an Ecore
> meta-metamodel present in the VPM model space in order to import an
> ecore model (metamodel).

Ah, ok. That makes sense.

> Instead I suggest giving another try to the ecore importer as
> described above.

Now I've already modeled both source and target metamodel, as well as a
source instance in the VDM editor. And my first transformation is also
nearly complete. ;-)

But for the next models, I'll try the ecore approach.

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Previous Topic:Concrete models and VTCL transformations
Next Topic:Please criticise my transformation
Goto Forum:
  


Current Time: Mon Dec 22 03:00:10 GMT 2014

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

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