Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Body of the subtypes
Body of the subtypes [message #28095] Fri, 15 June 2007 07:32 Go to next message
A. Jibran Shidqie is currently offline A. Jibran Shidqie
Messages: 26
Registered: July 2009
Junior Member
Hi,

We found out that in the results of the parsing process of the overwriting
operation of Body expression, the OCL parser returns the operation context
of its supertype. To make things clear, we'll give the example. The
following OCL input is parsed : (the ecore model is attached)

--------------------
package example

context Sub1OfA::superToString() : String
body : 'result of Sub1OfA'

context Sub2OfA::superToString() : String
body : 'result of Sub2OfA'

endpackage
---------------

For each expression above, it results the same operation context, the
operation of their superclass (SuperA).
Can we have difference result context for each subtypes expression? In this
case the 1st expression would have the operation context which its container
is itself instead of its superclass, and so as the 2nd expression.

Best regards,
Jibran


  • Attachment: model.ecore
    (Size: 0.69KB, Downloaded 71 times)
Re: Body of the subtypes [message #28153 is a reply to message #28095] Fri, 15 June 2007 09:57 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Jibran,

The "constrained operation" in both of these cases should be the same,
because I suppose that superToString() actually only has one definition,
and that is in the SuperA class. What distinguishes the two constraints is
that they have different *context classifiers.*

Inspecting the Constraints created by the parser, you should see the
following:

- in the first case:
- constrainedElement references the Sub1OfA class and the
SuperA.superToString() operation (context classifier is Sub1OfA)
- specification contains an ExpressionInOCL in which:
- contextVariable is a Variable whose type is Sub1OfA (this is the
"self" variable)
- in the second case:
- constrainedElement references the Sub2OfA class and the
SuperA.superToString() operation (context classifier is Sub2OfA)
- specification contains an ExpressionInOCL in which:
- contextVariable is a Variable whose type is Sub2OfA (this is the
"self" variable)

If you don't see this, then the parser has a bug.

Cheers,

Christian


A. Jibran Shidqie wrote:

> Hi,
>
> We found out that in the results of the parsing process of the overwriting
> operation of Body expression, the OCL parser returns the operation context
> of its supertype. To make things clear, we'll give the example. The
> following OCL input is parsed : (the ecore model is attached)
>
> --------------------
> package example
>
> context Sub1OfA::superToString() : String
> body : 'result of Sub1OfA'
>
> context Sub2OfA::superToString() : String
> body : 'result of Sub2OfA'
>
> endpackage
> ---------------
>
> For each expression above, it results the same operation context, the
> operation of their superclass (SuperA).
> Can we have difference result context for each subtypes expression? In
> this case the 1st expression would have the operation context which its
> container is itself instead of its superclass, and so as the 2nd
> expression.
>
> Best regards,
> Jibran
Re: Body of the subtypes [message #28191 is a reply to message #28153] Mon, 18 June 2007 05:03 Go to previous message
A. Jibran Shidqie is currently offline A. Jibran Shidqie
Messages: 26
Registered: July 2009
Junior Member
Hi Christian,

Yes, we saw it. It works perfectly well :)
Thanks again

Best regards,
Jibran

"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:f4u5sg$fab$1@build.eclipse.org...
> Hi, Jibran,
>
> The "constrained operation" in both of these cases should be the same,
> because I suppose that superToString() actually only has one definition,
> and that is in the SuperA class. What distinguishes the two constraints
> is
> that they have different *context classifiers.*
>
> Inspecting the Constraints created by the parser, you should see the
> following:
>
> - in the first case:
> - constrainedElement references the Sub1OfA class and the
> SuperA.superToString() operation (context classifier is Sub1OfA)
> - specification contains an ExpressionInOCL in which:
> - contextVariable is a Variable whose type is Sub1OfA (this is the
> "self" variable)
> - in the second case:
> - constrainedElement references the Sub2OfA class and the
> SuperA.superToString() operation (context classifier is Sub2OfA)
> - specification contains an ExpressionInOCL in which:
> - contextVariable is a Variable whose type is Sub2OfA (this is the
> "self" variable)
>
> If you don't see this, then the parser has a bug.
>
> Cheers,
>
> Christian
>
>
> A. Jibran Shidqie wrote:
>
>> Hi,
>>
>> We found out that in the results of the parsing process of the
>> overwriting
>> operation of Body expression, the OCL parser returns the operation
>> context
>> of its supertype. To make things clear, we'll give the example. The
>> following OCL input is parsed : (the ecore model is attached)
>>
>> --------------------
>> package example
>>
>> context Sub1OfA::superToString() : String
>> body : 'result of Sub1OfA'
>>
>> context Sub2OfA::superToString() : String
>> body : 'result of Sub2OfA'
>>
>> endpackage
>> ---------------
>>
>> For each expression above, it results the same operation context, the
>> operation of their superclass (SuperA).
>> Can we have difference result context for each subtypes expression? In
>> this case the 1st expression would have the operation context which its
>> container is itself instead of its superclass, and so as the 2nd
>> expression.
>>
>> Best regards,
>> Jibran
>
Previous Topic:Tuple Type problems
Next Topic:[Announce] MDT OCL 1.1.0 1.1RC4 is available
Goto Forum:
  


Current Time: Wed Jul 23 14:17:46 EDT 2014

Powered by FUDForum. Page generated in 0.06240 seconds