Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Getting errors when invoking sortedBy (Does sortedBy work with expressions that are invokation to a custom query that retrieves a tagged value from a stereotype?)
[Acceleo] Getting errors when invoking sortedBy [message #898902] Sun, 29 July 2012 03:26 Go to next message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Member
In the following code operandIndex() is a query that retrieves the value of a tagged attribute from the stereotype extending an instance of the metaclass InputPin:

[anOpaqueAction.input->asSequence()->sortedBy(operandIndex())/];


This code does not produce any error and generates some text with internal information about the objects for the input pins of the receiving object anOpaqueAction. However, when I use the sorted list as the receiver of a template (any template, including an empty one), I get errors. This is the code:

[anOpaqueAction.input->asSequence()->sortedBy(operandIndex())->generateExpression('&')/];[/for]

...

[template public generateExpression(aSequence: Sequence(InputPin), anOperator: String)]
[/template]


The errors are as follows:

Operation operandIndex() is undefined on type org.eclipse.uml2.uml.internal.impl.InputPinImpl.

Undefined argument anOpaqueAction.input->asSequence()->sortedBy(temp1 : InputPin | temp1.operandIndex()) of invocation at line 0 in Module generateArchitectureStatementPart for block generateExpression(anOpaqueAction.input->asSequence()->sortedBy(temp1 : InputPin | temp1.operandIndex()),'&'). Last recorded value of self was org.eclipse.uml2.uml.internal.impl.OpaqueActionImpl@6e833131 (name: merge, visibility: <unset>) (isLeaf: false) (body: null, language: null). Problem found while generating the file ...


What am I doing wrong?

Thanks


/TB
Re: [Acceleo] Getting errors when invoking sortedBy [message #898946 is a reply to message #898902] Sun, 29 July 2012 07:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Tomas

This seems vaguely familiar. Acceleo or OCL has trouble with
over-complex collections.

Try using an intermediate let-variable.

Regards

Ed Willink

On 29/07/2012 04:26, Tomas Balderas wrote:
> In the following code operandIndex() is a query that retrieves the
> value of a tagged attribute from the stereotype extending an instance
> of the metaclass InputPin:
>
>
> [anOpaqueAction.input->asSequence()->sortedBy(operandIndex())/];
>
>
> This code does not produce any error and generates some text with
> internal information about the objects for the input pins of the
> receiving object anOpaqueAction. However, when I use the sorted list
> as the receiver of a template (any template, including an empty one),
> I get errors. This is the code:
>
>
> [anOpaqueAction.input->asSequence()->sortedBy(operandIndex())->generateExpression('&')/];[/for]
>
>
> ..
>
> [template public generateExpression(aSequence: Sequence(InputPin),
> anOperator: String)]
> [/template]
>
>
> The errors are as follows:
>
>
> Operation operandIndex() is undefined on type
> org.eclipse.uml2.uml.internal.impl.InputPinImpl.
>
> Undefined argument anOpaqueAction.input->asSequence()->sortedBy(temp1
> : InputPin | temp1.operandIndex()) of invocation at line 0 in Module
> generateArchitectureStatementPart for block
> generateExpression(anOpaqueAction.input->asSequence()->sortedBy(temp1
> : InputPin | temp1.operandIndex()),'&'). Last recorded value of self
> was org.eclipse.uml2.uml.internal.impl.OpaqueActionImpl@6e833131
> (name: merge, visibility: <unset>) (isLeaf: false) (body: null,
> language: null). Problem found while generating the file ...
>
>
> What am I doing wrong?
>
> Thanks
Re: [Acceleo] Getting errors when invoking sortedBy [message #898977 is a reply to message #898946] Sun, 29 July 2012 23:06 Go to previous message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Member
Thank you Ed

You have saved my life, as before. I implemented your suggestion and everything worked fine!

Kindest regards.


/TB
Previous Topic:[Acceleo] how to create a compiler with xtext and Acceleo ?
Next Topic:XPand2 / MWE: Load file for XPand generator from outside the Java classpath?
Goto Forum:
  


Current Time: Thu Apr 25 16:54:21 GMT 2024

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

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

Back to the top