Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EObject type in Epsilon
EObject type in Epsilon [message #1723595] Tue, 16 February 2016 17:21 Go to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi,

I want to know how I could set the eType of an EReference to EObject by EOL instruction.
I try something like this:
ref.eType = Ecore!EObject;
However, it is incorrect.
I also want to check that whether an object is type of EObject or not but the below code is not correct:
...object.isTypeOf(EObject)...

Bests,
Leila
Re: EObject type in Epsilon [message #1723636 is a reply to message #1723595] Tue, 16 February 2016 22:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

The following should do the trick.

ref.eType = EClass.all.selectOne(c|c.name="EObject");
...
object.isKindOf(EObject); // EObject is an abstract class


Cheers,
Dimitris
Re: EObject type in Epsilon [message #1723640 is a reply to message #1723636] Wed, 17 February 2016 01:29 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,

Because I use two metamodels, I try something like this:
ref.eType = Ecore!EClass.all.selectOne(c|c.name="EObject");
There is not any error, but the eType of ref will be empty. It is shown that there is no any EClass with name "EObject"!
My metamodels are similar to your paper:
Engineering a DSL for Software Traceability
http://link.springer.com/chapter/10.1007%2F978-3-642-00434-6_10

Bests,
Leila
Re: EObject type in Epsilon [message #1723713 is a reply to message #1723640] Wed, 17 February 2016 10:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

Could you please provide a minimal example [1] that we can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: EObject type in Epsilon [message #1723719 is a reply to message #1723713] Wed, 17 February 2016 11:10 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,

The minimal Example can be found in the attached file:

an ETL transformation from GeneralTrace to Ecore.

The output of the transformation should be generated in SpecialTraceMetamodel.ecore

My question is about line 111 in the ETL program.

Bests,
Leila
Re: EObject type in Epsilon [message #1723723 is a reply to message #1723719] Wed, 17 February 2016 11:17 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

I see. I think that you need to add Ecore.ecore to your transformation as a third model (e.g. EcoreEcore). To do this you can select the "Registered EMF EPackage" model type in the "Select type of model" configuration dialog, set the name of the model to EcoreEcore and type/select the following metamodel URI: http://www.eclipse.org/emf/2002/Ecore. Line 111 of your code should then be modified as follows:

ref.eType := EcoreEcore!EClass.all.selectOne(c|c.name = "EObject");


Cheers,
Dimitris
Re: EObject type in Epsilon [message #1723729 is a reply to message #1723723] Wed, 17 February 2016 11:57 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,

Thank you very much.
Your suggested trick solved the problem.

Bests,
Leila.
Re: EObject type in Epsilon [message #1739941 is a reply to message #1723729] Fri, 05 August 2016 18:44 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi,
How can I pass a registered EMF EPackage (Ecore) to ETL module as a model programmatically?
Bests,
Leila.
Re: EObject type in Epsilon [message #1739944 is a reply to message #1739941] Fri, 05 August 2016 18:58 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

You need to create an instance of org.eclipse.epsilon.emc.emf.EmfMetaModel, configure it and then add it to module.getContext().getModelRepository() as usual.

Cheers,
Dimitris
Re: EObject type in Epsilon [message #1739967 is a reply to message #1739944] Sat, 06 August 2016 06:34 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Thanks Dimitris.

I write the below code to create an EMFMetaModel:
protected EmfMetaModel createEmfMetaModel(String name, String metamodelUri,
			boolean readOnLoad, boolean storeOnDisposal) 
			throws EolModelLoadingException, URISyntaxException {
		
	EmfMetaModel emfMetaModel = new EmfMetaModel(name,metamodelUri);
	emfMetaModel.setReadOnLoad(readOnLoad);
	emfMetaModel.setStoredOnDisposal(storeOnDisposal);
	return emfMetaModel;
	}

However, I don't know how I can access the ecore metamodel uri.

Bests,
Leila
Re: EObject type in Epsilon [message #1739995 is a reply to message #1739967] Sun, 07 August 2016 10:12 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

You can access it through EcorePackage.eINSTANCE.getNsURI().

Cheers,
Dimitris
Re: EObject type in Epsilon [message #1739996 is a reply to message #1739995] Sun, 07 August 2016 11:03 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Thanks Dimitris.
I have called the createEmfMetaModel in this way:
models.add(createEmfMetaModel("EcoreM",EcorePackage.eINSTANCE.getNsURI(),true,false));

and it causes errors:
Internal error: java.lang.NullPointerException
	at org.eclipse.epsilon.emc.emf.AbstractEmfModel.getPackageRegistry[AbstractEmfModel.java:117]
	at org.eclipse.epsilon.emc.emf.AbstractEmfModel.classForName[AbstractEmfModel.java:197]
	at org.eclipse.epsilon.emc.emf.AbstractEmfModel.hasType[AbstractEmfModel.java:557]
	at org.eclipse.epsilon.eol.types.EolModelElementType.<init>[EolModelElementType.java:69]
	at org.eclipse.epsilon.eol.dom.NameExpression.getModelElementType[NameExpression.java:117]
	at org.eclipse.epsilon.eol.dom.NameExpression.execute[NameExpression.java:48]
	at org.eclipse.epsilon.eol.dom.NameExpression.execute[NameExpression.java:90]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.PropertyCallExpression.execute[PropertyCallExpression.java:39]
	at org.eclipse.epsilon.eol.dom.PropertyCallExpression.execute[PropertyCallExpression.java:72]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.FirstOrderOperationCallExpression.execute[FirstOrderOperationCallExpression.java:74]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.AssignmentStatement.execute[AssignmentStatement.java:59]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:79]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:48]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.AssignmentStatement.execute[AssignmentStatement.java:59]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:100]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:92]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:1]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:46]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:105]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:79]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:48]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.AssignmentStatement.execute[AssignmentStatement.java:59]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:100]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:92]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:1]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:46]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:105]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:79]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:48]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.AssignmentStatement.execute[AssignmentStatement.java:59]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.StatementBlock.execute[StatementBlock.java:43]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ForStatement.execute[ForStatement.java:88]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:62]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalents[FastTransformationStrategy.java:100]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:92]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.getEquivalent[FastTransformationStrategy.java:1]
	at org.eclipse.epsilon.etl.execute.operations.EquivalentOperation.execute[EquivalentOperation.java:46]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:131]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.OperationCallExpression.execute[OperationCallExpression.java:105]
	at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:109]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.executeBlockOrExpressionAst[ExecutableBlock.java:65]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:88]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:117]
	at org.eclipse.epsilon.eol.dom.ExecutableBlock.execute[ExecutableBlock.java:49]
	at org.eclipse.epsilon.etl.dom.TransformationRule.executeSuperRulesAndBody[TransformationRule.java:206]
	at org.eclipse.epsilon.etl.dom.TransformationRule.transform[TransformationRule.java:160]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.executeTransformations[FastTransformationStrategy.java:165]
	at org.eclipse.epsilon.etl.strategy.FastTransformationStrategy.transformModels[FastTransformationStrategy.java:157]
	at org.eclipse.epsilon.etl.EtlModule.execute[EtlModule.java:134]


