get "root model" context [message #1722879] |
Wed, 10 February 2016 00:06 |
St. K. Messages: 6 Registered: June 2014 |
Junior Member |
|
|
I am trying to graphically display the files and functions in our proprietary language.
My model looks like this:
Please note that the only classes that will be used in my diagram are CtlFile and CtlFunction.
The diagram representation is supposed to display the following:
- The CtlFile is the "root model"
- It is displayed as a container with its contained CtlFunctions inside
- The CtlFunctions have functioncalls (edges) between them (green arrows)
- The required "other CtlFiles" are being displayed as containers too. They are calculated via the functioncalls with aql:self.ctlfunctions.functioncalls.eContainer()->select(i | not i.equals(self) )
- These other files should display ONLY the functions that are being called from the root model and red arrows showing these calls
In the example below, I only want to display the elements inside fwException.ctl that have edges going in. However, I am failing to find the correct Semantic Candidates Expression.
My problem is, that I only can display all functions inside the other library. I have not managed to write an aql to filter correctly.
When I write the query "outside" the container, only the necessary files are displayed. AQL: aql:self.ctlfunctions.functioncalls->select(it | not it.eContainer().equals(self)) (see diagram below)
However, when I move the functions to be displayed inside the container, the query does not work, as "self" now refers to the container, not to the base element anymore. Is there a way that I can access the diagram's "original" model or prevent "self" to change its meaning inside the container?
Thank you
PS: here is the definitino of the odesign layers and containers
[Updated on: Wed, 10 February 2016 09:38] Report message to a moderator
|
|
|
Re: get "root model" context [message #1722996 is a reply to message #1722879] |
Wed, 10 February 2016 17:12 |
Yann Mortier Messages: 19 Registered: July 2009 Location: Paris FR |
Junior Member |
|
|
Hi
You can access to the diagram using the 'diagram' variable. You have to cast it into a DSemanticDecorator in order to access the referenced CtlFile:
aql:diagram.oclAsType(viewpoint::DSemanticDecorator).target.oclAsType(yourMMPackageName::CtlFile).ctlfunctions.functioncalls->select(it | not it.eContainer().equals(diagram.oclAsType(viewpoint::DSemanticDecorator).target))
Edit: note that all called functions will be displayed in all referenced files. A little improvement:
aql:diagram.oclAsType(viewpoint::DSemanticDecorator).target.oclAsType(yourMMPackageName::CtlFile).ctlfunctions.functioncalls->intersection(self.ctlfunctions)
Don't forget to add the viewpoint metamodel into referenced metamodels in the 'metamodels' properties tab of CtlFileDiaram (Click 'Add from registry...' and select 'http://www.eclipse.org/sirius/1.1.0').
Yann
[Updated on: Wed, 10 February 2016 17:21] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03908 seconds