Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Tuple type availability in Acceleo OCL
Tuple type availability in Acceleo OCL [message #1804882] Tue, 02 April 2019 17:22 Go to next message
Tomasz  abczy?ski is currently offline Tomasz abczy?skiFriend
Messages: 11
Registered: May 2015
Junior Member
Hi,
I decided to post the question here not at Acceleo forum because I believe that the problem conforms more to OCL than to Acceleo. I'm trying to improve the behaviour of Quick Fix in Acceleo so my problem is rather sophisticated then practical. But it is interesting (at least for me).
Does the OCL parser used in Acceleo recognize the Tuple type? Ican write something like:
Tuple{a=5,b='',c=Tuple{a=5}}
in the template invocation. The parser recognizes it producing the following marker:
Cannot find operation (ttt(Tuple(a : Integer, b : String, c : Tuple(a : Integer)))) for the type (Class)

which suggest that syntactically all is OK. But if I try to generate template for this type:
[template public ttt (aClass : Class, aTupleOfInteger_String_TupleOfInteger : Tuple(a : Integer, b : String, c : Tuple(a : Integer))) ][/template]]

I get two markers:
Invalid Type: Tuple(a : Integer
and
Invalid Type: Tuple(a : Integer))

So is the Tuple correct or no? Or maybe it should be declared in different way?

Tomek


Tomasz Babczyński
Re: Tuple type availability in Acceleo OCL [message #1804890 is a reply to message #1804882] Tue, 02 April 2019 19:46 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It could/should work, but it probably doesn't.

The Abstract Syntax ancestry for synthetic types such as Collections and Tuples is not specified by OMG.

For the Classic Ecore OCL used by Acceleo, synthetic types are orphans wrt the OCL tooling. It is the responsibility of the OCL wrapper (Acceleo) to locate them as singletons somewhere sensible such as the model root. Quite possibly Acceleo neglects to do this for Tuples during serialization and/or loading and/or reference resolution. A further challenge is mapping OCL types to Java types. The Collections are moderately straghtforward Sequence=>List etc. But Tuples? The correct semi-proprietary type must be used.

(The Pivot OCL, not used by Acceleo, introduces an Orphanage Package to hold singletons for all 'orphan' types; Collection, Tuples , Maps, Lambdas, Shadows.)

I'm afraid you may need to do some serious debugging.

Regards

Ed Willink
Previous Topic:NPE due to null source
Next Topic:how to reach OCLMessage from OCL API?
Goto Forum:
  


Current Time: Thu Apr 25 11:47:37 GMT 2024

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

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

Back to the top