Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using EVL in rekursive context
Using EVL in rekursive context [message #806818] Sat, 25 February 2012 09:40 Go to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Hello everybody i got a problem using EVL.

I have an .emf model like this :


@gmf(foo="bar")
@namespace(uri="testmodel", prefix="testmodel")
package testmodel;

@gmf.diagram(onefile="true")
class Mainclass {
  val NodeTypeOne[*] NodeTypeOneNodes;
  val NodeTypeTwo[*] NodeTypeTwoNodes;
}

@gmf.node(figure="rectangle",label="identifier")
class NodeTypeOne{
  attr String identifier;
  @gmf.link(target.decoration="filledclosedarrow", color="0,0,0")
  ref NodeTypeOne[*] NodeTypeOneRefsOfOne;
  @gmf.link(target.decoration="filledclosedarrow", color="0,0,0")
  ref NodeTypeTwo[*] NodeTypeTwoRefsOfOne;
}

@gmf.node(figure="rectangle",label="identifier")
class NodeTypeTwo{
  attr String identifier;
  @gmf.link(target.decoration="filledclosedarrow", color="0,0,0")
  ref NodeTypeOne[*] NodeTypeOneRefsOfTwo;
}



What i want to do in EVL now is to add a cyclic check to this.

So i think i have to write a rekursive method, getting all children of a node, and rekursivly call itself on everychild until there are no more childs.

After all, the current node needs to check if any of this nodes references himself.

The problem is i have two different types of nodes and references. Can i make a typecheck in EVL in anyway ? Anybody has some ideas or sample code on how to implement such a check ?

Greetings

[Updated on: Sat, 25 February 2012 09:43]

Report message to a moderator

Re: Using EVL in rekursive context [message #806871 is a reply to message #806818] Sat, 25 February 2012 11:37 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
Senior Member
You can import EOL code from an EVL module and use its operations. That's pretty useful if you have complex conditions that require actual algorithms. Alternatively, you can use a block of EOL code in the check clause. Have you tried that?

I use EOL+EVL to check for loops in some of my graph-based models:

https://neptuno.uca.es/redmine/projects/sodmt/repository/revisions/master/entry/workspace-metamodels/es.uca.modeling.eol/validation/common.evl#L249

As for type checks: why would you need them? The two kinds of references have distinct attributes in both node types, don't they?
Re: Using EVL in rekursive context [message #806984 is a reply to message #806871] Sat, 25 February 2012 15:34 Go to previous messageGo to next message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
Hi Antonio,

i think i could make it in EOL maybe.

You use a graphIsAcyclic method in your code in line 249.

Can you show me the code of it ?
Re: Using EVL in rekursive context [message #807025 is a reply to message #806984] Sat, 25 February 2012 17:16 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
Senior Member
Just follow the import at the top of the file:

https://neptuno.uca.es/redmine/projects/sodmt/repository/revisions/master/entry/workspace-metamodels/es.uca.modeling.eol/common/utils.eol#L228
Re: Using EVL in rekursive context [message #811487 is a reply to message #807025] Fri, 02 March 2012 07:03 Go to previous message
Snakebyte Missing name is currently offline Snakebyte Missing name
Messages: 130
Registered: November 2011
Senior Member
OK thanks. I got it Smile
Previous Topic:EVL Validation on Diagram with references
Next Topic:GMF Tooling update site url disabled?
Goto Forum:
  


Current Time: Tue Jul 22 19:37:31 EDT 2014

Powered by FUDForum. Page generated in 0.01806 seconds