Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Feature does not exist in refining mode
[ATL] Feature does not exist in refining mode [message #715401] Sat, 13 August 2011 18:59 Go to next message
Ravenlord  is currently offline Ravenlord Friend
Messages: 5
Registered: August 2011
Junior Member
Hello all

In order to get familiar with ATL I am trying to write a transformation for many-to-many relations. (The probably well known transformation where a many-to-many relation between two classes is transformed to an extra class with 1-to-may references.) In the catalogue of model transformations I already found such a transformation written using the KM3 model.
Since I don't want to write code for every possible element in the model I use the refining mode provided by ATL. When executing the transformation I get following error:

org.eclipse.m2m.atl.engine.emfvm.VMException: Feature eStructuralFeatures does not exist on EReference
<native>
	at __applyRefiningTrace__#41(mult.atl)
		local variables: self=mult : ASMModule
	at main#50(mult.atl)
		local variables: self=mult : ASMModule


This error makes no sense to me since I never call eStructuralFeatures from an EReference. Executing exactly the same code but in the default from mode runs as expected. My transformation looks as follows at the moment:

module mult;
create OUT : ecore refining IN : ecore;

-- Returns true if self and self.opposite constitute a many to many relation,
-- false otherwise
helper context ecore!EReference def : isManyToMany : Boolean =
	if (not self.eOpposite.oclIsUndefined()) then
		self.isMany and self.eOpposite.isMany
	else
		false
	endif;

-- Returns true if self has a lowerbound of 0 and an upperbound of *
helper context ecore!EReference def : isMany : Boolean =
	self.lowerBound = 0 and self.upperBound < 0;

rule association {
	from
		refA: ecore!EReference,
		refB: ecore!EReference,
		inputClassA: ecore!EClass,
		inputClassB: ecore!EClass (
			refA.eOpposite = refB and
			refA.isManyToMany and
			refA.eReferenceType = inputClassA and
			refB.eReferenceType = inputClassB
		)
	to
		outputClassA : ecore!EClass (
			name <- inputClassA.name,
			eStructuralFeatures <- outputRefAC
		),
		
		outputClassB : ecore!EClass (
			name <- inputClassB.name,
			eStructuralFeatures <- outputRefBC
		),
		
		outputClassC : ecore!EClass (
			name <- inputClassA.name->concat(inputClassB.name),
			eStructuralFeatures <- outputRefCA,
			eStructuralFeatures <- outputRefCB
		),
		
		outputRefAC : ecore!EReference (
			name <- refA.name,
			lowerBound <- 1,
			upperBound <- 1,
			eType <- outputClassA,
			eOpposite <- outputRefCA
		),
		
		outputRefCA : ecore!EReference (
			name <- refA.name + '1',
			lowerBound <- 0,
			upperBound <- 0-1,
			eType <- outputClassC,
			eOpposite <- outputRefAC
		),
		
		outputRefBC : ecore!EReference (
			name <- refB.name,
			lowerBound <- 1,
			upperBound <- 1,
			eType <- outputClassB,
			eOpposite <- outputRefCB
		),
		
		outputRefCB : ecore!EReference (
			name <- refB.name + '1',
			lowerBound <- 0,
			upperBound <- 0-1,
			eType <- outputClassC,
			eOpposite <- outputRefBC
		)
}


Any advice would be welcome.
Re: [ATL] Feature does not exist in refining mode [message #716013 is a reply to message #715401] Tue, 16 August 2011 08:20 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
In refining mode, the first element of the to section is the original from element (I'm not sure how it works with multiple froms but this should be the same).
try :
to
		outputRefA : ecore!EReference(),
		outputClassA : ecore!EClass (
			name <- inputClassA.name,
			eStructuralFeatures <- outputRefAC
		),


Your error comes from the fact that you have outputClassA as the first to element wich maps to refA which is actually an EReference

[Updated on: Tue, 16 August 2011 08:21]

Report message to a moderator

Re: [ATL] Feature does not exist in refining mode [message #716241 is a reply to message #716013] Tue, 16 August 2011 18:30 Go to previous message
Ravenlord  is currently offline Ravenlord Friend
Messages: 5
Registered: August 2011
Junior Member
Thank you very much that solved it.
Previous Topic:refining mode and move eattribute
Next Topic:Back Propagation into model
Goto Forum:
  


Current Time: Thu Apr 25 05:10:39 GMT 2024

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

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

Back to the top