Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Validate OCL constraints on XMI model
Validate OCL constraints on XMI model [message #945756] Mon, 15 October 2012 12:04 Go to next message
Clément Quinton is currently offline Clément Quinton
Messages: 5
Registered: October 2012
Junior Member
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 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
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 #946402 is a reply to message #945820] Tue, 16 October 2012 03:13 Go to previous messageGo to next message
Clément Quinton is currently offline Clément Quinton
Messages: 5
Registered: October 2012
Junior Member
Hi Ed,

Thank you for your answer.
I'm using the Juno release and I already followed the Complete OCL Tutorial,
but as I said, I don't know how to apply these technics to deal with an XMI model.

This is my "toto.ocl" file that works fine for my "Toto.ecore":
import 'platform:/resource/MyProject/model/Toto.ecore'

context TotoElement
inv CamelCaseName : name.matches('[A-Z][A-Za-z]*')


I tried the following import to deal with my "toto.xmi":
import 'platform:/resource/MyProject/model/toto.xmi'

...


But I get the following error message:
Unresolved import 'platform:/resource/Saloon/model/Jelastic.xmi' : Cannot create pivot from 'null'

I'd just like to know what is the correct import to use to "link" my .ocl file to my .xmi model.

Thank you,
Clément
Re: Validate OCL constraints on XMI model [message #946429 is a reply to message #946402] Tue, 16 October 2012 03:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

What tool are you using to process toto.xmi?

Regards

Ed Willink


On 16/10/2012 08:13, Clément Quinton wrote:
> Hi Ed,
>
> Thank you for your answer.
> I'm using the Juno release and I already followed the Complete OCL
> Tutorial, but as I said, I don't know how to apply these technics to
> deal with an XMI model.
>
> This is my "toto.ocl" file that works fine for my "Toto.ecore":
>
> import 'platform:/resource/MyProject/model/Toto.ecore'
>
> context TotoElement
> inv CamelCaseName : name.matches('[A-Z][A-Za-z]*')
>
>
> I tried the following import to deal with my "toto.xmi":
>
> import 'platform:/resource/MyProject/model/toto.xmi'
>
> ...
>
>
> But I get the following error message: Unresolved import
> 'platform:/resource/Saloon/model/Jelastic.xmi' : Cannot create pivot
> from 'null'
>
> I'd just like to know what is the correct import to use to "link" my
> .ocl file to my .xmi model.
>
> Thank you,
> Clément
Re: Validate OCL constraints on XMI model [message #946457 is a reply to message #946429] Tue, 16 October 2012 04:06 Go to previous messageGo to next message
Clément Quinton is currently offline Clément Quinton
Messages: 5
Registered: October 2012
Junior Member
Hi,

I open my toto.xmi file with the Sample Reflective Ecore Model Editor,
my toto.ocl with the CompleteOCL Editor.
Re: Validate OCL constraints on XMI model [message #946518 is a reply to message #946457] Tue, 16 October 2012 04:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

Using the Complete OCL editor is for development; not part of the
current activity.

Within the Sample Reflective Ecore Model Editor you can just Load
Complete OCL Resource... to install toto.ocl.

Thereafter the additional OCL should contribute to validation, or
evaluation in the Xtext OCL Console.

If you edit toto.ocl, you must restart the Sample Reflective Ecore Model
Editor to see the changes.

Regards

Ed Willink




On 16/10/2012 09:06, Clément Quinton wrote:
> Hi,
>
> I open my toto.xmi file with the Sample Reflective Ecore Model Editor,
> my toto.ocl with the CompleteOCL Editor.
Re: Validate OCL constraints on XMI model [message #946556 is a reply to message #946518] Tue, 16 October 2012 05:36 Go to previous messageGo to next message
Clément Quinton is currently offline Clément Quinton
Messages: 5
Registered: October 2012
Junior Member
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

Re: Validate OCL constraints on XMI model [message #946604 is a reply to message #946556] Tue, 16 October 2012 06:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
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
>
>
Re: Validate OCL constraints on XMI model [message #947886 is a reply to message #946604] Wed, 17 October 2012 10:43 Go to previous message
Clément Quinton is currently offline Clément Quinton
Messages: 5
Registered: October 2012
Junior Member
Hi,

thank you for your explanations.
I'm going to try another way. I've instance specific constraints (at xmi level) I'd like to apply.

Thank you again.
Clément
Previous Topic:Reverse sort for sortedBy()
Next Topic:Ecore derived attribute's derivation specialization
Goto Forum:
  


Current Time: Sat Aug 30 04:24:58 EDT 2014

Powered by FUDForum. Page generated in 0.09560 seconds