Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Errors when removing from and adding to the same sequence in refining mode
Errors when removing from and adding to the same sequence in refining mode [message #989274] Wed, 05 December 2012 13:14
Andreas Brieg is currently offline Andreas BriegFriend
Messages: 48
Registered: November 2012
Member
I'm refining an ecore model, so that classes will have an additional reference in their structural features and have some of their attributes dropped. The transformation is this:

-- @atlcompiler atl2010
-- @nsURI ECore=http://www.eclipse.org/emf/2002/Ecore


module refactorAuditInfo;
create output: ECore refining input: ECore, additional: ECore;

rule removeAuditInfoFeatures {
	from
		input_name: ECore!EAttribute (
			input_name.isAuditInfoAttribute()
		)
	to
		drop
}

rule addReferenceToAudit {
	from
		input: ECore!EClass (
			input.eStructuralFeatures -> exists(e | e.isAuditInfoAttribute())
		)
	to
		outputClass: ECore!EClass (
			eStructuralFeatures <- auditInfoReference
		),
		auditInfoReference: ECore!EReference (
			eType <- thisModule.auditClassifier,
			name <- 'audit'
		)
}

helper def: additionalDbadm: ECore!EPackage =
	ECore!EPackage.allInstances() -> select(e | e.nsURI = 'http://additional.dbadm/1.0').
			first();

helper def: auditClassifier: ECore!EClass =
	thisModule.additionalDbadm.eClassifiers -> select(e | e.name = 'Audit').first();

helper context ECore!EStructuralFeature def: isAuditInfoAttribute(): Boolean =
	false;

helper context ECore!EAttribute def: isAuditInfoAttribute(): Boolean =
	Sequence{'beDat',
				'beUser',
				'beRolle'} -> includes(self.name);


When I run the transformation, I get
org.eclipse.m2m.atl.engine.vm.VMException: Feature sourceElement does not exist on MOF!EAttribute
	at A.__applyRefiningTrace__() : ??#58(refactorAuditInfo.atl)
		local variables = {self=refactorAuditInfo : ASMModule}
		local stack = [refiningTrace!<unnamed>]


The problem has something to do with the drop of some of the features. However, I have no idea what I must do about it.

I already read this topic, which describes a similar problem. But as far as I understand I should already have followed the advice made their.

Does anybody has some advice for me to solve that problem? Thanks.

EDIT:
The above error message was with the regular VM. When I change to the EMF-specific VM, then I get:
org.eclipse.m2m.atl.engine.emfvm.VMException
	at __applyRefiningTrace__#47(refactorAuditInfo.atl)
		local variables: self=refactorAuditInfo : ASMModule
	at main#79(refactorAuditInfo.atl)
		local variables: self=refactorAuditInfo : ASMModule
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:643)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
	at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:234)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ArrayIndexOutOfBoundsException

Sadly, I don't see the trace where the ArrayIndexOutOfBoundsException comes from.

EDIT2:
The ArrayIndexOutOfBoundsException comes from the fact that the stack size is limited to 100 in the EMF-specific VM. I detected this by enabling the option Print execution information to console for every executed bytecode. The last output of that before the error had a stack depth of 100.

EDIT3:
I also get that error with a reduced transformation on the regular VM. Then it looks like this:
-- @atlcompiler atl2010
-- @nsURI ECore=http://www.eclipse.org/emf/2002/Ecore


module refactorAuditInfo;
create output: ECore refining input: ECore;

rule removeAuditInfoFeatures {
	from
		input_name: ECore!EAttribute (
			input_name.isAuditInfoAttribute()
		)
	to
		drop	
}

helper context ECore!EAttribute def: isAuditInfoAttribute(): Boolean =
	Sequence{'beDat',
				'beUser',
				'beRolle'} -> includes(self.name);

However when I use the EMF-specific VM, the transformation runs through. That means I'm stuck between two errors. Either the regular VM is failing because of the said error or the EMF-specific VM is failing because of its limited stack size.

As a workaround I'm going to split this up into two transformations that will run subsequently.

[Updated on: Wed, 05 December 2012 15:11]

Report message to a moderator

Previous Topic:NoSuchElementException when appending refining trace to sequence
Next Topic:ATL to ATL Refining Mode
Goto Forum:
  


Current Time: Sat Dec 20 23:06:51 GMT 2014

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

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