[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.mdt.uml2.ocl] Re: OCL questions
|
Hi, Christophe,
Find some replies in-line, below.
Cheers,
Christian
C. le Camus wrote:
> Hello,
>
> I 've got some problems using the ocl API.
> 1/ I Have a metamodel splited in several subpackages (the ocl metamodel
> for instance), and I try to create a query that use a navigation through
> a property that leads in another subpackage. My example is the following
> :
> context Constraint
> inv hello : self.body.name <> 'foo'
> Constraint is declared in the uml package, and the target of the body
> reference is declared, as I remember, in the types subpackage.
> This navigation results in an error.
> Is there a solution to avoid this behaviour ?
This is actually an instance of the same problem as reported in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=162300. I have added a
comment to that bug describing this particular scenario. The problem isn't
that the OCLExpression class (the type of self.body) is in a different
package. The problem is that the OCL grammar definition reserves 'body' as
a keyword, for the "body:" operation body condition syntax. The grammar
needs to be more flexible about that.
> 2/ When I register a new Def, I use a NewHelper to define a property or a
> method over the meta model. If I execute another time the registration
> of the Def I cath an error specifying this property or method is already
> defined. I have not found any utilities to check if a Def has already
> been registered. Have I miss something ? In the same approach, I have
> not found any utilities tyo delete the Def previous registration.
> My context is the following : we need to build several times an OCL
> document.
Yes, these definitions are "global"; they are actually attached via adapters
to your Ecore elements. There is a plan
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=154371) to fix that. These
definitions will be restricted to the environment in which they were
parsed.
> 3/ Registrations of DEF and LET clauses seem to be at the context level
> in the API. I'm a little bit surprised of that.
> Could you explain me the reason of that ?
I don't understand what you mean by "at the context level." Can you give me
an example? Let expressions are confined entirely to a particular
constraint, and defs currently are global (as mentioned above), which is a
problem.
>
> Thanks a lot for your attention.
>
> Best Regards
> Christophe Le Camus
> Topcased OCL contributor.
> PS : Sorry if this mail is present twice, but I do not see my previous
> message in the tree.