Acceleo - Reference to another model [message #1790221] |
Thu, 07 June 2018 08:52 |
Flora Ferreira Messages: 2 Registered: June 2018 |
Junior Member |
|
|
I am facing a problem and I am kind of desesperate :
I am trying to transform a constraint OCL into a C# program. To do so, I define my ocl constraints in a CompleteOCL document, and I save it as Abstract Syntax : POC.ocl.oclas. Then I use Acceleo with the Pivot Meta-model ('http://www.eclipse.org/ocl/2015/Pivot').
However, common OCL operations (such as 'size') are defined in another model : the Library. So when I try to recover operations used on my OCL model, nothing happened, I can only recover the operation I defined in my ocl document.
For example I wrote the following constraint :
inv pasPlusDe10Objets('Il y a plus de 10 objets dans ce diagramme'): self.DiagramObjects -> size() <= 10
I save it as Abstract Syntax under the name of POC.ocl.oclas, and when I opened POC.ocl.oclas and I go to the OperationCallExp of size, I obtain this :
> [OperationCallExp]
... > /eContainer
...... > name =
...
...... > referredOperatio
......... > [Operation] size
............ > name = size
...
So I could recover the referredOperation name inside the editor (MoDisco Model Browser)
I wrote in Acceleo :
[comment getCode() opération/]
[template public getCode(operationCallExp : pivot::OperationCallExp) post (trim())]
[operationCallExp.ownedSource.getCode()/]
[operationCallExp.referredOperation.name/][operationCallExp.ownedArguments -> getArguments()/]
[/template]
In theory, [operationCallExp.referredOperation.name/] gives me the name of the operation, as we have it in MoDisco Model Browser. In reality, it gives me nothing, except when I defined the operation (and thus when the operation doesn't come from the OCL Library).
And it only generate one file : "POC.oclxx", not "Library.oclxx"
That lead us to this question : Is it possible in Acceleo to make a reference to another model (than the main one) ? And if it is, how to do that ?
I am using Eclipse Oxygen (Release (4.7.3a)) and the '3.7.2.201708211328' version of Acceleo. I also tried with Photon package but the problem remains.
Thank you in advance !
---------------------------------------------------------------------------------------
The zipped projet attached :
POC folder contains POC metamodel (POC.ecore), OCL constraint on this metamodel (POC.ocl) and the Pivot model associate (POC.ocl.oclas). Files generated by Acceleo are in the files folder.
POC_Acceleo forlder contains the Acceleo transformation (generate.mtl).
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03772 seconds