Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Generating OCLinEcore Code
Generating OCLinEcore Code [message #1863656] Mon, 19 February 2024 13:33 Go to next message
omar Abugharbiyeh is currently offline omar AbugharbiyehFriend
Messages: 2
Registered: February 2024
Junior Member
Sorry if this is a stupid question I'm still very new to OCL in general, but is there a way to automatically generate the OCLinEcore code displayed when opening an Ecore file using the OCLinEcore editor? Like, write a script to take an Ecore file as input and output the OCLinEcore code?

I'd very much appreciate any help with this or any existing examples of something similar if possible
Re: Generating OCLinEcore Code [message #1863661 is a reply to message #1863656] Mon, 19 February 2024 16:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
The OCLinEcore editor is just a more friendly rendering of the Ecore and OCL embedded in annotations, so maybe you need nothing. Or maybe cut and paste, or maybe OCL->Save AS->OCLinEcore.

You ask about 'code' which to me suggests the Java code that can be generated from the OCL, but this is not shown in the editor so I suspect your usage of 'code' differs from mine and so I'm confused.

The displayed 'code' exists and is rendered by Open Source Java so it's certainly possible to do what you want.

The OCL Documentation has some examples, but probably not what you want. The OCL JUnit tests have all sorts of conversions in all sorts of directions. org.eclipse.ocl.examples.test.xtext.SerializeTests.testSerialize_RoyalAndLoyal_ecore uses a doSerialize to wrap ecore2as, as2cs and cs save so that RoyalAndLoyal.ecore is converted to RoyalAndLoyal.oclinecore.

Re: Generating OCLinEcore Code [message #1863669 is a reply to message #1863661] Tue, 20 February 2024 13:48 Go to previous message
omar Abugharbiyeh is currently offline omar AbugharbiyehFriend
Messages: 2
Registered: February 2024
Junior Member
Sorry for not being clear this is all new to me, but yes what I was wanted to get exactly was the rendering provided by OCLinEcore automatically serialized. The testSerialize_RoyalAndLoyal_ecore tests were exactly what I was looking for thanks you so much for the help :)
Previous Topic:Does OCL 6.19 / SimRel 2023-12 disable OCL ValidityView?
Next Topic:IllegalStateException when editing Complete OCL file
Goto Forum:
  


Current Time: Sun May 05 08:51:15 GMT 2024

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

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

Back to the top