OCL Parser Problem [message #69303] |
Sun, 29 March 2009 11:53  |
Eclipse User |
|
|
|
Hello,
Im having troubles to parse a let OCL expression. When I define a variable
with Set type, the parse says that Set is invalid.
Is there any way to solve this?
Thanks in advance.
|
|
|
|
|
Re: OCL Parser Problem [message #69397 is a reply to message #69359] |
Mon, 30 March 2009 17:01   |
Eclipse User |
|
|
|
Hi Marcellus,
The problem you mention is that you haven't specified the type of the
Set. When you don't know the type or you don't want a Set of a specific
type, you can define 'Set(OclAny)', however, you will problem have more
problems in the inner expression.
I'm not quite sure what are you trying to do....because it seems that
you want access to your metamodel inside of your model constraints....If
you want add an invariant to check that a model element is an instance
of some metaclass, what about doing the following ?
context Element inv:
self.oclIsKindOf(StructuralElement) or
self.oclIsKindOf(StructuralBehavioralElement) or
self.oclIsKindOf(ConstraintElement) or
self.oclIsKindOf(BehavioralElement)
Cheers,
Adolfo.
Marcellus Castro escribió:
> The expression is:
>
> context Element
> inv:letkindAllowed:Set = Set{StructuralElement,StructuralBehavioralElement
> ConstraintElement, BehavioralElement}
> in(kindAllowed->exists(e:Element | self.oclIsKindOf(e))
>
> In my metamodel I have a metaclass Element with 4 submetaclasses:
> StructuralElement,StructuralBehavioralElement, ConstraintElement and
> BehavioralElement.
>
> When I try to parse the expression the parser says that token "Set" is
> invalid.
> Why this is happening?
>
> thx
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.10471 seconds