Skip to main content



      Home
Home » Modeling » OCL » Traversing AST nodes of an OCL constraint programatically
Traversing AST nodes of an OCL constraint programatically [message #1102927] Fri, 06 September 2013 03:52 Go to next message
Eclipse UserFriend
Hi all,
Can you please point me to an apropriate library or documentation to traverse an OCL abstract tree and return the typedElements tied to each node.
Cheers.
Re: Traversing AST nodes of an OCL constraint programatically [message #1103035 is a reply to message #1102927] Fri, 06 September 2013 06:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi

The pivot OCL AS supports Visitors so you can just visit each node in
turn to determine whatever you want. (The classic OCL AS also supports
Visitors but only on the OCL nodes; not on the Ecore/UML metamodel nodes).

I'm not sure what you mean by TypedElements tied to each node. Some of
the nodes are TypedElement, so maybe you just want to do a generic tree
contents traversal with an instanceof.

Regards

Ed Willink


On 06/09/2013 08:52, Amine BEN wrote:
> Hi all,
> Can you please point me to an apropriate library or documentation to
> traverse an OCL abstract tree and return the typedElements tied to
> each node.
> Cheers.
>
Re: Traversing AST nodes of an OCL constraint programatically [message #1103057 is a reply to message #1103035] Fri, 06 September 2013 06:39 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Ed,

I want to mark all the attributes that are involved in an OCL constraint (attributes' name are fine for me ). For instance, in the following invariant the involved attributes are isMarried : EBoolean and age : EInt
Context Person
inv canMarry : self.isMarried implies self.age >18

N.B : I am working with the classical OCL

[Updated on: Fri, 06 September 2013 06:43] by Moderator

Re: Traversing AST nodes of an OCL constraint programatically [message #1103083 is a reply to message #1103057] Fri, 06 September 2013 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi

So do a tree search for all PropertyCallExp and gather the
referredProperty values.

Regards

Ed Willink


On 06/09/2013 11:39, Amine BEN wrote:
> I want to mark all the attributes that are involved in an OCL
> constraint (attributes' name are fine for me ). For instance, in the
> following invariant the involved attributes are isMarried : EBoolean
> and age : EInt Context Person
> inv canMarry : self.isMarried implies self.age >18
>
> N.B : I am working with the classical OCL
Re: Traversing AST nodes of an OCL constraint programatically [message #1103090 is a reply to message #1103083] Fri, 06 September 2013 07:16 Go to previous message
Eclipse UserFriend
That's what I am doing !
Thank you for your help I appreciate it !
Previous Topic:Checking OCL programmatically
Next Topic:Validating OCL in EMF - RCP
Goto Forum:
  


Current Time: Sun Jun 15 02:54:22 EDT 2025

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

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

Back to the top