Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] ATL API strangeness
[ATL] ATL API strangeness [message #81024] Wed, 07 May 2008 15:25 Go to next message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

This is a multi-part message in MIME format.
--------------070608070106070707030801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I get some strange results when programmatically invoking ATL.
The method doATLTransformation() in the attached file Transform.java doesn't seem to save the output models to the correct place.
Currently, everything is sent to outModels[0], but the output should go to the specified index of outModels[] (here 2).
As a result, the wrong part of the instance model gets substituted (which happens to throw an exception).

If I call addMetaModel() before each pair of addInputModel()/addOutputModel(), all output models stay empty (i.e. containing only the xmi header).
The idea is that all input and output models share the same metamodel, i.e. create o1,o2 : mm from i1,i2,i3 : mm;
The ATL file wizard seems to accept this.

Could I be bogusly aliasing something in Transform.java?

I'm currently using Eclipse 3.3.2 (20080221) with EMF 2.3.1 (20080205) and ATL 2.0.0 (20080303).
There didn't seem any updates available.

Thanks,
Rene

--------------070608070106070707030801
Content-Type: text/xml;
name="meta.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="meta.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="meta" nsURI="http://meta/" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="meta">
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_behaviour" eType="#/0/BehaviourElement"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_udd" eType="#/0/DeploymentDiagramEditModel"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_scenario" eType="#/0/ScenarioElement"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_action_beh" eType="#/0/behaviourModel"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_action_proc" eType="#/0/processModel"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ref_resource" eType="#/0/resourceModel"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="startLine" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="startColumn" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endLine" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endColumn" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" ordered="false"
eType="#/0/Element" eOpposite="#/0/Element/children"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Attribute" eSuperTypes="#/0/Node">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" ordered="false"
unique="false" lowerBound="1" eType="#/1/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Text" eSuperTypes="#/0/Node"/>
<eClassifiers xsi:type="ecore:EClass" name="Element" eSuperTypes="#/0/Node">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#/0/Node" containment="true" eOpposite="#/0/Node/parent"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Root" eSuperTypes="#/0/Element"/>
<eClassifiers xsi:type="ecore:EClass" name="ActionModel" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="componentGuid" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="componentName" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partOfTransformation"
eType="#/1/Boolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="deactivation">
<eStructuralFeatures xsi:type="ecore:EReference" name="by_default" eType="#/0/by_default"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="processModel" eSuperTypes="#/0/ActionModel">
<eStructuralFeatures xsi:type="ecore:EReference" name="process" upperBound="-1"
eType="#/0/process" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="process">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceRef" lowerBound="1"
eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceName" lowerBound="1"
eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1"
eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="behaviour" lowerBound="1"
eType="#/0/behaviour" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="periodicity" eType="#/0/periodicity"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="activation" eType="#/0/activation"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="deactivation" eType="#/0/deactivation"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="periodic">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="period" lowerBound="1"
eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="periodicity">
<eStructuralFeatures xsi:type="ecore:EReference" name="periodic" eType="#/0/periodic"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="behaviourModel" eSuperTypes="#/0/ActionModel">
<eStructuralFeatures xsi:type="ecore:EReference" name="implementedOperation"
upperBound="-1" eType="#/0/implementedOperation" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="implementedOperation">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="operationName" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="operationID" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromInterface" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromService" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromServiceName" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="behaviour" upperBound="-1"
eType="#/0/behaviour" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="cpuUsage" eType="#/0/cpuUsage"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="memoryUsage" eType="#/0/memoryUsage"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="busUsage" eType="#/0/busUsage"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="behaviour">
<eStructuralFeatures xsi:type="ecore:EReference" name="calledOperation" upperBound="-1"
eType="#/0/calledOperation" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="executionLoop" eType="#/0/executionLoop"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="calledOperation">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromInterface" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromService" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="synchronousCall" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="condition" eType="#/0/condition"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="numberOfIterations" eType="#/0/numberOfIterations"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="passedData" upperBound="-1"
eType="#/0/passedData" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="executionLoop">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfCycles" lowerBound="1"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="calledOperation" lowerBound="1"
upperBound="-1" eType="#/0/calledOperation" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="condition">
<eStructuralFeatures xsi:type="ecore:EReference" name="switch" lowerBound="1"
eType="#/0/Switch" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Switch">
<eStructuralFeatures xsi:type="ecore:EReference" name="case" lowerBound="2"
upperBound="2" eType="#/0/Case" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="externalAttribute" eType="#/1/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="externalAttribute">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attributeName" lowerBound="1"
eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attributeRange_min" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attributeRange_max" eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Case">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intervalFrom" lowerBound="1"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intervalUpto" lowerBound="1"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="numberOfIterations" eType="#/0/numberOfIterations"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="passedData" eType="#/0/passedData"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="numberOfIterations">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="passedData">
<eStructuralFeatures xsi:type="ecore:EReference" name="passedArg" eType="#/0/passedArg"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="returnedArg" eType="#/0/returnedArg"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfPassedBits" eType="#/1/Integer"
defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfReturnedBits"
eType="#/1/Integer" defaultValueLiteral="0"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="passedArg">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nmbElements" lowerBound="1"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="elementSize" lowerBound="1"
eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="returnedArg">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nmbElements" lowerBound="1"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="elementSize" lowerBound="1"
eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="by_default"/>
<eClassifiers xsi:type="ecore:EClass" name="activation">
<eStructuralFeatures xsi:type="ecore:EReference" name="by_default" eType="#/0/by_default"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BehaviourElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false"
unique="false" lowerBound="1" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partOfTransformation"
ordered="false" unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" ordered="false" unique="false"
lowerBound="1" eType="#/1/String" iD="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SequenceDiagram" eSuperTypes="#/0/BehaviourElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="subDiagram" upperBound="-1"
eType="#/0/SubDiagram" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="message" upperBound="-1"
eType="#/0/Message" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="classInstance" upperBound="-1"
eType="#/0/ClassInstance" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ClassInstance" eSuperTypes="#/0/BehaviourElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="actor" ordered="false"
unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="message" ordered="false"
upperBound="-1" eType="#/0/Message" eOpposite="#/0/Message/classinstance"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SubDiagram" eSuperTypes="#/0/BehaviourElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="message" upperBound="-1"
eType="#/0/Message" containment="true" eOpposite="#/0/Message/subdiagram"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outer" eType="#/0/SubDiagram"
eOpposite="#/0/SubDiagram/inner"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" ordered="false"
unique="false" lowerBound="1" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="inner" upperBound="-1"
eType="#/0/SubDiagram" containment="true" eOpposite="#/0/SubDiagram/outer"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="prev" upperBound="-1"
eType="#/0/BehaviourElement"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Message" eSuperTypes="#/0/BehaviourElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="deadline" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toSelf" ordered="false"
unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fromAbsent" ordered="false"
unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="classinstance" lowerBound="1"
upperBound="2" eType="#/0/ClassInstance" eOpposite="#/0/ClassInstance/message"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="prev" upperBound="-1"
eType="#/0/BehaviourElement"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="subdiagram" eType="#/0/SubDiagram"
eOpposite="#/0/SubDiagram/message"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ScenarioElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Name" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" ordered="false" unique="false"
lowerBound="1" eType="#/1/String" iD="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="height" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" ordered="false"
unique="false" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" ordered="false" unique="false"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="y" ordered="false" unique="false"
eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partOfTransformation"
ordered="false" unique="false" eType="#/1/Boolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Scenario" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="triggers" ordered="false"
upperBound="-1" eType="#/0/Trigger" containment="true" eOpposite="#/0/Trigger/scenario"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="triggerLinks" ordered="false"
upperBound="-1" eType="#/0/TriggerLink" containment="true" eOpposite="#/0/TriggerLink/scenario"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" ordered="false"
upperBound="-1" eType="#/0/ScenarioNode" containment="true" eOpposite="#/0/ScenarioNode/scenario"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="edges" ordered="false"
upperBound="-1" eType="#/0/Edge" containment="true" eOpposite="#/0/Edge/scenario"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Port" abstract="true" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" eType="#/1/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ScenarioNode" abstract="true" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isStart" ordered="false"
unique="false" lowerBound="1" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isFinish" ordered="false"
unique="false" lowerBound="1" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="compRef" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isBuffer" ordered="false"
unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bufferSizeKByte" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scenario" ordered="false"
lowerBound="1" eType="#/0/Scenario" eOpposite="#/0/Scenario/nodes"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="inputs" ordered="false"
upperBound="-1" eType="#/0/ProvidesPort" containment="true" eOpposite="#/0/ProvidesPort/node"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outputs" ordered="false"
upperBound="-1" eType="#/0/RequiresPort" containment="true" eOpposite="#/0/RequiresPort/node"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operation" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="triggerLinks" ordered="false"
upperBound="-1" eType="#/0/TriggerLink" eOpposite="#/0/TriggerLink/triggerTarget"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="providesPort" ordered="false"
lowerBound="1" eType="#/0/ProvidesPort" eOpposite="#/0/ProvidesPort/operations"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Edge" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="scenario" ordered="false"
lowerBound="1" eType="#/0/Scenario" eOpposite="#/0/Scenario/edges"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
lowerBound="1" eType="#/0/ProvidesPort" eOpposite="#/0/ProvidesPort/edges"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
lowerBound="1" eType="#/0/RequiresPort" eOpposite="#/0/RequiresPort/edges"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TriggerLink" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="scenario" ordered="false"
lowerBound="1" eType="#/0/Scenario" eOpposite="#/0/Scenario/triggerLinks"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="triggerSource" ordered="false"
lowerBound="1" eType="#/0/Trigger" eOpposite="#/0/Trigger/triggerLinks"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="triggerTarget" ordered="false"
lowerBound="1" eType="#/0/Operation" eOpposite="#/0/Operation/triggerLinks"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Trigger" eSuperTypes="#/0/ScenarioElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="periodic" ordered="false"
unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="jitter" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="offset" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="deadline" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="period" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="minArrivalInterval" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="precededByTask" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scenario" ordered="false"
lowerBound="1" eType="#/0/Scenario" eOpposite="#/0/Scenario/triggers"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="triggerLinks" ordered="false"
upperBound="-1" eType="#/0/TriggerLink" eOpposite="#/0/TriggerLink/triggerSource"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ProvidesPort" eSuperTypes="#/0/Port">
<eStructuralFeatures xsi:type="ecore:EReference" name="node" ordered="false"
lowerBound="1" eType="#/0/ScenarioNode" eOpposite="#/0/ScenarioNode/inputs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="edges" ordered="false"
upperBound="-1" eType="#/0/Edge" eOpposite="#/0/Edge/target"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="operations" ordered="false"
upperBound="-1" eType="#/0/Operation" containment="true" eOpposite="#/0/Operation/providesPort"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RequiresPort" eSuperTypes="#/0/Port">
<eStructuralFeatures xsi:type="ecore:EReference" name="node" ordered="false"
lowerBound="1" eType="#/0/ScenarioNode" eOpposite="#/0/ScenarioNode/outputs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="edges" ordered="false"
upperBound="-1" eType="#/0/Edge" eOpposite="#/0/Edge/source"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ServiceInstance" eSuperTypes="#/0/ScenarioNode"/>
<eClassifiers xsi:type="ecore:EClass" name="DeploymentDiagramEditModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="size" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="metadata" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="initialized" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="scrolledY" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#/0/ChildEditModel" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="scrolledX" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partOfTransformation"
eType="#/1/Boolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ChildEditModel" abstract="true" eSuperTypes="#/0/DeploymentDiagramEditModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stereotype" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="itemName" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="instanceLevel" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="location" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="targetConnections" upperBound="-1"
eType="#/0/ChildEditModel"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceConnections" upperBound="-1"
eType="#/0/ChildEditModel" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NodeEditModel" eSuperTypes="#/0/ChildEditModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nemId" lowerBound="1"
eType="#/1/String" defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComponentEditModel" eSuperTypes="#/0/ChildEditModel">
<eStructuralFeatures xsi:type="ecore:EReference" name="allowedNodes" lowerBound="1"
upperBound="-1" eType="#/0/NodeEditModel"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NotepadEditModel" eSuperTypes="#/0/ChildEditModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="note" eType="#/1/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DependencyEditModel" eSuperTypes="#/0/ChildEditModel">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" upperBound="-1"
eType="#/0/ChildEditModel"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" upperBound="-1"
eType="#/0/ChildEditModel"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="targetEnd" upperBound="-1"
eType="#/0/ChildEditModel"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceEnd" upperBound="-1"
eType="#/0/ChildEditModel"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="connectionRouterKind"
eType="#/1/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ComponentEndEditModel" eSuperTypes="#/0/ChildEditModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="attachSource" eType="#/1/Boolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="resourceModel">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="componentName" ordered="false"
unique="false" eType="#/1/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="componentGuid" ordered="false"
unique="false" eType="#/1/String" defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="partOfTransformation"
ordered="false" unique="false" eType="#/1/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="implementedOperation"
upperBound="-1" eType="#/0/implementedOperation" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="cpuUsage">
<eStructuralFeatures xsi:type="ecore:EReference" name="RISC" eType="#/0/RISC"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="CISC" eType="#/0/CISC"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="VLIW" eType="#/0/VLIW"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="DSP" eType="#/0/DSP"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RISC">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="minClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maxClaim" eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CISC">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="minClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maxClaim" eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="VLIW">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="minClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maxClaim" eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DSP">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="minClaim" eType="#/1/Integer"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maxClaim" eType="#/1/Integer"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="memoryUsage">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"
defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageRelease" eType="#/1/Integer"
defaultValueLiteral="0"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="busUsage">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageClaim" eType="#/1/Integer"
defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageTime" eType="#/1/Integer"
defaultValueLiteral="0"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="averageRelease" eType="#/1/Integer"/>
</eClassifiers>
</ecore:EPackage>
<ecore:EPackage name="PrimitiveTypes">
<eClassifiers xsi:type="ecore:EDataType" name="Boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Integer"/>
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
</xmi:XMI>

--------------070608070106070707030801
Content-Type: text/plain;
name="Transform.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Transform.java"

/**
* <copyright>
* Parts of this file are written by Dennis Wagelaar under the GPL v2 !!
* </copyright>
*/
package meta.custom;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;

import org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel;
import org.eclipse.m2m.atl.drivers.emf4atl.EMFModelLoader;
import org.eclipse.m2m.atl.engine.AtlEMFModelHandler;
import org.eclipse.m2m.atl.engine.AtlLauncher;
import org.eclipse.m2m.atl.engine.AtlModelHandler;

/**
* This class provides the glue for the ATL engine.
* @author rladan
*/
public class Transform {
private String transPath = Utils.mainPath + "transformations/";
private final HashMap<String, ASMEMFModel> models = new HashMap<String, ASMEMFModel>();
private ASMEMFModel metaModel;
private AtlModelHandler amh;
private EMFModelLoader ml;

/**
* Adds a metamodel to the internal list
*
* @param metaid ID of the metamodel
* @param metapath file name of <b>metaid</b>
* @throws FileNotFoundException if <b>metapath</b> is not found
*/
private void addMetaModel(final String metaid, final String metapath) throws FileNotFoundException {
this.metaModel = (ASMEMFModel) ((AtlEMFModelHandler) this.amh).loadModel(metaid, this.amh.getMof(), new FileInputStream(metapath));
this.metaModel.setIsTarget(false);
this.models.put(metaid, this.metaModel);
}

/**
* Add the input model to the internal list
* @param inModel The stream representing the input model
* @param inModelName The name of <b>inModel</b>
*/
private void addInputModel(final ByteArrayInputStream inModel, final String inModelName) {
ASMEMFModel inputModel;
inputModel = (ASMEMFModel) ((AtlEMFModelHandler) this.amh).loadModel(inModelName, this.metaModel, inModel);
inputModel.setIsTarget(false);
inputModel.setCheckSameModel(false);
this.models.put(inModelName, inputModel);
}

/**
* Add the output model to the internal list
* @param outModelName the name of the output model
* @throws Exception
*/
private void addOutputModel(final String outModelName) {
ASMEMFModel outputModel;
try {
outputModel = ASMEMFModel.newASMEMFModel(outModelName, outModelName, this.metaModel, this.ml);
outputModel.setIsTarget(true);
outputModel.setCheckSameModel(false);
this.models.put(outModelName, outputModel);
} catch (final Exception e) {
System.out.println("Could not add output models.");
e.printStackTrace();
}
}

/**
* Executes the ATL engine
* <p>
* This is specialized for our tool, meaning:<ul>
* <li>libraries are set to [XMLHelpers.asm , libTransformation.asm]
* <li>metamodel is set to meta.ecore
* </ul>
* </p>
* @param inModels the models to transform
* @param parameters the parameters for <b>inTransformation</b>
* @param inTransformation the name of the transformation to execute
* @param outModels the resulting models
* @throws IOException on various conditions
*/
public void doATLTransformation(final ByteArrayInputStream[] inModels, final ByteArrayInputStream parameters, final String inTransformation, final ByteArrayOutputStream[] outModels) throws IOException {
final URL trans = new URL("file:" + this.transPath + inTransformation + ".asm");
final HashMap<String, URL> libs = new HashMap<String, URL>();
libs.put("libTransformation", new URL("file:" + this.transPath + "libTransformation.asm"));
libs.put("XMLHelpers", new URL("file:" + this.transPath + "XMLHelpers.asm"));

this.models.clear();
this.amh = AtlModelHandler.getDefault(AtlModelHandler.AMH_EMF);
this.addMetaModel("meta", this.transPath + "meta.ecore");
this.addInputModel(parameters, "parameters");

if (inModels[0].available() > 0)
this.addInputModel(inModels[0], "IN_scenario");
this.addOutputModel("OUT_scenario");

if (inModels[1].available() > 0)
this.addInputModel(inModels[1], "IN_udd");
this.addOutputModel("OUT_udd");

if (inModels[2].available() > 0)
this.addInputModel(inModels[2], "IN_action_beh");
this.addOutputModel("OUT_action_beh");

if (inModels[3].available() > 0)
this.addInputModel(inModels[3], "IN_action_proc");
this.addOutputModel("OUT_action_proc");

if (inModels[4].available() > 0)
this.addInputModel(inModels[4], "IN_behaviour");
this.addOutputModel("OUT_behaviour");

if (inModels[5].available() > 0)
this.addInputModel(inModels[5], "IN_resource");
this.addOutputModel("OUT_resource");

final AtlLauncher myLauncher = AtlLauncher.getDefault();
myLauncher.launch(trans, libs, this.models, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP);

this.amh.saveModel(this.models.get("OUT_scenario"), outModels[0]);
this.amh.saveModel(this.models.get("OUT_udd"), outModels[1]);
this.amh.saveModel(this.models.get("OUT_action_beh"), outModels[2]);
this.amh.saveModel(this.models.get("OUT_action_proc"), outModels[3]);
this.amh.saveModel(this.models.get("OUT_behaviour"), outModels[4]);
this.amh.saveModel(this.models.get("OUT_resource"), outModels[5]);
}
}

--------------070608070106070707030801--
Re: [ATL] ATL API strangeness [message #81067 is a reply to message #81024] Thu, 08 May 2008 13:26 Go to previous message
Eclipse UserFriend
Originally posted by: r.c.ladan.tue.nl

This is a multi-part message in MIME format.
--------------090604040901010704030809
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Rene Ladan wrote:
> I get some strange results when programmatically invoking ATL.
> The method doATLTransformation() in the attached file Transform.java
> doesn't seem to save the output models to the correct place.
> Currently, everything is sent to outModels[0], but the output should go
> to the specified index of outModels[] (here 2).
> As a result, the wrong part of the instance model gets substituted
> (which happens to throw an exception).
>
Another bogus index: outModels[5] (i.e. the last assignment)

I've attached a diff representing the current Transform.java (mostly cleanups, still bogus).

>
> Could I be bogusly aliasing something in Transform.java?
>
> I'm currently using Eclipse 3.3.2 (20080221) with EMF 2.3.1 (20080205)
> and ATL 2.0.0 (20080303).
> There didn't seem any updates available.

Rene

--------------090604040901010704030809
Content-Type: text/plain;
name="transform.java.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="transform.java.diff"

Index: Transform.java
============================================================ =======
--- Transform.java (revision 313)
+++ Transform.java (working copy)
@@ -25,6 +25,10 @@
* @author rladan
*/
public class Transform {
+
+ /** Array containing the model type names. */
+ public final String[] modelNames = {"scenario", "udd", "action_beh", "action_proc", "behaviour", "resource"};
+
private String transPath = Utils.mainPath + "transformations/";
private final HashMap<String, ASMEMFModel> models = new HashMap<String, ASMEMFModel>();
private ASMEMFModel metaModel;
@@ -40,7 +44,6 @@
*/
private void addMetaModel(final String metaid, final String metapath) throws FileNotFoundException {
this.metaModel = (ASMEMFModel) ((AtlEMFModelHandler) this.amh).loadModel(metaid, this.amh.getMof(), new FileInputStream(metapath));
- this.metaModel.setIsTarget(false);
this.models.put(metaid, this.metaModel);
}

@@ -52,7 +55,6 @@
private void addInputModel(final ByteArrayInputStream inModel, final String inModelName) {
ASMEMFModel inputModel;
inputModel = (ASMEMFModel) ((AtlEMFModelHandler) this.amh).loadModel(inModelName, this.metaModel, inModel);
- inputModel.setIsTarget(false);
inputModel.setCheckSameModel(false);
this.models.put(inModelName, inputModel);
}
@@ -66,7 +68,6 @@
ASMEMFModel outputModel;
try {
outputModel = ASMEMFModel.newASMEMFModel(outModelName, outModelName, this.metaModel, this.ml);
- outputModel.setIsTarget(true);
outputModel.setCheckSameModel(false);
this.models.put(outModelName, outputModel);
} catch (final Exception e) {
@@ -100,36 +101,20 @@
this.addMetaModel("meta", this.transPath + "meta.ecore");
this.addInputModel(parameters, "parameters");

- if (inModels[0].available() > 0)
- this.addInputModel(inModels[0], "IN_scenario");
- this.addOutputModel("OUT_scenario");
+ for (int i = 0; i < this.modelNames.length; i++)
+ if (inModels[i].available() > 0) {
+ this.addInputModel(inModels[i], "IN_" + this.modelNames[i]);
+ this.addOutputModel("OUT_" + this.modelNames[i]);
+ inModels[i].reset();
+ }

- if (inModels[1].available() > 0)
- this.addInputModel(inModels[1], "IN_udd");
- this.addOutputModel("OUT_udd");
-
- if (inModels[2].available() > 0)
- this.addInputModel(inModels[2], "IN_action_beh");
- if (inModels[3].available() > 0)
- this.addInputModel(inModels[3], "IN_action_proc");
- this.addOutputModel("OUT_action");
-
- if (inModels[4].available() > 0)
- this.addInputModel(inModels[4], "IN_behaviour");
- this.addOutputModel("OUT_behaviour");
-
- if (inModels[5].available() > 0)
- this.addInputModel(inModels[5], "IN_resource");
- this.addOutputModel("OUT_resource");
-
final AtlLauncher myLauncher = AtlLauncher.getDefault();
myLauncher.launch(trans, libs, this.models, Collections.EMPTY_MAP, Collections.EMPTY_LIST, Collections.EMPTY_MAP);

- this.amh.saveModel(this.models.get("OUT_scenario"), outModels[0]);
- this.amh.saveModel(this.models.get("OUT_udd"), outModels[1]);
- this.amh.saveModel(this.models.get("OUT_action_beh"), outModels[2]);
- this.amh.saveModel(this.models.get("OUT_action_proc"), outModels[3]);
- this.amh.saveModel(this.models.get("OUT_behaviour"), outModels[4]);
- this.amh.saveModel(this.models.get("OUT_resource"), outModels[5]);
+ for (int i = 0; i < this.modelNames.length; i++) {
+ inModels[i].reset();
+ if (inModels[i].available() > 0)
+ this.amh.saveModel(this.models.get("OUT_" + this.modelNames[i]), outModels[i]);
+ }
}
}

--------------090604040901010704030809--
Previous Topic:[ATL] uml2wsdl
Next Topic:[ATL] href in IN model
Goto Forum:
  


Current Time: Sun May 26 16:59:21 GMT 2019

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

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

Back to the top