|
|
|
|
Re: Syntax clarification. [message #792324 is a reply to message #792244] |
Mon, 06 February 2012 22:13   |
|
Hi,
welcome to OMG Monster Specs
http://www.omg.org/spec/OCL/2.3.1/
Quote:The value of a property on an object that is defined in a class diagram is specified in an OCL expression by a dot
followed by the name of the property. For example:
context Person inv:
self.isMarried
Quote:Collections, like Sets, OrderedSets, Bags, and Sequences are predefined types in OCL. They have a large number of
predefined operations on them. A property of the collection itself is accessed by using an arrow '->' followed by the name
of the property.
Quote:Shorthand for Collect
Because navigation through many objects is very common, there is a shorthand notation for the collect that makes the
OCL expressions more readable. Instead of
self.employee->collect(birthdate)
we can also write:
self.employee.birthdate
~Christian
Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Mon, 06 February 2012 22:15] Report message to a moderator
|
|
|
Re: Syntax clarification. [message #792572 is a reply to message #792324] |
Tue, 07 February 2012 06:05   |
Ed Willink Messages: 7595 Registered: July 2009 |
Senior Member |
|
|
Hi
You may find slide 47 from
http://www.slideshare.net/EdWillink/enrich-your-models-with-ocl helpful.
The OCL specification lacks a clear exposition here.
In OCL, you always use "." to navigate from an object and "->" to
navigate from a collection. Everything else is a shorthand.
[To add confusion, various languages influenced by OCL use "." for
collection navigation and eliminate the shorthands.]
Regards
Ed Willink
On 06/02/2012 22:13, Christian Dietrich wrote:
> Hi,
>
> welcome to OMG Monster Specs
>
> http://www.omg.org/spec/OCL/2.3.1/
>
> Quote:
>> Collections, like Sets, OrderedSets, Bags, and Sequences are
>> predefined types in OCL. They have a large number of
>> predefined operations on them. A property of the collection itself is
>> accessed by using an arrow '->' followed by the name
>> of the property.
>
>
> Quote:
>> Shorthand for Collect
>> Because navigation through many objects is very common, there is a
>> shorthand notation for the collect that makes the
>> OCL expressions more readable. Instead of
>> self.employee->collect(birthdate)
>> we can also write:
>> self.employee.birthdate
>
>
> ~Christian
|
|
|
|
|
Re: Syntax clarification. [message #793559 is a reply to message #792728] |
Wed, 08 February 2012 09:34  |
|
Seref,
"OCL is heavily used in Acceleo" : well, Acceleo is an implementation of the MOFM2T OMG specification ... which is a "superset" of OCL, so yes we do have somewhat of a binding to OCL .
as for the random "connection reset", we do get it a lot to from another Europe location (France)... I'll try and see if the webmasters are aware.
Laurent Goubet
Obeo
|
|
|
Powered by
FUDForum. Page generated in 0.02688 seconds