Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Save Emf probleme with many reference to save(EMF Ecore save)
Save Emf probleme with many reference to save [message #1804842] Tue, 02 April 2019 08:04 Go to next message
Quentin Vaccaro is currently offline Quentin VaccaroFriend
Messages: 1
Registered: April 2019
Junior Member
Hi,

I use a Ecore model for generate domain code for my application.
In this model i have many Reference to a Object locate in a other file whom i don't know the path before i start the application.

This is a exemple of the persisting file,
index.php/fa/35186/0/

I use save provide by emf on ecore
		Resource resource = resourceSet.getResource(uri, true);
		resource.getContents().clear();
		resource.getContents().add(this.model);

		final Map<Object, Object> saveOptions = new HashMap<Object, Object>();

		try {
			String timeColonPattern = "HH:mm:ss SSS";
			DateTimeFormatter timeColonFormatter = DateTimeFormatter.ofPattern(timeColonPattern);
			LocalTime localTime = LocalTime.now();
			System.out.println("begin save :" + localTime.format(timeColonFormatter));
			resource.save(saveOptions);
			localTime = LocalTime.now();
			System.out.println("end save :" + localTime.format(timeColonFormatter));
		} catch (IOException e) {
			e.printStackTrace();
		}

When i have a little model , there no problem the saving is quick and work, but when i have to save a bigger model, as the example the file write 50 000 lines and it's take 10/15 min .
So i remove all the reference, i replace by a string and it's take less than 1 sec to save.

The problem is that i need this reference to the object, but i don't want to wait 15min all the time i want to save, same for the load.

How can i do that ? if is possible to not change the Ecore model ?
  • Attachment: exemple.png
    (Size: 13.00KB, Downloaded 206 times)
Re: Save Emf probleme with many reference to save [message #1805013 is a reply to message #1804842] Thu, 04 April 2019 15:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
You should measure it with a profiler such as YourKit. A poor-man's approach is to periodically stop the thread and see what it's doing at that point and hope you find the slow thing because it's so long/often on the stack. You're hrefs suggest that each referenced object is in the root of a separate resource so are there really such a huge number of resources involved?

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save Emf probleme with many reference to save [message #1805021 is a reply to message #1805013] Thu, 04 April 2019 15:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your model looks to be very flat so you may be experiencing the quadratic URI allocation reported in https://bugs.eclipse.org/bugs/show_bug.cgi?id=544951

You can workaround the problem by allocating the URIs yourself in linear time in a Save helper. org.eclipse.ocl.pivot.internal.resource.PivotSaveImpl uses an AS2ID class to assign xmi:id values in a deterministic semantically sensitive fashion. It may give you some ideas for a simple allocation. (You only need a complicated allocator if you want auto-generated xmi:id values to be substantially unchanged after a model change.)

Regards

Ed Willink
Re: Save Emf probleme with many reference to save [message #1805027 is a reply to message #1805021] Thu, 04 April 2019 16:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
How can his save operation in any way relate to a bug about an unload operation? I don't see any use of IDs, xmi or otherwise in his example. This just seems like unhelpful noise from your soap box...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Save Emf probleme with many reference to save [message #1805040 is a reply to message #1805027] Thu, 04 April 2019 17:55 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Both save and unload allocate all the URIs.

Regards

Ed Willink
Previous Topic:Loading different models concurrently synchronisation.
Next Topic:Is there a "CanAdd" API?
Goto Forum:
  


Current Time: Thu Apr 25 16:26:37 GMT 2024

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

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

Back to the top