Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » get "root model" context(switching to original context)
get "root model" context [message #1722879] Wed, 10 February 2016 00:06 Go to next message
St. K. is currently offline St. K.Friend
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:
index.php/fa/24933/0/
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.
index.php/fa/24934/0/

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?
index.php/fa/24935/0/

Thank you

PS: here is the definitino of the odesign layers and containers
index.php/fa/24936/0/

[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 Go to previous messageGo to next message
Yann Mortier is currently offline Yann MortierFriend
Messages: 13
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

Re: get "root model" context [message #1723018 is a reply to message #1722996] Wed, 10 February 2016 23:38 Go to previous messageGo to next message
St. K. is currently offline St. K.Friend
Messages: 6
Registered: June 2014
Junior Member
This is genius.
It works perfectly fine, especially the second call. It does exactly what I was looking for!

Two questions on the side:
1. I now added the viewpoint metamodel too. Could you explain to me though why I did it? What's its purpose?
2. Is there any documentation of all of this? Is there at least a JavaDoc of all these classes?

Thanks again!
Re: get "root model" context [message #1723052 is a reply to message #1723018] Thu, 11 February 2016 09:47 Go to previous message
Yann Mortier is currently offline Yann MortierFriend
Messages: 13
Registered: July 2009
Location: Paris FR
Junior Member
Hi

You're welcome.

The metamodels property tells Sirius witch metamodels are used by your diagram description. You should add, at least, your metamodel. You have to add the viewpoint metamodel because DSemanticDecorator is into this metamodel.

From the documentation ( https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#diagram_description )
Quote:

It is recommended that the Diagram Description be explicitly associated with the meta-model(s) of the semantic elements it will represent. You can add referenced meta-models from different sources in the Metamodels property section of the Diagram Description. Sirius will work even without this association, but setting it explicitly will give you better feedback when validating your VSM .


If you have not already done so, i recommend you to read the specifier documentation ( https://www.eclipse.org/sirius/doc/ ) especially the Writing Queries section.

In addition you can have a look to the Sirius metamodels organization here: https://www.eclipse.org/sirius/doc/developer/Meta-models.html

Cheers

Yann

[Updated on: Thu, 11 February 2016 09:49]

Report message to a moderator

Previous Topic:Create Instance in Tree Editor and Diagram Editor
Next Topic:How to delete view programmatically of a given DDiagramElement
Goto Forum:
  


Current Time: Sun Jan 24 06:17:16 GMT 2021

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

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

Back to the top