Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How can I get a class which is inherited from another class in acceleo
How can I get a class which is inherited from another class in acceleo [message #1826932] Mon, 04 May 2020 19:53 Go to next message
maryam mehrabi is currently offline maryam mehrabiFriend
Messages: 25
Registered: May 2019
Junior Member
Hello all,
how could I reach Author and editor from the root in acceleo templates without adding any additional relationships????

index.php/fa/38039/0/

I wrote a template which receives root and after that it just possible to get person, not author or editor

If anyone could help, I will appreciate!!!

thanks,
Maryam
  • Attachment: in.jpg
    (Size: 20.14KB, Downloaded 306 times)

[Updated on: Mon, 04 May 2020 20:31]

Report message to a moderator

Re: How can I get a class which is inherited from another class in acceleo [message #1826943 is a reply to message #1826932] Tue, 05 May 2020 04:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
Hi

Look at the documentation of oclIsTypeOf / oclIsKindOf

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1826967 is a reply to message #1826943] Tue, 05 May 2020 13:08 Go to previous messageGo to next message
maryam mehrabi is currently offline maryam mehrabiFriend
Messages: 25
Registered: May 2019
Junior Member
Hi Ed
thank you for your response. I read the tutorials for oclIsTypeOf/KindOf but I couldn't understand how it could be helpful. May I ask you to tell me using an example? (I'm new in acceleo)

Thanks
maryam
Re: How can I get a class which is inherited from another class in acceleo [message #1826973 is a reply to message #1826967] Tue, 05 May 2020 14:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
Hi

Well presumably if we translate "I wrote a template which receives root and after that it just possible to get person, not author or editor" into more formal English we get

select all root's persons that are not of type Author or Editor.

root.persons->select(not oclIsKindOf(Author) and not oclIsKindOf(Editor))
root.persons->reject(oclIsKindOf(Author) or oclIsKindOf(Editor))

and perhaps although oclIsTypeOf is usually a typo, and I suspect it is a typo here too, but it is what you asked for.

root.persons->select(oclIsTypeOf(Person))

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1827003 is a reply to message #1826973] Wed, 06 May 2020 05:32 Go to previous messageGo to next message
maryam mehrabi is currently offline maryam mehrabiFriend
Messages: 25
Registered: May 2019
Junior Member
Ed thank you a lot for your quick response, I got it and it works. You save my time :-)

And one more question. Now if we have an attribute for example 'phone' in Author, How could we reach it's value (I mean the value user enter as phone number)??!

Best
Maryam

[Updated on: Wed, 06 May 2020 05:44]

Report message to a moderator

Re: How can I get a class which is inherited from another class in acceleo [message #1827015 is a reply to message #1827003] Wed, 06 May 2020 07:25 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
Hi

Either I do not answer your question, or it is so banal that it is not worth answering.

Sorry. I now consider you to be a hostile SPAMmer.

Regards

Ed Willink
Re: How can I get a class which is inherited from another class in acceleo [message #1827045 is a reply to message #1827015] Wed, 06 May 2020 11:50 Go to previous messageGo to next message
maryam mehrabi is currently offline maryam mehrabiFriend
Messages: 25
Registered: May 2019
Junior Member
Sorry, I didn't want to make spam. Maybe I should ask my question in another topic in a better way because I think it is not banal. Anyway thanks for your previous help.

Re: How can I get a class which is inherited from another class in acceleo [message #1827058 is a reply to message #1827045] Wed, 06 May 2020 13:29 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
x.phone
Previous Topic:how to read EAnnotations separately in for loop?
Next Topic:Find property value over a set
Goto Forum:
  


Current Time: Wed Oct 09 03:49:35 GMT 2024

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

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

Back to the top