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: 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 ?
Previous Topic:[Announce] MDT OCL 1.1.0 1.1M7 is available
Next Topic:Question about EMF Query
Goto Forum:
  


Current Time: Tue Apr 16 17:47:57 GMT 2024

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

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

Back to the top