Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Problems starting with "Create a simple ATL transformation"(I am tring to make this basic tutorial and I got problems.)
Problems starting with "Create a simple ATL transformation" [message #945925] Mon, 15 October 2012 19:57 Go to next message
Bruno Carneiro is currently offline Bruno Carneiro
Messages: 7
Registered: October 2012
Junior Member
http://wiki.eclipse.org/ATL/Tutorials_-_Create_a_simple_ATL_transformation

When a tried to run the transformation, I got this error on console:

Error loading platform:/resourceFamilies2Persons/Families.ecore: java.net.MalformedURLException: Unsupported "platform:" protocol variation "resourceFamilies2Persons".

My files are copied bellow

Families.ecore
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage 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" name="Families"
nsURI="" nsPrefix="">
<eClassifiers xsi:type="ecore:EClass" name="Family">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="lastName" unique="false"
lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="father" lowerBound="1"
eType="#//Member" containment="true" eOpposite="#//Member/familyFather"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="mother" lowerBound="1"
eType="#//Member" containment="true" eOpposite="#//Member/familyMother"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sons" upperBound="-1" eType="#//Member"
containment="true" eOpposite="#//Member/familySon"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="daughters" upperBound="-1"
eType="#//Member" derived="true" containment="true" eOpposite="#//Member/familyDaughter"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Member">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyFather" eType="#//Family"
eOpposite="#//Family/father"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyMother" eType="#//Family"
eOpposite="#//Family/mother"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familySon" eType="#//Family"
eOpposite="#//Family/sons"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="familyDaughter" eType="#//Family"
eOpposite="#//Family/daughters"/>
</eClassifiers>
</ecore:EPackage>

Families2Persons.atl
-- @path Families=Families2Persons/Families.ecore
-- @path Persons=Families2Persons/Persons.ecore

module Families2Persons;

create OUT: Persons from IN: Families;

helper context Families!Member def: isFemale(): Boolean =
if not self.familyMother.oclIsUndefined() then
true
else
if not self.familyDaughter.oclIsUndefined() then
true
else
false
endif
endif;

helper context Families!Member def: familyName: String =
if not self.familyFather.oclIsUndefined() then
self.familyFather.lastName
else
if not self.familyMother.oclIsUndefined() then
self.familyMother.lastName
else
if not self.familySon.oclIsUndefined() then
self.familySon.lastName
else
self.familyDaughter.lastName
endif
endif
endif;

rule Member2Male {
from
s: Families!Member ( not s.isFemale() )
to
t: Persons!Male(
fullName <- s.firstName + ' ' + s.familyName
)
}

rule Member2Female {
from
s: Families!Member (s.isFemale())
to
t: Persons!Female (
fullName <- s.firstName + ' ' + s.familyName
)
}

Families2Persons.launch
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2m.atl.adt.launching.atlTransformation">
<stringAttribute key="ATL File Name" value="/Families2Persons/Families2Persons.atl"/>
<stringAttribute key="ATL VM" value="EMF-specific VM"/>
<stringAttribute key="ATL_COMPILER" value="atl2006"/>
<booleanAttribute key="IS_REFINING" value="false"/>
<mapAttribute key="Input">
<mapEntry key="IN" value="Families"/>
</mapAttribute>
<mapAttribute key="Libs"/>
<mapAttribute key="Model Handler">
<mapEntry key="Families" value="EMF"/>
<mapEntry key="Persons" value="EMF"/>
</mapAttribute>
<mapAttribute key="ModelType">
<mapEntry key="Families" value="METAMODELINPUT"/>
<mapEntry key="IN" value="MODELINPUT"/>
<mapEntry key="OUT" value="MODELOUTPUT"/>
<mapEntry key="Persons" value="METAMODELOUTPUT"/>
</mapAttribute>
<mapAttribute key="Options">
<mapEntry key="OPTION_CLEAR" value="false"/>
<mapEntry key="OPTION_CONTENT_TYPE" value="false"/>
<mapEntry key="OPTION_DERIVED" value="true"/>
<mapEntry key="allowInterModelReferences" value="false"/>
<mapEntry key="printExecutionTime" value="false"/>
<mapEntry key="step" value="false"/>
<mapEntry key="supportUML2Stereotypes" value="false"/>
</mapAttribute>
<listAttribute key="OrderedInput">
<listEntry value="IN"/>
</listAttribute>
<listAttribute key="OrderedOutput">
<listEntry value="OUT"/>
</listAttribute>
<mapAttribute key="Output">
<mapEntry key="OUT" value="Persons"/>
</mapAttribute>
<mapAttribute key="Path">
<mapEntry key="Families" value="Families2Persons/Families.ecore"/>
<mapEntry key="IN" value="/Families2Persons/sample-Families.xmi"/>
<mapEntry key="OUT" value="/Families2Persons/sample-Persons.xmi"/>
<mapEntry key="Persons" value="Families2Persons/Persons.ecore"/>
</mapAttribute>
<listAttribute key="Superimpose"/>
</launchConfiguration>


Persons.ecore
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage 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" name="Persons">
<eClassifiers xsi:type="ecore:EClass" name="Person" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Male" eSuperTypes="#//Person"/>
<eClassifiers xsi:type="ecore:EClass" name="Female" eSuperTypes="#//Person"/>
</ecore:EPackage>

sample-Families.xmi
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http:// www.omg. org/XMI" xmlns="Families">
<Family lastName="March">
<father firstName="Jim"/>
<mother firstName="Cindy"/>
<sons firstName="Brandon"/>
<daughters firstName="Brenda"/>
</Family>
<Family lastName="Sailor">
<father firstName="Peter"/>
<mother firstName="Jackie"/>
<sons firstName="David"/>
<sons firstName="Dylan"/>
<daughters firstName="Kelly"/>
</Family>
</xmi:XMI>
Re: Problems starting with "Create a simple ATL transformation" [message #955296 is a reply to message #945925] Tue, 23 October 2012 17:32 Go to previous messageGo to next message
Bruno Carneiro is currently offline Bruno Carneiro
Messages: 7
Registered: October 2012
Junior Member
I found the problem: we must use "/" in the paths' beginning.
Re: Problems starting with "Create a simple ATL transformation" [message #955332 is a reply to message #955296] Tue, 23 October 2012 18:08 Go to previous message
Bruno Carneiro is currently offline Bruno Carneiro
Messages: 7
Registered: October 2012
Junior Member
I am still having problems. In the file smaple-Families.xmi, in the line 2, if I use xmlsn="Families" I get a problem:

Error loading platform:/resource/Families2Persons/sample-Families.xmi: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'Families' not found. (platform:/resource/Families2Persons/sample-Families.xmi, 3, 27)

In order to solve this problem, I need to use xmlns="/Families2Persons/Families.ecore"

Why am I having this problem?

In Families2Persons.launch I have '<mapEntry key="Families" value="/Families2Persons/Families.ecore"/>'
In Families2Persons.atl I have '-- @path Families=/Families2Persons/Families.ecore'
Previous Topic:How to inject code into java model MethodDeclaration
Next Topic:Error at execution: java.lang.NoClassDefFoundError
Goto Forum:
  


Current Time: Tue Sep 30 16:04:00 GMT 2014

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

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