|
Re: Question to OCL-expression used in EMF Query [message #642304 is a reply to message #642075] |
Tue, 30 November 2010 17:56 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi calimeah
Your example has quite a few trivial typos, and the main logic looks
very suspect.
In principle if you write your algorithm in simple English, you can then
transcribe it to OCL.
Your problem is very similar to those that occur for UML itself, so you
might care to look at the UML specification for many relevant OCL
examples (you may need to correct minor typos).
Regards
Ed Willink
On 29/11/2010 18:20, calimeah wrote:
> Hi,
>
> I am currently using BooleanOCLConditions in EMF Query.
>
> Simple OCL-expressions work fine but I am confronted with some rather
> complicated ones that wont work correctly.
>
> The used ecore-model is a meta-model for UML-class-diagramms.
> The model instance xmi-file contains some packages, some classes,
> operations with parameters... etc.
>
> A simple and working OCL contraint is e.g.:
>
> UMLOperation.allInstances()->select(id='123')->size()=1
>
> This tells me wether the model instance xmi file contains an operation
> with the id '123'.
>
> Now comes the tricky constraint, which should tell me if an operation
> with the same name already exists in the model instance and
> furthermore if thats the case, I want to know if that operation also
> consists of the same parameter count and the same parameter types in
> the same order.
>
> My idea of the according OCL-expression was something like this:
>
> UMLOperation.allInstances->select(id='123').class->forAll(c:UMLClass|c.operations-
> >select(name='theOperationName').parameters <>
> (UMLOperation.allInstances->select(id='123').parameters))->size()=0
>
> Do you know a better and working way?
>
> Thanx,
> Calimeah
|
|
|
Powered by
FUDForum. Page generated in 0.04258 seconds