Re: OCL constraint [message #23158] |
Tue, 15 May 2007 13:25 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
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 |
c.name = 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 |
c.name = self.componentModel).maxOutput
which will fix also your problem of getting the first ComponentModel
instance that matches your name criterion, using the "any" iterator.
Cheers,
Christian
Julien Forot wrote:
> Hi !
>
> I want to make an OCL constaint on my gmfmap. I try this one :
> self.sourceConnections->size()< ComponentModel->select(c |
> c.name=self.componentModel).maxOutput
>
> 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 ?
|
|
|
Powered by
FUDForum. Page generated in 0.04536 seconds