Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL Parser Problem
OCL Parser Problem [message #69303] Sun, 29 March 2009 15:53 Go to next message
Marcellus Castro is currently offline Marcellus Castro
Messages: 10
Registered: July 2009
Junior Member
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 11:41 Go to previous messageGo to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
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 14:17 Go to previous messageGo to next message
Marcellus Castro is currently offline Marcellus Castro
Messages: 10
Registered: July 2009
Junior Member
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 21:01 Go to previous messageGo to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
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] Tue, 31 March 2009 03:25 Go to previous message
Marcellus Castro is currently offline Marcellus Castro
Messages: 10
Registered: July 2009
Junior Member
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: Tue Oct 21 18:35:19 GMT 2014

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

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