Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL/EOL] Operation not known if used in guard more than one time
[ETL/EOL] Operation not known if used in guard more than one time [message #1697874] Tue, 09 June 2015 09:55 Go to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi,

if I try to run an operation for an existence check that I wrote myself more than one time (in more than one rule), then the Epsilon interpreter does not know this anymore.

Example:
The first time I call the operation "hasStereotype(...)", this works fine, see:
rule instantiateElemOfTypeSpExistingClass 
	transform iv_srcClass : RetResSpModel!Class
	to cv_tgtClass : InstRetReqSpModel!Class {
	guard : iv_srcClass.doesExistInPcp2SpTrafoTraceModelAs("Client") == true and iv_srcClass.name <> getNotExistingElementPlaceholderName() and iv_srcClass.hasGainedNewPropsOrOps() == true and iv_srcClass.eContainer().eContainer().hasStereotype("SolutionPattern") == true


If I then use it in another rule, it is not known anymore. Example for such another rule, see:
rule instantiateElemOfTypeSpNewClass
	transform iv_srcClass : RetResSpModel!Class
	to cv_tgtClass : InstRetReqSpModel!Class {
	guard: iv_srcClass.doesExistInPcp2SpTrafoTraceModelAs("Client") == false
and iv_srcClass.name <> getNotExistingElementPlaceholderName() and	hasStereotype("SolutionPattern") == true
}


The error message is the following:
"Method 'hasStereotype' not found (D:\Eclipse\Workspace1\de.uni.due.swe.propman\res\ProPMan_EpsilonModules\ProPInsEpsilonModules\ProPInsPcp2SpTrafo.etl@366:18)"

Note that the classes of the source model are located in a package that is part of the source model (therefore I use the "eContainer().eContainer()" statement).

Any hint is very much appreciated. Thanks in advance and kind regards, Alexander
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1697879 is a reply to message #1697874] Tue, 09 June 2015 10:20 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 599
Registered: January 2010
Location: Birmingham, UK
Senior Member

The first invocation is r().hasStereotype(...), and the second invocation is simply hasStereotype(...). Perhaps your operation is defined only as a context operation for the type returned by r(), and not as a context-less operation?
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1697884 is a reply to message #1697879] Tue, 09 June 2015 10:58 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Thanks for this hint, Antonio. However, this is a copy/paste error ;-(. I use the same invocation via "iv_srcClass.eContainer().eContainer()...". Hence, this cannot be the reason... KR, Alex
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698019 is a reply to message #1697884] Wed, 10 June 2015 12:43 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 599
Registered: January 2010
Location: Birmingham, UK
Senior Member

Could you send us a minimal example that reproduces the problem? It'd be great for debugging the issue.
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698543 is a reply to message #1698019] Tue, 16 June 2015 10: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 again Antonio,

in the meantime, I have been able to fix this Problem and to provide a solution. I suppose that it works as designed, namely that I can only call an Operation for the same Kind of element (model, class) only exactly one time, at least when I apply this in guards. Am I right?

Instead of calling the same Operation for the same element instance several times in different guards, I centralized such a call in the pre section and store the resulting object instance in a variable, see the subsequent Piece of code:

[...]
	/* store the relevant retrieval request source problem-context
       pattern model: */ 
	for (m in SrcRetReqPcp!Model.all) {
		for (s in m.getAppliedStereotypes()) {
			if (s.name == "ProblemContextPattern") {
	    		gv_srcRetReqPcp = m;
	    		breakAll;
	    	}
	    	else if (s.name <> "ProblemContextPattern") {
	    		continue;
	    	}
	    }
	}
[...]


In the specific guards of the several rules, I then just refer to the variable, see:

[...]
rule transformElemOfTypePcpModel
	transform iv_srcModel : SrcRetReqPcp!Model
	to         cv_tgtModel : TgtInstRetReqSp!Model {
    guard:    iv_srcModel == gv_srcRetReqPcp
[...]


Hence, for me this issue is solved.

Thanks again for your Support and Kind regards, Alex
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698640 is a reply to message #1698543] Tue, 16 June 2015 20:38 Go to previous messageGo to next message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi again,

closely related to this issue I Need to know how I can Access all classes or other kind of elements of such a "filtered" model. With the following Piece of code, I get too many, namely from all models:

	/* store the corresponding problem-context pattern model: */ 
	for (m in CorrespondingPcp!Model.all) {
		for (s in m.getAppliedStereotypes()) {
			if (s.name == "ProblemContextPattern") {
    			    gt_leftSrcPcpClassAll = CorrespondingPcp!Class.all;
			    gt_leftSrcPcpPropAll = CorrespondingPcp!Property.all;
			    gt_leftSrcPcpOpAll = CorrespondingPcp!Operation.all;			
	    		   gv_correspondingSrcPcpModel = m;
	    		breakAll;
	    	}
	    	else if (s.name <> "ProblemContextPattern") {
	    		continue;
	    	}
	    }
	}


I Need only all those classes or other elements that belong to the variable m for the filtered model. Hence, a Statement like " gt_leftSrcPcpClassAll = m!Class.all;". However, this does not work.

Any help is very much appreciated.

Thanks and Kind regards, Alex
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1698681 is a reply to message #1698640] Wed, 17 June 2015 09:00 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 599
Registered: January 2010
Location: Birmingham, UK
Senior Member

The "X!Y" syntax refers to type Y in model X: it can't be used with regular variables. In particular, "X!Y.all" gets all the instances of that type Y in model X, so this is working as intended.

Since you are looping through m.getAppliedStereotypes() on the variable s, shouldn't you use an expression that starts from s or m? Without knowing your metamodel and the kind of query you want to do, we can't help you much more, I'm afraid.

EOL offers extension operations such as collect(...) or filter(...) on collections, which may be useful. You could do something like CorrespondingPcp!Class.all.select(c | ... expression using c, m and s ...) to retrieve the CorrespondingPcp!Class instances that match the condition in that expression.
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1707726 is a reply to message #1698681] Tue, 08 September 2015 19: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 Antonio,

sorry for my late Response, but in the meanwhile I had a lot other Problems to solve ;-(. Getting back to your proposal I understand what you mean. However, to be honest, I do not really know how to apply it to my example. Let me try to express my query in "pseudo-code": What I Need is the following:

"var gt_correspondingPcmPropAll = CorrespondingPcm!Property.all.select(p|<properties for a model in CorrespondingPcm that has the stereotype <<ProblemContextModel>>);"

It would be great if you can give me a hint.

Thanks a lot in advance and Kind regards, Alex
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1708084 is a reply to message #1707726] Sat, 12 September 2015 11:48 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 Alex,

Could you please provide a minimal example I can use to advise?

Cheers,
Dimitris
Re: [ETL/EOL] Operation not known if used in guard more than one time [message #1708362 is a reply to message #1708084] Tue, 15 September 2015 20:56 Go to previous message
Alexander Fülleborn is currently offline Alexander FüllebornFriend
Messages: 132
Registered: April 2013
Senior Member
Hi Dimitris,

thanks for your reply. After that I immediately started to construct a minimal example. However, I am struggling with a couple of things and will Need some more time to complete this example.

Just for your Information. Thanks a lot for your support and Kind regards, Alex
Previous Topic:[ETL] NoSuchMethodError
Next Topic:[Eugenia] Divide the editor in subspaces
Goto Forum:
  


Current Time: Wed Sep 25 04:06:20 GMT 2024

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

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

Back to the top