Skip to main content



      Home
Home » Modeling » ATL » NoSuchElementException when appending refining trace to sequence
NoSuchElementException when appending refining trace to sequence [message #989204] Wed, 05 December 2012 03:47 Go to next message
Eclipse UserFriend
I have an ecore model where a lot of classes have 3 attributes for audit information. I want to replace these 3 attributes with a reference to a class that contains all those attributes. That class is contained in another ecore model.

Therefore I wrote the following transformation:

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


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

rule addReferenceToAudit {
	from
	    input : ECore!EClass (
	    	input.eStructuralFeatures -> exists(e | e.isAuditInfoFeature())
	    )
	to  
		auditInfoReference : ECore!EReference (
			eContainingClass <- input,
			eType <- input.refImmediateComposite().auditClassifier(),
			name <- 'audit',
			eReferenceType <- input.refImmediateComposite().auditClassifier().debug()
		),
	    outputClass : ECore!EClass (
	    	eStructuralFeatures <- input.eStructuralFeatures.append(auditInfoReference.debug())
	    )
}

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

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


helper context ECore!EStructuralFeature def : isAuditInfoFeature() : Boolean = 
	Sequence{'beDat', 'beUser', 'beRolle'}.contains(self.name);


However I get a NoSuchElementException when I execute that transformation. The output is:
additional!Audit
refiningTrace!<unnamed>
org.eclipse.m2m.atl.engine.emfvm.VMException
	at __resolve__#13(refactorAuditInfo.atl)
		local variables: self=refactorAuditInfo : ASMModule, value=input!beDat
	at __resolve__#26(refactorAuditInfo.atl)
		local variables: self=refactorAuditInfo : ASMModule, value=Sequence {input!***, input!***, input!***, input!***, input!***, input!***, input!***, input!***, input!***, input!***, input!***, input!***, refiningTrace!<unnamed>}, e=input!beDat
	at __applyaddReferenceToAudit#56(refactorAuditInfo.atl[30:7-30:90])
		local variables: self=refactorAuditInfo : ASMModule, link=TransientLink {rule = addReferenceToAudit, sourceElements = {input = org.eclipse.emf.ecore.impl.EClassImpl@209933c3 (name: ***) (instanceClassName: null) (abstract: false, interface: false)}, targetElements = {auditInfoReference = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@483d42d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@56cb4b5d (name: Element) (instanceClassName: null) (abstract: false, interface: false)), outputClass = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6aded8ab (eClass: org.eclipse.emf.ecore.impl.EClassImpl@56cb4b5d (name: Element) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}, input=input!***, auditInfoReference=refiningTrace!<unnamed>, outputClass=refiningTrace!<unnamed>
	at __exec__#18(refactorAuditInfo.atl)
		local variables: self=refactorAuditInfo : ASMModule, e=TransientLink {rule = addReferenceToAudit, sourceElements = {input = org.eclipse.emf.ecore.impl.EClassImpl@209933c3 (name: ***) (instanceClassName: null) (abstract: false, interface: false)}, targetElements = {auditInfoReference = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@483d42d (eClass: org.eclipse.emf.ecore.impl.EClassImpl@56cb4b5d (name: Element) (instanceClassName: null) (abstract: false, interface: false)), outputClass = org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6aded8ab (eClass: org.eclipse.emf.ecore.impl.EClassImpl@56cb4b5d (name: Element) (instanceClassName: null) (abstract: false, interface: false))}, variables = {}}
	at main#57(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.ASMOperation.exec(ASMOperation.java:388)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:388)
	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.util.NoSuchElementException
	at java.util.ArrayList$Itr.next(Unknown Source)
	at org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv$173.exec(ExecEnv.java:1683)
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:391)
	... 15 more


The NoSuchElementException is raised during execution of the line
eStructuralFeatures <- input.eStructuralFeatures.append(auditInfoReference.debug())

Note that the line information of the ATL stack is not matching the correct line in the above ATL transformation, because I left out some other stuff.

I'm using Juno with ATL 3.3.1. Does anyone know, why this exception is raised and what I'm doing wrong? Thanks

[Updated on: Wed, 05 December 2012 03:49] by Moderator

Re: NoSuchElementException when appending refining trace to sequence [message #989210 is a reply to message #989204] Wed, 05 December 2012 04:04 Go to previous messageGo to next message
Eclipse UserFriend
In refining the first "to" element is always the "from" element.
Just place outputClass before auditInfoReference in the "to" section and it will work.
Re: NoSuchElementException when appending refining trace to sequence [message #989247 is a reply to message #989210] Wed, 05 December 2012 05:51 Go to previous messageGo to next message
Eclipse UserFriend
I have tried that, but it doesn't work. I get the same error message and stack trace, except that the auditInfoReference element isn't executed.

Any more ideas?

[Updated on: Wed, 05 December 2012 05:55] by Moderator

Re: NoSuchElementException when appending refining trace to sequence [message #989255 is a reply to message #989247] Wed, 05 December 2012 06:20 Go to previous messageGo to next message
Eclipse UserFriend
Have you tried eStructuralFeatures <- auditInfoReference directly ?
The existing eStructuralFeatures are already copied because of the refining type of this transformation.
So eStructuralFeatures <- auditInfoReference will add auditInfoReference to the existing list.
Re: NoSuchElementException when appending refining trace to sequence [message #989271 is a reply to message #989255] Wed, 05 December 2012 07:54 Go to previous message
Eclipse UserFriend
I found the solution for the NoSuchElementException. When i change the VM the transformation is running in to the regular VM, then I get the error message
org.eclipse.m2m.atl.engine.vm.VMException: Could not find operation contains on Sequence(OclAny) having supertypes: [Collection(OclAny)]
	at MECore!EStructuralFeature;.isAuditInfoFeature() : ??#11(refactorAuditInfo.atl[37:2-37:60])
		local variables = {self=input!betId}
		local stack = []

So the line
Sequence{'beDat', 'beUser', 'beRolle'}.contains(self.name);

must be rewritten to
Sequence{'beDat', 'beUser', 'beRolle'}->includes(self.name);


Thanks for your help Sylvain.
Previous Topic:basic ATL transformation tutorial
Next Topic:Errors when removing from and adding to the same sequence in refining mode
Goto Forum:
  


Current Time: Wed Jul 23 11:36:03 EDT 2025

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

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

Back to the top