Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] How to acces a element in my model
[EVL] How to acces a element in my model [message #989174] Wed, 05 December 2012 00:44 Go to next message
Sebastian Rivera is currently offline Sebastian RiveraFriend
Messages: 7
Registered: December 2012
Junior Member
Hi , first I attached a picture of my metamodel to explain what I need help with

From the picture you can see that a navigational class has attributes and operations.So I don't know how to make or the syntax to create a constraint that checks all the navigational attributes associated with a specific navigational class. Like check for each navigational class all of navigational attributes associated with it.

Thanks in advance for your help

pd: sorry for my English, not my native language Razz
Re: [EVL] How to acces a element in my model [message #989279 is a reply to message #989174] Wed, 05 December 2012 13:48 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1230
Registered: July 2009
Senior Member
Hi,

Would the following work?

context NAVIGATIONALATTRIBUTE {

constraint SomeConstraint {
check: ...
}

}

Cheers,
Dimitris
Re: [EVL] How to acces a element in my model [message #989343 is a reply to message #989174] Wed, 05 December 2012 18:17 Go to previous messageGo to next message
Sebastian Rivera is currently offline Sebastian RiveraFriend
Messages: 7
Registered: December 2012
Junior Member
not really,I want to do something like this (i know the sintax and the code its not right)

context NAVIGATIONALCLASS {

constraint SomeConstraint {
check: self.name = "something" and self.NavigationalClassNavigationalAttribute.name="anotherthing";

}

}

Something like that so i can check all the navigational attributes associated with a navigational class in specific and check the value name in both the class and the attribute.

I hope that clarifies what i'm trying to do

thx for the help
Re: [EVL] How to acces a element in my model [message #989351 is a reply to message #989343] Wed, 05 December 2012 18:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1230
Registered: July 2009
Senior Member
Hi,

If you need to check only the attributes of a specific class (X) you could use a guard to specify this e.g.

context NAVIGATIONALATTRIBUTE {

constraint SomeConstraint {
guard: self.eContainer()./*this navigates to the container NAVIGATIONALCLASS*/.name = "X"
check: ...
}

}

Cheers,
Dimitris
Re: [EVL] How to acces a element in my model [message #989357 is a reply to message #989351] Wed, 05 December 2012 20:10 Go to previous messageGo to next message
Sebastian Rivera is currently offline Sebastian RiveraFriend
Messages: 7
Registered: December 2012
Junior Member
I think thats it , i will try it later since i cant at the moment and will comment back.

Thx alot for all the help
Re: [EVL] How to acces a element in my model [message #989594 is a reply to message #989357] Thu, 06 December 2012 22:11 Go to previous messageGo to next message
Sebastian Rivera is currently offline Sebastian RiveraFriend
Messages: 7
Registered: December 2012
Junior Member
it worked perfect
I got a last question, its there a place where i can check all the things i can use with evl like the .eContainer()? , because i never knew that existed.

Thx alot again
Re: [EVL] How to acces a element in my model [message #989595 is a reply to message #989594] Thu, 06 December 2012 22:17 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1230
Registered: July 2009
Senior Member
Hi Sebastian,

eContainer() is a method of EObject which is the interface that all EMF model elements conform to (see http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.3/org/eclipse/emf/ecore/EObject.html for more methods)

Cheers,
Dimitris
Re: [EVL] How to acces a element in my model [message #1724108 is a reply to message #989174] Sun, 21 February 2016 01:02 Go to previous messageGo to next message
C. Santos is currently offline C. SantosFriend
Messages: 12
Registered: September 2015
Junior Member
Hi Dimitris,

Is it possible check if the compartment contains elements?

@gmf.node(label="name", label.text="Procedure", border.color="255,13,13")
class Procedure extends Subprograms {
@gmf.compartment
val Parameters[*] parameters;
}

Cheers,
Crystal.
Re: [EVL] How to acces a element in my model [message #1724119 is a reply to message #1724108] Sun, 21 February 2016 10:30 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1230
Registered: July 2009
Senior Member
Hi Crystal,

Would a constraint like the one below do the trick?

context Procedure {
  constraint HasParameters {
    check: not self.parameters.isEmpty()
  }
}


Cheers,
Dimitris
Re: [EVL] How to acces a element in my model [message #1724131 is a reply to message #1724119] Sun, 21 February 2016 15:34 Go to previous message
C. Santos is currently offline C. SantosFriend
Messages: 12
Registered: September 2015
Junior Member
Yes, this worked for me.

Thank you, Dimitris Smile
Previous Topic:EOL: Call by reference and Map type
Next Topic:query 2 xml files at the same time
Goto Forum:
  


Current Time: Sat Aug 27 01:23:34 GMT 2016

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

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