Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ECL] Problems to get my minimal example running ;-(
[ECL] Problems to get my minimal example running ;-( [message #1328311] Fri, 02 May 2014 16:26 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

I am trying to put together a minimal example for another issue I have with ECL. Unfortunately, I get errors when trying to create EMF models before I'd like to call the ECL module with the problem I want to address.

I attached the ZIP file with the project and a text file with the output of the console. Thanks a lot for your appreciated support!

Kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1333537 is a reply to message #1328311] Mon, 05 May 2014 05:33 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

The following line in ModelFactory doesn't look right:

properties.put(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, metaModelAsFile);

Also, in getLeftModelFile/getProfileModelFile, you may need something in the line of

return new File("res/LeftModel.uml"); / return new File("res/Profile_13189844566037.profile.uml"); instead of ModelFactory.getClass().getResource(...)

On an related note, opening LeftModel.uml, right-clicking its root and selecting "Validate" is producing a number of errors.

I'd suggest trying to load your model programmatically as an EMF resource (without using Epsilon) and once you've got this to work, you can use Epsilon's InMemoryEmfModel class [1] to wrap your loaded resource as an Epsilon-compatible model. If you come across problems while doing the former, I'd suggest posting a message to the UML2 forum (unfortunately, UML/profiles is not my strong suit).

Cheers,
Dimitris

[1] http://download.eclipse.org/epsilon/javadoc/org/eclipse/epsilon/emc/emf/InMemoryEmfModel.html
Re: [ECL] Problems to get my minimal example running ;-( [message #1350566 is a reply to message #1333537] Mon, 12 May 2014 18:28 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks a lot for your analysis and proposals. In the meantime, I indeed have posted a UML2 issue and currently work on solving this first. After that I will get back to you in case the ECL problems are still there...

Kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1357894 is a reply to message #1350566] Thu, 15 May 2014 18:48 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

in the meantime, my UML2 problems have gone, and I am continueing on putting together the example to get the problems with the profile solved. I get a strange error. I get parse problems if I parse the module in my java code. However, if I perform the module via the launch configuration apart from my java code, everything works fine. What might be the reason for this?

In the following, I list the output of my minimal example:

Hello. This is the minimal example to fix my problems with ECL.
Model
Model
Left
Right
C:\ECLTest.ecl
Parse errors occured...
Line: 14, Column: 61, Reason: mismatched input: ';'


Thanks and kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1358304 is a reply to message #1357894] Thu, 15 May 2014 22:56 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

It's hard to tell from the trace provided - other than that the parser thinks that your code contains a misplaced ';' in line 14 Smile

Could you please provide a copy of your code so that I can have a look at this?

Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1372464 is a reply to message #1358304] Wed, 21 May 2014 21:08 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

of course, I provide you the code, see attachment. Just start the Java program "ProPManMinimalExample.java" and you will get the trace output as provided earlier.

Thanks and kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1380872 is a reply to message #1372464] Sun, 25 May 2014 09:14 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

do you have any news on this? At the moment, this problem is the only "showstopper" of my current developments ;-(.

Thanks a lot for a short update on this issue...

Cheers, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1382082 is a reply to message #1380872] Sun, 25 May 2014 21:31 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

Apologies for the slow response. I've had a look at this but I can't find a .ecl file within the attached projects (your code seems to be referring to a .ecl file under C:/). I've also noticed that the project has a number of dependencies on JARs in your local filesystem. Could you please attach a complete/ready-to-run example I can use to reproduce this?

Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1383798 is a reply to message #1382082] Mon, 26 May 2014 14:49 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for getting back to me on this important issue. And sorry, please, not providing you the necessary data.

Now I converted my java project to a plug-in project, containing the manifest. I hope that you are now able to work on the analysis. Please note that a null pointer exception occurs due to a problem with the URL converter. This is an issue I'd like to ask you to look at, too. I have not been able to remove it.

Thanks a lot in advance. In case you need any additional information, please do not hesitate to get back to me.

Cheers, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1383987 is a reply to message #1383798] Tue, 27 May 2014 16:29 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

I'm getting the following (non-Epsilon-related) exception which I'm afraid I'm not sure how to resolve.

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/uml2/uml/profile/l2/L2Package
at org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(UMLResourcesUtil.java:154)

Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1458446 is a reply to message #1383987] Sat, 01 November 2014 11:16 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

hope you are doing well. I've done my preparation work to be able to continue this issue in the meantime. I think that it will be easier for you now to analyze my issue. Unfortunately, despite of the fact that I use the InMemoryEmf approach now, still the error that the stereotype "Left!ProblemStatement" cannot be found, appears.

I also changed my Eclipse environment to Kepler:
- Version: 4.3.2,
- Build id: M20140221-1700.

Epsilon:
- Epsilon Core 1.1.0.201309101707

Further information:
Eclipse JDT (Java Development Tools) Patch with Java 8 support (for Kepler SR2) 1.0.0.v20140317-1956, org.eclipse.jdt.java8patch.feature.group Eclipse.org Eclipse PDE (Plug-in Development Environment) Patch with Java 8 support (for Kepler SR2) 1.0.0.v20140317-1956 org.eclipse.pde.java8patch.feature.group Eclipse.org

I created a runnable jar file, see attachment. If you run the class "MinimalExampleECLModuleForInMemoryEMF", the ECL module "MinimalExampleECLModuleForInMemoryEMF.ecl" is called from within the java program, working on an InMemoryEmfModel.

However, the profile "model.profile.uml" that I created via Papyrus seems not be recognized, as the error "Type 'Left!ProblemStatement' not found (D:\Eclipse\Workspace1\Minimal Example - running ECL module for InMemoryEmfModel\bin\res\MinimalExampleInMemoryEmfModel.ecl@5:27)" appears.

When I create a launch configuration and add the models statically there, then no error appears. Please note that I compare the model with itself (2 times "Left" in the ecl module) due to simplification of the example. If I use 2 different models "Left" and "Right", I get the same error.

Would be great if you are able to support here, as it is quite a showstopper at the moment.

Thanks a lot and kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1458757 is a reply to message #1458446] Sat, 01 November 2014 19:30 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

Debugging this is not straightforward as the attached archive only seems to be containing compiled code. Could you share a copy of your project instead?

Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1459382 is a reply to message #1458757] Sun, 02 November 2014 12:16 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for your quick action on this. I attached my zipped archive. Hope that it works better.

Cheers, Alex

[Updated on: Sun, 02 November 2014 13:03]

Report message to a moderator

Re: [ECL] Problems to get my minimal example running ;-( [message #1461244 is a reply to message #1459382] Tue, 04 November 2014 11:08 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

sorry for asking but would it be possible to give me an update on this issue? The Background is that I have a Workshop soon where I Need to present my results. As this is a Major showstopper, it would be great if I could do progress here. Have you had the Chance to look on it? Does my minimal example hopefully allow Debugging now? If not, please tell me so that I can provide you with the needed Details.

Thanks a lot in advance and Kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1461258 is a reply to message #1461244] Tue, 04 November 2014 11:26 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

The problem appears to be that the profile is not loaded correctly in the standalone mode. I'm not very familiar with loading profile-based UML models from Java so this may take a while to figure out. Could you post a message to the UML forum (ommitting any Epsilon-specific bits) to see if anyone there can help?

Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1461685 is a reply to message #1461258] Tue, 04 November 2014 20:52 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

I had already posted such an inquiry at the time when this conversation between you and me about this issue started. Principally, the problem with creating an UML model correctly loading the profile is already solved. However, the question now is how I can cast an UML model into a (Epsilon) Emf model. I think this is something I need to address to you Wink. This is also the feedback I received from Christian Damus who picked my the UML part, see https://www.eclipse.org/forums/index.php/mv/msg/732808/1350873/#msg_1350873.

I now have attached a new version of my project where I added the creation of the UML model within Java as the result of my conversation with Christian, see also remarks within the code. This might be a good starting point for your analysis.

Thanks a lot and kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1461761 is a reply to message #1461685] Tue, 04 November 2014 22:47 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

The following should do the trick.

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.epsilon.ecl.EclModule;
import org.eclipse.epsilon.emc.emf.InMemoryEmfModel;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.UMLResource;
import org.eclipse.uml2.uml.resources.util.UMLResourcesUtil;

public class MinimalExampleECLModuleForInMemoryEMF {
	
	public static void main(String[] args) throws Exception {
		new MinimalExampleECLModuleForInMemoryEMF().run();
	}
	
	public void run() throws Exception {
		InMemoryEmfModel leftModel = getUmlModel("Left", new File("src/res/LeftModelToCompare.uml"));
		InMemoryEmfModel rightModel = getUmlModel("Right", new File("src/res/RightModelToCompare.uml"));
		EclModule module = new EclModule();
		module.parse(new File("src/res/MinimalExampleInMemoryEmfModel.ecl"));
		module.getContext().getModelRepository().addModel(leftModel);
		module.getContext().getModelRepository().addModel(rightModel);
		module.execute();
	}
	
	public InMemoryEmfModel getUmlModel(String name, File file) throws Exception {
		ResourceSet set = new ResourceSetImpl();
		UMLResourcesUtil.init(set);
		set.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
		set.getResourceFactoryRegistry().getExtensionToFactoryMap().
		         put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
		Resource r = set.getResource(URI.createFileURI(file.getAbsolutePath()), true);
		r.load(null);
		
		Collection<EPackage> ePackages = new ArrayList<EPackage>();
		for (Object ePackage : set.getPackageRegistry().values()) {
			ePackages.add((EPackage) ePackage);
		}
		return new InMemoryEmfModel(name, r, ePackages);
	}
}


Cheers,
Dimitris
Re: [ECL] Problems to get my minimal example running ;-( [message #1462707 is a reply to message #1461761] Wed, 05 November 2014 21:45 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

fantastic!!! It works perfectly. I am very happy!

Hopefully, you did not need to spend too much time on this?

Thanks a lot - you saved my workshop Wink.

Have a good time and kind regards, Alex
Re: [ECL] Problems to get my minimal example running ;-( [message #1463163 is a reply to message #1462707] Thu, 06 November 2014 09:21 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Alex,

I'm glad this helped. It did take me a while to figure out why this was not working but in the process I also enahnced InMemoryEmfModel so that it can pick up the appropriate EPackages from the resource's resource set automatically - so overall, this was time well spent.

Cheers,
Dimitris
Previous Topic:Flock restructuring Meta-Model-Packages
Next Topic:[ETL] Get element type
Goto Forum:
  


Current Time: Thu Apr 25 01:46:26 GMT 2024

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

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

Back to the top