[gme-users] OCL Question
Matthew J. Emerson
mjemerson at isis.vanderbilt.edu
Wed Aug 2 14:15:15 CDT 2006
To keep with your example, you need to edit your definition of dest:
Let dest =
self.connectedFCOs("dst")->theOnly().oclAsType(meta::WhateverTheTypeIs).
DataType.trim() in
But I don't recommend using theOnly because if one atom connects to zero
or more than one other atoms it returns undefined. I also don't think
you need to use trim(). For the metamodel fragment in the image, I would
write the constraint:
self.connectedFCOs(meta::Conn)->forAll(other : meta::B | self.DataType =
other.DataType)
The context of the constraint is the 'A' type. Flag the constraint to be
checked on connect.
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Raub,
Ryan W (FMSCOE)
Sent: Tuesday, August 01, 2006 4:42 PM
To: gme-users
Subject: [gme-users] OCL Question
I am trying to write a constraint to compare a common attribute on two
atoms that are connected, to allow or disallow the connection.
I have not been able to access the 2nd connecting atom's attribute. The
source atom can be referred to as "self", but I can not find any method
combination that leads me to the destination atom.
So far this is what I have:
-- DataType is the name of the string attribute I wish to compare on
both SRC and DST atoms.
let dest = self.connectedFCOs("dst")->theOnly() in
let src = self.DataType.trim() in
dest = src
Thanks,
Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20060802/16efc6f0/attachment.htm
More information about the gme-users
mailing list