Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » generate OCL code from "OCL ecore instance"
generate OCL code from "OCL ecore instance" [message #1170359] Mon, 04 November 2013 15:40 Go to next message
aurel pestell is currently offline aurel pestell
Messages: 12
Registered: October 2013
Location: Sweden
Junior Member
Hi,

Is it possible to do this:
-programmatically generate an "*.xmi" instance of OCL.ecore.
-then generate the quivalent "*.ocl" file from this instance ?

Anybody knows ? Thank you,

Aurel
Re: generate OCL code from "OCL ecore instance" [message #1170383 is a reply to message #1170359] Mon, 04 November 2013 15:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4110
Registered: July 2009
Senior Member
Hi

What do you mean by *.xmi? Ecore files are already XMI files.

What do you mean by OCL.ecore?

- Your question makes little sense as /org.eclipse.ocl/model/OCL.ecore
- for generically OCL in Ecore, that is what OCLinEcore CG is all about

There is a poorly documented CompleteOCLSplitter to split off *.ocl files.

Regards

Ed Willink

On 04/11/2013 15:40, aurel pestell wrote:
> Hi,
>
> Is it possible to do this:
> -programmatically generate an "*.xmi" instance of OCL.ecore.
> -then generate the quivalent "*.ocl" file from this instance ?
>
> Anybody knows ? Thank you,
>
> Aurel
Re: generate OCL code from "OCL ecore instance" [message #1170672 is a reply to message #1170383] Mon, 04 November 2013 20:18 Go to previous messageGo to next message
aurel pestell is currently offline aurel pestell
Messages: 12
Registered: October 2013
Location: Sweden
Junior Member
Hi Ed,

Sorry, that was not clear. I'll explain what I am trying
to achieve instead:

Brievly, in my project, I generate an ecore metamodel programmatically.
I generate it using an ATL transformation that transform
an instance of a Xtext AST instance model to an instance
of the Ecore.ecore metamodel (see http://www.eclipse.org/forums/index.php/t/542586/).
It works just perfectly.

Now, I need to enrich it with a validation system.
The thing is that I also need to generate it programmatically.

So I was wondering if I could use the same strategy with the
OCL.ecore metmodel shipped with "org.eclipse.ocl".

Thank you for your reply.

Aurel

[Updated on: Mon, 04 November 2013 20:20]

Report message to a moderator

Re: generate OCL code from "OCL ecore instance" [message #1171657 is a reply to message #1170672] Tue, 05 November 2013 11:44 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4110
Registered: July 2009
Senior Member
Hi

You cannot create instances of /org.eclipse.ocl/model/OCL.ecore because
it is a generic templated metamodel

You can however create instances of
/org.eclipse.ocl.ecore/model/OCLEcore.ecore in which the templating is
resolved towards Ecore.ecore
or /org.eclipse.ocl.uml/model/OCLUML.ecore in which the templating is
resolved towards UML.ecore

Unfortunately the OCL standard is currently unimplementable when it
comes to XMI interchange.

You will find that an instance of
/org.eclipse.ocl.examples.pivot/model/Pivot.ecore gives you something
that is likely to be much closer to the eventual OMG resolutions and
avoids the needless template complexities.

OCL has survived very well for the last 20 years without XMI
interchange, because in practice everyone interchanges OCL concrete
syntax. You might prefer to do this and use the OCLinEcore editor to
examine what you have generated or practice what you are trying to
generate. If you embed your OCL in Ecore you will be able to use the OCL
to Java code generator.

Regards

Ed Willink




On 04/11/2013 20:18, aurel pestell wrote:
> Hi Ed,
>
> Sorry, that was not clear. I'll explain what I am trying
> to achieve instead:
>
> Brievly, in my project, I generate an ecore metamodel programmatically.
> I generate it using an ATL transformation that transform
> an instance of a Xtext AST instance model to an instance
> of the Ecore.ecore metamodel.
> It works just perfectly.
>
> Now, I need to enrich it with a validation system.
> The thing is that I also need to generate it programmatically.
>
> So I was wondering if I could use the same strategy with the
> OCL.ecore metmodel shipped with "org.eclipse.ocl".
>
> Thank you for your reply.
>
> Aurel
Re: generate OCL code from "OCL ecore instance" [message #1171838 is a reply to message #1170359] Tue, 05 November 2013 14:16 Go to previous messageGo to next message
aurel pestell is currently offline aurel pestell
Messages: 12
Registered: October 2013
Location: Sweden
Junior Member
Hi Ed,

I am reading the documentation on help.eclipse.org about the pivot metamodel and it says:

Quote:
From the specification perspective, the pivot metamodel
is UML-aligned
supports modeling of the OCL standard library
supports 'merging' of additional Complete OCL definitions
supports an interchangeable XMI representation
supports a fully reflective oclType()


Does it mean model instances will be serializable into XMI ?

Anyway, I'll make some tests with your tips in mind and reply back here.

Big thank !

Aurel
Re: generate OCL code from "OCL ecore instance" [message #1171908 is a reply to message #1171838] Tue, 05 November 2013 15:16 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4110
Registered: July 2009
Senior Member
Hi

Yes.

GIT\org.eclipse.ocl\examples\org.eclipse.ocl.examples.pivot\model-gen\Pivot.oclas

GIT\org.eclipse.ocl\examples\org.eclipse.ocl.examples.library\model-gen\OCL-2.5.oclas

are XMI and being successfully used for model transformation.

Regards

Ed Willink

On 05/11/2013 14:16, aurel pestell wrote:
> Hi Ed,
>
> I am reading the documentation on help.eclipse.org about the pivot
> metamodel and it says:
>
> Quote:
>> From the specification perspective, the pivot metamodel
>> is UML-aligned
>> supports modeling of the OCL standard library
>> supports 'merging' of additional Complete OCL definitions
>> supports an interchangeable XMI representation
>> supports a fully reflective oclType()
>
>
> Does it mean model instances will be serializable into XMI ?
>
> Anyway, I'll make some tests with your tips in mind and reply back here.
>
> Big thank !
>
> Aurel
Previous Topic:Programmatically load a complete OCL file
Next Topic:installing MDT OCL
Goto Forum:
  


Current Time: Thu Oct 30 17:37:19 GMT 2014

Powered by FUDForum. Page generated in 0.03616 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software