Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Re: OCL Help
Re: OCL Help [message #3396] Sat, 03 February 2007 17:26 Go to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------030302080200020605060603
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Ole,

There's an OCL newsgroup which I've added to the to list.

You'll likely be interested in this article Christian wrote:

http://www.eclipse.org/articles/Article-EMF-Codegen-with-OCL /article.html

The sexier/interesting approach probably won't perform quite as well.


Ole Ersoy wrote:
> Hi,
>
> I hope this is the right place to ask.
>
> I have an EOperation that generates code like this
> (I filled in the implementation):
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated NOT
> */
> public Mapping getTargetMapping(EObject sourceEObject) {
> EClass sourceEClass = sourceEObject.eClass();
> return getEClass2MappingMap().get(sourceEClass);
> }
>
> So this works, but OCL is sexier.
> Anyone know how to write the OCL does implements the body?
>
> self.eClass2MappingMap()....
>
> Thanks,
> - Ole
>
>
>
>


--------------030302080200020605060603
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ole,<br>
<br>
There's an OCL newsgroup which I've added to the to list.
Re: OCL Help [message #3430 is a reply to message #3396] Sat, 03 February 2007 19:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ole_ersoy.yahoo.com

Ed,

Terrific - Thanks. Yes - I love that article. It's my inspiration for
trying out OCL.

I'll probably just keep the hand coded version in the end though.

Would be cool if EMF generated
the hand written version of the OCL.

I just need 48 hours more in the day for that.

Thanks again,
- Ole
Re: OCL Help [message #3464 is a reply to message #3430] Sat, 03 February 2007 20:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ole,

If I can find the time, at some point I'll try to find a way to be able
to support this via extension points so that any expression language
could be plugged in...


Ole Ersoy wrote:
> Ed,
>
> Terrific - Thanks. Yes - I love that article. It's my inspiration
> for trying out OCL.
>
> I'll probably just keep the hand coded version in the end though.
>
> Would be cool if EMF generated the hand written version of the OCL.
>
> I just need 48 hours more in the day for that.
>
> Thanks again,
> - Ole
>
>
>
>
>
Re: OCL Help [message #3497 is a reply to message #3430] Mon, 05 February 2007 17:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Ole,

Thanks! I'm glad that you enjoyed that article. You may be interested to
know that I am working on an update for the M5 milestone of OCL, which
illustrates the new generic API (based on the J2SE 5.0 support of EMF 2.3).

Unfortunately, your particular EOperation poses a problem for OCL, as it is
not currently capable of accessing operations such as eClass() unless your
model types explicitly subclass EObject (in your ecore model, not just in
code). See https://bugs.eclipse.org/bugs/show_bug.cgi?id=152003 for
details of that, and various posts in this newsgroup and its predecessors
discussing the addition of custom attributes and operations (such as
eClass()) into the OCL environment:

http://wiki.eclipse.org/index.php/CustomizingOclEnvironments

Previous history of this newsgroup is available in the HTML archives, under
the IDs eclipse.modeling.mdt.uml2.ocl and eclipse.technology.emft.

As Ed indicates, for a high-performance API, you probably want to stick with
Java or else devise codegen extensions that will transform OCL expressions
into (efficient) Java code. However, OCL is very good for providing an
abstract and portable *specification* of your constraints and for testing
that they really are what you want them to be before you make the effort of
writing Java code. Even with the annotations implemented in the article,
you can use @generated NOT to override the OCL with your Java
implementation. :-)

Cheers,

Christian


Ole Ersoy wrote:

> Ed,
>
> Terrific - Thanks. Yes - I love that article. It's my inspiration for
> trying out OCL.
>
> I'll probably just keep the hand coded version in the end though.
>
> Would be cool if EMF generated
> the hand written version of the OCL.
>
> I just need 48 hours more in the day for that.
>
> Thanks again,
> - Ole
Re: OCL Help [message #3563 is a reply to message #3464] Tue, 06 February 2007 04:15 Go to previous message
Eclipse UserFriend
Originally posted by: ole_ersoy.yahoo.com

Ed,

Sounds great. I'd love to help out with that as well. I'm almost done
with the Ecore2Ecore excercise. Hope to have something well tested on
Bugzilla tomorrow.

Then I just have to finish up this Maven RPM Factory thing that the
Ecore2Ecore stuff is going to be used for, and after that I'm diving in
to the method generation head first :-)

Cheers,
- Ole
Previous Topic:Getting started questions from the mailing list
Next Topic:[Announce] EclipseCon 2007 Registration
Goto Forum:
  


Current Time: Thu Apr 25 05:40:17 GMT 2024

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

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

Back to the top