Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Assignment with different types(Problem regarding the assignment of attributes/features)
Assignment with different types [message #1709040] Wed, 23 September 2015 13:34 Go to next message
Jan Novacek is currently offline Jan NovacekFriend
Messages: 3
Registered: August 2012
Junior Member
I started working with ATL yesterday, so please don't be hard on me - this is a newbie question Smile

When doing assignments to attributes/features having the same type for source and target attributes it's simple. But how can I implement an assignment where the types are different?
Using an imperative programming language I would probably create a new instance of the target type and set it's values accordingly then assign it to the target attribute.
How can I do this in ATL?

For example

rule A2B {
  from
     r: A!Root
  to
    o: B!Target(
        attr <- r.srcAttr
    )
}


Where attr is of type URI and srcAttr is just a plain String.
Re: Assignment with different types [message #1709046 is a reply to message #1709040] Wed, 23 September 2015 14:22 Go to previous messageGo to next message
Jan Novacek is currently offline Jan NovacekFriend
Messages: 3
Registered: August 2012
Junior Member
Okay, sorry for wasting time, I have found it in the ATL User Guide:
Quote:
User-defined Datatypes are unsupported


Sad
Re: Assignment with different types [message #1709442 is a reply to message #1709046] Mon, 28 September 2015 12:48 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Interaction with the Java world has been improved in the new EMFTVM runtime for ATL. You can create a new java.net.URI instance from a String as follows:

"java::net::URI".refNewInstance(Sequence{r.srcAttr})


See also: https://wiki.eclipse.org/ATL/EMFTVM#OclType_operations


Cheers,
Dennis
Previous Topic:ATL-Builder doesn't create .asm files
Next Topic:Stereotype attribute using ATL
Goto Forum:
  


Current Time: Fri Mar 29 00:14:29 GMT 2024

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

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

Back to the top