Skip to main content



      Home
Home » Eclipse Projects » Sirius » Modelling an EMF model from memory
Modelling an EMF model from memory [message #1829771] Fri, 10 July 2020 07:19 Go to next message
Eclipse UserFriend
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 15:22 Go to previous messageGo to next message
Eclipse UserFriend
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 03:09 Go to previous messageGo to next message
Eclipse UserFriend
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 04:54 Go to previous messageGo to next message
Eclipse UserFriend
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 10:26 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Modelling an EMF model from memory [message #1830572 is a reply to message #1830390] Wed, 29 July 2020 06:18 Go to previous message
Eclipse UserFriend
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: Mon Jun 16 15:34:33 EDT 2025

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

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

Back to the top