Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend - nested graph information(problem with creating nested graph information)
Xtend - nested graph information [message #703333] Wed, 27 July 2011 13:11 Go to next message
gibtsdennsowas is currently offline gibtsdennsowasFriend
Messages: 3
Registered: July 2011
Junior Member
hi there,

i want to implement a M2M.
therefor i have a target metamodel:

Vertex {
NativeProperties(type of SemanticProperty)
}

SemanticProperty {
Name(type of String)
Value(type of String)
NativeProperties (type of SemanticProperty)
}

So, a Vertex object can contain some information (nested informations too, cause SemanticProperty contains a NativeProperties too).

my prob is: how do i put the (nested) source informations into this metamodel.
i tried:

create Vertex toVertex(Entity e):

NativeProperties.addAll(e.eContents.collect(e|e.metaType.toString().toSemanticProperties()))

;


create SemanticProperty toSemanticProperties(Parameter p):
	//setting name-attribute here..works fine	
;

create SemanticProperty toSemanticProperties(String string):
	setName(string)
;


ok, this is fine if i have informations on level 0.

but now i want to add some informations on level 1, e.g.

Level1Info1
--Level1InfoSub1
--Level1InfoSub2
--Level1InfoSub3
Level1Info2
--Level1InfoSub4
--Level1InfoSub5
--Level1InfoSub6

for this, i have:

//...same as above
(1) NativeProperties.select(e|e.Name.endsWith("Parameter")).collect(e|e.NativeProperties.addAll(e.params.typeSelect(Parameter).toSemanticProperties()))

(2) NativeProperties.collect(e|("  "+e.Name).info()->"  "+e.NativeProperties.collect(e|("	"+e.Name).info()))




but it seems that its not a good way, cause my output says:

Level1Info1
--Level1InfoSub1
--Level1InfoSub2
--Level1InfoSub3
Level1Info2
--Level1InfoSub1 (!)
--Level1InfoSub2 (!)
--Level1InfoSub3 (!)
--Level1InfoSub4
--Level1InfoSub5
--Level1InfoSub6

i not sure if the computation of the output (2) is wrong, or the creation statement (2) is wrong.
Can anyone help me please?

Thanks a lot!
Dirk
Re: Xtend - nested graph information [message #703670 is a reply to message #703333] Wed, 27 July 2011 20:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13601
Registered: July 2009
Senior Member
Hi, you are using Xpands Xtend. Therefore the M2T forum would be the right place.
never the less

to solve this problem following would be helpful:

- how does to source mm look like
- how does a sample input model look like
- how does the complete ext file look like
(where do you call the trafo for the nested stuff)

In General: why do you do this string/metatype stuff

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext 1.0 -> 2.0 / import ecore on classpath not working as before
Next Topic:Error-markers for write-protected files
Goto Forum:
  


Current Time: Wed Sep 23 04:21:22 GMT 2020

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

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

Back to the top