[gme-users] enum attribute values in ocl constraints

Matthew J. Emerson mjemerson at isis.vanderbilt.edu
Thu Jul 21 15:58:20 CDT 2005


I see, I didn't realize you could separate the text seen by the user
from the actual fields of the enumeration attribute. Very cool. Thanks,
Zoli.

--Matt

> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu [mailto:gme-users-
> bounces at list.isis.vanderbilt.edu] On Behalf Of Zoltan Molnar
> Sent: Thursday, July 21, 2005 2:41 PM
> To: gme-users
> Subject: RE: [gme-users] enum attribute values in ocl constraints
> 
> For the users it is seamless.
> 
> > -----Original Message-----
> > From: gme-users-bounces at list.isis.vanderbilt.edu
> > [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf
> > Of Matthew J. Emerson
> > Sent: Thursday, July 21, 2005 2:36 PM
> > To: gme-users
> > Subject: RE: [gme-users] enum attribute values in ocl constraints
> >
> >
> > But...it doesn't look as pretty :)
> >
> > --Matt
> >
> > > -----Original Message-----
> > > From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-
> > > bounces at list.isis.vanderbilt.edu] On Behalf Of Zoltan Molnar
> > > Sent: Thursday, July 21, 2005 2:34 PM
> > > To: gme-users
> > > Subject: RE: [gme-users] enum attribute values in ocl constraints
> > >
> > > I think you could get around this problem by defining the
> > enumeration
> > > attribute like:
> > >
> > > Foo Bar, Foo_Bar
> > > Any String, Any_String
> > >
> > > Generally speaking:
> > > text1, value1
> > > text2, value2
> > > ...
> > >
> > > This way in the constraint you could use:
> > > Self.X = #Foo_Bar implies self.Y = #Any_String
> > >
> > > Br,Zoli
> > >
> > >
> > > > -----Original Message-----
> > > > From: gme-users-bounces at list.isis.vanderbilt.edu
> > > > [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of
> > > > Matthew J. Emerson
> > > > Sent: Tuesday, June 21, 2005 4:17 PM
> > > > To: gme-users
> > > > Subject: [gme-users] enum attribute values in ocl constraints
> > > >
> > > >
> > > > I need to write an ocl constraint which essentially says, "If
the
> > > > enum attribute X of the context class has value Y, then enum
> > > > attribute M of the context class must have value N".
> > > >
> > > > I know how to do this in most cases. The constraint would
> > look like
> > > > this:
> > > >
> > > >      (self.X = #Y) implies (self.M = #N)
> > > >
> > > > But, it doesn't really work value Y contains whitespace. For
> > > > instance, suppose the value I need to check for is "Foo Bar":
> > > >
> > > >      (self.X = #Foo Bar) implies (self.M = #N)
> > > >
> > > > The ocl parser can't understand this because of the
> > whitespace. So,
> > > > I performed a little experiment to figure out how the
> > parser would
> > > > like the value to be formated. I wrote the following constraint:
> > > >
> > > >      let testVal = self.X in false
> > > >
> > > > When I check the constraint in a model where the value of X for
a
> > > > particular object is "Foo Bar", then I can look at the value of
> > > > testVal in the constraint violation window and see how
> > the parser is
> > > > formating the enum value "Foo Bar". Unfortunately, what I got
was:
> > > >
> > > >      testVal     ocl::Enumeration{#Foo Bar}
> > > >
> > > > Since I already determined that the above formatting for the
enum
> > > > value wouldn't be accepted by the parser as input, my experiment
> > > > didn't help me.
> > > >
> > > > So, how am I supposed to write this constraint? I'd like to
write
> > > > something like
> > > >
> > > >      (self.X = #[Foo Bar]) implies (self.M = #N)
> > > >
> > > > or
> > > >
> > > >      (self.X = #"Foo Bar") implies (self.M = #N)
> > > >
> > > > or even
> > > >
> > > >      (self.X = ocl::Enumeration("Foo Bar")) implies (self.M =
#N)
> > > >
> > > > But the parser doesn't like any of these (and the last
> > one causes an
> > > > emergency exception which crashes GME. Unfortunately, I
> > can't find
> > > > any GME documentation or existing examples which cover this
case.
> > > > Anyone know what to do?
> > > > _______________________________________________
> > > > gme-users mailing list
> > > > gme-users at list.isis.vanderbilt.edu
> > > > http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> > > >
> > > _______________________________________________
> > > gme-users mailing list
> > > gme-users at list.isis.vanderbilt.edu
> > > http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> >
> > _______________________________________________
> > gme-users mailing list
> > gme-users at list.isis.vanderbilt.edu
> > http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> >
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users



More information about the gme-users mailing list