Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » OCL expr as an initializer
OCL expr as an initializer [message #476441] Wed, 31 October 2007 08:20 Go to next message
Krzysztof Kaczmarski is currently offline Krzysztof KaczmarskiFriend
Messages: 88
Registered: July 2009
Member
Hi All,

in the OCL standard description there is an information that OCL
expression may be used as an initialization expression for UML class
attributes. I suppose that in such case Property's defaultValue is set
to ExpressionInOCL object.
My question is how are the types and values mapped between OCL and
UML. If we have a Property that is a collection ( dogs:Dog[0..*] ) are
the values from a resulting OCL matched automatically?

This question has a little deeper meaning for me. If we use
ExpressionInOCL as a ValueSpecification in a UML Action (for example
ValueSpecificationAction) and we need to use OutputPin and ObjectFlow
to actually consume resulting values. How is the OCL collection
interpreted then?

Thanks in advance,
Krzysztof
Re: OCL expr as an initializer [message #476443 is a reply to message #476441] Wed, 31 October 2007 12:34 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

The default value could be an ExpressionInOcl, or it could simply be an
OpaqueExpression having "OCL" in its language.

I'm not sure what you mean by matching. The OCL parser will interpret the
types of MultiplicityElements in your model as having the appropriate OCL
collection type.

ExpressionInOcl is not a MultiplicityElement, so it cannot implicitly
declare its type as a collection type in the usual UML way. Pins are
MultiplicityElements, so I suppose that inputs to them should conform to
their implied collection types.

Some Actions have the ability to index collections, so these should work
with Sequences and OrderedSets. I'm not sure that there is much cohesion
between the specifications in this area, though. For example, the
AddStructuralFeatureValueAction has an "inserAt" InputPin that accepts the
collection index. However, UML requires this to be an UnlimitedNatural
(why? * would never be valid), but indexing in OCL is by Integer.
Moreover, the WriteStructuralFeatureAction abstract metaclass requires that
the type of the "value" InputPin be the same as the structural feature's
type, but doesn't account for multiplicities of either the structural
feature or the value specified by the pin (either by an ObjectFlow or by
using a ValuePin). On that subject, the only constraint on ValuePin is
that its value specification must have a type "compatible with" the pin's
type. That's pretty vague.

All of this is to say, that I'm not sure that you can actually satisfy the
type conformance constraints using ValueSpecifications of any kind in
Actions because ValueSpecifications are not MultiplicityElements, so you
cannot express collection types in the way that Pins require.

HTH,

Christian

Krzysztof Kaczmarski wrote:

> Hi All,
>
> in the OCL standard description there is an information that OCL
> expression may be used as an initialization expression for UML class
> attributes. I suppose that in such case Property's defaultValue is set
> to ExpressionInOCL object.
> My question is how are the types and values mapped between OCL and
> UML. If we have a Property that is a collection ( dogs:Dog[0..*] ) are
> the values from a resulting OCL matched automatically?
>
> This question has a little deeper meaning for me. If we use
> ExpressionInOCL as a ValueSpecification in a UML Action (for example
> ValueSpecificationAction) and we need to use OutputPin and ObjectFlow
> to actually consume resulting values. How is the OCL collection
> interpreted then?
>
> Thanks in advance,
> Krzysztof
Re: OCL expr as an initializer [message #625346 is a reply to message #476441] Wed, 31 October 2007 12:34 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

The default value could be an ExpressionInOcl, or it could simply be an
OpaqueExpression having "OCL" in its language.

I'm not sure what you mean by matching. The OCL parser will interpret the
types of MultiplicityElements in your model as having the appropriate OCL
collection type.

ExpressionInOcl is not a MultiplicityElement, so it cannot implicitly
declare its type as a collection type in the usual UML way. Pins are
MultiplicityElements, so I suppose that inputs to them should conform to
their implied collection types.

Some Actions have the ability to index collections, so these should work
with Sequences and OrderedSets. I'm not sure that there is much cohesion
between the specifications in this area, though. For example, the
AddStructuralFeatureValueAction has an "inserAt" InputPin that accepts the
collection index. However, UML requires this to be an UnlimitedNatural
(why? * would never be valid), but indexing in OCL is by Integer.
Moreover, the WriteStructuralFeatureAction abstract metaclass requires that
the type of the "value" InputPin be the same as the structural feature's
type, but doesn't account for multiplicities of either the structural
feature or the value specified by the pin (either by an ObjectFlow or by
using a ValuePin). On that subject, the only constraint on ValuePin is
that its value specification must have a type "compatible with" the pin's
type. That's pretty vague.

All of this is to say, that I'm not sure that you can actually satisfy the
type conformance constraints using ValueSpecifications of any kind in
Actions because ValueSpecifications are not MultiplicityElements, so you
cannot express collection types in the way that Pins require.

HTH,

Christian

Krzysztof Kaczmarski wrote:

> Hi All,
>
> in the OCL standard description there is an information that OCL
> expression may be used as an initialization expression for UML class
> attributes. I suppose that in such case Property's defaultValue is set
> to ExpressionInOCL object.
> My question is how are the types and values mapped between OCL and
> UML. If we have a Property that is a collection ( dogs:Dog[0..*] ) are
> the values from a resulting OCL matched automatically?
>
> This question has a little deeper meaning for me. If we use
> ExpressionInOCL as a ValueSpecification in a UML Action (for example
> ValueSpecificationAction) and we need to use OutputPin and ObjectFlow
> to actually consume resulting values. How is the OCL collection
> interpreted then?
>
> Thanks in advance,
> Krzysztof
Previous Topic:OCL expr as an initializer
Next Topic:UML 2.2
Goto Forum:
  


Current Time: Sat Apr 20 01:46:11 GMT 2024

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

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

Back to the top