Model-To-Model Sibling Child Problem [message #1811210] |
Wed, 28 August 2019 12:46  |
Eclipse User |
|
|
|
Dear All,
I have two metamodels which are a PIM and PSM.
PIM -> 
PSM-> 
According to my metamodel Design -> IoTSystem , i can transform this easily
. Indirect-> NodeR , i can transform this but is transforms as sibling of IoTSystem not it's chield.
SensorDevice->Saul is also sibling of IoTSystem.
According to my metamodel IoTsystem has chield NodeR , NodeR has chield Saul.

According to the above figure and my code below, the wrong hierarchy is made. I try to achieve the correct result.
Here is my transformation code;
rule DesignToIoTSystem {
from
pim : PIM!Design
to
iot : ContikiOS!IoTSystem (
Name<- 'DesignIoTSystem'
)
}
rule DirectToNode {
from
pim : PIM!Direct
to
psm : ContikiOS!NodeR(
Name<- 'NodeR'
)
}
rule SensorDeviceToSaul {
from
pim : PIM!SensorDevice
to
psm : ContikiOS!SAUL (
Name<- 'aSaulDevice',
Temperature<-pim.Temperature,
Humidity<-pim.Humidity
)
}
So my question is according to my metamodels how should i mofiy my ATL code to achieve it?
Thanks All.
Attachment: PIM.png
(Size: 14.58KB, Downloaded 416 times)
Attachment: PSM.png
(Size: 21.29KB, Downloaded 417 times)
Attachment: result.png
(Size: 3.13KB, Downloaded 394 times)
[Updated on: Wed, 28 August 2019 13:02] by Moderator
|
|
|
|
|
|
|
|
|
Re: Model-To-Model Sibling Child Problem [message #1811262 is a reply to message #1811230] |
Thu, 29 August 2019 14:30   |
Eclipse User |
|
|
|
Hi Ed,
-I am really sorry that I could not recognize what you asked at first about "repro" project. Moreover, I wish I had a mentor like you, and have just looked at your academic profile. I am a student who suffers the deadline of my defense thesis. Because this is my first and big MDE project.
-I exported my project and in the attachments, the file named "contikiOS" is my PSMM (metamodel). The file named "PIM" is my PIMM (metamodel). You can freely edit any PIMM (metamodel) relations, cardinalities, and Eclasses, However, PSMM (named contikiOS) shall not be modified.
- PIM.pim is my PIM model and you don't need Sirius files for the model part. I just create a simple model to achieve what i asked above. But if it is required I can send them to you.
- File named " Deneme" has ATL rules. The rules transform each Class as a parent However as I said they have children.
- I send you my project and Run configurations.
-I use OBEO 11.0 version.
The xml output of the wrong (always transforms as parent all Models) is shown below;
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:contikiOS="http://www.eclipse.org/sirius/contikiOS">
<contikiOS:IoTSystem Name="DesignIoTSystem"/>
<contikiOS:PlatformR Name="RiotPlatformR"/>
<contikiOS:Platform Name="ContikiPlatform"/>
<contikiOS:RaspberryPi Name="RaspberryPI"/>
<contikiOS:LogMan URL="www.example.com"/>
<contikiOS:NodeR Name="NodeR"/>
<contikiOS:Node Name="Node"/>
<contikiOS:SAUL Temperature="true" Humidity="true" Name="aSaulDevice"/>
</xmi:XMI>
To have correct output i added elements manually the output should be as follows;
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:contikiOS="http://www.eclipse.org/sirius/contikiOS">
<contikiOS:IoTSystem Name="DesignIoTSystem">
<platform/>
<logman/>
<platformR>
<saul Temperature="true" Humidity="true" Name="aSaul"/>
</platformR>
</contikiOS:IoTSystem>
</xmi:XMI>
Thanks for your help.
[Updated on: Thu, 29 August 2019 14:33] by Moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05727 seconds