Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]: a target model inconsistant with it's metamodel
[ATL]: a target model inconsistant with it's metamodel [message #742546] Thu, 20 October 2011 11:39
El Arbi Aboussoror is currently offline El Arbi Aboussoror
Messages: 88
Registered: June 2010
Member
Hi,

I have defined an ATL module that suprisingly produces a new kind of models. In fact after execution I get a model that is not conform to it's metamodel !

My taget metamodel is ComGraph.ecore and this it's Emfatic description:
class ComGraph {
   val Element[*] elements;
}

class Element {
   attr String name;
}
class Node extends Element {
   
}
class Link extends Element {
   ref Node source;
   ref Node target;
}


My source metamodel is Scenario.ecore:
package Scenario;

import "platform:resource/diagnostic_SGS/metamodel/IFConfiguration.ecore";


class Scenario extends IFConfig.NamedElement{
   val IFConfig.Transition[*] firedTransitions;
}


And it is using a metaclass from the IFConfiguration.ecore :
@namespace(
	uri="http://irit.fr/ifconfiguration",
	prefix="ifconf")
package IFConfig;

...
class Transition {
   val Action[*] actions;
   attr Integer number;
}
class Action {
   attr String kind;
}
...



So the following transformation should create a ComGraph model:

-- @path ComGraph=/diagnostic_SGS/metamodel/ComGraph.ecore
-- @path Scenario=/diagnostic_SGS/metamodel/Scenario.ecore

module Scenario2ComGraph;
create OUT : ComGraph from IN : Scenario;

rule Scenario2ComGraph {
	from
		sS : Scenario!Scenario
	to 
		tC : ComGraph!ComGraph (
			elements <- sS.firedTransitions
		)
}

rule Transition2Element {
	from
		sT : Scenario!Transition
	to 
		tC : ComGraph!Element (
			name <- sT.actions->first().kind
		)
}


BUT after the execution I found my self with a surprising model with elements from both target AND SOURCE metamodel:
<?xml version="1.0" encoding="ISO-8859-1"?>
<comgraph:ComGraph xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:comgraph="http://irit.fr/comgraph" xmlns:ifconf="http://irit.fr/ifconfiguration">
  <elements xsi:type="ifconf:Transition" number="1">
    <actions kind="DEBUG" value="402">
      <by name="Properties_p0"/>
    </actions>
    <actions kind="DEBUG" value="428">
      <by name="Properties_p0"/>
    </actions>
  </elements>
</comgraph:ComGraph>


As you can see the ComGraph has elements of type Transition wich is not consistent with the ComGraph metamodel.

This my Eclipse configuraiton:

Eclipse Modeling Tools
Version: Helios Service Release 1
Build id: 20100917-0705
ATLAS Transformation Language (ATL)
Version: 3.1.1.v201009141132
Build id: 201009141132



[Updated on: Thu, 20 October 2011 11:49]

Report message to a moderator

Previous Topic:[ATL] Many imperative instructions inside a helper
Next Topic:[QVTo] Generate XMI with multiple namespaces
Goto Forum:
  


Current Time: Sat Apr 19 23:22:36 EDT 2014

Powered by FUDForum. Page generated in 0.07481 seconds