Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL with Java importer
OCL with Java importer [message #34324] Fri, 27 July 2007 12:28 Go to next message
Robert Enyedi is currently offline Robert EnyediFriend
Messages: 68
Registered: July 2009
Member
Hi,

I'm investigating the usage of OCL for my models. I maintain my domain
model as Java code and use the EMF Java importer to obtain the actual
Ecore model (always generated and not manually edited).

Is there a way to specify OCL constraints directly in the Java
interfaces? If so, is this documented/exemplified?

Regards,
Robert
Re: OCL with Java importer [message #34357 is a reply to message #34324] Fri, 27 July 2007 12:51 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Robert,

EMF does not define any mechanism for attaching OCL constraints to Ecore
models.

MDT OCL does provide support for defining constraints in text documents
using the OMG-standard syntax for context declarations; the developer guide
documentation included in the SDK and the JUnit tests provide examples of
this.

If you are referring to the "Implementing Model Integrity in EMF with OCL"
article's annotations, then you should be able to specify them in your Java
model using EMF's syntax for annotations, e.g.:

/**
* Some class.
*
* @annotation http://www.eclipse.org/ocl/examples/OCL
* someConstraint=self.someOclExpression()
* someOtherConstraint=self.somethingElse()
*/
public interface SomeClass extends EObject {

I'm not exactly sure of the syntax. You can find out by creating an
annotation in an Ecore model and generating the Java interfaces from it.

HTH,

Christian

Robert Enyedi wrote:

> Hi,
>
> I'm investigating the usage of OCL for my models. I maintain my domain
> model as Java code and use the EMF Java importer to obtain the actual
> Ecore model (always generated and not manually edited).
>
> Is there a way to specify OCL constraints directly in the Java
> interfaces? If so, is this documented/exemplified?
>
> Regards,
> Robert
Previous Topic:OCL queries on UML / M1 level
Next Topic:how to call a user defined operation.
Goto Forum:
  


Current Time: Thu Dec 18 21:05:44 GMT 2014

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

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