[gme-users] OCL?

Matthew J. Emerson mjemerson at isis.vanderbilt.edu
Fri Feb 10 09:15:22 CST 2006


If I'm interpreting what you want to do correctly, the constraint would be written as follows:

	let parts = self.parts(meta::Contained) in

	parts->forAny(p : meta::Contained | p.value1 = 0) => parts->size < 2

The context of the constraint is the Container object.

The English translation of the constraint is, "If any of the 'Contained' objects within a Container object has a value1 of 0, then the Container may not contain more than one 'Contained' object.

OCL as it applies to GME is very well documented in the user manual; you can also look a the MetaGME metamodel which ships with GME to see some complicated examples.

Hope that helps,
Matt

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Kai Lukoschek
Sent: Wednesday, February 08, 2006 3:20 AM
To: gme-users
Subject: [gme-users] OCL?

Hi,

could anybody please help me with an OCL problem, which might actually be
very easy but I can't solve (I've just started using GME and never used
OCL).

Having a "Container" model containing a number of "Contained" atoms (see
attached picture), I'd like to restrict the contained objects in case the
"value1" Integer field of "Contained" is 0 (zero) so that no other objects
may be associated.

What I came up with is the following constraint attached to the Container:

contained->exists(value1 = 0) implies 
not contained->select(s | s.value1 <> 0)

Unfortunately, this doesn't work. The message I get says that the ocl::Type
(probably "contained") does not have an Iterator and is not compound and
secondly that "value1" doesn't exist.

Any hints?

Thanks a lot,
Kai.

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++



More information about the gme-users mailing list