Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Question about ATL
Question about ATL [message #988696] Sat, 01 December 2012 08:18 Go to next message
Rafael Durelli is currently offline Rafael Durelli
Messages: 51
Registered: September 2012
Member
Hello guys, i'm new at ATL and I'm trying to create a simple transformation that transform a SQLMODEL, which I've devised, to a KDMSQL, which correspond to a extension to the KDM to model SQL statements. However, when I have to create the Datatype I always get an exception. Please, see the code below

-- @path MM=/SQLMODEL/model/sqlmodel.ecore
-- @path MM1=/KDMSQLExtesion/model/kdmSQL.ecore

module transformation;
create OUT : MM1 from IN : MM;



rule table2TableUnit {
	from
		table : MM!Table
	to 
		tableUnit : MM1!TableUnit (
			name <- table.name,
			codeElement <- table.columns
		)
}

rule column2ColumnUnit {
	from
		column : MM!Column
	to 
		columnUnit : MM1!ColumnUnit (
			name <- column.name,
			type <- column.type //the error of Casting is happing here.
                       //type is Datatype and column.type is a String, how can I create a Datatype correctly?
		)
}


Thanks guys, please help.
Re: Question about ATL [message #988761 is a reply to message #988696] Sun, 02 December 2012 19:42 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael Durelli
Messages: 51
Registered: September 2012
Member
-- @path MM=/SQLMODEL/model/sqlmodel.ecore
-- @path MM1=/KDMSQLExtesion/model/kdmSQL.ecore

module transformation;
create OUT : MM1 from IN : MM;



rule table2TableUnit {
	from
		table : MM!Table
	to 
		tableUnit : MM1!TableUnit (
			name <- table.name,
			codeElement <- table.columns
		)
}

rule column2ColumnUnit {
	from
		column : MM!Column
	to 
		columnUnit : MM1!ColumnUnit (
			name <- column.name,
			type.name <- column.type -- Herein is the problem...
		) 
}



I have been tried make type.name (String) <- column.type (also string) but the source code don't compile. Could someone please help me on this?
Re: Question about ATL [message #988820 is a reply to message #988696] Mon, 03 December 2012 05:54 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael Durelli
Messages: 51
Registered: September 2012
Member
Hello everyone, I have done it. It was really simple. Please, see the source code below.
Thanks.

-- @path MM=/SQLMODEL/model/sqlmodel.ecore
-- @path MM1=/KDMSQLExtesion/model/kdmSQL.ecore

module transformation;
create OUT : MM1 from IN : MM;


helper def : teste : MM1!ColumnUnit = 0;

rule table2TableUnit {
	from
		table : MM!Table
	to 
		tableUnit : MM1!TableUnit (
			name <- table.name,
			codeElement <- table.columns
		)
}

rule column2ColumnUnit {
	from
		column : MM!Column 
	to 
		columnUnit : MM1!ColumnUnit (
			name <- column.name,
			type <- type
		),
		type : MM1!ColumnUnit (
		
			name <- column.type
			
		)
}

Re: Question about ATL [message #988834 is a reply to message #988761] Mon, 03 December 2012 06:46 Go to previous message
Hugo Bruneliere is currently offline Hugo Bruneliere
Messages: 600
Registered: July 2009
Senior Member
Hello,

ATL does not currently provide a full support for custom datatypes.
This limitation has been recently discussed, e.g. in http://www.eclipse.org/forums/index.php/mv/msg/440384/986641/#msg_986641

Best regards,

Hugo


------------------------------------------
Hugo Bruneliere - R&D Engineer
AtlanMod research team (Inria, EMN & LINA)
Ecole des Mines de Nantes
Nantes - France
------------------------------------------
Previous Topic:Querying KDM model
Next Topic:MoDisco already supports SMM (structured metrics metamodel) ?
Goto Forum:
  


Current Time: Wed Jul 30 15:15:21 EDT 2014

Powered by FUDForum. Page generated in 0.01721 seconds