Validate OCL constraints on XMI model [message #945756] |
Mon, 15 October 2012 12:04  |
Eclipse User |
|
|
|
Hi everyone,
pretty new to OCL, I've got a simple question:
is it possible to create an "toto.ocl" file, add constraints and click "Load Complete OCL Resource" on the "toto.xmi" model?
I checked the Royal and Loyal tutorial, tried first with my metamodel and it works fine with my "toto.ecore"
(ok not too hard, just changed the tutorial to work with my model).
Then I tried to do the same thing with my "toto.xmi" file instead of "toto.ecore", adapting the imports and the constraints.
Maybe I misunderstood something, or maybe I don't use the correct import statement in my "toto.ocl" file.
Any advice would be appreciated.
Thank you.
|
|
|
Re: Validate OCL constraints on XMI model [message #945820 is a reply to message #945756] |
Mon, 15 October 2012 13:24   |
Eclipse User |
|
|
|
Hi
Yes, using the Juno release of OCL Examples and Editors (which may be
installed on Indigo).
See the Complete OCL Tutorial in the Help documentation.
Regards
Ed Willink
On 15/10/2012 17:46, Clément Quinton wrote:
> Hi everyone,
>
> pretty new to OCL, I've got a simple question:
> is it possible to create an "toto.ocl" file, add constraints and click
> "Load Complete OCL Resource" on the "toto.xmi" model?
>
> I checked the Royal and Loyal tutorial, tried first with my metamodel
> and it works fine with my "toto.ecore"
> (ok not too hard, just changed the tutorial to work with my model).
> Then I tried to do the same thing with my "toto.xmi" file instead of
> "toto.ecore", adapting the imports and the constraints.
> Maybe I misunderstood something, or maybe I don't use the correct
> import statement in my "toto.ocl" file.
>
> Any advice would be appreciated.
>
> Thank you.
|
|
|
|
|
|
|
|
Re: Validate OCL constraints on XMI model [message #946604 is a reply to message #946556] |
Tue, 16 October 2012 06:29   |
Eclipse User |
|
|
|
Hi
OCL constraints are applied to a meta-model; Ecore/UML/...
OCL constraints are evaluated on instances of that meta-model; XMI,...
e.g A constraint that a Person's name contains no spaces is defined for
the Person meta-class but evaluated for individuals.
So if your XMI contains many instances, you just load the XMI into a
tool and the load the OCL that refers to the corresponding meta-model.
If your XMI is itself a meta-model, then that is not directly supported,
you will need to add an XMItoPivot loader so that the Classes,
Properties, Operations etc are understood. This is not that hard, but it
probably reflects a failure to use the EMF tools sensibly. Ecore (or
UML) are good for meta-modeling so why not use them.
Regards
Ed Willink
On 16/10/2012 10:36, Clément Quinton wrote:
> Hi,
>
> I'm not sure to completely understand your answer, so I just recap the
> problem:
>
> What I have is an ecore model and an xmi model that conforms this
> ecore model.
> What I want is apply ocl constraints against the .xmi model.
> Then, I want to query the xmi model (that is, the .xmi model with the
> oil constraints applied).
>
> So I just thought about using a separate .ocl file, then load resource
> on the .xmi model to load this .ocl file and
> apply constraints on the model.
> Here is my problem. I don't know how to refer to the .xmi model in the
> .ocl file to write the constraints, as it has been done in the
> tutorial for an .ecore model with the correct import.
>
> Hope it's clear.
>
> Regards,
> Clément
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.08913 seconds