Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EGL applied to compartments(standard output expressions)
EGL applied to compartments [message #1857304] Mon, 30 January 2023 04:52 Go to next message
Clever Alves is currently offline Clever AlvesFriend
Messages: 101
Registered: August 2019
Senior Member
Hi there,

The code below transforms a diagram graphical object's content into text in an html table:

[%for (n in DiagramClassObject.DiagramClassObjectVal.DiagramClassObjectValCompartmentVal.sortBy(n|n.name)){%] <tr>
<td>[%=n.name%]</td>
<td>[%=n.type%]</td>
</tr>
[%}%]

However, there are undesirable sentences: "EolSequence"+square brackets and "OrderedSet".

index.php/fa/42867/0/

The cell contents should simply be "MyName" and "MyType".

Could you please help me resolve it?

Many thanks.
  • Attachment: Table.png
    (Size: 2.74KB, Downloaded 159 times)
Re: EGL applied to compartments [message #1857321 is a reply to message #1857304] Mon, 30 January 2023 12:04 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Clever,

Could you provide a minimal example that reproduces this issue?

https://www.eclipse.org/epsilon/doc/articles/minimal-examples/

It's hard to provide any help when we don't have a full picture of the metamodel / model you're using.

Best,
Antonio
EGL applied to compartments [message #1857385 is a reply to message #1857321] Fri, 03 February 2023 06:27 Go to previous messageGo to next message
Clever Alves is currently offline Clever AlvesFriend
Messages: 101
Registered: August 2019
Senior Member
Thank you for your reply, Antonio.

I made changes to the example at https://www.eclipse.org/epsilon/doc/eugenia/ and managed to reproduce the problem. I noticed that when I call an attr "type" the message "OrderedSet" appears in the html output table. If I use the name "ttype" instead, the output is "EolSequence [NameIsNotType]" (see attached html file).

Version: index.php/fa/42888/0/

Metamodel (FS.emf):

@namespace(uri="filesystem", prefix="filesystem")
@gmf
package filesystem;

@gmf.diagram
class Filesystem {
attr String name;
val Drive[*] drives;
val File[*] files;
}

@gmf.node(label = "name")
class Drive {
attr String name;
@gmf.compartment
val File[*] files;
}

@gmf.node(label = "name")
class File {
attr String name;
attr String type;
attr String ttype;
}

EGL

<h1>Filesytem [%=filesystem.name%]</h1>

<table border="1">

[%for (n in filesystem.drives.files.sortBy(n|n.name)){%] <tr>
<td>[%=n.name%]</td>
<td>[%=n.type%]</td>
<td>[%=n.ttype%]</td>
</tr>
[%}%]

</table>

EGX

rule FILESYSTEM2HTML
transform filesystem : Filesystem {

template : "filesystem2html.egl"

target : "GeneratedText/filesystem" + filesystem.name + ".html"

}


index.php/fa/42884/0/

index.php/fa/42889/0/

index.php/fa/42890/0/

Re: EGL applied to compartments [message #1857395 is a reply to message #1857385] Fri, 03 February 2023 14:30 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
Senior Member

From your original post and the launch configuration in your second one I think the issue is that you are navigating the GMF model not your EMF model. The default.filesystem_diagram is a model that contains the graphical information to show your model as a diagram. To generate text form your model you need to load the EMF model in the run configuration, that is your default.filesystem file. Note that behind the scenes GMF will update that model with any changes you do in the graphical editor.

Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech

[Updated on: Fri, 03 February 2023 14:31]

Report message to a moderator

Re: EGL applied to compartments [message #1857406 is a reply to message #1857395] Sat, 04 February 2023 17:41 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Clever,

filesystem.drives returns a collection, and therefore filesystem.drives.files returns a collection of collections. Flattening your nested collection with EOL's flatten() operation (i.e. filesystem.drives.files.flatten().sortBy(...)) should do the trick.

Thanks,
Dimitris
Re: EGL applied to compartments [message #1857444 is a reply to message #1857406] Wed, 08 February 2023 05:36 Go to previous message
Clever Alves is currently offline Clever AlvesFriend
Messages: 101
Registered: August 2019
Senior Member
Thank you both for your replies!


Quote:
filesystem.drives.files.flatten().sortBy(...)) should do the trick
=> Problem resolved, many thanks!
Previous Topic:Flock Ecore Migration leaving dangling reference
Next Topic:EPSILON INSTALLATION
Goto Forum:
  


Current Time: Sat Apr 27 06:00:14 GMT 2024

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

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

Back to the top