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 12:26  |
Eclipse User |
|
|
|
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 01:33   |
Eclipse User |
|
|
|
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 #1357894 is a reply to message #1350566] |
Thu, 15 May 2014 14:48   |
Eclipse User |
|
|
|
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 #1458446 is a reply to message #1383987] |
Sat, 01 November 2014 07:16   |
Eclipse User |
|
|
|
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 #1461761 is a reply to message #1461685] |
Tue, 04 November 2014 17:47   |
Eclipse User |
|
|
|
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 #1463163 is a reply to message #1462707] |
Thu, 06 November 2014 04:21  |
Eclipse User |
|
|
|
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
|
|
|
Goto Forum:
Current Time: Fri Jul 04 02:59:29 EDT 2025
Powered by FUDForum. Page generated in 0.06597 seconds
|