[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.mdt.uml2.ocl] Re: ocl in ecore meta model
|
Hi, Luis,
Find some responses, in-line below.
HTH,
Christian
Luis Pedro wrote:
> Hi Christian,
> Yes I get it!
> So, if I have an attribute Number of type EInt in my ecore model and I
> want to describe a constraint that does not allow to have numbers
> smaller that 99 should a specify an ocl invariant "self.number > 99"?
> After adding this constraint to the Attribute Number by means of an
> EAnnotation should I get something different from the generated code?
Yes, if your attribute is named "number", then you can define an invariant
constraint "self.number > 99" on the EClass that contains it. The only OCL
particles that can be specified in an attribute context are initial-value
and derived-value expressions, not constraints (note that the article
doesn't deal with initial values).
In general, if you'r finding that you're not getting the right code
generated or that validation at run-time is reporting the right problems,
you should compare your Ecore model against the article's example (the
article links to a ZIPped up project containing the complete source for a
working example). Seeing how your Ecore differs from the example will
usually help to clarify things. :-)
>
> Thanks very much in advance and I'm sorry for the naif questions, but
> I'm really trying to understand if and how can I use OCL in my ECore
> models...
That's what this newsgroup is here for! Precisely to help developers to
leverage OCL in their EMF-based applications, and to gather input from them
that will help to improve the OCL project.
>
> Best regards,
>
> Luis Pedro
>
<snip>