Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Epsilon] Compare an enumeration value with a string in EVL
[Epsilon] Compare an enumeration value with a string in EVL [message #563801] Mon, 12 January 2009 16:00
Hector Iturria is currently offline Hector IturriaFriend
Messages: 60
Registered: July 2009
Member
Hi!

I am still using EVL to validate UML (I say "still" becuase it has
passed a long time since my last question) and I have found something
wrong (or that I don't know how to do it).

The thing is that I tried to compare an enumeration value with a string,
because it was the first that came to my head, but didn't work. But I
never surrender, so I copied the check line and pasted it in the message
instrucction to watch what was returning my code, and to my surprise it
was indeed returning what I expected. However, the test failed. You'll
see what I mean with an example:

The constraint:

constraint isShared{

check: self.packagedElement.select(a: Association | a.name=
'Association1').first().ownedEnd.select(p: Property | p.name =
'dst').first().aggregation = 'shared'

message: 'The Associoation must have the field Aggregation = shared
and is ' + self.packagedElement.select(a: Association | a.name=
'Association1').first().ownedEnd.select(p: Property | p.name =
'dst').first().aggregation

}

returns: 'The Associoation must have the field Aggregation = shared and
is shared


After confirming that there were no troubles with blank spaces next to
check were data types. And managed to compare them converting the
enumeration value into a string, through appending an string:

constraint isShared{

check: self.packagedElement.select(a: Association | a.name=
'Association1').first().ownedEnd.select(p: Property | p.name =
'dst').first().aggregation+'' = 'shared'

message: 'The Associoation must have the field Aggregation = shared
and is ' + self.packagedElement.select(a: Association | a.name=
'Association1').first().ownedEnd.select(p: Property | p.name =
'dst').first().aggregation

}

This workaround works fine, but I don't know if it is the best way to do
it. I tought you may want to know this.

Best regards,
Héctor Iturria
Previous Topic:One model + EGL; multiple targets
Next Topic:[Epsilon] Compare an enumeration value with a string in EVL
Goto Forum:
  


Current Time: Fri Apr 26 23:43:16 GMT 2024

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

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

Back to the top