Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] update in-memory model modified programmatically
[EVL] update in-memory model modified programmatically [message #1802551] Mon, 11 February 2019 19:25 Go to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 3
Registered: March 2011
Junior Member
Dear Dimitris and all,

I am exploiting EVL for UML model refactoring. Since my process is a three-phases process, I have extended EvlValidationView and EvlValidationViewFixer classes and I have added a call to a Java routine that performs some analysis on the current UML.
The UML model is profiled with MARTE and the workflow is like follows:

1st phase: a .evl file is executed, checking for some preconditions for analysis; if any precondition is broken, then some automated refactoring can be executed, until all the preconditions are satisfied.

2nd phase: a Java routine is called (programmatically, within my customized EvlValidationView), performing some analysis and putting some resulting values to predefined MARTE tags of certain stereotypes.

3rd phase: a different .evl file is executed, aimed at checking some constraints involving values from the previous step. At each refactoring, the process goes back to phase 2, in order to analyze the refactored model and re-execute phase 3.

Phases 1 and 2 work properly. However, when the 3rd phase starts, the UML input model for the latter phase seems to be the one resulting from phase 1 instead of phase 2. In fact, I cannot see any tag set within the UML model.
My question is how can I "reload" the UML model resulting from phase 2 within the model repository? It seems that changing modelUri and saving the model resource is not enough to get the model with filled MARTE tags.

Please notice that the workflow above is executed within the same "session", i.e. my customized EvlValidationView implements it within the run method of its PerformFixAction inner-class. Moreover, since at each refactoring of step 3 the Java routine must be re-executed on the refactored model, I really need to "update" the in-memory model with the refactored one. In practical terms, I am looking for a kind of "reloadModel" method which updates the model repository with the refactored model within its modelImpl field.

Thanks in advance for your help,
Davide.

[Updated on: Mon, 11 February 2019 19:38]

Report message to a moderator

Re: [EVL] update in-memory model modified programmatically [message #1802563 is a reply to message #1802551] Mon, 11 February 2019 23:03 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

I don't think I understand the problem well enough to provide a meaningful response. Could you please try to construct a minimal example [1] I can use to reproduce the behaviour you're encountering? To speed things up, it'd be great if your minimal example could work with Ecore instead of UML models so that I don't have to download and set up a compatible version of Papyrus, MARTE etc.

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [EVL] update in-memory model modified programmatically [message #1802676 is a reply to message #1802563] Wed, 13 February 2019 18:53 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 3
Registered: March 2011
Junior Member
Dear Dimitris,

fortunately I solved my problem. It was not that simple, given the complexity of the project, hence I am not going to tell this story.

However, I have another problem, which concerns an ETL transformation: Given a UML model with MARTE profile applied, I need to integrate the model by adding additional MARTE stereotypes (and setting some of their tagged values) to certain model element whereas, for other elements, I just need to set certain tagged values of some existing stereotypes.
My idea was to copy the source UML model and then (in the "post" block) to apply additional stereotypes and set tagged values. Currently, my question is: How can I copy the source UML-MARTE model? I have the following rule, where I call getEcoreUtil().copy() on each UML Package. Unfortunately, it seems that it is unable to copy existing stereotypes and tagged values. Any help is very appreciated.

rule Model2Model
	transform m : UML!Model
	to mperf : UMLPerf!Model {
		mperf.name = m.name;
		var emfTool : new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
		var packageImports = m.packageImport;
		for(imp in packageImports) {
			mperf.packageImport.add(emfTool.getECoreUtil().copy(imp));
		}
		var profileApps = m.profileApplication;
		for(pApp in profileApps) {
			mperf.profileApplication.add(emfTool.getECoreUtil().copy(pApp));
		}
		var packagedEls : Set(UML!Package) = m.packagedElement;
		for(el in packagedEls) {
			var clone = emfTool.getECoreUtil().copy(el);
			mperf.packagedElement.add(clone);
		}
		"UML-MARTE model copied.".println();
}


Best regards,
Davide
Re: [EVL] update in-memory model modified programmatically [message #1802680 is a reply to message #1802676] Wed, 13 February 2019 21:57 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

getEcoreUtil().copy() invokes EcoreUtil.copy() [1] and this seems to be the expected behaviour according to [2].

Thanks,
Dimitris

[1] https://download.eclipse.org/modeling/emf/emf/javadoc/2.5.0/org/eclipse/emf/ecore/util/EcoreUtil.html#copy(org.eclipse.emf.ecore.EObject)
[2] https://www.eclipse.org/forums/index.php/m/628568
Previous Topic:New EVL Plugin: WebChecker - Bootstrap Linter
Next Topic:Calling ETL from Java with "partial" reset
Goto Forum:
  


Current Time: Mon Sep 23 02:25:38 GMT 2024

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

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

Back to the top