Skip to main content


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 13:18 Go to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
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] Mon, 03 December 2012 00:42 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
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 10:54 Go to previous messageGo to next message
Rafael Durelli is currently offline Rafael DurelliFriend
Messages: 72
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 11:46 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
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, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Previous Topic:Querying KDM model
Next Topic:MoDisco already supports SMM (structured metrics metamodel) ?
Goto Forum:
  


Current Time: Fri Apr 26 16:22:57 GMT 2024

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

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

Back to the top