Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo 3.2] Don't understand the error/problem with a simple query modification
[acceleo 3.2] Don't understand the error/problem with a simple query modification [message #756887] Tue, 15 November 2011 12:44 Go to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Hello (again),

I have this query, that works fine:
[query private uppers(aPrio : PriorityDeclaration) : Sequence(Sequence(PriorityDeclaration)) =
  let retSeq : Sequence(Sequence(riorityDeclaration)) = 
                           fusionPrioSeq(aPrio.upper()
                                              ->collectNested(uPrio : PriorityDeclaration |uPrio.uppers() ) )
                              ->collectNested(e:Sequence(PriorityDeclaration)| e->prepend(aPrio) )  in
        if retSeq->isEmpty() then
            Sequence{Sequence{aPrio}}
        else
            retSeq
        endif
/]

And it's called by a template:
[template private genPriorityCondition(aPrioDecl : PriorityDeclaration) post(trim())
    {
        ups : Sequence(Sequence(PriorityDeclaration)) = aPrioDecl.uppers();
    }]
....


Suppose I want to add an extra argument to the query. I have now:
[query private uppers(aPrio : PriorityDeclaration, i: Integer) : Sequence(Sequence(PriorityDeclaration)) =
  let retSeq : Sequence(Sequence(PriorityDeclaration)) = 
                           fusionPrioSeq(aPrio.upper()
                                              ->collectNested(uPrio : PriorityDeclaration | uPrio.uppers(1) ) )
                              ->collectNested(e:Sequence(PriorityDeclaration)| e->prepend(aPrio) )  in
        if retSeq->isEmpty() then
            Sequence{Sequence{aPrio}}
        else
            retSeq
        endif
/]


Unfortunately, this gives me the following output:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined argument upper(aPrio)->collectNested(uPrio : PriorityDeclaration | uppers(1)) of invocation at line 0 in Module generateType for block fusionPrioSeq(upper(aPrio)->collectNested(uPrio : PriorityDeclaration | uppers(1))). Last recorded value of self was bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result for expression let retSeq : Sequence(Sequence(PriorityDeclaration)) = fusionPrioSeq(upper(aPrio)->collectNested(uPrio : PriorityDeclaration | uppers(1)))->collectNested(e : Sequence(PriorityDeclaration) | e->prepend(aPrio)) in if retSeq->isEmpty() then Sequence {Sequence {aPrio}} else retSeq endif at line 160 in Module generateType for query uppers(PriorityDeclaration,Integer). Last recorded value of self was bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop iteration at line 180 in Module generateType for block for (ups) separator(' || '). Last recorded value of self was bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
	at generateType.genPriorityCondition(PriorityDeclaration)(generateType.mtl:180)


But if I change the recursive call, from
uPrio.uppers(1)
to
uppers(uPrio, 1)
, it works...

I guess I'm not using correctly something, but I can't understand what and how...
Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #756957 is a reply to message #756887] Tue, 15 November 2011 17:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Marc

Puzzling, but you're using Acceleo 3.2, for which IMHO the builder just
doesn't work (https://bugs.eclipse.org/bugs/show_bug.cgi?id=363651). You
may need to try a variety of tricks to actually get a rebuild to build.
I suggest trying your 'bad' code again, and then make significant
changes like adding another query and verifying that the *.emtl files
acquire a new date.

Regards

Ed Willink

