Home » Modeling » Epsilon » [ECL] Problems to get my minimal example running ;-(
|
Re: [ECL] Problems to get my minimal example running ;-( [message #1333537 is a reply to message #1328311] |
Mon, 05 May 2014 05:33 |
|
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 18:48 |
Alexander Fülleborn 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 #1382082 is a reply to message #1380872] |
Sun, 25 May 2014 21:31 |
|
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 #1383987 is a reply to message #1383798] |
Tue, 27 May 2014 16:29 |
|
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 |
Alexander Fülleborn 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 #1461258 is a reply to message #1461244] |
Tue, 04 November 2014 11:26 |
|
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 #1461761 is a reply to message #1461685] |
Tue, 04 November 2014 22:47 |
|
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
|
|
| | |
Goto Forum:
Current Time: Thu Apr 25 01:46:26 GMT 2024
Powered by FUDForum. Page generated in 0.04556 seconds
|