Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Modelling an EMF model from memory
Modelling an EMF model from memory [message #1829771] Fri, 10 July 2020 11:19 Go to next message
Jad El-khoury is currently offline Jad El-khouryFriend
Messages: 46
Registered: August 2015
Member
Is it possible to represent an EMF model with Sirius, where the model is not persistent on file?

I am quite familiar with EMF and Sirius, but I normally work with EMF models persistent on file.

In this particular scenario, I would like to have a Sirius Diagram of EMF data (based on a specific metamodel), where the EMF data (eclasse, etc) is created dynamically, based on some calls to web services.

Is that possible?

My idea was to based on the Sirius Digram on an empty EMF resource (no eclasses in it). The Sirius Description then calls a number of java services that return sets of Eclasses, etc.

Is this a sustainable approach? Is there a better one?
Re: Modelling an EMF model from memory [message #1829806 is a reply to message #1829771] Fri, 10 July 2020 19:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6875
Registered: July 2009
Senior Member
Hi

All EMF usage occurs in memory. It is just a common practice to load beforehand and save afterwards. You can create directly in memory if you want.

Regards

Ed Willink
Re: Modelling an EMF model from memory [message #1829856 is a reply to message #1829806] Mon, 13 July 2020 07:09 Go to previous messageGo to next message
Jad El-khoury is currently offline Jad El-khouryFriend
Messages: 46
Registered: August 2015
Member
Thanks Ed. But how can I tell Sirius "to load"?

Normally (when using files), this loading into memory is transparent. All i ever needed to do was to set the appropriate Viewpoint in the modelling project, that contained the EMF file.

How can I in this case, tell SIrius that the data is already in memory?

Re: Modelling an EMF model from memory [message #1829868 is a reply to message #1829856] Mon, 13 July 2020 08:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6875
Registered: July 2009
Senior Member
Hi

No idea, but the debugger is your friend.

See where the resource is loaded. There are 3 XMLResourceImpl doLoad routines to choose from; it's usually the InputStream one, but you can set a breakpoint on all 3 just in case. Easier if you have a custom resource to add dummy overrides so that you avoid breakpoint hits on all the other resources. Once you know how Sirius loads your resource you can examine the call tree to find a suitable point at which to intercept the behaviour. If the worst comes to the worst, you can write yourself a NotReallyAStrreamStream that pretends to access your model from a file. But you should just be able to flip to use your prelaoded resource.

Regards

Ed Willink
Re: Modelling an EMF model from memory [message #1830390 is a reply to message #1829868] Fri, 24 July 2020 14:26 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 496
Registered: July 2009
Location: Nantes, France
Senior Member
Hi Jad,

Sirius currently requires that EObject belongs to a Resource.
It provies a InMemoryResource (memory://, org.eclipse.sirius.tools.internal.resource.InMemoryResourceFactoryImpl, org.eclipse.sirius.tools.internal.resource.InMemoryResourceImpl)

A possibility might be to create such in memory resource, then create a session with a local aird file referencing this resource in its semantic resource.
You might need to hook the load of this resource or the opening of the session in order to put your data in its content.

Regards


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

Join the Sirius community at SiriusCon. Register for free: Nov. 9th Paris
http://www.siriuscon.org/
Re: Modelling an EMF model from memory [message #1830572 is a reply to message #1830390] Wed, 29 July 2020 10:18 Go to previous message
Jad El-khoury is currently offline Jad El-khouryFriend
Messages: 46
Registered: August 2015
Member
Hi

I've been trying to update the EMF generated methods to create Eobjects on the fly, but as you explained Maxime this fails because Sirius tries to resolve the EObject, and identify which Resource it belongs to.
I'll give this InMemoryResource a try. Any examples of such use? I tried to figure how and when to create such EMF resources in relation to the Sirius Session, but can't get the big picture in place.
Previous Topic:CrossTable: Delete tool
Next Topic:Ho can I get x and y in layoutConstraint in representations.aird from a session?
Goto Forum:
  


Current Time: Tue Oct 27 16:07:32 GMT 2020

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

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

Back to the top