Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EVL] conditional syntax
[EVL] conditional syntax [message #1308921] Tue, 22 April 2014 11:02 Go to next message
Shrikanth NC is currently offline Shrikanth NCFriend
Messages: 31
Registered: February 2014
Member

Say I have a rough emfatic file like this,


class Block {
}

//Node
class A extends Block { }

//Node
class B extends Block { }

//Node
class C extends Block { }

//Link
class connect{

ref Block target;

ref Block source;

}


All i want to validate in EVL is ...


context connect

if ( source instanceof A & target instanceof B ) {

message : "This is discouraged!"

}
else if ( source instanceof C & target instanceof B ) {

message : "This is encouraged!"

}

Kindly help me with the evl syntax!

Thanks,
Shrikanth NC
Re: [EVL] conditional syntax [message #1308922 is a reply to message #1308921] Tue, 22 April 2014 11:05 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi,

Please refer to the isTypeOf/isKindOf operations in the Epsilon book.

Cheers,
Dimitris
Re: [EVL] conditional syntax [message #1308949 is a reply to message #1308922] Tue, 22 April 2014 11:24 Go to previous messageGo to next message
Shrikanth NC is currently offline Shrikanth NCFriend
Messages: 31
Registered: February 2014
Member
It does work as intended. ( when i use either isKindOf/isTypeOf )

But there is a side effect.

Like if I connect A to A or B to B or A to C

then in this case both messages are shown with error!


My Evl below,


context connect{

constraint DiscouragedUsage1{


check : self.source.isKindOf(A) and self.target.isKindOf( B)
message : "This is discouraged usage 1!"

}

constraint DiscouragedUsage2{

check : self.source.isKindOf(B) and self.target.isKindOf( C)
message : "This is discouraged usage 2!"

}

}



Thanks,
Shrikanth NC

[Updated on: Tue, 22 April 2014 11:26]

Report message to a moderator

Re: [EVL] conditional syntax [message #1309039 is a reply to message #1308949] Tue, 22 April 2014 12:33 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi,

Could you please put together a minimal example [1] I can use to reproduce this?

Cheers,
Dimitris

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [EVL] conditional syntax [message #1310259 is a reply to message #1309039] Wed, 23 April 2014 05:01 Go to previous messageGo to next message
Shrikanth NC is currently offline Shrikanth NCFriend
Messages: 31
Registered: February 2014
Member
mailed to epsilon.devs@gmail.com <epsilon.devs@gmail.com>;

Thanks,
Shrikanth NC
Re: [EVL] conditional syntax [message #1312444 is a reply to message #1310259] Thu, 24 April 2014 09:42 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi,

Apologies for the slow response. In EVL, validation errors are produced when check condition are *not* satisfied. As such, you'll need to express your constraints as follows:

context Connect{


constraint DiscouragedUsage2{


check : not (self.source.isKindOf(A) and self.target.isKindOf( B ))

message : "This is discouraged usage 1!"

}

constraint DiscouragedUsage1{


check : not (self.source.isKindOf(A) and self.target.isKindOf( C ))

message : "This is discouraged usage 2!"

}

}

Cheers,
Dimitris
Re: [EVL] conditional syntax [message #1313739 is a reply to message #1312444] Fri, 25 April 2014 02:08 Go to previous message
Shrikanth NC is currently offline Shrikanth NCFriend
Messages: 31
Registered: February 2014
Member
Fine. Got it!

Thanks,
Shrikanth NC
Previous Topic:Problems using HUTN with Epsilon
Next Topic:GMF node disappears
Goto Forum:
  


Current Time: Fri Apr 26 00:15:36 GMT 2024

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

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

Back to the top