Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Injecting a model into a .xmi is very slow
Injecting a model into a .xmi is very slow [message #636963] Wed, 03 November 2010 10:58 Go to next message
Eclipse UserFriend
Hello

I created my own little language (called AnnotationDSL) in Xtext, and I want to inject it into an EMF in-memory model to process using some other MDE tools (ie. model transformation tools).

It all works, but it seems that the standAloneSetup is very slow, it takes like 7 seconds to inject a model.

What is the best way to do this from java? I run the piece of code below as an ANT task that I created myself (running the ANT script from eclipse). Is this a good approach?
AnnotationDSLStandaloneSetup.doSetup();
ResourceSet rs = new ResourceSetImpl();
Resource res = rs.getResource(URI.createURI("file://"+this.AnnotationModel), true);
		
EObject eobject = res.getContents().get(0);


is there another way to inject a model from ant script, such that I can use the resulting in memory model for the rest of the processing (then I might not need the piece of java anymore)?
Re: Injecting a model into a .xmi is very slow [message #636964 is a reply to message #636963] Wed, 03 November 2010 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Or might it be slow because of my language grammar? It truly is a very simple language, with a grammar of like 20 lines...
Re: Injecting a model into a .xmi is very slow [message #636969 is a reply to message #636963] Wed, 03 November 2010 11:24 Go to previous messageGo to next message
Eclipse UserFriend
You can also directly use your file. If you load it using the registered factory generated by Xtext this will behave just like any other model. Only the serialization form changes but the in-memory model will work just as any xmi file.
Re: Injecting a model into a .xmi is very slow [message #636975 is a reply to message #636963] Wed, 03 November 2010 11:56 Go to previous messageGo to next message
Eclipse UserFriend
I'm sorry, but what do you mean with 'using directly'? Do you mean remove the AnnotationDSLStandaloneSetup.doSetup();
call?


could you give an example?

[Updated on: Wed, 03 November 2010 11:57] by Moderator

Re: Injecting a model into a .xmi is very slow [message #636983 is a reply to message #636963] Wed, 03 November 2010 12:25 Go to previous messageGo to next message
Eclipse UserFriend
What you call "injecting" a model, is direct in Xtext. The model is stored in your language and not in XMI but once loaded with the corresponding factory you get an in-memory model just as if it was stored in a XMI format.

So basically you don't need to export it in XMI and you should be able to use the files of your language directly.
Re: Injecting a model into a .xmi is very slow [message #637048 is a reply to message #636963] Wed, 03 November 2010 18:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi Marten,

you should never use the standalone setup inside a running Eclipse.
(Guess where StandloneSetup got its name from ;-)
Simply use resourceSet.getResource(uri).getcontents...

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 03.11.10 15:59, schrieb Marten Sijtema:
> Hello
>
> I created my own little language (called AnnotationDSL) in Xtext, and I
> want to inject it into an EMF in-memory model to process using some
> other MDE tools (ie. model transformation tools).
> It all works, but it seems that the standAloneSetup is very slow, it
> takes like 7 seconds to inject a model.
>
> What is the best way to do this from java? I run the piece of code below
> as an ANT task that I created myself (running the ANT script from
> eclipse). Is this a good approach?
> AnnotationDSLStandaloneSetup.doSetup();
> ResourceSet rs = new ResourceSetImpl();
> Resource res =
> rs.getResource(URI.createURI("file://"+this.AnnotationModel), true);
>
> EObject eobject = res.getContents().get(0);
>
>
> is there another way to inject a model from ant script, such that I can
> use the resulting in memory model for the rest of the processing (then I
> might not need the piece of java anymore)?
Re: Injecting a model into a .xmi is very slow [message #637381 is a reply to message #636963] Fri, 05 November 2010 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Okay thanks, that works way quicker Smile

Re: Injecting a model into a .xmi is very slow [message #637423 is a reply to message #636964] Fri, 05 November 2010 08:39 Go to previous messageGo to next message
Eclipse UserFriend
Sorry. I don't understand, what do you mean by injecting a model?
Why and how do you do that?

Am 03.11.10 16:01, schrieb Marten Sijtema:
> Or might it be slow because of my language grammar? It truly is a very
> simple language, with a grammar of like 20 lines...


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Injecting a model into a .xmi is very slow [message #637434 is a reply to message #636963] Fri, 05 November 2010 09:47 Go to previous messageGo to next message
Eclipse UserFriend
Well, I am from the ATL community, and new to XText. There they call the process of getting a textual model (in your own defined syntax) into memory 'injecting'.

I thought this was common terminology, but appearantly is not.

So: injection = getting a textual model with specific syntax into memory where it is an EMF object.
Re: Injecting a model into a .xmi is very slow [message #637507 is a reply to message #637434] Fri, 05 November 2010 17:44 Go to previous message
Eclipse UserFriend
Right, in this part of the (Eclipse) universe we call the right-hand side of that equation "resource loading" or "parsing" Wink
Previous Topic:Re: using AbstractXtextTests
Next Topic:Validation with StandaloneSetup
Goto Forum:
  


Current Time: Wed Sep 24 16:37:27 EDT 2025

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

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

Back to the top