OCL expression intersection [message #892315] |
Wed, 27 June 2012 13:12  |
Eclipse User |
|
|
|
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
[Updated on: Wed, 27 June 2012 13:13] by Moderator
|
|
|
Re: OCL expression intersection [message #892320 is a reply to message #892315] |
Wed, 27 June 2012 13:36  |
Eclipse User |
|
|
|
Hi
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,
self.ownedRule->select(name='interestingInvariant')->any(true).specification.oclAsType(ExpressionInOCL).bodyExpression
gives the AST of the invariant named 'interestingInvariant'.
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03375 seconds