Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » [OCLinEcore] Definition of TemplateSignatureCS?(OCLinEcore Language documentation uses but never defines it)
icon5.gif  [OCLinEcore] Definition of TemplateSignatureCS? [message #1249687] Tue, 18 February 2014 14:16 Go to next message
Martin Hanysz is currently offline Martin Hanysz
Messages: 30
Registered: November 2013
Member
Hello OCL Community,

I am currently in the process of building a metamodel with the OCLinEcore Language that makes use of generic type parameters. While browsing the Help Pages for Eclipse Kepler I noticed that there is no definition of TemplateSignatureCS although it is used to define DataTypeCS, EnumerationCS, ClassCS and OperationCS.

So my question is:
How do I define a class with a type parameter?

Let's say I have a class MyClass that has a type parameter T that extends MyOtherClass. How can I define that with the OCLinEcore Language? Additionally, how can I use the type parameter T to express that MyClass has a reference named myReference to other instances of MyClass that have the same type parameter?

What I got so far is:
import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';

package myPackage : mp = 'http://www.example.com/myPackage.ecore'
{
    class MyClass(T extends MyOtherClass)
    {
        property myReference : MyClass(T)[*];
    }
    class MyOtherClass;
}

The OCLinEcore editor accepts this as valid syntax, but when I reopen the file, it suddenly contains the following:
import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';

package myPackage : mp = 'http://www.example.com/myPackage.ecore'
{
    class MyClass(T)
    {
        property myReference : MyClass[*];
    }
    class MyOtherClass;
}

As you can see the bound for the type parameter is gone as well as the type parameter of the referenced type.

Best regards,
Martin
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1249781 is a reply to message #1249687] Tue, 18 February 2014 16:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

*CS classes are part of the non-normative OCL metamodel, so you should
not use them (unless you are creating an extended OCL language and are
extending the OCL tooling).

You should only use Pivot.ecore (or OCL.ecore if you prefer the Classic
Eclipse OCL).

You can find examples of templates in Pivot.oclas and OCL-2.5.oclas.

I'm pretty certain that the support for template parameter upper/lower
bounds in incomplete.

Regards

Ed Willink


On 18/02/2014 14:16, Martin Hanysz wrote:
> Hello OCL Community,
>
> I am currently in the process of building a metamodel with the
> OCLinEcore Language that makes use of generic type parameters. While
> browsing the Help Pages for Eclipse Kepler I noticed that there is no
> definition of TemplateSignatureCS although it is used to define
> DataTypeCS, EnumerationCS, ClassCS and OperationCS.
>
> So my question is:
> How do I define a class with a type parameter?
>
> Let's say I have a class MyClass that has a type parameter T that
> extends MyOtherClass. How can I define that with the OCLinEcore
> Language? Additionally, how can I use the type parameter T to express
> that MyClass has a reference named myReference to other instances of
> MyClass that have the same type parameter?
>
> What I got so far is:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T extends MyOtherClass)
> {
> property myReference : MyClass(T)[*];
> }
> class MyOtherClass;
> }
>
> The OCLinEcore editor accepts this as valid syntax, but when I reopen
> the file, it suddenly contains the following:
>
> import ecore : 'http://www.eclipse.org/emf/2002/Ecore#/';
>
> package myPackage : mp = 'http://www.example.com/myPackage.ecore'
> {
> class MyClass(T)
> {
> property myReference : MyClass[*];
> }
> class MyOtherClass;
> }
>
> As you can see the bound for the type parameter is gone as well as the
> type parameter of the referenced type.
>
> Best regards,
> Martin
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1251648 is a reply to message #1249781] Thu, 20 February 2014 12:54 Go to previous messageGo to next message
Martin Hanysz is currently offline Martin Hanysz
Messages: 30
Registered: November 2013
Member
Hello Ed,

First of all, thanks for your quick answer.

I think I didn't express myself clearly enough regarding the definition of TemplateSignatureCS part.

Since I am new to the OCLinEcore syntax I looked it up in the Eclipse Kepler help under "OCL Documentation" > "Users Guide" > "The OCLinEcore Language". In this document, the syntax of the OCLinEcore Language is described using that kind of "routing diagram" (I don't know the correct name of these, see attachment for screenshot). All nodes in this diagram are descibed somewhere else on the page except TemplateSignatureCS.

I was just guessing that this part is used for specifying type parameters of some sort and tried different notations until the OCLinEcore editor didn't mark it as a syntax error anymore.

So I think the documentation on this specific part of the OCLinEcore Language syntax should be added.

Best regards,
Martin
Re: [OCLinEcore] Definition of TemplateSignatureCS? [message #1251820 is a reply to message #1251648] Thu, 20 February 2014 16:32 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

The missing diocumentation is all part of the auto-generation that will
hopefully happen for OCL 2.5. Until then many things about OCL are left
to implementers common sense.

Note that OMG OCL does not supoort templates at all yet.

Regards

Ed Willink


On 20/02/2014 12:54, Martin Hanysz wrote:
> Hello Ed,
>
> First of all, thanks for your quick answer.
>
> I think I didn't express myself clearly enough regarding the definition of TemplateSignatureCS part.
>
> Since I am new to the OCLinEcore syntax I looked it up in the Eclipse Kepler help under "OCL Documentation" > "Users Guide" > "The OCLinEcore Language". In this document, the syntax of the OCLinEcore Language is described using that kind of "routing diagram" (I don't know the correct name of these, see attachment for screenshot). All nodes in this diagram are descibed somewhere else on the page except TemplateSignatureCS.
>
> I was just guessing that this part is used for specifying type parameters of some sort and tried different notations until the OCLinEcore editor didn't mark it as a syntax error anymore.
>
> So I think the documentation on this specific part of the OCLinEcore Language syntax should be added.
>
> Best regards,
> Martin
>
Previous Topic:How to exploit OCL constraints on derived features?
Next Topic:How to Apply OCL code on Ecore KDM Model
Goto Forum:
  


Current Time: Mon Sep 22 18:17:00 GMT 2014

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

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