Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Re: OCL constraint
Re: OCL constraint [message #23158] Tue, 15 May 2007 13:25
Eclipse UserFriend
Originally posted by:

Hi, Julien,

It appears that you are trying to access the instances of the ComponentModel
class. You need the allInstances() operation for this. Your expression,
as it is written, is attempting to select an element from a set of OclTypes
whose name is equal to self.componentModel. Filling in the implicit
constructs in your original example, we get:

self.sourceConnections->size() < Set{ComponentModel}->select(c : OclType | = self.componentModel)->collect(c : OclType | c.maxOutput)

It just so happens that OclType, being a Classifier, has a "name" property
but it does not have a maxOutput property. Moreover, maxOutput is not a
static attribute (Ecore does not model statics).

Rewrite this as

self.sourceConnections->size() < ComponentModel.allInstances()->any(c | = self.componentModel).maxOutput

which will fix also your problem of getting the first ComponentModel
instance that matches your name criterion, using the "any" iterator.



Julien Forot wrote:

> Hi !
> I want to make an OCL constaint on my gmfmap. I try this one :
> self.sourceConnections->size()< ComponentModel->select(c |
> I sure to have a maxOutput field on my ComponentModel class, but when i
> want to create generator model, I have the following error :
> unrecognized variable (maxOuput).
> Does soemeone can help me ?
Previous Topic:[Announce] MDT OCL 1.1.0 1.1M7 is available
Next Topic:Question about EMF Query
Goto Forum:

Current Time: Fri May 25 15:04:57 GMT 2018

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

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

Back to the top