On 15/11/2011 12:44, Marc wrote:
> Hello (again),
>
> I have this query, that works fine:
>
> [query private uppers(aPrio : PriorityDeclaration) :
> Sequence(Sequence(PriorityDeclaration)) =
> let retSeq : Sequence(Sequence(riorityDeclaration)) =
> fusionPrioSeq(aPrio.upper()
> ->collectNested(uPrio :
> PriorityDeclaration |uPrio.uppers() ) )
>
> ->collectNested(e:Sequence(PriorityDeclaration)| e->prepend(aPrio) ) in
> if retSeq->isEmpty() then
> Sequence{Sequence{aPrio}}
> else
> retSeq
> endif
> /]
> And it's called by a template:
>
> [template private genPriorityCondition(aPrioDecl :
> PriorityDeclaration) post(trim())
> {
> ups : Sequence(Sequence(PriorityDeclaration)) =
> aPrioDecl.uppers();
> }]
> ...
>
>
> Suppose I want to add an extra argument to the query. I have now:
> [query private uppers(aPrio : PriorityDeclaration, i: Integer) :
> Sequence(Sequence(PriorityDeclaration)) =
> let retSeq : Sequence(Sequence(PriorityDeclaration)) =
> fusionPrioSeq(aPrio.upper()
> ->collectNested(uPrio :
> PriorityDeclaration | uPrio.uppers(1) ) )
>
> ->collectNested(e:Sequence(PriorityDeclaration)| e->prepend(aPrio) ) in
> if retSeq->isEmpty() then
> Sequence{Sequence{aPrio}}
> else
> retSeq
> endif
> /]
>
> Unfortunately, this gives me the following output:
>
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Undefined
> argument upper(aPrio)->collectNested(uPrio : PriorityDeclaration |
> uppers(1)) of invocation at line 0 in Module generateType for block
> fusionPrioSeq(upper(aPrio)->collectNested(uPrio : PriorityDeclaration
> | uppers(1))). Last recorded value of self was
> bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result
> for expression let retSeq : Sequence(Sequence(PriorityDeclaration)) =
> fusionPrioSeq(upper(aPrio)->collectNested(uPrio : PriorityDeclaration
> | uppers(1)))->collectNested(e : Sequence(PriorityDeclaration) |
> e->prepend(aPrio)) in if retSeq->isEmpty() then Sequence {Sequence
> {aPrio}} else retSeq endif at line 160 in Module generateType for
> query uppers(PriorityDeclaration,Integer). Last recorded value of self
> was bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop
> iteration at line 180 in Module generateType for block for (ups)
> separator(' || '). Last recorded value of self was
> bla.priority.impl.PriorityDeclarationImpl@1144ba2 (name: ND).
> at
> generateType.genPriorityCondition(PriorityDeclaration)(generateType.mtl:180)
>
> But if I change the recursive call, from uPrio.uppers(1) to
> uppers(uPrio, 1), it works...
>
> I guess I'm not using correctly something, but I can't understand what
> and how...
Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #757675 is a reply to message #756957] Mon, 21 November 2011 08:57 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Ed,

The builder does seem to "forget" rebuilding things, but the problem at hand is not one of these "things" : the builder should always rebuild the module that is being edited. Only the modules that depend on this "edited" one will be forgotten. We rebuild the "depending" modules only if one of the "edited"'s signatures change; and it seems like we don't rebuild them in all possible cases (though I couldn't pinpoint which). Marc's issue has obviously nothing to do with the builder though.

Marc,

The recursive call should have worked ... we might have an issue with recursive query resolution, but we'll need to isolate a simpler minimal use case.

Laurent Goubet
Obeo

[Updated on: Mon, 21 November 2011 09:23]

Report message to a moderator

Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #757691 is a reply to message #757675] Mon, 21 November 2011 09:22 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Marc,

I could confirm that there is a bug in the parser that makes the call spelled "uPrio.uppers(1)" fail; I tracked it as bug 364272 with the reproduction steps.

For now, please do with the workaround you found (explicitely calling uppers(uPrio, 1)) as this does not present the same bug.

Laurent Goubet
Obeo
Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #757702 is a reply to message #757691] Mon, 21 November 2011 09:57 Go to previous messageGo to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Thanks for the help !
Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #757712 is a reply to message #757702] Mon, 21 November 2011 10:37 Go to previous messageGo to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Small addition, as it is very similar (at least the workaround is).

I have something like:

query
template using the query

Both in the same file, nothing in between. It works as expected in Eclipse (for different users), and for most os the user from command line (I use a standalone compilation). Except for 1, who gets the following message:

  [acceleo] 246:Cannot find operation (getPathsWithoutCycle(OrderedSet(OrderedSet(PriorityDeclaration)))) for the type (Sequence(Sequence(PriorityDeclaration))) 


Simply changing the calling code from :
ups->getPathsWithoutCycle(cycles)
to
getPathsWithoutCycle(ups,cycles)


fixes the problem. Not sure why... It looks very similar as the query prototype is:
[query public getPathsWithoutCycle(paths : Sequence(Sequence(PriorityDeclaration)), 
                                   cycles : OrderedSet(OrderedSet(PriorityDeclaration))) : Set(Sequence(PriorityDeclaration)) = ...


Re: [acceleo 3.2] Don't understand the error/problem with a simple query modification [message #758426 is a reply to message #757712] Wed, 23 November 2011 09:15 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Marc, seems like the same issue indeed, or at least very similar. It does not really surprise me though ... there's a bit too much Sequences, Sets and OrderedSets in there Razz.

Laurent Goubet
Obeo
Previous Topic:[Acceleo] dynamic vs generated package used by Acceleo Plug-in Application
Next Topic:[acceleo] debug java code in "Acceleo Plug-in Application"
Goto Forum:
  


Current Time: Fri Apr 19 09:40:54 GMT 2024

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

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

Back to the top