Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] How to get attributes from this meta-model
icon5.gif  [Acceleo] How to get attributes from this meta-model [message #1272264] Mon, 17 March 2014 14:00 Go to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

Dear all,

I got a meta-model like the picture that I've attached

I want to get the "value" from that meta-model with this code
[for (it : Feature | aFeatureModel.eAllContents(Feature))]
	[if (it.attributes->notEmpty())]
		[i/]. [it.name/] with attributes [it.attributes.name/] and value [it.attributes/]
 		[else]
		[i/]. [it.name/]		
	[/if]	
[/for]


I hope the output will be like this
1. [Feature_name] with attributes [name of feature's attribute] and value [value of attribute]

but instead of that result, I got
1. [Feature_name] with attributes [name of feature's attribute] and value
org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976 (name: amount) (type: Int, value: in [0..5])


I think my problem is I can not get the contained items in second round bracket (type: Int, value: in [0..5]). So, I change the code to
[it.attributes.value/]
but I got an error message "Unrecognized variable: (value)"

I hope someone can help me solve this problem Surprised

Thank you

Regards,
Irfan
  • Attachment: Metamodel.PNG
    (Size: 39.45KB, Downloaded 183 times)
Re: [Acceleo] How to get attributes from this meta-model [message #1272378 is a reply to message #1272264] Mon, 17 March 2014 19:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
attributes is a Collection so you should probably iterate over it, but
if really want just one attributes->any(true).value should work.

Regards

Ed Willink


On 17/03/2014 18:59, Irfan Fadhillah wrote:
> Dear all,
>
> I got a meta-model like the picture that I've attached
>
> I want to get the "value" from that meta-model with this code
>
> [for (it : Feature | aFeatureModel.eAllContents(Feature))]
> [if (it.attributes->notEmpty())]
> [i/]. [it.name/] with attributes [it.attributes.name/] and value [it.attributes/]
> [else]
> [i/]. [it.name/]
> [/if]
> [/for]
>
>
> I hope the output will be like this
> 1. [Feature_name] with attributes [name of feature's attribute] and value [value of attribute]
>
> but instead of that result, I got
> 1. [Feature_name] with attributes [name of feature's attribute] and value org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976 (name: amount) (type: Int, value: in [0..5])
>
> I think my problem is I can not get the contained items in second round bracket (type: Int, value: in [0..5]). So, I change the code to [it.attributes.value/] but I got an error message "Unrecognized variable: (value)"
>
> I hope someone can help me solve this problem :o
>
> Thank you
>
> Regards,
> Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1272483 is a reply to message #1272378] Tue, 18 March 2014 02:30 Go to previous messageGo to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

Ed Willink wrote on Tue, 18 March 2014 02:53
attributes is a Collection so you should probably iterate over it, but
if really want just one attributes->any(true).value should work.

Regards

Ed Willink


Hello Ed,

thank you for your reply. Yes it's true that attributes is a collection.
I've tried your code but I still get the error message "Unrecognized variable: (value)"

I think I cannot do direct access to value since it's in the second round bracket in this result (I make it red) -> org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976 (name: amount) (type: Int, value: in [0..5])

I can do a direct access like attributes->any(true).name and I get "amount" as a result since it's in first round bracket.

Regards,
Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1272576 is a reply to message #1272483] Tue, 18 March 2014 08:35 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I've completely lost you. You might find
https://wiki.eclipse.org/OCL/ForumNetiquette provides some ideas on more
effective communication.

Regards

Ed Willink


On 18/03/2014 02:30, Irfan Fadhillah wrote:
> Ed Willink wrote on Tue, 18 March 2014 02:53
>> attributes is a Collection so you should probably iterate over it,
>> but if really want just one attributes->any(true).value should work.
>>
>> Regards
>>
>> Ed Willink
>
>
> Hello Ed,
>
> thank you for your reply. Yes it's true that attributes is a collection.
> I've tried your code but I still get the error message "Unrecognized
> variable: (value)"
>
> I think I cannot do direct access to value since it's in the second
> round bracket in this result (I make it red) ->
> mailto:org.hyperflex.featuremodels.impl.SimpleAttributeImpl@6e486976
> (name: amount) (type: Int, value: in [0..5])
> I can do a direct access like attributes->any(true).name and I get
> "amount" as a result since it's in first round bracket.
>
> Regards,
> Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1272630 is a reply to message #1272576] Tue, 18 March 2014 11:20 Go to previous messageGo to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

I am sorry if I made you a little bit confused.

I just want to get the value of my model's attribute. I have provided the meta-model and I think I can get that value just by using this code
[it.attributes.value/]


I have put your code and I get an error message like in the picture I've attached in this reply

Hope it helps you see my problem

Thank you

Regards,
Irfan
  • Attachment: error.png
    (Size: 4.48KB, Downloaded 184 times)
Re: [Acceleo] How to get attributes from this meta-model [message #1272642 is a reply to message #1272630] Tue, 18 March 2014 11:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I see that you have a problem but where is the repro?

Regards

Ed Willink

On 18/03/2014 11:20, Irfan Fadhillah wrote:
> I am sorry if I made you a little bit confused.
>
> I just want to get the value of my model's attribute. I have provided the meta-model and I think I can get that value just by using this code
> [it.attributes.value/]
>
> I have put your code and I get an error message like in the picture I've attached in this reply
>
> Hope it helps you see my problem
>
> Thank you
>
> Regards,
> Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1272930 is a reply to message #1272642] Wed, 19 March 2014 05:08 Go to previous messageGo to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

Hello

I use Eclipse Modeling Tools Kepler v.4.3 and Acceleo v.3.4

I have attached my project and I am not so sure if I should provide the meta-model too if I've provided my project.

Thank you very much

Regards,
Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1272985 is a reply to message #1272930] Wed, 19 March 2014 08:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I'm not sure how you think I can look at your project when you omit half
of it.

Two email exchanges ago I referred you to "You might find
https://wiki.eclipse.org/OCL/ForumNetiquette provides some ideas on more
effective communication. "

Yet you still ask me to waste my time looking at a problem that you
won't show me. This of course is a waste of your time too. And everyone
else's since you have just prevented me working on something more useful.

Regards

Ed Willink

On 19/03/2014 05:08, Irfan Fadhillah wrote:
> Hello
>
> I use Eclipse Modeling Tools Kepler v.4.3 and Acceleo v.3.4
>
> I have attached my project and I am not so sure if I should provide the meta-model too if I've provided my project.
>
> Thank you very much
>
> Regards,
> Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1273022 is a reply to message #1272985] Wed, 19 March 2014 10:26 Go to previous messageGo to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

Hello,

I am really sorry I did not mean to waste your time and everyone in this forum.
It's kind a new stuff for me to ask in the forum and using Acceleo.
So, I do not know if I throw a half of my project.

I am really sorry for my mistake hope you still can help me,sir

Thank you

Regards,
Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1273023 is a reply to message #1272985] Wed, 19 March 2014 10:29 Go to previous messageGo to next message
Irfan Fadhillah is currently offline Irfan FadhillahFriend
Messages: 6
Registered: February 2014
Location: Jakarta
Junior Member

Hello,

Okay, I am trying to make a better explanation. So, I hope everyone can see a better perspective.

In my project, there is a folder called "model".
This folder contains my feature diagram named "account.featuremodel_diagram" and the model of that feature diagram called "account.featuremodel"
I made that diagram using HyperFlex Feature Diagram editor that I found in its update site http://lucagherardi.it/projects/HyperFlex/UpdateSite
So, if you do not mind please install new software in eclipse using that link first.
and if no plugins are showed try to unflagged "Groups item by category" like this picture

http://i57.tinypic.com/28cledx.jpg

The meta-model is included in that tools.
I have no idea how to extract just the meta-model from that tools,
that's why I did not provide the meta model.
And the for the launch configuration I made it this way

http://i59.tinypic.com/nlpq86.png

My problem is I want to get the value in feature diagram that I've made.
I do not know how to get that value like my first post.


Thank you

Best regards,
Irfan
Re: [Acceleo] How to get attributes from this meta-model [message #1273030 is a reply to message #1273023] Wed, 19 March 2014 10:48 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If you want help you should expect to make the job easy, not give a list
of special non-Eclipse installs.

If you cannot provide a sensible repro, I am sorry, but you will have to
hope that someone else on this newsgroup can help.

Regards

Ed Willink



On 19/03/2014 10:29, Irfan Fadhillah wrote:
> Hello,
>
> Okay, I am trying to make a better explanation. So, I hope everyone
> can see a better perspective.
>
> In my project, there is a folder called "model".
> This folder contains my feature diagram named
> "account.featuremodel_diagram" and the model of that feature diagram
> called "account.featuremodel"
> I made that diagram using HyperFlex Feature Diagram editor that I
> found in its update site
> http://lucagherardi.it/projects/HyperFlex/UpdateSite
> So, if you do not mind please install new software in eclipse using
> that link first.
> and if no plugins are showed try to unflagged "Groups item by
> category" like this picture
>
>
>
> The meta-model is included in that tools. I have no idea how to
> extract just the meta-model from that tools, that's why I did not
> provide the meta model.
> And the for the launch configuration I made it this way
>
>
>
> My problem is I want to get the value in feature diagram that I've made.
> I do not know how to get that value like my first post.
>
>
> Thank you
>
> Best regards,
> Irfan
Previous Topic:Acceleo how to change the value of a variable of type String
Next Topic:Generate Code from model with multiple packages
Goto Forum:
  


Current Time: Fri Apr 19 09:42:58 GMT 2024

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

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

Back to the top