OCL expression intersectionhttps://www.eclipse.org/forums/index.php/mv/msg/366526/892315/#msg_892315
I would to know if its possible to easilly (of course) determine if an OCL expression OExp1 is "included in" another OCL expression OExp2 in the same context.
For example, my first expression is "self.age < 18" then I've another expression which is "self.category = CategoryKind.CAT1 && self.age < 34". So is it possible to determine that my first expression is "included in", "compatible with" my second expression ?

Thanks
]]>Erik Gollot2012-06-27T17:12:43-00:00Re: OCL expression intersectionhttps://www.eclipse.org/forums/index.php/mv/msg/366526/892320/#msg_892320
Using the Pivot binding of OCL that you can find as examples functionality:

oclType() is fully reflective so provided you can navigate from the self
Classifier to rthe expression, e.g to an invariant or operation body,

Once you have two ASTs you can then just detect whether one 'covers' the
other.

This could be achieved by defining a 'covers' operation for relevant
nodes in the OCL AST.

You can implement 'covers' to be exact match or greater than match.

No exactly easy, but in principle what you would do in Java.

Regards

Ed Willink

On 27/06/2012 18:12, Erik Gollot wrote:
> Hello,
>
> I would to know if its possible to easilly (of course) determine if an
> OCL expression OExp1 is "included in" another OCL expression OExp2 in
> the same context.
> For example, my first expression is "self.age < 18" then I've another
> expression which is "self.category = CategoryKind.CAT1 && self.age <
> 34". So is it possible to determine that my first expression is
> "included in", "compatible with" my second expression ?
>
> Thanks
>]]>Ed Willink2012-06-27T17:36:54-00:00