Would you please guide me to solve the problem?

Bests,
Leila.
Re: EObject type in Epsilon [message #1739997 is a reply to message #1739996] Sun, 07 August 2016 11:04 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

Could you please send me a minimal example [1] I can can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: EObject type in Epsilon [message #1739998 is a reply to message #1739997] Sun, 07 August 2016 13:15 Go to previous messageGo to next message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,
The minimal example contains SpecificTrace.java file. Please run it to see the errors.
I use Eclipse Mars with Epsilon 1.3.0.
Bests,
Leila.
  • Attachment: TestETL.zip
    (Size: 19.99KB, Downloaded 51 times)
Re: EObject type in Epsilon [message #1740108 is a reply to message #1739998] Tue, 09 August 2016 10:06 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1588
Registered: July 2009
Location: York, UK
Senior Member

Hi Leila,

The problem seems to be that you're not calling the load() method of your instance of EmfMetaModel. Adding a call to load() seems to be doing the trick.

protected EmfMetaModel createEmfMetaModel(String name, String metamodelUri,
		boolean readOnLoad, boolean storeOnDisposal) 
				throws EolModelLoadingException, URISyntaxException {
		
	EmfMetaModel emfMetaModel = new EmfMetaModel(name,metamodelUri);
	emfMetaModel.setReadOnLoad(readOnLoad);
	emfMetaModel.setStoredOnDisposal(storeOnDisposal);
	emfMetaModel.load();
	return emfMetaModel;
}


Cheers,
Dimitris

[Updated on: Tue, 09 August 2016 10:06]

Report message to a moderator

Re: EObject type in Epsilon [message #1740109 is a reply to message #1740108] Tue, 09 August 2016 10:15 Go to previous message
Leila S is currently offline Leila SFriend
Messages: 36
Registered: January 2015
Member
Hi Dimitris,
Thank you very much. It works well.

Bests,
Leila
Previous Topic:Eunit JunitClasses missing in jars?
Next Topic:EVL GMF Integration
Goto Forum:
  


Current Time: Sun Sep 23 00:45:58 GMT 2018

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

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

Back to the top