Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]referencing problem
[ATL]referencing problem [message #657254] Wed, 02 March 2011 08:33
Fa Za is currently offline Fa ZaFriend
Messages: 245
Registered: March 2010
Senior Member
Hi All,
I Have a model like this
<?xml version="1.0" encoding="ASCII"?>
<myDsl:Scenario xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myDsl="http://www.xtext.org/example/mydsl/MyDsl">
  <pretransitions xsi:type="myDsl:PartialPreTransition">
    <state>
      <nodeDynamics name="Conception_notStarted"/>
      <nodeDynamics name="Development_notStarted"/>
      <nodeDynamics name="RedactionDoc_notStarted"/>
      <nodeDynamics name="RedactionTest_notStarted"/>
    </state>
    <event name="Conception_start"/>
    <next xsi:type="myDsl:PartialPreTransition">
      <state nbre="1">
        <nodeDynamics name="Conception_inProgress"/>
        <nodeDynamics name="Conception_started"/>
        <nodeDynamics name="Development_notStarted"/>
        <nodeDynamics name="RedactionDoc_notStarted"/>
        <nodeDynamics name="RedactionTest_notStarted"/>
      </state>
      <event name="Conception_finish"/>
      <next xsi:type="myDsl:PartialPreTransition">
        <state nbre="2">
          <nodeDynamics name="Conception_finished"/>
          <nodeDynamics name="Conception_started"/>
          <nodeDynamics name="Development_notStarted"/>
          <nodeDynamics name="RedactionDoc_notStarted"/>
          <nodeDynamics name="RedactionTest_notStarted"/>
        </state>
        <event name="Development_start"/>
        <next xsi:type="myDsl:PartialPreTransition">
          <state nbre="3">
            <nodeDynamics name="Conception_finished"/>
            <nodeDynamics name="Conception_started"/>
            <nodeDynamics name="Development_inProgress"/>
            <nodeDynamics name="Development_started"/>
            <nodeDynamics name="RedactionDoc_notStarted"/>
            <nodeDynamics name="RedactionTest_notStarted"/>
          </state>
          <event name="Development_finish"/>
          <next xsi:type="myDsl:PartialPreTransition">
            <state nbre="4">
              <nodeDynamics name="Conception_finished"/>
              <nodeDynamics name="Conception_started"/>
              <nodeDynamics name="Development_finished"/>
              <nodeDynamics name="Development_started"/>
              <nodeDynamics name="RedactionDoc_notStarted"/>
              <nodeDynamics name="RedactionTest_notStarted"/>
            </state>
            <event name="RedactionDoc_start"/>
            <next xsi:type="myDsl:PartialPreTransition">
              <state nbre="5">
                <nodeDynamics name="Conception_finished"/>
                <nodeDynamics name="Conception_started"/>
                <nodeDynamics name="Development_finished"/>
                <nodeDynamics name="Development_started"/>
                <nodeDynamics name="RedactionDoc_inProgress"/>
                <nodeDynamics name="RedactionDoc_started"/>
                <nodeDynamics name="RedactionTest_notStarted"/>
              </state>
              <event name="RedactionDoc_finish"/>
              <next xsi:type="myDsl:PartialPreTransition">
                <state nbre="6">
                  <nodeDynamics name="Conception_finished"/>
                  <nodeDynamics name="Conception_started"/>
                  <nodeDynamics name="Development_finished"/>
                  <nodeDynamics name="Development_started"/>
                  <nodeDynamics name="RedactionDoc_finished"/>
                  <nodeDynamics name="RedactionDoc_started"/>
                  <nodeDynamics name="RedactionTest_notStarted"/>
                </state>
                <event name="RedactionTest_start"/>
                <next xsi:type="myDsl:PartialPreTransition">
                  <state nbre="7">
                    <nodeDynamics name="Conception_finished"/>
                    <nodeDynamics name="Conception_started"/>
                    <nodeDynamics name="Development_finished"/>
                    <nodeDynamics name="Development_started"/>
                    <nodeDynamics name="RedactionDoc_finished"/>
                    <nodeDynamics name="RedactionDoc_started"/>
                    <nodeDynamics name="RedactionTest_inProgress"/>
                    <nodeDynamics name="RedactionTest_started"/>
                  </state>
                  <event name="RedactionTest_finish"/>
                  <next xsi:type="myDsl:PartialPreTransition">
                    <state nbre="8">
                      <nodeDynamics name="Conception_finished"/>
                      <nodeDynamics name="Conception_started"/>
                      <nodeDynamics name="Development_finished"/>
                      <nodeDynamics name="Development_started"/>
                      <nodeDynamics name="RedactionDoc_finished"/>
                      <nodeDynamics name="RedactionDoc_started"/>
                      <nodeDynamics name="RedactionTest_finished"/>
                      <nodeDynamics name="RedactionTest_started"/>
                    </state>
                  </next>
                </next>
              </next>
            </next>
          </next>
        </next>
      </next>
    </next>
  </pretransitions>
</myDsl:Scenario>

I 'd like to transform it a another model like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<scenario:Scenario xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:scenario="http://scenario">
  <transitions>
    <previous nbre="1">
      <places name="Conception_notStarted"/>
      <places name="Development_notStarted"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="Conception_start"/>
    <next nbre="2">
      <places name="Conception_inProgress"/>
      <places name="Conception_started"/>
      <places name="Development_notStarted"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="2">
      <places name="Conception_inProgress"/>
      <places name="Conception_started"/>
      <places name="Development_notStarted"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="Conception_finish"/>
    <next nbre="3">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_notStarted"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="3">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_notStarted"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="Development_start"/>
    <next nbre="4">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_inProgress"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="4">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_inProgress"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="Development_finish"/>
    <next nbre="5">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="5">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_notStarted"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="RedactionDoc_start"/>
    <next nbre="6">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_inProgress"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="6">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_inProgress"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="RedactionDoc_finish"/>
    <next nbre="7">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_finished"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_notStarted"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="7">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_finished"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_notStarted"/>
    </previous>
    <event name="RedactionTest_start"/>
    <next nbre="8">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_finished"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_inProgress"/>
      <places name="RedactionTest_started"/>
    </next>
  </transitions>
  <transitions>
    <previous nbre="8">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_finished"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_inProgress"/>
      <places name="RedactionTest_started"/>
    </previous>
    <event name="RedactionTest_finish"/>
    <next nbre="9">
      <places name="Conception_finished"/>
      <places name="Conception_started"/>
      <places name="Development_finished"/>
      <places name="Development_started"/>
      <places name="RedactionDoc_finished"/>
      <places name="RedactionDoc_started"/>
      <places name="RedactionTest_finished"/>
      <places name="RedactionTest_started"/>
    </next>
  </transitions>
</scenario:Scenario>

my ATL transformation is
-- @path Scenario=/PreScenario2Scenario/Scenario.ecore
-- @path PreScenario=/PreScenario2Scenario/MyDsl.ecore

module PreScenario2Scenario;
create scenario : Scenario   from prescenario : PreScenario;




rule PreScenario2Scenario {
from p: PreScenario!Scenario
to s: Scenario!Scenario(transitions<-PreScenario!PartialPreTransition.allInstances())

}

rule PartialPreTransition2Transition {
	from 
		pt:PreScenario!PartialPreTransition
	to  
		tr:Scenario!Transition(
			previous <- pt.state ,
		  next <- if pt.next.oclIsUndefined() then pt.state else pt.next.state endif ,
			event <- pt.event)

			
}
rule Event2Event{
	from 
	ev: PreScenario!Event
	to
	sev:Scenario!Event(
		name<- ev.name
		)
}
rule Place2Place {
	from ndp : PreScenario!Place
	to nd : Scenario!Place(name<-ndp.name)
}
rule State2State {
	from prs: PreScenario!State
	to st :Scenario!State (
		nbre <- if prs.nbre.oclIsUndefined() then  1 else prs.nbre + 1 endif,
		places <- prs.nodeDynamics )
		
}


the problem that this transformation don't transform the "next" feature and generate a model without next state feature.
please help me

[Updated on: Wed, 02 March 2011 08:34]

Report message to a moderator

Previous Topic:[QVTo] One transformation on two models
Next Topic:[ATL] Generate href="pathmap://..."
Goto Forum:
  


Current Time: Mon Mar 01 07:04:13 GMT 2021

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

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

Back to the top