Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:58 Go to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
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)?


My company: Sytematic, building business software from models.
Re: Injecting a model into a .xmi is very slow [message #636964 is a reply to message #636963] Wed, 03 November 2010 15:01 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
Or might it be slow because of my language grammar? It truly is a very simple language, with a grammar of like 20 lines...

My company: Sytematic, building business software from models.
Re: Injecting a model into a .xmi is very slow [message #636969 is a reply to message #636963] Wed, 03 November 2010 15:24 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
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 15:56 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
I'm sorry, but what do you mean with 'using directly'? Do you mean remove the AnnotationDSLStandaloneSetup.doSetup();
call?


could you give an example?


My company: Sytematic, building business software from models.

[Updated on: Wed, 03 November 2010 15:57]

Report message to a moderator

Re: Injecting a model into a .xmi is very slow [message #636983 is a reply to message #636963] Wed, 03 November 2010 16:25 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
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 22:49 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
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 10:12 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
Okay thanks, that works way quicker Smile



My company: Sytematic, building business software from models.
Re: Injecting a model into a .xmi is very slow [message #637423 is a reply to message #636964] Fri, 05 November 2010 12:39 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
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


---
Get professional support from the Xtext committers at www.typefox.io
Re: Injecting a model into a .xmi is very slow [message #637434 is a reply to message #636963] Fri, 05 November 2010 13:47 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
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.


My company: Sytematic, building business software from models.
Re: Injecting a model into a .xmi is very slow [message #637507 is a reply to message #637434] Fri, 05 November 2010 21:44 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
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: Thu Apr 25 06:35:56 GMT 2024

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

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

Back to the top