Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Re: Run-time errors in queries and templates
Re: Run-time errors in queries and templates [message #1462369] Wed, 05 November 2014 13:55
Ed Willink is currently offline Ed WillinkFriend
Messages: 5580
Registered: July 2009
Senior Member
Hi

This is not an OCL issue. It is an Acceleo problem where you will find a
recent thread reporting a very similar issue.

If one form of query works, then use it.

Regards

Ed Willink


On 05/11/2014 13:35, Anakreontas Mentis wrote:
> In queries (and templates), the query raises a run-time error but when I
> substitute an expression with a variable that stores the expression
> result, the error disappears. The following query provides a
> demonstration. When I replace the expression p.componentDeclaration
> with the variable comp that stores the expression result, the run-time
> error of the first version is not raised. Why aren't the two queries
> equivalent?
>
> First version:
> [query private getConIndexes(p : SubPortDeclarationReference, compound :
> CompoundInstance, cluster : Integer, nextPorts :
> Set(AtomInternalPortDeclaration)) : Set(Integer) =
> nextPorts->select(pp |
> p.forwardPortDeclaration.oclAsType(AtomExportPortDeclaration)
> portDeclarationReferences->includes(pp))->collect(getIndex(compound.declaration,
> p.componentDeclaration, cluster))
> /] raises a run-time error:
> =====
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined
> argument p.componentDeclaration of invocation at line 0 in Module atom
> for block
> getIndex(temp97,compound.declaration,p.componentDeclaration,cluster).
> Last recorded value of self was
> mailto:bip2.ujf.verimag.bip.port.impl.SubPortDeclarationReferenceImpl@2f97fb84.
> Problem found while generating the file
> '/home/mentis/sources/demo/./cluster1.cpp'.
> at
> atom.getConIndexes(SubPortDeclarationReference,CompoundInstance,Integer,Set(AtomInternalPortDeclaration))(atom.mtl:0)
>
> at
> atom.getConIndexes(SubPortDeclarationReference,CompoundInstance,Integer,Set(AtomInternalPortDeclaration))(atom.mtl:0)
>
> at
> atom.nextPossiblyEnabledPortIndexex(ConnectorDeclaration,ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:0)
>
> at
> atom.nextPossiblyEnabledPortIndexex(ConnectorDeclaration,ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:0)
>
> at
> atom.generatePostExec(ConnectorDeclaration,CompoundInstance,Integer,Boolean)(atom.mtl:0)
>
> at
> atom.generatePostExec(ConnectorDeclaration,CompoundInstance,Integer,Boolean)(atom.mtl:0)
>
> at
> atom.generatePostExec(ConnectorDeclaration,CompoundInstance,Integer,Boolean)(atom.mtl:649)
>
> at
> atom.generatePostExec(ConnectorDeclaration,CompoundInstance,Integer,Boolean)(atom.mtl:648)
>
> at
> atom.generatePostExec(ConnectorDeclaration,CompoundInstance,Integer,Boolean)(atom.mtl:614)
>
> at
> atom.generateExec(ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:0)
>
> at
> atom.generateExec(ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:547)
>
> at
> atom.generateExec(ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:546)
>
> at
> atom.generateExec(ConnectorDeclaration,CompoundInstance,Integer)(atom.mtl:519)
>
> at
> connector.generateLock(ConnectorDeclaration,CompoundInstance,Integer)(connector.mtl:0)
>
> at
> connector.generateLock(ConnectorDeclaration,CompoundInstance,Integer)(connector.mtl:316)
>
> at
> connector.generateLock(ConnectorDeclaration,CompoundInstance,Integer)(connector.mtl:253)
>
> at
> connector.generateLock(ConnectorDeclaration,CompoundInstance,Integer)(connector.mtl:232)
>
> at
> connector.generateConnectorFunction(ConnectorDeclaration,CompoundInstance)(connector.mtl:0)
>
> at
> connector.generateConnectorFunction(ConnectorDeclaration,CompoundInstance)(connector.mtl:600)
>
> at
> connector.generateConnectorFunction(ConnectorDeclaration,CompoundInstance)(connector.mtl:593)
>
> at
> connector.generateConnectorFunction(ConnectorDeclaration,CompoundInstance)(connector.mtl:567)
>
> at
> generateCluster.generateCluster(ComponentInstance)(generateCluster.mtl:0)
> at
> generateCluster.generateCluster(ComponentInstance)(generateCluster.mtl:741)
> at
> generateCluster.generateCluster(ComponentInstance)(generateCluster.mtl:666)
> at
> generateCluster.generateCluster(ComponentInstance)(generateCluster.mtl:665)
> at
> generateCluster.generateCluster(ComponentInstance)(generateCluster.mtl:658)
> java.lang.UnsupportedOperationException: Operation sep(String) is
> undefined on type org.eclipse.ocl.ecore.internal.OCLStandardLibraryImpl$1.
> at
> org.eclipse.acceleo.engine.internal.environment.AcceleoLibraryOperationVisitor.getExceptionOperationCallFailed(AcceleoLibraryOperationVisitor.java:1046)
>
> ........
>
> If I change the query into:
> [query private getConIndexes(p : SubPortDeclarationReference, compound :
> CompoundInstance, cluster : Integer, nextPorts :
> Set(AtomInternalPortDeclaration)) : Set(Integer) =
> let comp : ComponentDeclaration = p.componentDeclaration
> in nextPorts->select(pp |
> p.forwardPortDeclaration.oclAsType(AtomExportPortDeclaration)
> portDeclarationReferences->includes(pp))->collect(getIndex(compound.declaration,
> comp, cluster))
> /] no errors are raised. Unfortunately this happens quite often and I
> haven't discovered why. The two queries should be equivalent.
Previous Topic:Acceleo
Next Topic:[ACCELEO] Problem with casting
Goto Forum:
  


Current Time: Fri Jan 19 11:54:58 GMT 2018

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

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