Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » EDate in the transformations
EDate in the transformations [message #987586] Tue, 27 November 2012 09:26 Go to next message
Aran A is currently offline Aran AFriend
Messages: 30
Registered: January 2011
Member
Hi,

One of my metamodels have some attributes defined as EDate, but now in the transformation I can't find the way to work with them. I mean I can't define, e.g. a helper as helper def : getDate(....) : EDate = ..., or as helper def : getSomething (...) : String = let a : Sequence(Edate) = MM!Command.allInstances()->collect(i | i.date) in ...

How can I do? Do I have to specify that EDate is an Ecore data-type?, but how?

Best regards,
Re: EDate in the transformations [message #987684 is a reply to message #987586] Tue, 27 November 2012 15:22 Go to previous messageGo to next message
Aran A is currently offline Aran AFriend
Messages: 30
Registered: January 2011
Member
Hi,

Sorry, I insist on this issue again, but I'm really stuck with it.

I haven't defined a custom or special EDate, I'm just using the Ecore data type. So, I understand that I don't have to rewrite the createXXXXFromString(EDataType eDataType, String initialValue) and convertXXXXToString(EDataType eDataType, Object instanceValue). That is for custom data types, isn't it?

With Strings I can define:

let aux: String = 'xxx' in ...
or
let aux: Sequence(String) = Sequence{'xx', 'zz'} in ...

So, with EDate I would like to do the same:

let aux: EDate = .... in ...
or
let aux: Sequence(EDate) = Sequence{....} in ...

Do I need something more in the ATL module specification? or what is that I am misunderstanding? I would appreciate any clue.

Thanks in advance,
Re: EDate in the transformations [message #987786 is a reply to message #987684] Wed, 28 November 2012 07:42 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In so far as ATL follows the OCL specification, you cannot construct
DataType (or Class objects).

There have been a number of suggestions for object construction in OCL.
The new Pivot-based Eclipse OCL prototypes a solution re-using the Tuple
syntax: MyClass{name="myName} for classes and the Collection syntax
ecore::EDate{"20-Nov-2011"} for datatypes.

For now, I suspect that you may need Java helper functions.

Regards

Ed Willink


On 27/11/2012 15:23, Aran A wrote:
> Hi,
>
> Sorry, I insist on this issue again, but I'm really stuck with it.
> I haven't defined a custom or special EDate, I'm just using the Ecore
> data type. So, I understand that I don't have to rewrite the
> createXXXXFromString(EDataType eDataType, String initialValue) and
> convertXXXXToString(EDataType eDataType, Object instanceValue). That
> is for custom data types, isn't it?
>
> With Strings I can define:
>
> let aux: String = 'xxx' in ...
> or
> let aux: Sequence(String) = Sequence{'xx', 'zz'} in ...
>
> So, with EDate I would like to do the same:
>
> let aux: EDate = .... in ...
> or
> let aux: Sequence(EDate) = Sequence{....} in ...
>
> Do I need something more in the ATL module specification? or what is
> that I am misunderstanding? I would appreciate any clue.
>
> Thanks in advance,
>
Re: EDate in the transformations [message #987825 is a reply to message #987786] Wed, 28 November 2012 10:13 Go to previous message
Aran A is currently offline Aran AFriend
Messages: 30
Registered: January 2011
Member
Hi,

I'm really disappointed...I thought it was a 'silly' issue.

Many, many thanks for your answer. I'm not sure if I catch on the idea about using the Tuple syntax, but probably I will change the metamodel to avoid the EDate attribute Confused .

You mention the "Java helper functions". I didn't know about them and I don't find anything, please, could you give me a reference?

Thanks again, best regards,

Aran
Previous Topic:Convert Float to Double - by refInvokeOperation?
Next Topic:does lazy rules from clause works?
Goto Forum:
  


Current Time: Tue Mar 19 03:46:15 GMT 2024

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

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

Back to the top