Skip to main content



      Home
Home » Modeling » OCL » OCL Parser Problem
OCL Parser Problem [message #69303] Sun, 29 March 2009 11:53 Go to next message
Eclipse UserFriend
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 #69320 is a reply to message #69303] Mon, 30 March 2009 07:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Marcellus,

Could you provide the entire OCL expression you are trying to parse ?
How are you trying to parse it ?

Cheers,
Adolfo.
Marcellus Castro escribió:
> 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 #69359 is a reply to message #69320] Mon, 30 March 2009 10:17 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: OCL Parser Problem [message #69397 is a reply to message #69359] Mon, 30 March 2009 17:01 Go to previous messageGo to next message
Eclipse UserFriend
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
>
Re: OCL Parser Problem [message #69418 is a reply to message #69397] Mon, 30 March 2009 23:25 Go to previous message
Eclipse UserFriend
Thanks Adolfo!
Previous Topic:Ocl Query to retrieve all classes implementing a certain interface
Next Topic:Problem with OCL interactive console.
Goto Forum:
  


Current Time: Sat Jul 19 02:55:01 EDT 2025

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

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

Back to the top